import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse } 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 , strictParseInt32 as __strictParseInt32 , } from "@aws-sdk/smithy-client" ; import { Endpoint as __Endpoint , MetadataBearer as __MetadataBearer , ResponseMetadata as __ResponseMetadata , SerdeContext as __SerdeContext , SmithyException as __SmithyException , } from "@aws-sdk/types" ; import { v4 as generateIdempotencyToken } from "uuid" ; import { AssociateServiceRoleToAccountCommandInput , AssociateServiceRoleToAccountCommandOutput , } from "../commands/AssociateServiceRoleToAccountCommand" ; import { BatchAssociateClientDeviceWithCoreDeviceCommandInput , BatchAssociateClientDeviceWithCoreDeviceCommandOutput , } from "../commands/BatchAssociateClientDeviceWithCoreDeviceCommand" ; import { BatchDisassociateClientDeviceFromCoreDeviceCommandInput , BatchDisassociateClientDeviceFromCoreDeviceCommandOutput , } from "../commands/BatchDisassociateClientDeviceFromCoreDeviceCommand" ; import { CancelDeploymentCommandInput , CancelDeploymentCommandOutput } from "../commands/CancelDeploymentCommand" ; import { CreateComponentVersionCommandInput , CreateComponentVersionCommandOutput , } from "../commands/CreateComponentVersionCommand" ; import { CreateDeploymentCommandInput , CreateDeploymentCommandOutput } from "../commands/CreateDeploymentCommand" ; import { DeleteComponentCommandInput , DeleteComponentCommandOutput } from "../commands/DeleteComponentCommand" ; import { DeleteCoreDeviceCommandInput , DeleteCoreDeviceCommandOutput } from "../commands/DeleteCoreDeviceCommand" ; import { DescribeComponentCommandInput , DescribeComponentCommandOutput } from "../commands/DescribeComponentCommand" ; import { DisassociateServiceRoleFromAccountCommandInput , DisassociateServiceRoleFromAccountCommandOutput , } from "../commands/DisassociateServiceRoleFromAccountCommand" ; import { GetComponentCommandInput , GetComponentCommandOutput } from "../commands/GetComponentCommand" ; import { GetComponentVersionArtifactCommandInput , GetComponentVersionArtifactCommandOutput , } from "../commands/GetComponentVersionArtifactCommand" ; import { GetConnectivityInfoCommandInput , GetConnectivityInfoCommandOutput , } from "../commands/GetConnectivityInfoCommand" ; import { GetCoreDeviceCommandInput , GetCoreDeviceCommandOutput } from "../commands/GetCoreDeviceCommand" ; import { GetDeploymentCommandInput , GetDeploymentCommandOutput } from "../commands/GetDeploymentCommand" ; import { GetServiceRoleForAccountCommandInput , GetServiceRoleForAccountCommandOutput , } from "../commands/GetServiceRoleForAccountCommand" ; import { ListClientDevicesAssociatedWithCoreDeviceCommandInput , ListClientDevicesAssociatedWithCoreDeviceCommandOutput , } from "../commands/ListClientDevicesAssociatedWithCoreDeviceCommand" ; import { ListComponentsCommandInput , ListComponentsCommandOutput } from "../commands/ListComponentsCommand" ; import { ListComponentVersionsCommandInput , ListComponentVersionsCommandOutput , } from "../commands/ListComponentVersionsCommand" ; import { ListCoreDevicesCommandInput , ListCoreDevicesCommandOutput } from "../commands/ListCoreDevicesCommand" ; import { ListDeploymentsCommandInput , ListDeploymentsCommandOutput } from "../commands/ListDeploymentsCommand" ; import { ListEffectiveDeploymentsCommandInput , ListEffectiveDeploymentsCommandOutput , } from "../commands/ListEffectiveDeploymentsCommand" ; import { ListInstalledComponentsCommandInput , ListInstalledComponentsCommandOutput , } from "../commands/ListInstalledComponentsCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { ResolveComponentCandidatesCommandInput , ResolveComponentCandidatesCommandOutput , } from "../commands/ResolveComponentCandidatesCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateConnectivityInfoCommandInput , UpdateConnectivityInfoCommandOutput , } from "../commands/UpdateConnectivityInfoCommand" ; import { AccessDeniedException , AssociateClientDeviceWithCoreDeviceEntry , AssociateClientDeviceWithCoreDeviceErrorEntry , AssociatedClientDevice , CloudComponentStatus , Component , ComponentCandidate , ComponentConfigurationUpdate , ComponentDependencyRequirement , ComponentDeploymentSpecification , ComponentLatestVersion , ComponentPlatform , ComponentRunWith , ComponentVersionListItem , ConflictException , ConnectivityInfo , CoreDevice , Deployment , DeploymentComponentUpdatePolicy , DeploymentConfigurationValidationPolicy , DeploymentIoTJobConfiguration , DeploymentPolicies , DisassociateClientDeviceFromCoreDeviceEntry , DisassociateClientDeviceFromCoreDeviceErrorEntry , EffectiveDeployment , InstalledComponent , InternalServerException , IoTJobAbortConfig , IoTJobAbortCriteria , IoTJobExecutionsRolloutConfig , IoTJobExponentialRolloutRate , IoTJobRateIncreaseCriteria , IoTJobTimeoutConfig , LambdaContainerParams , LambdaDeviceMount , LambdaEventSource , LambdaExecutionParameters , LambdaFunctionRecipeSource , LambdaLinuxProcessParams , LambdaVolumeMount , RequestAlreadyInProgressException , ResolvedComponentVersion , ResourceNotFoundException , ServiceQuotaExceededException , SystemResourceLimits , ThrottlingException , ValidationException , ValidationExceptionField , } from "../models/models_0" ; export const serializeAws_restJson1AssociateServiceRoleToAccountCommand = 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 || "" }` + "/greengrass/servicerole" ; let body ; body = JSON . stringify ( { ... ( input . roleArn !== undefined && input . roleArn !== null && { RoleArn : input . roleArn } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1BatchAssociateClientDeviceWithCoreDeviceCommand = 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 || "" }` + "/greengrass/v2/coreDevices/{coreDeviceThingName}/associateClientDevices" ; if ( input . coreDeviceThingName !== undefined ) { const labelValue = input . coreDeviceThingName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: coreDeviceThingName." ) ; } resolvedPath = resolvedPath . replace ( "{coreDeviceThingName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: coreDeviceThingName." ) ; } let body ; body = JSON . stringify ( { ... ( input . entries !== undefined && input . entries !== null && { entries : serializeAws_restJson1AssociateClientDeviceWithCoreDeviceEntryList ( input . entries , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1BatchDisassociateClientDeviceFromCoreDeviceCommand = 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 || "" }` + "/greengrass/v2/coreDevices/{coreDeviceThingName}/disassociateClientDevices" ; if ( input . coreDeviceThingName !== undefined ) { const labelValue = input . coreDeviceThingName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: coreDeviceThingName." ) ; } resolvedPath = resolvedPath . replace ( "{coreDeviceThingName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: coreDeviceThingName." ) ; } let body ; body = JSON . stringify ( { ... ( input . entries !== undefined && input . entries !== null && { entries : serializeAws_restJson1DisassociateClientDeviceFromCoreDeviceEntryList ( input . entries , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CancelDeploymentCommand = 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 || "" }` + "/greengrass/v2/deployments/{deploymentId}/cancel" ; if ( input . deploymentId !== undefined ) { const labelValue = input . deploymentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: deploymentId." ) ; } resolvedPath = resolvedPath . replace ( "{deploymentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: deploymentId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateComponentVersionCommand = 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 || "" }` + "/greengrass/v2/createComponentVersion" ; let body ; body = JSON . stringify ( { clientToken : input . clientToken ?? generateIdempotencyToken ( ) , ... ( input . inlineRecipe !== undefined && input . inlineRecipe !== null && { inlineRecipe : context . base64Encoder ( input . inlineRecipe ) } ) , ... ( input . lambdaFunction !== undefined && input . lambdaFunction !== null && { lambdaFunction : serializeAws_restJson1LambdaFunctionRecipeSource ( input . lambdaFunction , context ) , } ) , ... ( 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_restJson1CreateDeploymentCommand = 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 || "" }` + "/greengrass/v2/deployments" ; let body ; body = JSON . stringify ( { clientToken : input . clientToken ?? generateIdempotencyToken ( ) , ... ( input . components !== undefined && input . components !== null && { components : serializeAws_restJson1ComponentDeploymentSpecifications ( input . components , context ) , } ) , ... ( input . deploymentName !== undefined && input . deploymentName !== null && { deploymentName : input . deploymentName } ) , ... ( input . deploymentPolicies !== undefined && input . deploymentPolicies !== null && { deploymentPolicies : serializeAws_restJson1DeploymentPolicies ( input . deploymentPolicies , context ) , } ) , ... ( input . iotJobConfiguration !== undefined && input . iotJobConfiguration !== null && { iotJobConfiguration : serializeAws_restJson1DeploymentIoTJobConfiguration ( input . iotJobConfiguration , context ) , } ) , ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_restJson1TagMap ( input . tags , context ) } ) , ... ( input . targetArn !== undefined && input . targetArn !== null && { targetArn : input . targetArn } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteComponentCommand = 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 || "" }` + "/greengrass/v2/components/{arn}" ; if ( input . arn !== undefined ) { const labelValue = input . arn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: arn." ) ; } resolvedPath = resolvedPath . replace ( "{arn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: arn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteCoreDeviceCommand = 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 || "" }` + "/greengrass/v2/coreDevices/{coreDeviceThingName}" ; if ( input . coreDeviceThingName !== undefined ) { const labelValue = input . coreDeviceThingName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: coreDeviceThingName." ) ; } resolvedPath = resolvedPath . replace ( "{coreDeviceThingName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: coreDeviceThingName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeComponentCommand = 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 || "" }` + "/greengrass/v2/components/{arn}/metadata" ; if ( input . arn !== undefined ) { const labelValue = input . arn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: arn." ) ; } resolvedPath = resolvedPath . replace ( "{arn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: arn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DisassociateServiceRoleFromAccountCommand = 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 || "" }` + "/greengrass/servicerole" ; let body ; body = "" ; return new __HttpRequest ( { protocol , hostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetComponentCommand = 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 || "" }` + "/greengrass/v2/components/{arn}" ; if ( input . arn !== undefined ) { const labelValue = input . arn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: arn." ) ; } resolvedPath = resolvedPath . replace ( "{arn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: arn." ) ; } const query = { ... ( input . recipeOutputFormat !== undefined && { recipeOutputFormat : input . recipeOutputFormat } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1GetComponentVersionArtifactCommand = 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 || "" }` + "/greengrass/v2/components/{arn}/artifacts/{artifactName+}" ; if ( input . arn !== undefined ) { const labelValue = input . arn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: arn." ) ; } resolvedPath = resolvedPath . replace ( "{arn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: arn." ) ; } if ( input . artifactName !== undefined ) { const labelValue = input . artifactName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: artifactName." ) ; } resolvedPath = resolvedPath . replace ( "{artifactName+}" , labelValue . split ( "/" ) . map ( ( segment ) => __extendedEncodeURIComponent ( segment ) ) . join ( "/" ) ) ; } else { throw new Error ( "No value provided for input HTTP label: artifactName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetConnectivityInfoCommand = 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 || "" }` + "/greengrass/things/{thingName}/connectivityInfo" ; if ( input . thingName !== undefined ) { const labelValue = input . thingName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: thingName." ) ; } resolvedPath = resolvedPath . replace ( "{thingName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: thingName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetCoreDeviceCommand = 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 || "" }` + "/greengrass/v2/coreDevices/{coreDeviceThingName}" ; if ( input . coreDeviceThingName !== undefined ) { const labelValue = input . coreDeviceThingName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: coreDeviceThingName." ) ; } resolvedPath = resolvedPath . replace ( "{coreDeviceThingName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: coreDeviceThingName." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetDeploymentCommand = 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 || "" }` + "/greengrass/v2/deployments/{deploymentId}" ; if ( input . deploymentId !== undefined ) { const labelValue = input . deploymentId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: deploymentId." ) ; } resolvedPath = resolvedPath . replace ( "{deploymentId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: deploymentId." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetServiceRoleForAccountCommand = 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 || "" }` + "/greengrass/servicerole" ; let body ; body = "" ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListClientDevicesAssociatedWithCoreDeviceCommand = 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 || "" }` + "/greengrass/v2/coreDevices/{coreDeviceThingName}/associatedClientDevices" ; if ( input . coreDeviceThingName !== undefined ) { const labelValue = input . coreDeviceThingName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: coreDeviceThingName." ) ; } resolvedPath = resolvedPath . replace ( "{coreDeviceThingName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: coreDeviceThingName." ) ; } const query = { ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListComponentsCommand = 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 || "" }` + "/greengrass/v2/components" ; const query = { ... ( input . scope !== undefined && { scope : input . scope } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListComponentVersionsCommand = 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 || "" }` + "/greengrass/v2/components/{arn}/versions" ; if ( input . arn !== undefined ) { const labelValue = input . arn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: arn." ) ; } resolvedPath = resolvedPath . replace ( "{arn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: arn." ) ; } const query = { ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListCoreDevicesCommand = 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 || "" }` + "/greengrass/v2/coreDevices" ; const query = { ... ( input . thingGroupArn !== undefined && { thingGroupArn : input . thingGroupArn } ) , ... ( input . status !== undefined && { status : input . status } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListDeploymentsCommand = 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 || "" }` + "/greengrass/v2/deployments" ; const query = { ... ( input . targetArn !== undefined && { targetArn : input . targetArn } ) , ... ( input . historyFilter !== undefined && { historyFilter : input . historyFilter } ) , ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListEffectiveDeploymentsCommand = 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 || "" }` + "/greengrass/v2/coreDevices/{coreDeviceThingName}/effectiveDeployments" ; if ( input . coreDeviceThingName !== undefined ) { const labelValue = input . coreDeviceThingName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: coreDeviceThingName." ) ; } resolvedPath = resolvedPath . replace ( "{coreDeviceThingName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: coreDeviceThingName." ) ; } const query = { ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListInstalledComponentsCommand = 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 || "" }` + "/greengrass/v2/coreDevices/{coreDeviceThingName}/installedComponents" ; if ( input . coreDeviceThingName !== undefined ) { const labelValue = input . coreDeviceThingName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: coreDeviceThingName." ) ; } resolvedPath = resolvedPath . replace ( "{coreDeviceThingName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: coreDeviceThingName." ) ; } const query = { ... ( input . maxResults !== undefined && { maxResults : input . maxResults . toString ( ) } ) , ... ( input . nextToken !== undefined && { nextToken : input . nextToken } ) , } ; let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1ListTagsForResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{resourceArn}" ; if ( input . resourceArn !== undefined ) { const labelValue = input . resourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{resourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceArn." ) ; } let body ; return new __HttpRequest ( { protocol , hostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ResolveComponentCandidatesCommand = 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 || "" }` + "/greengrass/v2/resolveComponentCandidates" ; let body ; body = JSON . stringify ( { ... ( input . componentCandidates !== undefined && input . componentCandidates !== null && { componentCandidates : serializeAws_restJson1ComponentCandidateList ( input . componentCandidates , context ) , } ) , ... ( input . platform !== undefined && input . platform !== null && { platform : serializeAws_restJson1ComponentPlatform ( input . platform , context ) } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1TagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; let resolvedPath = `${ basePath ?. endsWith ( "/" ) ? basePath . slice ( 0 , - 1 ) : basePath || "" }` + "/tags/{resourceArn}" ; if ( input . resourceArn !== undefined ) { const labelValue = input . resourceArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: resourceArn." ) ; } resolvedPath = resolvedPath . replace ( "{resourceArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: resourceArn." ) ; } let body ; body = JSON . stringify ( { ... ( input . tags !== undefined && input . tags !== null && { tags : serializeAws_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_restJson1UpdateConnectivityInfoCommand = 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 || "" }` + "/greengrass/things/{thingName}/connectivityInfo" ; if ( input . thingName !== undefined ) { const labelValue = input . thingName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: thingName." ) ; } resolvedPath = resolvedPath . replace ( "{thingName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: thingName." ) ; } let body ; body = JSON . stringify ( { ... ( input . connectivityInfo !== undefined && input . connectivityInfo !== null && { ConnectivityInfo : serializeAws_restJson1connectivityInfoList ( input . connectivityInfo , context ) , } ) , } ) ; return new __HttpRequest ( { protocol , hostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const deserializeAws_restJson1AssociateServiceRoleToAccountCommand = async ( output , context ) : Promise < AssociateServiceRoleToAccountCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1AssociateServiceRoleToAccountCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , associatedAt : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . AssociatedAt !== undefined && data . AssociatedAt !== null ) { contents . associatedAt = __expectString ( data . AssociatedAt ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1AssociateServiceRoleToAccountCommandError = async ( output , context ) : Promise < AssociateServiceRoleToAccountCommandOutput > => { 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.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1BatchAssociateClientDeviceWithCoreDeviceCommand = async ( output , context ) : Promise < BatchAssociateClientDeviceWithCoreDeviceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1BatchAssociateClientDeviceWithCoreDeviceCommandError ( 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_restJson1AssociateClientDeviceWithCoreDeviceErrorList ( data . errorEntries , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1BatchAssociateClientDeviceWithCoreDeviceCommandError = async ( output , context ) : Promise < BatchAssociateClientDeviceWithCoreDeviceCommandOutput > => { 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.greengrassv2#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.greengrassv2#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.greengrassv2#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1BatchDisassociateClientDeviceFromCoreDeviceCommand = async ( output , context ) : Promise < BatchDisassociateClientDeviceFromCoreDeviceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1BatchDisassociateClientDeviceFromCoreDeviceCommandError ( 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_restJson1DisassociateClientDeviceFromCoreDeviceErrorList ( data . errorEntries , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1BatchDisassociateClientDeviceFromCoreDeviceCommandError = async ( output , context ) : Promise < BatchDisassociateClientDeviceFromCoreDeviceCommandOutput > => { 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.greengrassv2#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.greengrassv2#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.greengrassv2#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1CancelDeploymentCommand = async ( output , context ) : Promise < CancelDeploymentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CancelDeploymentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , message : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CancelDeploymentCommandError = async ( output , context ) : Promise < CancelDeploymentCommandOutput > => { 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.greengrassv2#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.greengrassv2#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.greengrassv2#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.greengrassv2#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1CreateComponentVersionCommand = async ( output , context ) : Promise < CreateComponentVersionCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateComponentVersionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , arn : undefined , componentName : undefined , componentVersion : undefined , creationTimestamp : undefined , status : 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 . componentName !== undefined && data . componentName !== null ) { contents . componentName = __expectString ( data . componentName ) ; } if ( data . componentVersion !== undefined && data . componentVersion !== null ) { contents . componentVersion = __expectString ( data . componentVersion ) ; } if ( data . creationTimestamp !== undefined && data . creationTimestamp !== null ) { contents . creationTimestamp = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . creationTimestamp ) ) ) ; } if ( data . status !== undefined && data . status !== null ) { contents . status = deserializeAws_restJson1CloudComponentStatus ( data . status , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateComponentVersionCommandError = async ( output , context ) : Promise < CreateComponentVersionCommandOutput > => { 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.greengrassv2#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.greengrassv2#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RequestAlreadyInProgressException" : case "com.amazonaws.greengrassv2#RequestAlreadyInProgressException" : response = { ... ( await deserializeAws_restJson1RequestAlreadyInProgressExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.greengrassv2#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.greengrassv2#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1CreateDeploymentCommand = async ( output , context ) : Promise < CreateDeploymentCommandOutput > => { if ( output . statusCode !== 201 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateDeploymentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , deploymentId : undefined , iotJobArn : undefined , iotJobId : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . deploymentId !== undefined && data . deploymentId !== null ) { contents . deploymentId = __expectString ( data . deploymentId ) ; } if ( data . iotJobArn !== undefined && data . iotJobArn !== null ) { contents . iotJobArn = __expectString ( data . iotJobArn ) ; } if ( data . iotJobId !== undefined && data . iotJobId !== null ) { contents . iotJobId = __expectString ( data . iotJobId ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateDeploymentCommandError = async ( output , context ) : Promise < CreateDeploymentCommandOutput > => { 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.greengrassv2#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "RequestAlreadyInProgressException" : case "com.amazonaws.greengrassv2#RequestAlreadyInProgressException" : response = { ... ( await deserializeAws_restJson1RequestAlreadyInProgressExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.greengrassv2#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.greengrassv2#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1DeleteComponentCommand = async ( output , context ) : Promise < DeleteComponentCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteComponentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteComponentCommandError = async ( output , context ) : Promise < DeleteComponentCommandOutput > => { 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.greengrassv2#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.greengrassv2#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.greengrassv2#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.greengrassv2#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1DeleteCoreDeviceCommand = async ( output , context ) : Promise < DeleteCoreDeviceCommandOutput > => { if ( output . statusCode !== 204 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteCoreDeviceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteCoreDeviceCommandError = async ( output , context ) : Promise < DeleteCoreDeviceCommandOutput > => { 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.greengrassv2#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.greengrassv2#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.greengrassv2#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.greengrassv2#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1DescribeComponentCommand = async ( output , context ) : Promise < DescribeComponentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeComponentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , arn : undefined , componentName : undefined , componentVersion : undefined , creationTimestamp : undefined , description : undefined , platforms : undefined , publisher : undefined , status : undefined , tags : 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 . componentName !== undefined && data . componentName !== null ) { contents . componentName = __expectString ( data . componentName ) ; } if ( data . componentVersion !== undefined && data . componentVersion !== null ) { contents . componentVersion = __expectString ( data . componentVersion ) ; } if ( data . creationTimestamp !== undefined && data . creationTimestamp !== null ) { contents . creationTimestamp = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . creationTimestamp ) ) ) ; } if ( data . description !== undefined && data . description !== null ) { contents . description = __expectString ( data . description ) ; } if ( data . platforms !== undefined && data . platforms !== null ) { contents . platforms = deserializeAws_restJson1ComponentPlatformList ( data . platforms , context ) ; } if ( data . publisher !== undefined && data . publisher !== null ) { contents . publisher = __expectString ( data . publisher ) ; } if ( data . status !== undefined && data . status !== null ) { contents . status = deserializeAws_restJson1CloudComponentStatus ( data . status , context ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1TagMap ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeComponentCommandError = async ( output , context ) : Promise < DescribeComponentCommandOutput > => { 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.greengrassv2#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.greengrassv2#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.greengrassv2#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1DisassociateServiceRoleFromAccountCommand = async ( output , context ) : Promise < DisassociateServiceRoleFromAccountCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DisassociateServiceRoleFromAccountCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , disassociatedAt : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DisassociatedAt !== undefined && data . DisassociatedAt !== null ) { contents . disassociatedAt = __expectString ( data . DisassociatedAt ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DisassociateServiceRoleFromAccountCommandError = async ( output , context ) : Promise < DisassociateServiceRoleFromAccountCommandOutput > => { 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.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( 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_restJson1GetComponentCommand = async ( output , context ) : Promise < GetComponentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetComponentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , recipe : undefined , recipeOutputFormat : undefined , tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . recipe !== undefined && data . recipe !== null ) { contents . recipe = context . base64Decoder ( data . recipe ) ; } if ( data . recipeOutputFormat !== undefined && data . recipeOutputFormat !== null ) { contents . recipeOutputFormat = __expectString ( data . recipeOutputFormat ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1TagMap ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetComponentCommandError = async ( output , context ) : Promise < GetComponentCommandOutput > => { 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.greengrassv2#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.greengrassv2#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.greengrassv2#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1GetComponentVersionArtifactCommand = async ( output , context ) : Promise < GetComponentVersionArtifactCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetComponentVersionArtifactCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , preSignedUrl : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . preSignedUrl !== undefined && data . preSignedUrl !== null ) { contents . preSignedUrl = __expectString ( data . preSignedUrl ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetComponentVersionArtifactCommandError = async ( output , context ) : Promise < GetComponentVersionArtifactCommandOutput > => { 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.greengrassv2#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.greengrassv2#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.greengrassv2#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1GetConnectivityInfoCommand = async ( output , context ) : Promise < GetConnectivityInfoCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetConnectivityInfoCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , connectivityInfo : undefined , message : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ConnectivityInfo !== undefined && data . ConnectivityInfo !== null ) { contents . connectivityInfo = deserializeAws_restJson1connectivityInfoList ( data . ConnectivityInfo , context ) ; } if ( data . Message !== undefined && data . Message !== null ) { contents . message = __expectString ( data . Message ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetConnectivityInfoCommandError = async ( output , context ) : Promise < GetConnectivityInfoCommandOutput > => { 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.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1GetCoreDeviceCommand = async ( output , context ) : Promise < GetCoreDeviceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetCoreDeviceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , architecture : undefined , coreDeviceThingName : undefined , coreVersion : undefined , lastStatusUpdateTimestamp : undefined , platform : undefined , status : undefined , tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . architecture !== undefined && data . architecture !== null ) { contents . architecture = __expectString ( data . architecture ) ; } if ( data . coreDeviceThingName !== undefined && data . coreDeviceThingName !== null ) { contents . coreDeviceThingName = __expectString ( data . coreDeviceThingName ) ; } if ( data . coreVersion !== undefined && data . coreVersion !== null ) { contents . coreVersion = __expectString ( data . coreVersion ) ; } if ( data . lastStatusUpdateTimestamp !== undefined && data . lastStatusUpdateTimestamp !== null ) { contents . lastStatusUpdateTimestamp = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . lastStatusUpdateTimestamp ) ) ) ; } if ( data . platform !== undefined && data . platform !== null ) { contents . platform = __expectString ( data . platform ) ; } if ( data . status !== undefined && data . status !== null ) { contents . status = __expectString ( data . status ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1TagMap ( data . tags , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetCoreDeviceCommandError = async ( output , context ) : Promise < GetCoreDeviceCommandOutput > => { 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.greengrassv2#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.greengrassv2#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.greengrassv2#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1GetDeploymentCommand = async ( output , context ) : Promise < GetDeploymentCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDeploymentCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , components : undefined , creationTimestamp : undefined , deploymentId : undefined , deploymentName : undefined , deploymentPolicies : undefined , deploymentStatus : undefined , iotJobArn : undefined , iotJobConfiguration : undefined , iotJobId : undefined , isLatestForTarget : undefined , revisionId : undefined , tags : undefined , targetArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . components !== undefined && data . components !== null ) { contents . components = deserializeAws_restJson1ComponentDeploymentSpecifications ( data . components , context ) ; } if ( data . creationTimestamp !== undefined && data . creationTimestamp !== null ) { contents . creationTimestamp = __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( data . creationTimestamp ) ) ) ; } if ( data . deploymentId !== undefined && data . deploymentId !== null ) { contents . deploymentId = __expectString ( data . deploymentId ) ; } if ( data . deploymentName !== undefined && data . deploymentName !== null ) { contents . deploymentName = __expectString ( data . deploymentName ) ; } if ( data . deploymentPolicies !== undefined && data . deploymentPolicies !== null ) { contents . deploymentPolicies = deserializeAws_restJson1DeploymentPolicies ( data . deploymentPolicies , context ) ; } if ( data . deploymentStatus !== undefined && data . deploymentStatus !== null ) { contents . deploymentStatus = __expectString ( data . deploymentStatus ) ; } if ( data . iotJobArn !== undefined && data . iotJobArn !== null ) { contents . iotJobArn = __expectString ( data . iotJobArn ) ; } if ( data . iotJobConfiguration !== undefined && data . iotJobConfiguration !== null ) { contents . iotJobConfiguration = deserializeAws_restJson1DeploymentIoTJobConfiguration ( data . iotJobConfiguration , context ) ; } if ( data . iotJobId !== undefined && data . iotJobId !== null ) { contents . iotJobId = __expectString ( data . iotJobId ) ; } if ( data . isLatestForTarget !== undefined && data . isLatestForTarget !== null ) { contents . isLatestForTarget = __expectBoolean ( data . isLatestForTarget ) ; } if ( data . revisionId !== undefined && data . revisionId !== null ) { contents . revisionId = __expectString ( data . revisionId ) ; } if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_restJson1TagMap ( data . tags , context ) ; } if ( data . targetArn !== undefined && data . targetArn !== null ) { contents . targetArn = __expectString ( data . targetArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDeploymentCommandError = async ( output , context ) : Promise < GetDeploymentCommandOutput > => { 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.greengrassv2#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.greengrassv2#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.greengrassv2#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1GetServiceRoleForAccountCommand = async ( output , context ) : Promise < GetServiceRoleForAccountCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetServiceRoleForAccountCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , associatedAt : undefined , roleArn : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . AssociatedAt !== undefined && data . AssociatedAt !== null ) { contents . associatedAt = __expectString ( data . AssociatedAt ) ; } if ( data . RoleArn !== undefined && data . RoleArn !== null ) { contents . roleArn = __expectString ( data . RoleArn ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetServiceRoleForAccountCommandError = async ( output , context ) : Promise < GetServiceRoleForAccountCommandOutput > => { 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.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( 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_restJson1ListClientDevicesAssociatedWithCoreDeviceCommand = async ( output , context ) : Promise < ListClientDevicesAssociatedWithCoreDeviceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListClientDevicesAssociatedWithCoreDeviceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , associatedClientDevices : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . associatedClientDevices !== undefined && data . associatedClientDevices !== null ) { contents . associatedClientDevices = deserializeAws_restJson1AssociatedClientDeviceList ( data . associatedClientDevices , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListClientDevicesAssociatedWithCoreDeviceCommandError = async ( output , context ) : Promise < ListClientDevicesAssociatedWithCoreDeviceCommandOutput > => { 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.greengrassv2#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.greengrassv2#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.greengrassv2#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1ListComponentsCommand = async ( output , context ) : Promise < ListComponentsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListComponentsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , components : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . components !== undefined && data . components !== null ) { contents . components = deserializeAws_restJson1ComponentList ( data . components , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListComponentsCommandError = async ( output , context ) : Promise < ListComponentsCommandOutput > => { 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.greengrassv2#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.greengrassv2#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1ListComponentVersionsCommand = async ( output , context ) : Promise < ListComponentVersionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListComponentVersionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , componentVersions : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . componentVersions !== undefined && data . componentVersions !== null ) { contents . componentVersions = deserializeAws_restJson1ComponentVersionList ( data . componentVersions , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListComponentVersionsCommandError = async ( output , context ) : Promise < ListComponentVersionsCommandOutput > => { 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.greengrassv2#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.greengrassv2#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.greengrassv2#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1ListCoreDevicesCommand = async ( output , context ) : Promise < ListCoreDevicesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListCoreDevicesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , coreDevices : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . coreDevices !== undefined && data . coreDevices !== null ) { contents . coreDevices = deserializeAws_restJson1CoreDevicesList ( data . coreDevices , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListCoreDevicesCommandError = async ( output , context ) : Promise < ListCoreDevicesCommandOutput > => { 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.greengrassv2#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.greengrassv2#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1ListDeploymentsCommand = async ( output , context ) : Promise < ListDeploymentsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListDeploymentsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , deployments : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . deployments !== undefined && data . deployments !== null ) { contents . deployments = deserializeAws_restJson1DeploymentList ( data . deployments , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListDeploymentsCommandError = async ( output , context ) : Promise < ListDeploymentsCommandOutput > => { 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.greengrassv2#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.greengrassv2#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1ListEffectiveDeploymentsCommand = async ( output , context ) : Promise < ListEffectiveDeploymentsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListEffectiveDeploymentsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , effectiveDeployments : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . effectiveDeployments !== undefined && data . effectiveDeployments !== null ) { contents . effectiveDeployments = deserializeAws_restJson1EffectiveDeploymentsList ( data . effectiveDeployments , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListEffectiveDeploymentsCommandError = async ( output , context ) : Promise < ListEffectiveDeploymentsCommandOutput > => { 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.greengrassv2#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.greengrassv2#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.greengrassv2#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1ListInstalledComponentsCommand = async ( output , context ) : Promise < ListInstalledComponentsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListInstalledComponentsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , installedComponents : undefined , nextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . installedComponents !== undefined && data . installedComponents !== null ) { contents . installedComponents = deserializeAws_restJson1InstalledComponentList ( data . installedComponents , context ) ; } if ( data . nextToken !== undefined && data . nextToken !== null ) { contents . nextToken = __expectString ( data . nextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListInstalledComponentsCommandError = async ( output , context ) : Promise < ListInstalledComponentsCommandOutput > => { 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.greengrassv2#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.greengrassv2#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.greengrassv2#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1ListTagsForResourceCommand = async ( output , context ) : Promise < ListTagsForResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTagsForResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , tags : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . tags !== undefined && data . tags !== null ) { contents . tags = deserializeAws_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 "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.greengrassv2#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1ResolveComponentCandidatesCommand = async ( output , context ) : Promise < ResolveComponentCandidatesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ResolveComponentCandidatesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , resolvedComponentVersions : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . resolvedComponentVersions !== undefined && data . resolvedComponentVersions !== null ) { contents . resolvedComponentVersions = deserializeAws_restJson1ResolvedComponentVersionsList ( data . resolvedComponentVersions , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ResolveComponentCandidatesCommandError = async ( output , context ) : Promise < ResolveComponentCandidatesCommandOutput > => { 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.greengrassv2#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.greengrassv2#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.greengrassv2#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.greengrassv2#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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 "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.greengrassv2#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1UntagResourceCommand = async ( output , context ) : Promise < UntagResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UntagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UntagResourceCommandError = async ( output , context ) : Promise < UntagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "InternalServerException" : case "com.amazonaws.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.greengrassv2#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#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_restJson1UpdateConnectivityInfoCommand = async ( output , context ) : Promise < UpdateConnectivityInfoCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateConnectivityInfoCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , message : undefined , version : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Message !== undefined && data . Message !== null ) { contents . message = __expectString ( data . Message ) ; } if ( data . Version !== undefined && data . Version !== null ) { contents . version = __expectString ( data . Version ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateConnectivityInfoCommandError = async ( output , context ) : Promise < UpdateConnectivityInfoCommandOutput > => { 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.greengrassv2#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.greengrassv2#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; const deserializeAws_restJson1AccessDeniedExceptionResponse = async ( parsedOutput , context ) : Promise < AccessDeniedException > => { const contents = { name : "AccessDeniedException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ConflictExceptionResponse = async ( parsedOutput , context ) : Promise < ConflictException > => { const contents = { name : "ConflictException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , resourceId : undefined , resourceType : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } if ( data . resourceId !== undefined && data . resourceId !== null ) { contents . resourceId = __expectString ( data . resourceId ) ; } if ( data . resourceType !== undefined && data . resourceType !== null ) { contents . resourceType = __expectString ( data . resourceType ) ; } return contents ; } ; const deserializeAws_restJson1InternalServerExceptionResponse = async ( parsedOutput , context ) : Promise < InternalServerException > => { const contents = { name : "InternalServerException" , $fault : "server" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , retryAfterSeconds : undefined , } ; if ( parsedOutput . headers [ "retry-after" ] !== undefined ) { contents . retryAfterSeconds = __strictParseInt32 ( parsedOutput . headers [ "retry-after" ] ) ; } const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1RequestAlreadyInProgressExceptionResponse = async ( parsedOutput , context ) : Promise < RequestAlreadyInProgressException > => { const contents = { name : "RequestAlreadyInProgressException" , $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_restJson1ResourceNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < ResourceNotFoundException > => { const contents = { name : "ResourceNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , resourceId : undefined , resourceType : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } if ( data . resourceId !== undefined && data . resourceId !== null ) { contents . resourceId = __expectString ( data . resourceId ) ; } if ( data . resourceType !== undefined && data . resourceType !== null ) { contents . resourceType = __expectString ( data . resourceType ) ; } return contents ; } ; const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async ( parsedOutput , context ) : Promise < ServiceQuotaExceededException > => { const contents = { name : "ServiceQuotaExceededException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , quotaCode : undefined , resourceId : undefined , resourceType : undefined , serviceCode : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } if ( data . quotaCode !== undefined && data . quotaCode !== null ) { contents . quotaCode = __expectString ( data . quotaCode ) ; } if ( data . resourceId !== undefined && data . resourceId !== null ) { contents . resourceId = __expectString ( data . resourceId ) ; } if ( data . resourceType !== undefined && data . resourceType !== null ) { contents . resourceType = __expectString ( data . resourceType ) ; } if ( data . serviceCode !== undefined && data . serviceCode !== null ) { contents . serviceCode = __expectString ( data . serviceCode ) ; } return contents ; } ; const deserializeAws_restJson1ThrottlingExceptionResponse = async ( parsedOutput , context ) : Promise < ThrottlingException > => { const contents = { name : "ThrottlingException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , message : undefined , quotaCode : undefined , retryAfterSeconds : undefined , serviceCode : undefined , } ; if ( parsedOutput . headers [ "retry-after" ] !== undefined ) { contents . retryAfterSeconds = __strictParseInt32 ( parsedOutput . headers [ "retry-after" ] ) ; } const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } if ( data . quotaCode !== undefined && data . quotaCode !== null ) { contents . quotaCode = __expectString ( data . quotaCode ) ; } if ( data . serviceCode !== undefined && data . serviceCode !== null ) { contents . serviceCode = __expectString ( data . serviceCode ) ; } return contents ; } ; const deserializeAws_restJson1ValidationExceptionResponse = async ( parsedOutput , context ) : Promise < ValidationException > => { const contents = { name : "ValidationException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , fields : undefined , message : undefined , reason : undefined , } ; const data = parsedOutput . body ; if ( data . fields !== undefined && data . fields !== null ) { contents . fields = deserializeAws_restJson1ValidationExceptionFieldList ( data . fields , context ) ; } if ( data . message !== undefined && data . message !== null ) { contents . message = __expectString ( data . message ) ; } if ( data . reason !== undefined && data . reason !== null ) { contents . reason = __expectString ( data . reason ) ; } return contents ; } ; const serializeAws_restJson1AssociateClientDeviceWithCoreDeviceEntry = ( input , context ) : any => { return { ... ( input . thingName !== undefined && input . thingName !== null && { thingName : input . thingName } ) , } ; } ; const serializeAws_restJson1AssociateClientDeviceWithCoreDeviceEntryList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1AssociateClientDeviceWithCoreDeviceEntry ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ComponentCandidate = ( input , context ) : any => { return { ... ( input . componentName !== undefined && input . componentName !== null && { componentName : input . componentName } ) , ... ( input . componentVersion !== undefined && input . componentVersion !== null && { componentVersion : input . componentVersion } ) , ... ( input . versionRequirements !== undefined && input . versionRequirements !== null && { versionRequirements : serializeAws_restJson1ComponentVersionRequirementMap ( input . versionRequirements , context ) , } ) , } ; } ; const serializeAws_restJson1ComponentCandidateList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1ComponentCandidate ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ComponentConfigurationPathList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1ComponentConfigurationUpdate = ( input , context ) : any => { return { ... ( input . merge !== undefined && input . merge !== null && { merge : input . merge } ) , ... ( input . reset !== undefined && input . reset !== null && { reset : serializeAws_restJson1ComponentConfigurationPathList ( input . reset , context ) } ) , } ; } ; const serializeAws_restJson1ComponentDependencyMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_restJson1ComponentDependencyRequirement ( value , context ) , } ; } , { } ) ; } ; const serializeAws_restJson1ComponentDependencyRequirement = ( input , context ) : any => { return { ... ( input . dependencyType !== undefined && input . dependencyType !== null && { dependencyType : input . dependencyType } ) , ... ( input . versionRequirement !== undefined && input . versionRequirement !== null && { versionRequirement : input . versionRequirement } ) , } ; } ; const serializeAws_restJson1ComponentDeploymentSpecification = ( input , context ) : any => { return { ... ( input . componentVersion !== undefined && input . componentVersion !== null && { componentVersion : input . componentVersion } ) , ... ( input . configurationUpdate !== undefined && input . configurationUpdate !== null && { configurationUpdate : serializeAws_restJson1ComponentConfigurationUpdate ( input . configurationUpdate , context ) , } ) , ... ( input . runWith !== undefined && input . runWith !== null && { runWith : serializeAws_restJson1ComponentRunWith ( input . runWith , context ) } ) , } ; } ; const serializeAws_restJson1ComponentDeploymentSpecifications = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : serializeAws_restJson1ComponentDeploymentSpecification ( value , context ) , } ; } , { } ) ; } ; const serializeAws_restJson1ComponentPlatform = ( input , context ) : any => { return { ... ( input . attributes !== undefined && input . attributes !== null && { attributes : serializeAws_restJson1PlatformAttributesMap ( input . attributes , context ) , } ) , ... ( input . name !== undefined && input . name !== null && { name : input . name } ) , } ; } ; const serializeAws_restJson1ComponentPlatformList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1ComponentPlatform ( entry , context ) ; } ) ; } ; const serializeAws_restJson1ComponentRunWith = ( input , context ) : any => { return { ... ( input . posixUser !== undefined && input . posixUser !== null && { posixUser : input . posixUser } ) , ... ( input . systemResourceLimits !== undefined && input . systemResourceLimits !== null && { systemResourceLimits : serializeAws_restJson1SystemResourceLimits ( input . systemResourceLimits , context ) , } ) , ... ( input . windowsUser !== undefined && input . windowsUser !== null && { windowsUser : input . windowsUser } ) , } ; } ; const serializeAws_restJson1ComponentVersionRequirementMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1ConnectivityInfo = ( input , context ) : any => { return { ... ( input . hostAddress !== undefined && input . hostAddress !== null && { HostAddress : input . hostAddress } ) , ... ( input . id !== undefined && input . id !== null && { Id : input . id } ) , ... ( input . metadata !== undefined && input . metadata !== null && { Metadata : input . metadata } ) , ... ( input . portNumber !== undefined && input . portNumber !== null && { PortNumber : input . portNumber } ) , } ; } ; const serializeAws_restJson1connectivityInfoList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1ConnectivityInfo ( entry , context ) ; } ) ; } ; const serializeAws_restJson1DeploymentComponentUpdatePolicy = ( input , context ) : any => { return { ... ( input . action !== undefined && input . action !== null && { action : input . action } ) , ... ( input . timeoutInSeconds !== undefined && input . timeoutInSeconds !== null && { timeoutInSeconds : input . timeoutInSeconds } ) , } ; } ; const serializeAws_restJson1DeploymentConfigurationValidationPolicy = ( input , context ) : any => { return { ... ( input . timeoutInSeconds !== undefined && input . timeoutInSeconds !== null && { timeoutInSeconds : input . timeoutInSeconds } ) , } ; } ; const serializeAws_restJson1DeploymentIoTJobConfiguration = ( input , context ) : any => { return { ... ( input . abortConfig !== undefined && input . abortConfig !== null && { abortConfig : serializeAws_restJson1IoTJobAbortConfig ( input . abortConfig , context ) , } ) , ... ( input . jobExecutionsRolloutConfig !== undefined && input . jobExecutionsRolloutConfig !== null && { jobExecutionsRolloutConfig : serializeAws_restJson1IoTJobExecutionsRolloutConfig ( input . jobExecutionsRolloutConfig , context ) , } ) , ... ( input . timeoutConfig !== undefined && input . timeoutConfig !== null && { timeoutConfig : serializeAws_restJson1IoTJobTimeoutConfig ( input . timeoutConfig , context ) , } ) , } ; } ; const serializeAws_restJson1DeploymentPolicies = ( input , context ) : any => { return { ... ( input . componentUpdatePolicy !== undefined && input . componentUpdatePolicy !== null && { componentUpdatePolicy : serializeAws_restJson1DeploymentComponentUpdatePolicy ( input . componentUpdatePolicy , context ) , } ) , ... ( input . configurationValidationPolicy !== undefined && input . configurationValidationPolicy !== null && { configurationValidationPolicy : serializeAws_restJson1DeploymentConfigurationValidationPolicy ( input . configurationValidationPolicy , context ) , } ) , ... ( input . failureHandlingPolicy !== undefined && input . failureHandlingPolicy !== null && { failureHandlingPolicy : input . failureHandlingPolicy } ) , } ; } ; const serializeAws_restJson1DisassociateClientDeviceFromCoreDeviceEntry = ( input , context ) : any => { return { ... ( input . thingName !== undefined && input . thingName !== null && { thingName : input . thingName } ) , } ; } ; const serializeAws_restJson1DisassociateClientDeviceFromCoreDeviceEntryList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1DisassociateClientDeviceFromCoreDeviceEntry ( entry , context ) ; } ) ; } ; const serializeAws_restJson1IoTJobAbortConfig = ( input , context ) : any => { return { ... ( input . criteriaList !== undefined && input . criteriaList !== null && { criteriaList : serializeAws_restJson1IoTJobAbortCriteriaList ( input . criteriaList , context ) , } ) , } ; } ; const serializeAws_restJson1IoTJobAbortCriteria = ( input , context ) : any => { return { ... ( input . action !== undefined && input . action !== null && { action : input . action } ) , ... ( input . failureType !== undefined && input . failureType !== null && { failureType : input . failureType } ) , ... ( input . minNumberOfExecutedThings !== undefined && input . minNumberOfExecutedThings !== null && { minNumberOfExecutedThings : input . minNumberOfExecutedThings } ) , ... ( input . thresholdPercentage !== undefined && input . thresholdPercentage !== null && { thresholdPercentage : __serializeFloat ( input . thresholdPercentage ) } ) , } ; } ; const serializeAws_restJson1IoTJobAbortCriteriaList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1IoTJobAbortCriteria ( entry , context ) ; } ) ; } ; const serializeAws_restJson1IoTJobExecutionsRolloutConfig = ( input , context ) : any => { return { ... ( input . exponentialRate !== undefined && input . exponentialRate !== null && { exponentialRate : serializeAws_restJson1IoTJobExponentialRolloutRate ( input . exponentialRate , context ) , } ) , ... ( input . maximumPerMinute !== undefined && input . maximumPerMinute !== null && { maximumPerMinute : input . maximumPerMinute } ) , } ; } ; const serializeAws_restJson1IoTJobExponentialRolloutRate = ( input , context ) : any => { return { ... ( input . baseRatePerMinute !== undefined && input . baseRatePerMinute !== null && { baseRatePerMinute : input . baseRatePerMinute } ) , ... ( input . incrementFactor !== undefined && input . incrementFactor !== null && { incrementFactor : __serializeFloat ( input . incrementFactor ) } ) , ... ( input . rateIncreaseCriteria !== undefined && input . rateIncreaseCriteria !== null && { rateIncreaseCriteria : serializeAws_restJson1IoTJobRateIncreaseCriteria ( input . rateIncreaseCriteria , context ) , } ) , } ; } ; const serializeAws_restJson1IoTJobRateIncreaseCriteria = ( input , context ) : any => { return { ... ( input . numberOfNotifiedThings !== undefined && input . numberOfNotifiedThings !== null && { numberOfNotifiedThings : input . numberOfNotifiedThings } ) , ... ( input . numberOfSucceededThings !== undefined && input . numberOfSucceededThings !== null && { numberOfSucceededThings : input . numberOfSucceededThings } ) , } ; } ; const serializeAws_restJson1IoTJobTimeoutConfig = ( input , context ) : any => { return { ... ( input . inProgressTimeoutInMinutes !== undefined && input . inProgressTimeoutInMinutes !== null && { inProgressTimeoutInMinutes : input . inProgressTimeoutInMinutes } ) , } ; } ; const serializeAws_restJson1LambdaContainerParams = ( input , context ) : any => { return { ... ( input . devices !== undefined && input . devices !== null && { devices : serializeAws_restJson1LambdaDeviceList ( input . devices , context ) } ) , ... ( input . memorySizeInKB !== undefined && input . memorySizeInKB !== null && { memorySizeInKB : input . memorySizeInKB } ) , ... ( input . mountROSysfs !== undefined && input . mountROSysfs !== null && { mountROSysfs : input . mountROSysfs } ) , ... ( input . volumes !== undefined && input . volumes !== null && { volumes : serializeAws_restJson1LambdaVolumeList ( input . volumes , context ) } ) , } ; } ; const serializeAws_restJson1LambdaDeviceList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1LambdaDeviceMount ( entry , context ) ; } ) ; } ; const serializeAws_restJson1LambdaDeviceMount = ( input , context ) : any => { return { ... ( input . addGroupOwner !== undefined && input . addGroupOwner !== null && { addGroupOwner : input . addGroupOwner } ) , ... ( input . path !== undefined && input . path !== null && { path : input . path } ) , ... ( input . permission !== undefined && input . permission !== null && { permission : input . permission } ) , } ; } ; const serializeAws_restJson1LambdaEnvironmentVariables = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1LambdaEventSource = ( input , context ) : any => { return { ... ( input . topic !== undefined && input . topic !== null && { topic : input . topic } ) , ... ( input . type !== undefined && input . type !== null && { type : input . type } ) , } ; } ; const serializeAws_restJson1LambdaEventSourceList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1LambdaEventSource ( entry , context ) ; } ) ; } ; const serializeAws_restJson1LambdaExecArgsList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1LambdaExecutionParameters = ( input , context ) : any => { return { ... ( input . environmentVariables !== undefined && input . environmentVariables !== null && { environmentVariables : serializeAws_restJson1LambdaEnvironmentVariables ( input . environmentVariables , context ) , } ) , ... ( input . eventSources !== undefined && input . eventSources !== null && { eventSources : serializeAws_restJson1LambdaEventSourceList ( input . eventSources , context ) , } ) , ... ( input . execArgs !== undefined && input . execArgs !== null && { execArgs : serializeAws_restJson1LambdaExecArgsList ( input . execArgs , context ) } ) , ... ( input . inputPayloadEncodingType !== undefined && input . inputPayloadEncodingType !== null && { inputPayloadEncodingType : input . inputPayloadEncodingType } ) , ... ( input . linuxProcessParams !== undefined && input . linuxProcessParams !== null && { linuxProcessParams : serializeAws_restJson1LambdaLinuxProcessParams ( input . linuxProcessParams , context ) , } ) , ... ( input . maxIdleTimeInSeconds !== undefined && input . maxIdleTimeInSeconds !== null && { maxIdleTimeInSeconds : input . maxIdleTimeInSeconds } ) , ... ( input . maxInstancesCount !== undefined && input . maxInstancesCount !== null && { maxInstancesCount : input . maxInstancesCount } ) , ... ( input . maxQueueSize !== undefined && input . maxQueueSize !== null && { maxQueueSize : input . maxQueueSize } ) , ... ( input . pinned !== undefined && input . pinned !== null && { pinned : input . pinned } ) , ... ( input . statusTimeoutInSeconds !== undefined && input . statusTimeoutInSeconds !== null && { statusTimeoutInSeconds : input . statusTimeoutInSeconds } ) , ... ( input . timeoutInSeconds !== undefined && input . timeoutInSeconds !== null && { timeoutInSeconds : input . timeoutInSeconds } ) , } ; } ; const serializeAws_restJson1LambdaFunctionRecipeSource = ( input , context ) : any => { return { ... ( input . componentDependencies !== undefined && input . componentDependencies !== null && { componentDependencies : serializeAws_restJson1ComponentDependencyMap ( input . componentDependencies , context ) , } ) , ... ( input . componentLambdaParameters !== undefined && input . componentLambdaParameters !== null && { componentLambdaParameters : serializeAws_restJson1LambdaExecutionParameters ( input . componentLambdaParameters , context ) , } ) , ... ( input . componentName !== undefined && input . componentName !== null && { componentName : input . componentName } ) , ... ( input . componentPlatforms !== undefined && input . componentPlatforms !== null && { componentPlatforms : serializeAws_restJson1ComponentPlatformList ( input . componentPlatforms , context ) , } ) , ... ( input . componentVersion !== undefined && input . componentVersion !== null && { componentVersion : input . componentVersion } ) , ... ( input . lambdaArn !== undefined && input . lambdaArn !== null && { lambdaArn : input . lambdaArn } ) , } ; } ; const serializeAws_restJson1LambdaLinuxProcessParams = ( input , context ) : any => { return { ... ( input . containerParams !== undefined && input . containerParams !== null && { containerParams : serializeAws_restJson1LambdaContainerParams ( input . containerParams , context ) , } ) , ... ( input . isolationMode !== undefined && input . isolationMode !== null && { isolationMode : input . isolationMode } ) , } ; } ; const serializeAws_restJson1LambdaVolumeList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1LambdaVolumeMount ( entry , context ) ; } ) ; } ; const serializeAws_restJson1LambdaVolumeMount = ( input , context ) : any => { return { ... ( input . addGroupOwner !== undefined && input . addGroupOwner !== null && { addGroupOwner : input . addGroupOwner } ) , ... ( input . destinationPath !== undefined && input . destinationPath !== null && { destinationPath : input . destinationPath } ) , ... ( input . permission !== undefined && input . permission !== null && { permission : input . permission } ) , ... ( input . sourcePath !== undefined && input . sourcePath !== null && { sourcePath : input . sourcePath } ) , } ; } ; const serializeAws_restJson1PlatformAttributesMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1SystemResourceLimits = ( input , context ) : any => { return { ... ( input . cpus !== undefined && input . cpus !== null && { cpus : __serializeFloat ( input . cpus ) } ) , ... ( input . memory !== undefined && input . memory !== null && { memory : input . memory } ) , } ; } ; 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_restJson1AssociateClientDeviceWithCoreDeviceErrorEntry = ( output , context ) : AssociateClientDeviceWithCoreDeviceErrorEntry => { return { code : __expectString ( output . code ) , message : __expectString ( output . message ) , thingName : __expectString ( output . thingName ) , } as any ; } ; const deserializeAws_restJson1AssociateClientDeviceWithCoreDeviceErrorList = ( output , context ) : AssociateClientDeviceWithCoreDeviceErrorEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1AssociateClientDeviceWithCoreDeviceErrorEntry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1AssociatedClientDevice = ( output , context ) : AssociatedClientDevice => { return { associationTimestamp : output . associationTimestamp !== undefined && output . associationTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . associationTimestamp ) ) ) : undefined , thingName : __expectString ( output . thingName ) , } as any ; } ; const deserializeAws_restJson1AssociatedClientDeviceList = ( output , context ) : AssociatedClientDevice [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1AssociatedClientDevice ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1CloudComponentStatus = ( output , context ) : CloudComponentStatus => { return { componentState : __expectString ( output . componentState ) , errors : output . errors !== undefined && output . errors !== null ? deserializeAws_restJson1StringMap ( output . errors , context ) : undefined , message : __expectString ( output . message ) , } as any ; } ; const deserializeAws_restJson1Component = ( output , context ) : Component => { return { arn : __expectString ( output . arn ) , componentName : __expectString ( output . componentName ) , latestVersion : output . latestVersion !== undefined && output . latestVersion !== null ? deserializeAws_restJson1ComponentLatestVersion ( output . latestVersion , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ComponentConfigurationPathList = ( 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_restJson1ComponentConfigurationUpdate = ( output , context ) : ComponentConfigurationUpdate => { return { merge : __expectString ( output . merge ) , reset : output . reset !== undefined && output . reset !== null ? deserializeAws_restJson1ComponentConfigurationPathList ( output . reset , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ComponentDeploymentSpecification = ( output , context ) : ComponentDeploymentSpecification => { return { componentVersion : __expectString ( output . componentVersion ) , configurationUpdate : output . configurationUpdate !== undefined && output . configurationUpdate !== null ? deserializeAws_restJson1ComponentConfigurationUpdate ( output . configurationUpdate , context ) : undefined , runWith : output . runWith !== undefined && output . runWith !== null ? deserializeAws_restJson1ComponentRunWith ( output . runWith , context ) : undefined , } as any ; } ; const deserializeAws_restJson1ComponentDeploymentSpecifications = ( output , context ) : { [ key ] : ComponentDeploymentSpecification ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : deserializeAws_restJson1ComponentDeploymentSpecification ( value , context ) , } ; } , { } ) ; } ; const deserializeAws_restJson1ComponentLatestVersion = ( output , context ) : ComponentLatestVersion => { return { arn : __expectString ( output . arn ) , componentVersion : __expectString ( output . componentVersion ) , creationTimestamp : output . creationTimestamp !== undefined && output . creationTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . creationTimestamp ) ) ) : undefined , description : __expectString ( output . description ) , platforms : output . platforms !== undefined && output . platforms !== null ? deserializeAws_restJson1ComponentPlatformList ( output . platforms , context ) : undefined , publisher : __expectString ( output . publisher ) , } as any ; } ; const deserializeAws_restJson1ComponentList = ( output , context ) : Component [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Component ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ComponentPlatform = ( output , context ) : ComponentPlatform => { return { attributes : output . attributes !== undefined && output . attributes !== null ? deserializeAws_restJson1PlatformAttributesMap ( output . attributes , context ) : undefined , name : __expectString ( output . name ) , } as any ; } ; const deserializeAws_restJson1ComponentPlatformList = ( output , context ) : ComponentPlatform [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ComponentPlatform ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ComponentRunWith = ( output , context ) : ComponentRunWith => { return { posixUser : __expectString ( output . posixUser ) , systemResourceLimits : output . systemResourceLimits !== undefined && output . systemResourceLimits !== null ? deserializeAws_restJson1SystemResourceLimits ( output . systemResourceLimits , context ) : undefined , windowsUser : __expectString ( output . windowsUser ) , } as any ; } ; const deserializeAws_restJson1ComponentVersionList = ( output , context ) : ComponentVersionListItem [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ComponentVersionListItem ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ComponentVersionListItem = ( output , context ) : ComponentVersionListItem => { return { arn : __expectString ( output . arn ) , componentName : __expectString ( output . componentName ) , componentVersion : __expectString ( output . componentVersion ) , } as any ; } ; const deserializeAws_restJson1ConnectivityInfo = ( output , context ) : ConnectivityInfo => { return { hostAddress : __expectString ( output . HostAddress ) , id : __expectString ( output . Id ) , metadata : __expectString ( output . Metadata ) , portNumber : __expectInt32 ( output . PortNumber ) , } as any ; } ; const deserializeAws_restJson1connectivityInfoList = ( output , context ) : ConnectivityInfo [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ConnectivityInfo ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1CoreDevice = ( output , context ) : CoreDevice => { return { coreDeviceThingName : __expectString ( output . coreDeviceThingName ) , lastStatusUpdateTimestamp : output . lastStatusUpdateTimestamp !== undefined && output . lastStatusUpdateTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . lastStatusUpdateTimestamp ) ) ) : undefined , status : __expectString ( output . status ) , } as any ; } ; const deserializeAws_restJson1CoreDevicesList = ( output , context ) : CoreDevice [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1CoreDevice ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1Deployment = ( output , context ) : Deployment => { return { creationTimestamp : output . creationTimestamp !== undefined && output . creationTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . creationTimestamp ) ) ) : undefined , deploymentId : __expectString ( output . deploymentId ) , deploymentName : __expectString ( output . deploymentName ) , deploymentStatus : __expectString ( output . deploymentStatus ) , isLatestForTarget : __expectBoolean ( output . isLatestForTarget ) , revisionId : __expectString ( output . revisionId ) , targetArn : __expectString ( output . targetArn ) , } as any ; } ; const deserializeAws_restJson1DeploymentComponentUpdatePolicy = ( output , context ) : DeploymentComponentUpdatePolicy => { return { action : __expectString ( output . action ) , timeoutInSeconds : __expectInt32 ( output . timeoutInSeconds ) , } as any ; } ; const deserializeAws_restJson1DeploymentConfigurationValidationPolicy = ( output , context ) : DeploymentConfigurationValidationPolicy => { return { timeoutInSeconds : __expectInt32 ( output . timeoutInSeconds ) , } as any ; } ; const deserializeAws_restJson1DeploymentIoTJobConfiguration = ( output , context ) : DeploymentIoTJobConfiguration => { return { abortConfig : output . abortConfig !== undefined && output . abortConfig !== null ? deserializeAws_restJson1IoTJobAbortConfig ( output . abortConfig , context ) : undefined , jobExecutionsRolloutConfig : output . jobExecutionsRolloutConfig !== undefined && output . jobExecutionsRolloutConfig !== null ? deserializeAws_restJson1IoTJobExecutionsRolloutConfig ( output . jobExecutionsRolloutConfig , context ) : undefined , timeoutConfig : output . timeoutConfig !== undefined && output . timeoutConfig !== null ? deserializeAws_restJson1IoTJobTimeoutConfig ( output . timeoutConfig , context ) : undefined , } as any ; } ; const deserializeAws_restJson1DeploymentList = ( output , context ) : Deployment [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Deployment ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1DeploymentPolicies = ( output , context ) : DeploymentPolicies => { return { componentUpdatePolicy : output . componentUpdatePolicy !== undefined && output . componentUpdatePolicy !== null ? deserializeAws_restJson1DeploymentComponentUpdatePolicy ( output . componentUpdatePolicy , context ) : undefined , configurationValidationPolicy : output . configurationValidationPolicy !== undefined && output . configurationValidationPolicy !== null ? deserializeAws_restJson1DeploymentConfigurationValidationPolicy ( output . configurationValidationPolicy , context ) : undefined , failureHandlingPolicy : __expectString ( output . failureHandlingPolicy ) , } as any ; } ; const deserializeAws_restJson1DisassociateClientDeviceFromCoreDeviceErrorEntry = ( output , context ) : DisassociateClientDeviceFromCoreDeviceErrorEntry => { return { code : __expectString ( output . code ) , message : __expectString ( output . message ) , thingName : __expectString ( output . thingName ) , } as any ; } ; const deserializeAws_restJson1DisassociateClientDeviceFromCoreDeviceErrorList = ( output , context ) : DisassociateClientDeviceFromCoreDeviceErrorEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1DisassociateClientDeviceFromCoreDeviceErrorEntry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1EffectiveDeployment = ( output , context ) : EffectiveDeployment => { return { coreDeviceExecutionStatus : __expectString ( output . coreDeviceExecutionStatus ) , creationTimestamp : output . creationTimestamp !== undefined && output . creationTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . creationTimestamp ) ) ) : undefined , deploymentId : __expectString ( output . deploymentId ) , deploymentName : __expectString ( output . deploymentName ) , description : __expectString ( output . description ) , iotJobArn : __expectString ( output . iotJobArn ) , iotJobId : __expectString ( output . iotJobId ) , modifiedTimestamp : output . modifiedTimestamp !== undefined && output . modifiedTimestamp !== null ? __expectNonNull ( __parseEpochTimestamp ( __expectNumber ( output . modifiedTimestamp ) ) ) : undefined , reason : __expectString ( output . reason ) , targetArn : __expectString ( output . targetArn ) , } as any ; } ; const deserializeAws_restJson1EffectiveDeploymentsList = ( output , context ) : EffectiveDeployment [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1EffectiveDeployment ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1InstalledComponent = ( output , context ) : InstalledComponent => { return { componentName : __expectString ( output . componentName ) , componentVersion : __expectString ( output . componentVersion ) , isRoot : __expectBoolean ( output . isRoot ) , lifecycleState : __expectString ( output . lifecycleState ) , lifecycleStateDetails : __expectString ( output . lifecycleStateDetails ) , } as any ; } ; const deserializeAws_restJson1InstalledComponentList = ( output , context ) : InstalledComponent [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1InstalledComponent ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1IoTJobAbortConfig = ( output , context ) : IoTJobAbortConfig => { return { criteriaList : output . criteriaList !== undefined && output . criteriaList !== null ? deserializeAws_restJson1IoTJobAbortCriteriaList ( output . criteriaList , context ) : undefined , } as any ; } ; const deserializeAws_restJson1IoTJobAbortCriteria = ( output , context ) : IoTJobAbortCriteria => { return { action : __expectString ( output . action ) , failureType : __expectString ( output . failureType ) , minNumberOfExecutedThings : __expectInt32 ( output . minNumberOfExecutedThings ) , thresholdPercentage : __limitedParseDouble ( output . thresholdPercentage ) , } as any ; } ; const deserializeAws_restJson1IoTJobAbortCriteriaList = ( output , context ) : IoTJobAbortCriteria [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1IoTJobAbortCriteria ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1IoTJobExecutionsRolloutConfig = ( output , context ) : IoTJobExecutionsRolloutConfig => { return { exponentialRate : output . exponentialRate !== undefined && output . exponentialRate !== null ? deserializeAws_restJson1IoTJobExponentialRolloutRate ( output . exponentialRate , context ) : undefined , maximumPerMinute : __expectInt32 ( output . maximumPerMinute ) , } as any ; } ; const deserializeAws_restJson1IoTJobExponentialRolloutRate = ( output , context ) : IoTJobExponentialRolloutRate => { return { baseRatePerMinute : __expectInt32 ( output . baseRatePerMinute ) , incrementFactor : __limitedParseDouble ( output . incrementFactor ) , rateIncreaseCriteria : output . rateIncreaseCriteria !== undefined && output . rateIncreaseCriteria !== null ? deserializeAws_restJson1IoTJobRateIncreaseCriteria ( output . rateIncreaseCriteria , context ) : undefined , } as any ; } ; const deserializeAws_restJson1IoTJobRateIncreaseCriteria = ( output , context ) : IoTJobRateIncreaseCriteria => { return { numberOfNotifiedThings : __expectInt32 ( output . numberOfNotifiedThings ) , numberOfSucceededThings : __expectInt32 ( output . numberOfSucceededThings ) , } as any ; } ; const deserializeAws_restJson1IoTJobTimeoutConfig = ( output , context ) : IoTJobTimeoutConfig => { return { inProgressTimeoutInMinutes : __expectLong ( output . inProgressTimeoutInMinutes ) , } as any ; } ; const deserializeAws_restJson1PlatformAttributesMap = ( 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_restJson1ResolvedComponentVersion = ( output , context ) : ResolvedComponentVersion => { return { arn : __expectString ( output . arn ) , componentName : __expectString ( output . componentName ) , componentVersion : __expectString ( output . componentVersion ) , recipe : output . recipe !== undefined && output . recipe !== null ? context . base64Decoder ( output . recipe ) : undefined , } as any ; } ; const deserializeAws_restJson1ResolvedComponentVersionsList = ( output , context ) : ResolvedComponentVersion [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ResolvedComponentVersion ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1StringMap = ( 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_restJson1SystemResourceLimits = ( output , context ) : SystemResourceLimits => { return { cpus : __limitedParseDouble ( output . cpus ) , memory : __expectLong ( output . memory ) , } 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_restJson1ValidationExceptionField = ( output , context ) : ValidationExceptionField => { return { message : __expectString ( output . message ) , name : __expectString ( output . name ) , } as any ; } ; const deserializeAws_restJson1ValidationExceptionFieldList = ( output , context ) : ValidationExceptionField [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ValidationExceptionField ( entry , context ) ; } ) ; } ; 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 "" ; } ;