import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http" ; import { expectNonNull as __expectNonNull , expectNumber as __expectNumber , expectObject as __expectObject , expectString as __expectString , extendedEncodeURIComponent as __extendedEncodeURIComponent , parseEpochTimestamp as __parseEpochTimestamp , } 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 { AssociateDeviceWithPlacementCommandInput , AssociateDeviceWithPlacementCommandOutput , } from "../commands/AssociateDeviceWithPlacementCommand" ; import { CreatePlacementCommandInput , CreatePlacementCommandOutput } from "../commands/CreatePlacementCommand" ; import { CreateProjectCommandInput , CreateProjectCommandOutput } from "../commands/CreateProjectCommand" ; import { DeletePlacementCommandInput , DeletePlacementCommandOutput } from "../commands/DeletePlacementCommand" ; import { DeleteProjectCommandInput , DeleteProjectCommandOutput } from "../commands/DeleteProjectCommand" ; import { DescribePlacementCommandInput , DescribePlacementCommandOutput } from "../commands/DescribePlacementCommand" ; import { DescribeProjectCommandInput , DescribeProjectCommandOutput } from "../commands/DescribeProjectCommand" ; import { DisassociateDeviceFromPlacementCommandInput , DisassociateDeviceFromPlacementCommandOutput , } from "../commands/DisassociateDeviceFromPlacementCommand" ; import { GetDevicesInPlacementCommandInput , GetDevicesInPlacementCommandOutput , } from "../commands/GetDevicesInPlacementCommand" ; import { ListPlacementsCommandInput , ListPlacementsCommandOutput } from "../commands/ListPlacementsCommand" ; import { ListProjectsCommandInput , ListProjectsCommandOutput } from "../commands/ListProjectsCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdatePlacementCommandInput , UpdatePlacementCommandOutput } from "../commands/UpdatePlacementCommand" ; import { UpdateProjectCommandInput , UpdateProjectCommandOutput } from "../commands/UpdateProjectCommand" ; import { DeviceTemplate , InternalFailureException , InvalidRequestException , PlacementDescription , PlacementSummary , PlacementTemplate , ProjectDescription , ProjectSummary , ResourceConflictException , ResourceNotFoundException , TooManyRequestsException , } from "../models/models_0" ; export const serializeAws_restJson1AssociateDeviceWithPlacementCommand = 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 || "" }` + "/projects/{projectName}/placements/{placementName}/devices/{deviceTemplateName}" ; if ( input . projectName !== undefined ) { const labelValue = input . projectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: projectName." ) ; } resolvedPath = resolvedPath . replace ( "{projectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: projectName." ) ; } if ( input . placementName !== undefined ) { const labelValue = input . placementName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: placementName." ) ; } resolvedPath = resolvedPath . replace ( "{placementName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: placementName." ) ; } if ( input . deviceTemplateName !== undefined ) { const labelValue = input . deviceTemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: deviceTemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{deviceTemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: deviceTemplateName." ) ; } let body ; body = JSON . stringify ( { ... ( input . deviceId !== undefined && input . deviceId !== null && { deviceId : input . deviceId } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreatePlacementCommand = 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 || "" }` + "/projects/{projectName}/placements" ; if ( input . projectName !== undefined ) { const labelValue = input . projectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: projectName." ) ; } resolvedPath = resolvedPath . replace ( "{projectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: projectName." ) ; } let body ; body = JSON . stringify ( { ... ( input . attributes !== undefined && input . attributes !== null && { attributes : serializeAws_restJson1PlacementAttributeMap ( input . attributes , context ) , } ) , ... ( input . placementName !== undefined && input . placementName !== null && { placementName : input . placementName } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateProjectCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/projects" ; let body ; body = JSON . stringify ( { ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . placementTemplate !== undefined && input . placementTemplate !== null && { placementTemplate : serializeAws_restJson1PlacementTemplate ( input . placementTemplate , context ) , } ) , ... ( input . projectName !== undefined && input . projectName !== null && { projectName : input . projectName } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagMap ( input . tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeletePlacementCommand = 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 || "" }` + "/projects/{projectName}/placements/{placementName}" ; if ( input . placementName !== undefined ) { const labelValue = input . placementName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: placementName." ) ; } resolvedPath = resolvedPath . replace ( "{placementName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: placementName." ) ; } if ( input . projectName !== undefined ) { const labelValue = input . projectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: projectName." ) ; } resolvedPath = resolvedPath . replace ( "{projectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: projectName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteProjectCommand = 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 || "" }` + "/projects/{projectName}" ; if ( input . projectName !== undefined ) { const labelValue = input . projectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: projectName." ) ; } resolvedPath = resolvedPath . replace ( "{projectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: projectName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribePlacementCommand = 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 || "" }` + "/projects/{projectName}/placements/{placementName}" ; if ( input . placementName !== undefined ) { const labelValue = input . placementName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: placementName." ) ; } resolvedPath = resolvedPath . replace ( "{placementName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: placementName." ) ; } if ( input . projectName !== undefined ) { const labelValue = input . projectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: projectName." ) ; } resolvedPath = resolvedPath . replace ( "{projectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: projectName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeProjectCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/projects/{projectName}" ; if ( input . projectName !== undefined ) { const labelValue = input . projectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: projectName." ) ; } resolvedPath = resolvedPath . replace ( "{projectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: projectName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DisassociateDeviceFromPlacementCommand = 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 || "" }` + "/projects/{projectName}/placements/{placementName}/devices/{deviceTemplateName}" ; if ( input . projectName !== undefined ) { const labelValue = input . projectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: projectName." ) ; } resolvedPath = resolvedPath . replace ( "{projectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: projectName." ) ; } if ( input . placementName !== undefined ) { const labelValue = input . placementName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: placementName." ) ; } resolvedPath = resolvedPath . replace ( "{placementName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: placementName." ) ; } if ( input . deviceTemplateName !== undefined ) { const labelValue = input . deviceTemplateName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: deviceTemplateName." ) ; } resolvedPath = resolvedPath . replace ( "{deviceTemplateName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: deviceTemplateName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetDevicesInPlacementCommand = 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 || "" }` + "/projects/{projectName}/placements/{placementName}/devices" ; if ( input . projectName !== undefined ) { const labelValue = input . projectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: projectName." ) ; } resolvedPath = resolvedPath . replace ( "{projectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: projectName." ) ; } if ( input . placementName !== undefined ) { const labelValue = input . placementName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: placementName." ) ; } resolvedPath = resolvedPath . replace ( "{placementName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: placementName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListPlacementsCommand = 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 || "" }` + "/projects/{projectName}/placements" ; if ( input . projectName !== undefined ) { const labelValue = input . projectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: projectName." ) ; } resolvedPath = resolvedPath . replace ( "{projectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: projectName." ) ; } const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListProjectsCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; const resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/projects" ; const query = { ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListTagsForResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{resourceArn}" ; if ( input . resourceArn !== undefined ) { const labelValue = input . resourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{resourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1TagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{resourceArn}" ; if ( input . resourceArn !== undefined ) { const labelValue = input . resourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{resourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceArn." ) ; } let body ; body = JSON . stringify ( { ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagMap ( input . tags , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UntagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{resourceArn}" ; if ( input . resourceArn !== undefined ) { const labelValue = input . resourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{resourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceArn." ) ; } const query = { ... ( input . tagKeys !== undefined && { tagKeys : ( input . tagKeys || [ ] ) . map ( ( _entry ) => _entry as any ) } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1UpdatePlacementCommand = 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 || "" }` + "/projects/{projectName}/placements/{placementName}" ; if ( input . placementName !== undefined ) { const labelValue = input . placementName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: placementName." ) ; } resolvedPath = resolvedPath . replace ( "{placementName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: placementName." ) ; } if ( input . projectName !== undefined ) { const labelValue = input . projectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: projectName." ) ; } resolvedPath = resolvedPath . replace ( "{projectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: projectName." ) ; } let body ; body = JSON . stringify ( { ... ( input . attributes !== undefined && input . attributes !== null && { attributes : serializeAws_restJson1PlacementAttributeMap ( input . attributes , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateProjectCommand = 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 || "" }` + "/projects/{projectName}" ; if ( input . projectName !== undefined ) { const labelValue = input . projectName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: projectName." ) ; } resolvedPath = resolvedPath . replace ( "{projectName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: projectName." ) ; } let body ; body = JSON . stringify ( { ... ( input . description !== undefined && input . description !== null && { description : input . description } ) , ... ( input . placementTemplate !== undefined && input . placementTemplate !== null && { placementTemplate : serializeAws_restJson1PlacementTemplate ( input . placementTemplate , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const deserializeAws_restJson1AssociateDeviceWithPlacementCommand = async ( output , context ) : Promise < AssociateDeviceWithPlacementCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1AssociateDeviceWithPlacementCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1AssociateDeviceWithPlacementCommandError = async ( output , context ) : Promise < AssociateDeviceWithPlacementCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalFailureException" : case "com.amazonaws.iot1clickprojects#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.iot1clickprojects#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceConflictException" : case "com.amazonaws.iot1clickprojects#ResourceConflictException" : response = { ... ( await deserializeAws_restJson1ResourceConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iot1clickprojects#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_restJson1CreatePlacementCommand = async ( output , context ) : Promise < CreatePlacementCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreatePlacementCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreatePlacementCommandError = async ( output , context ) : Promise < CreatePlacementCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalFailureException" : case "com.amazonaws.iot1clickprojects#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.iot1clickprojects#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceConflictException" : case "com.amazonaws.iot1clickprojects#ResourceConflictException" : response = { ... ( await deserializeAws_restJson1ResourceConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iot1clickprojects#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_restJson1CreateProjectCommand = async ( output , context ) : Promise < CreateProjectCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateProjectCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateProjectCommandError = async ( output , context ) : Promise < CreateProjectCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalFailureException" : case "com.amazonaws.iot1clickprojects#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.iot1clickprojects#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceConflictException" : case "com.amazonaws.iot1clickprojects#ResourceConflictException" : response = { ... ( await deserializeAws_restJson1ResourceConflictExceptionResponse ( 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_restJson1DeletePlacementCommand = async ( output , context ) : Promise < DeletePlacementCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeletePlacementCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeletePlacementCommandError = async ( output , context ) : Promise < DeletePlacementCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalFailureException" : case "com.amazonaws.iot1clickprojects#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.iot1clickprojects#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iot1clickprojects#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.iot1clickprojects#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1DeleteProjectCommand = async ( output , context ) : Promise < DeleteProjectCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteProjectCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteProjectCommandError = async ( output , context ) : Promise < DeleteProjectCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalFailureException" : case "com.amazonaws.iot1clickprojects#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.iot1clickprojects#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iot1clickprojects#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.iot1clickprojects#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1DescribePlacementCommand = async ( output , context ) : Promise < DescribePlacementCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribePlacementCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , placement : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . placement !== undefined && data . placement !== null ) { contents . placement = deserializeAws_restJson1PlacementDescription ( data . placement , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribePlacementCommandError = async ( output , context ) : Promise < DescribePlacementCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalFailureException" : case "com.amazonaws.iot1clickprojects#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.iot1clickprojects#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iot1clickprojects#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_restJson1DescribeProjectCommand = async ( output , context ) : Promise < DescribeProjectCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeProjectCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , project : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . project !== undefined && data . project !== null ) { contents . project = deserializeAws_restJson1ProjectDescription ( data . project , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeProjectCommandError = async ( output , context ) : Promise < DescribeProjectCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalFailureException" : case "com.amazonaws.iot1clickprojects#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.iot1clickprojects#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iot1clickprojects#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_restJson1DisassociateDeviceFromPlacementCommand = async ( output , context ) : Promise < DisassociateDeviceFromPlacementCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DisassociateDeviceFromPlacementCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DisassociateDeviceFromPlacementCommandError = async ( output , context ) : Promise < DisassociateDeviceFromPlacementCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalFailureException" : case "com.amazonaws.iot1clickprojects#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.iot1clickprojects#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iot1clickprojects#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.iot1clickprojects#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1GetDevicesInPlacementCommand = async ( output , context ) : Promise < GetDevicesInPlacementCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDevicesInPlacementCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , devices : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . devices !== undefined && data . devices !== null ) { contents . devices = deserializeAws_restJson1DeviceMap ( data . devices , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDevicesInPlacementCommandError = async ( output , context ) : Promise < GetDevicesInPlacementCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalFailureException" : case "com.amazonaws.iot1clickprojects#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.iot1clickprojects#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iot1clickprojects#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_restJson1ListPlacementsCommand = async ( output , context ) : Promise < ListPlacementsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListPlacementsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , nextToken : undefined , placements : 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 . placements !== undefined && data . placements !== null ) { contents . placements = deserializeAws_restJson1PlacementSummaryList ( data . placements , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListPlacementsCommandError = async ( output , context ) : Promise < ListPlacementsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalFailureException" : case "com.amazonaws.iot1clickprojects#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.iot1clickprojects#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iot1clickprojects#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_restJson1ListProjectsCommand = async ( output , context ) : Promise < ListProjectsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListProjectsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , nextToken : undefined , projects : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } if ( data . projects !== undefined && data . projects !== null ) { contents . projects = deserializeAws_restJson1ProjectSummaryList ( data . projects , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListProjectsCommandError = async ( output , context ) : Promise < ListProjectsCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalFailureException" : case "com.amazonaws.iot1clickprojects#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.iot1clickprojects#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListTagsForResourceCommand = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTagsForResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_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 "InternalFailureException" : case "com.amazonaws.iot1clickprojects#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.iot1clickprojects#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iot1clickprojects#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_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 "InternalFailureException" : case "com.amazonaws.iot1clickprojects#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.iot1clickprojects#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iot1clickprojects#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_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 "InternalFailureException" : case "com.amazonaws.iot1clickprojects#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.iot1clickprojects#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iot1clickprojects#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_restJson1UpdatePlacementCommand = async ( output , context ) : Promise < UpdatePlacementCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdatePlacementCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdatePlacementCommandError = async ( output , context ) : Promise < UpdatePlacementCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalFailureException" : case "com.amazonaws.iot1clickprojects#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.iot1clickprojects#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iot1clickprojects#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.iot1clickprojects#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1UpdateProjectCommand = async ( output , context ) : Promise < UpdateProjectCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateProjectCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateProjectCommandError = async ( output , context ) : Promise < UpdateProjectCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalFailureException" : case "com.amazonaws.iot1clickprojects#InternalFailureException" : response = { ... ( await deserializeAws_restJson1InternalFailureExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InvalidRequestException" : case "com.amazonaws.iot1clickprojects#InvalidRequestException" : response = { ... ( await deserializeAws_restJson1InvalidRequestExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.iot1clickprojects#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "TooManyRequestsException" : case "com.amazonaws.iot1clickprojects#TooManyRequestsException" : response = { ... ( await deserializeAws_restJson1TooManyRequestsExceptionResponse ( 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_restJson1InternalFailureExceptionResponse = async ( parsedOutput , context ) : Promise < InternalFailureException > => { const contents = { name : "InternalFailureException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , code : undefined , message : undefined , } ; const data = parsedOutput . body ; if ( data . code !== undefined && data . code !== null ) { contents . code = __expectString ( data . code ) ; } if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1InvalidRequestExceptionResponse = async ( parsedOutput , context ) : Promise < InvalidRequestException > => { const contents = { name : "InvalidRequestException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , code : undefined , message : undefined , } ; const data = parsedOutput . body ; if ( data . code !== undefined && data . code !== null ) { contents . code = __expectString ( data . code ) ; } if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ResourceConflictExceptionResponse = async ( parsedOutput , context ) : Promise < ResourceConflictException > => { const contents = { name : "ResourceConflictException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , code : undefined , message : undefined , } ; const data = parsedOutput . body ; if ( data . code !== undefined && data . code !== null ) { contents . code = __expectString ( data . code ) ; } if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < ResourceNotFoundException > => { const contents = { name : "ResourceNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , code : undefined , message : undefined , } ; const data = parsedOutput . body ; if ( data . code !== undefined && data . code !== null ) { contents . code = __expectString ( data . code ) ; } if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1TooManyRequestsExceptionResponse = async ( parsedOutput , context ) : Promise < TooManyRequestsException > => { const contents = { name : "TooManyRequestsException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , code : undefined , message : undefined , } ; const data = parsedOutput . body ; if ( data . code !== undefined && data . code !== null ) { contents . code = __expectString ( data . code ) ; } if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const serializeAws_restJson1DefaultPlacementAttributeMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1DeviceCallbackOverrideMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1DeviceTemplate = ( input , context ) : any => { return { ... ( input . callbackOverrides !== undefined && input . callbackOverrides !== null && { callbackOverrides : serializeAws_restJson1DeviceCallbackOverrideMap ( input . callbackOverrides , context ) , } ) , ... ( input . deviceType !== undefined && input . deviceType !== null && { deviceType : input . deviceType } ) , } ; } ; const serializeAws_restJson1DeviceTemplateMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_restJson1DeviceTemplate ( value , context ) , } ; } , { } ) ; } ; const serializeAws_restJson1PlacementAttributeMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1PlacementTemplate = ( input , context ) : any => { return { ... ( input . defaultAttributes !== undefined && input . defaultAttributes !== null && { defaultAttributes : serializeAws_restJson1DefaultPlacementAttributeMap ( input . defaultAttributes , context ) , } ) , ... ( input . deviceTemplates !== undefined && input . deviceTemplates !== null && { deviceTemplates : serializeAws_restJson1DeviceTemplateMap ( input . deviceTemplates , context ) , } ) , } ; } ; 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_restJson1DefaultPlacementAttributeMap = ( 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_restJson1DeviceCallbackOverrideMap = ( 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_restJson1DeviceMap = ( 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_restJson1DeviceTemplate = ( output , context ) : DeviceTemplate => { return { callbackOverrides : output . callbackOverrides !== undefined && output . callbackOverrides !== null ? deserializeAws_restJson1DeviceCallbackOverrideMap ( output . callbackOverrides , context ) : undefined , deviceType : __expectString ( output . deviceType ) , } as any ; } ; const deserializeAws_restJson1DeviceTemplateMap = ( output , context ) : { [ key ] : DeviceTemplate ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1DeviceTemplate ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1PlacementAttributeMap = ( 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_restJson1PlacementDescription = ( output , context ) : PlacementDescription => { return { attributes : output . attributes !== undefined && output . attributes !== null ? deserializeAws_restJson1PlacementAttributeMap ( output . attributes , context ) : undefined , createdDate : output . createdDate !== undefined && output . createdDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . createdDate ) ) ) : undefined , placementName : __expectString ( output . placementName ) , projectName : __expectString ( output . projectName ) , updatedDate : output . updatedDate !== undefined && output . updatedDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . updatedDate ) ) ) : undefined , } as any ; } ; const deserializeAws_restJson1PlacementSummary = ( output , context ) : PlacementSummary => { return { createdDate : output . createdDate !== undefined && output . createdDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . createdDate ) ) ) : undefined , placementName : __expectString ( output . placementName ) , projectName : __expectString ( output . projectName ) , updatedDate : output . updatedDate !== undefined && output . updatedDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . updatedDate ) ) ) : undefined , } as any ; } ; const deserializeAws_restJson1PlacementSummaryList = ( output , context ) : PlacementSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1PlacementSummary ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1PlacementTemplate = ( output , context ) : PlacementTemplate => { return { defaultAttributes : output . defaultAttributes !== undefined && output . defaultAttributes !== null ? deserializeAws_restJson1DefaultPlacementAttributeMap ( output . defaultAttributes , context ) : undefined , deviceTemplates : output . deviceTemplates !== undefined && output . deviceTemplates !== null ? deserializeAws_restJson1DeviceTemplateMap ( output . deviceTemplates , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ProjectDescription = ( output , context ) : ProjectDescription => { return { arn : __expectString ( output . arn ) , createdDate : output . createdDate !== undefined && output . createdDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . createdDate ) ) ) : undefined , description : __expectString ( output . description ) , placementTemplate : output . placementTemplate !== undefined && output . placementTemplate !== null ? deserializeAws_restJson1PlacementTemplate ( output . placementTemplate , context ) : undefined , projectName : __expectString ( output . projectName ) , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1TagMap ( output . tags , context ) : undefined , updatedDate : output . updatedDate !== undefined && output . updatedDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . updatedDate ) ) ) : undefined , } as any ; } ; const deserializeAws_restJson1ProjectSummary = ( output , context ) : ProjectSummary => { return { arn : __expectString ( output . arn ) , createdDate : output . createdDate !== undefined && output . createdDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . createdDate ) ) ) : undefined , projectName : __expectString ( output . projectName ) , tags : output . tags !== undefined && output . tags !== null ? deserializeAws_restJson1TagMap ( output . tags , context ) : undefined , updatedDate : output . updatedDate !== undefined && output . updatedDate !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . updatedDate ) ) ) : undefined , } as any ; } ; const deserializeAws_restJson1ProjectSummaryList = ( output , context ) : ProjectSummary [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ProjectSummary ( entry , context ) ; } ) ; } ; 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 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 "" ; } ;