import { HttpRequest as __HttpRequest , HttpResponse as __HttpResponse , isValidHostname as __isValidHostname , } from "@aws-sdk/protocol-http" ; import { expectBoolean as __expectBoolean , expectInt32 as __expectInt32 , expectNonNull as __expectNonNull , expectObject as __expectObject , expectString as __expectString , extendedEncodeURIComponent as __extendedEncodeURIComponent , limitedParseDouble as __limitedParseDouble , parseRfc3339DateTime as __parseRfc3339DateTime , serializeFloat as __serializeFloat , } from "@aws-sdk/smithy-client" ; import { Endpoint as __Endpoint , MetadataBearer as __MetadataBearer , ResponseMetadata as __ResponseMetadata , SerdeContext as __SerdeContext , SmithyException as __SmithyException , } from "@aws-sdk/types" ; import { AssociateTrackerConsumerCommandInput , AssociateTrackerConsumerCommandOutput , } from "../commands/AssociateTrackerConsumerCommand" ; import { BatchDeleteDevicePositionHistoryCommandInput , BatchDeleteDevicePositionHistoryCommandOutput , } from "../commands/BatchDeleteDevicePositionHistoryCommand" ; import { BatchDeleteGeofenceCommandInput , BatchDeleteGeofenceCommandOutput , } from "../commands/BatchDeleteGeofenceCommand" ; import { BatchEvaluateGeofencesCommandInput , BatchEvaluateGeofencesCommandOutput , } from "../commands/BatchEvaluateGeofencesCommand" ; import { BatchGetDevicePositionCommandInput , BatchGetDevicePositionCommandOutput , } from "../commands/BatchGetDevicePositionCommand" ; import { BatchPutGeofenceCommandInput , BatchPutGeofenceCommandOutput } from "../commands/BatchPutGeofenceCommand" ; import { BatchUpdateDevicePositionCommandInput , BatchUpdateDevicePositionCommandOutput , } from "../commands/BatchUpdateDevicePositionCommand" ; import { CalculateRouteCommandInput , CalculateRouteCommandOutput } from "../commands/CalculateRouteCommand" ; import { CreateGeofenceCollectionCommandInput , CreateGeofenceCollectionCommandOutput , } from "../commands/CreateGeofenceCollectionCommand" ; import { CreateMapCommandInput , CreateMapCommandOutput } from "../commands/CreateMapCommand" ; import { CreatePlaceIndexCommandInput , CreatePlaceIndexCommandOutput } from "../commands/CreatePlaceIndexCommand" ; import { CreateRouteCalculatorCommandInput , CreateRouteCalculatorCommandOutput , } from "../commands/CreateRouteCalculatorCommand" ; import { CreateTrackerCommandInput , CreateTrackerCommandOutput } from "../commands/CreateTrackerCommand" ; import { DeleteGeofenceCollectionCommandInput , DeleteGeofenceCollectionCommandOutput , } from "../commands/DeleteGeofenceCollectionCommand" ; import { DeleteMapCommandInput , DeleteMapCommandOutput } from "../commands/DeleteMapCommand" ; import { DeletePlaceIndexCommandInput , DeletePlaceIndexCommandOutput } from "../commands/DeletePlaceIndexCommand" ; import { DeleteRouteCalculatorCommandInput , DeleteRouteCalculatorCommandOutput , } from "../commands/DeleteRouteCalculatorCommand" ; import { DeleteTrackerCommandInput , DeleteTrackerCommandOutput } from "../commands/DeleteTrackerCommand" ; import { DescribeGeofenceCollectionCommandInput , DescribeGeofenceCollectionCommandOutput , } from "../commands/DescribeGeofenceCollectionCommand" ; import { DescribeMapCommandInput , DescribeMapCommandOutput } from "../commands/DescribeMapCommand" ; import { DescribePlaceIndexCommandInput , DescribePlaceIndexCommandOutput } from "../commands/DescribePlaceIndexCommand" ; import { DescribeRouteCalculatorCommandInput , DescribeRouteCalculatorCommandOutput , } from "../commands/DescribeRouteCalculatorCommand" ; import { DescribeTrackerCommandInput , DescribeTrackerCommandOutput } from "../commands/DescribeTrackerCommand" ; import { DisassociateTrackerConsumerCommandInput , DisassociateTrackerConsumerCommandOutput , } from "../commands/DisassociateTrackerConsumerCommand" ; import { GetDevicePositionCommandInput , GetDevicePositionCommandOutput } from "../commands/GetDevicePositionCommand" ; import { GetDevicePositionHistoryCommandInput , GetDevicePositionHistoryCommandOutput , } from "../commands/GetDevicePositionHistoryCommand" ; import { GetGeofenceCommandInput , GetGeofenceCommandOutput } from "../commands/GetGeofenceCommand" ; import { GetMapGlyphsCommandInput , GetMapGlyphsCommandOutput } from "../commands/GetMapGlyphsCommand" ; import { GetMapSpritesCommandInput , GetMapSpritesCommandOutput } from "../commands/GetMapSpritesCommand" ; import { GetMapStyleDescriptorCommandInput , GetMapStyleDescriptorCommandOutput , } from "../commands/GetMapStyleDescriptorCommand" ; import { GetMapTileCommandInput , GetMapTileCommandOutput } from "../commands/GetMapTileCommand" ; import { ListDevicePositionsCommandInput , ListDevicePositionsCommandOutput , } from "../commands/ListDevicePositionsCommand" ; import { ListGeofenceCollectionsCommandInput , ListGeofenceCollectionsCommandOutput , } from "../commands/ListGeofenceCollectionsCommand" ; import { ListGeofencesCommandInput , ListGeofencesCommandOutput } from "../commands/ListGeofencesCommand" ; import { ListMapsCommandInput , ListMapsCommandOutput } from "../commands/ListMapsCommand" ; import { ListPlaceIndexesCommandInput , ListPlaceIndexesCommandOutput } from "../commands/ListPlaceIndexesCommand" ; import { ListRouteCalculatorsCommandInput , ListRouteCalculatorsCommandOutput , } from "../commands/ListRouteCalculatorsCommand" ; import { ListTagsForResourceCommandInput , ListTagsForResourceCommandOutput , } from "../commands/ListTagsForResourceCommand" ; import { ListTrackerConsumersCommandInput , ListTrackerConsumersCommandOutput , } from "../commands/ListTrackerConsumersCommand" ; import { ListTrackersCommandInput , ListTrackersCommandOutput } from "../commands/ListTrackersCommand" ; import { PutGeofenceCommandInput , PutGeofenceCommandOutput } from "../commands/PutGeofenceCommand" ; import { SearchPlaceIndexForPositionCommandInput , SearchPlaceIndexForPositionCommandOutput , } from "../commands/SearchPlaceIndexForPositionCommand" ; import { SearchPlaceIndexForSuggestionsCommandInput , SearchPlaceIndexForSuggestionsCommandOutput , } from "../commands/SearchPlaceIndexForSuggestionsCommand" ; import { SearchPlaceIndexForTextCommandInput , SearchPlaceIndexForTextCommandOutput , } from "../commands/SearchPlaceIndexForTextCommand" ; import { TagResourceCommandInput , TagResourceCommandOutput } from "../commands/TagResourceCommand" ; import { UntagResourceCommandInput , UntagResourceCommandOutput } from "../commands/UntagResourceCommand" ; import { UpdateGeofenceCollectionCommandInput , UpdateGeofenceCollectionCommandOutput , } from "../commands/UpdateGeofenceCollectionCommand" ; import { UpdateMapCommandInput , UpdateMapCommandOutput } from "../commands/UpdateMapCommand" ; import { UpdatePlaceIndexCommandInput , UpdatePlaceIndexCommandOutput } from "../commands/UpdatePlaceIndexCommand" ; import { UpdateRouteCalculatorCommandInput , UpdateRouteCalculatorCommandOutput , } from "../commands/UpdateRouteCalculatorCommand" ; import { UpdateTrackerCommandInput , UpdateTrackerCommandOutput } from "../commands/UpdateTrackerCommand" ; import { AccessDeniedException , BatchDeleteDevicePositionHistoryError , BatchDeleteGeofenceError , BatchEvaluateGeofencesError , BatchGetDevicePositionError , BatchItemError , BatchPutGeofenceError , BatchPutGeofenceRequestEntry , BatchPutGeofenceSuccess , BatchUpdateDevicePositionError , CalculateRouteCarModeOptions , CalculateRouteSummary , CalculateRouteTruckModeOptions , ConflictException , DataSourceConfiguration , DevicePosition , DevicePositionUpdate , GeofenceGeometry , InternalServerException , Leg , LegGeometry , ListDevicePositionsResponseEntry , ListGeofenceCollectionsResponseEntry , ListGeofenceResponseEntry , ListMapsResponseEntry , ListPlaceIndexesResponseEntry , ListRouteCalculatorsResponseEntry , ListTrackersResponseEntry , MapConfiguration , Place , PlaceGeometry , PositionalAccuracy , ResourceNotFoundException , SearchForPositionResult , SearchForSuggestionsResult , SearchForTextResult , SearchPlaceIndexForPositionSummary , SearchPlaceIndexForSuggestionsSummary , SearchPlaceIndexForTextSummary , ServiceQuotaExceededException , Step , ThrottlingException , TimeZone , TruckDimensions , TruckWeight , ValidationException , ValidationExceptionField , } from "../models/models_0" ; export const serializeAws_restJson1AssociateTrackerConsumerCommand = 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 || "" }` + "/tracking/v0/trackers/{TrackerName}/consumers" ; if ( input . TrackerName !== undefined ) { const labelValue = input . TrackerName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TrackerName." ) ; } resolvedPath = resolvedPath . replace ( "{TrackerName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TrackerName." ) ; } let body ; body = JSON . stringify ( { ... ( input . ConsumerArn !== undefined && input . ConsumerArn !== null && { ConsumerArn : input . ConsumerArn } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "tracking." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1BatchDeleteDevicePositionHistoryCommand = 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 || "" }` + "/tracking/v0/trackers/{TrackerName}/delete-positions" ; if ( input . TrackerName !== undefined ) { const labelValue = input . TrackerName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TrackerName." ) ; } resolvedPath = resolvedPath . replace ( "{TrackerName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TrackerName." ) ; } let body ; body = JSON . stringify ( { ... ( input . DeviceIds !== undefined && input . DeviceIds !== null && { DeviceIds : serializeAws_restJson1DeviceIdsList ( input . DeviceIds , context ) } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "tracking." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1BatchDeleteGeofenceCommand = 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 || "" }` + "/geofencing/v0/collections/{CollectionName}/delete-geofences" ; if ( input . CollectionName !== undefined ) { const labelValue = input . CollectionName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CollectionName." ) ; } resolvedPath = resolvedPath . replace ( "{CollectionName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CollectionName." ) ; } let body ; body = JSON . stringify ( { ... ( input . GeofenceIds !== undefined && input . GeofenceIds !== null && { GeofenceIds : serializeAws_restJson1IdList ( input . GeofenceIds , context ) } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "geofencing." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1BatchEvaluateGeofencesCommand = 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 || "" }` + "/geofencing/v0/collections/{CollectionName}/positions" ; if ( input . CollectionName !== undefined ) { const labelValue = input . CollectionName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CollectionName." ) ; } resolvedPath = resolvedPath . replace ( "{CollectionName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CollectionName." ) ; } let body ; body = JSON . stringify ( { ... ( input . DevicePositionUpdates !== undefined && input . DevicePositionUpdates !== null && { DevicePositionUpdates : serializeAws_restJson1DevicePositionUpdateList ( input . DevicePositionUpdates , context ) , } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "geofencing." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1BatchGetDevicePositionCommand = 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 || "" }` + "/tracking/v0/trackers/{TrackerName}/get-positions" ; if ( input . TrackerName !== undefined ) { const labelValue = input . TrackerName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TrackerName." ) ; } resolvedPath = resolvedPath . replace ( "{TrackerName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TrackerName." ) ; } let body ; body = JSON . stringify ( { ... ( input . DeviceIds !== undefined && input . DeviceIds !== null && { DeviceIds : serializeAws_restJson1IdList ( input . DeviceIds , context ) } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "tracking." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1BatchPutGeofenceCommand = 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 || "" }` + "/geofencing/v0/collections/{CollectionName}/put-geofences" ; if ( input . CollectionName !== undefined ) { const labelValue = input . CollectionName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CollectionName." ) ; } resolvedPath = resolvedPath . replace ( "{CollectionName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CollectionName." ) ; } let body ; body = JSON . stringify ( { ... ( input . Entries !== undefined && input . Entries !== null && { Entries : serializeAws_restJson1BatchPutGeofenceRequestEntryList ( input . Entries , context ) , } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "geofencing." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1BatchUpdateDevicePositionCommand = 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 || "" }` + "/tracking/v0/trackers/{TrackerName}/positions" ; if ( input . TrackerName !== undefined ) { const labelValue = input . TrackerName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TrackerName." ) ; } resolvedPath = resolvedPath . replace ( "{TrackerName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TrackerName." ) ; } let body ; body = JSON . stringify ( { ... ( input . Updates !== undefined && input . Updates !== null && { Updates : serializeAws_restJson1DevicePositionUpdateList ( input . Updates , context ) } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "tracking." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CalculateRouteCommand = 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 || "" }` + "/routes/v0/calculators/{CalculatorName}/calculate/route" ; if ( input . CalculatorName !== undefined ) { const labelValue = input . CalculatorName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CalculatorName." ) ; } resolvedPath = resolvedPath . replace ( "{CalculatorName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CalculatorName." ) ; } let body ; body = JSON . stringify ( { ... ( input . CarModeOptions !== undefined && input . CarModeOptions !== null && { CarModeOptions : serializeAws_restJson1CalculateRouteCarModeOptions ( input . CarModeOptions , context ) , } ) , ... ( input . DepartNow !== undefined && input . DepartNow !== null && { DepartNow : input . DepartNow } ) , ... ( input . DeparturePosition !== undefined && input . DeparturePosition !== null && { DeparturePosition : serializeAws_restJson1Position ( input . DeparturePosition , context ) , } ) , ... ( input . DepartureTime !== undefined && input . DepartureTime !== null && { DepartureTime : input . DepartureTime . toISOString ( ) . split ( "." ) [ 0 ] + "Z" } ) , ... ( input . DestinationPosition !== undefined && input . DestinationPosition !== null && { DestinationPosition : serializeAws_restJson1Position ( input . DestinationPosition , context ) , } ) , ... ( input . DistanceUnit !== undefined && input . DistanceUnit !== null && { DistanceUnit : input . DistanceUnit } ) , ... ( input . IncludeLegGeometry !== undefined && input . IncludeLegGeometry !== null && { IncludeLegGeometry : input . IncludeLegGeometry } ) , ... ( input . TravelMode !== undefined && input . TravelMode !== null && { TravelMode : input . TravelMode } ) , ... ( input . TruckModeOptions !== undefined && input . TruckModeOptions !== null && { TruckModeOptions : serializeAws_restJson1CalculateRouteTruckModeOptions ( input . TruckModeOptions , context ) , } ) , ... ( input . WaypointPositions !== undefined && input . WaypointPositions !== null && { WaypointPositions : serializeAws_restJson1WaypointPositionList ( input . WaypointPositions , context ) , } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "routes." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateGeofenceCollectionCommand = 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 || "" }` + "/geofencing/v0/collections" ; let body ; body = JSON . stringify ( { ... ( input . CollectionName !== undefined && input . CollectionName !== null && { CollectionName : input . CollectionName } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . KmsKeyId !== undefined && input . KmsKeyId !== null && { KmsKeyId : input . KmsKeyId } ) , ... ( input . PricingPlan !== undefined && input . PricingPlan !== null && { PricingPlan : input . PricingPlan } ) , ... ( input . PricingPlanDataSource !== undefined && input . PricingPlanDataSource !== null && { PricingPlanDataSource : input . PricingPlanDataSource } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagMap ( input . Tags , context ) } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "geofencing." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateMapCommand = 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 || "" }` + "/maps/v0/maps" ; let body ; body = JSON . stringify ( { ... ( input . Configuration !== undefined && input . Configuration !== null && { Configuration : serializeAws_restJson1MapConfiguration ( input . Configuration , context ) , } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . MapName !== undefined && input . MapName !== null && { MapName : input . MapName } ) , ... ( input . PricingPlan !== undefined && input . PricingPlan !== null && { PricingPlan : input . PricingPlan } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagMap ( input . Tags , context ) } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "maps." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreatePlaceIndexCommand = 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 || "" }` + "/places/v0/indexes" ; let body ; body = JSON . stringify ( { ... ( input . DataSource !== undefined && input . DataSource !== null && { DataSource : input . DataSource } ) , ... ( input . DataSourceConfiguration !== undefined && input . DataSourceConfiguration !== null && { DataSourceConfiguration : serializeAws_restJson1DataSourceConfiguration ( input . DataSourceConfiguration , context ) , } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . IndexName !== undefined && input . IndexName !== null && { IndexName : input . IndexName } ) , ... ( input . PricingPlan !== undefined && input . PricingPlan !== null && { PricingPlan : input . PricingPlan } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagMap ( input . Tags , context ) } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "places." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateRouteCalculatorCommand = 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 || "" }` + "/routes/v0/calculators" ; let body ; body = JSON . stringify ( { ... ( input . CalculatorName !== undefined && input . CalculatorName !== null && { CalculatorName : input . CalculatorName } ) , ... ( input . DataSource !== undefined && input . DataSource !== null && { DataSource : input . DataSource } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . PricingPlan !== undefined && input . PricingPlan !== null && { PricingPlan : input . PricingPlan } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagMap ( input . Tags , context ) } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "routes." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1CreateTrackerCommand = 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 || "" }` + "/tracking/v0/trackers" ; let body ; body = JSON . stringify ( { ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . KmsKeyId !== undefined && input . KmsKeyId !== null && { KmsKeyId : input . KmsKeyId } ) , ... ( input . PositionFiltering !== undefined && input . PositionFiltering !== null && { PositionFiltering : input . PositionFiltering } ) , ... ( input . PricingPlan !== undefined && input . PricingPlan !== null && { PricingPlan : input . PricingPlan } ) , ... ( input . PricingPlanDataSource !== undefined && input . PricingPlanDataSource !== null && { PricingPlanDataSource : input . PricingPlanDataSource } ) , ... ( input . Tags !== undefined && input . Tags !== null && { Tags : serializeAws_restJson1TagMap ( input . Tags , context ) } ) , ... ( input . TrackerName !== undefined && input . TrackerName !== null && { TrackerName : input . TrackerName } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "tracking." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteGeofenceCollectionCommand = 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 || "" }` + "/geofencing/v0/collections/{CollectionName}" ; if ( input . CollectionName !== undefined ) { const labelValue = input . CollectionName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CollectionName." ) ; } resolvedPath = resolvedPath . replace ( "{CollectionName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CollectionName." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "geofencing." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteMapCommand = 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 || "" }` + "/maps/v0/maps/{MapName}" ; if ( input . MapName !== undefined ) { const labelValue = input . MapName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: MapName." ) ; } resolvedPath = resolvedPath . replace ( "{MapName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: MapName." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "maps." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeletePlaceIndexCommand = 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 || "" }` + "/places/v0/indexes/{IndexName}" ; if ( input . IndexName !== undefined ) { const labelValue = input . IndexName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: IndexName." ) ; } resolvedPath = resolvedPath . replace ( "{IndexName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: IndexName." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "places." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteRouteCalculatorCommand = 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 || "" }` + "/routes/v0/calculators/{CalculatorName}" ; if ( input . CalculatorName !== undefined ) { const labelValue = input . CalculatorName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CalculatorName." ) ; } resolvedPath = resolvedPath . replace ( "{CalculatorName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CalculatorName." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "routes." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DeleteTrackerCommand = 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 || "" }` + "/tracking/v0/trackers/{TrackerName}" ; if ( input . TrackerName !== undefined ) { const labelValue = input . TrackerName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TrackerName." ) ; } resolvedPath = resolvedPath . replace ( "{TrackerName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TrackerName." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "tracking." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeGeofenceCollectionCommand = 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 || "" }` + "/geofencing/v0/collections/{CollectionName}" ; if ( input . CollectionName !== undefined ) { const labelValue = input . CollectionName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CollectionName." ) ; } resolvedPath = resolvedPath . replace ( "{CollectionName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CollectionName." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "geofencing." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeMapCommand = 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 || "" }` + "/maps/v0/maps/{MapName}" ; if ( input . MapName !== undefined ) { const labelValue = input . MapName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: MapName." ) ; } resolvedPath = resolvedPath . replace ( "{MapName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: MapName." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "maps." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribePlaceIndexCommand = 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 || "" }` + "/places/v0/indexes/{IndexName}" ; if ( input . IndexName !== undefined ) { const labelValue = input . IndexName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: IndexName." ) ; } resolvedPath = resolvedPath . replace ( "{IndexName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: IndexName." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "places." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeRouteCalculatorCommand = 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 || "" }` + "/routes/v0/calculators/{CalculatorName}" ; if ( input . CalculatorName !== undefined ) { const labelValue = input . CalculatorName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CalculatorName." ) ; } resolvedPath = resolvedPath . replace ( "{CalculatorName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CalculatorName." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "routes." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DescribeTrackerCommand = 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 || "" }` + "/tracking/v0/trackers/{TrackerName}" ; if ( input . TrackerName !== undefined ) { const labelValue = input . TrackerName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TrackerName." ) ; } resolvedPath = resolvedPath . replace ( "{TrackerName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TrackerName." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "tracking." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1DisassociateTrackerConsumerCommand = 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 || "" }` + "/tracking/v0/trackers/{TrackerName}/consumers/{ConsumerArn}" ; if ( input . TrackerName !== undefined ) { const labelValue = input . TrackerName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TrackerName." ) ; } resolvedPath = resolvedPath . replace ( "{TrackerName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TrackerName." ) ; } if ( input . ConsumerArn !== undefined ) { const labelValue = input . ConsumerArn ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: ConsumerArn." ) ; } resolvedPath = resolvedPath . replace ( "{ConsumerArn}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: ConsumerArn." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "tracking." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "DELETE" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetDevicePositionCommand = 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 || "" }` + "/tracking/v0/trackers/{TrackerName}/devices/{DeviceId}/positions/latest" ; if ( input . TrackerName !== undefined ) { const labelValue = input . TrackerName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TrackerName." ) ; } resolvedPath = resolvedPath . replace ( "{TrackerName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TrackerName." ) ; } if ( input . DeviceId !== undefined ) { const labelValue = input . DeviceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DeviceId." ) ; } resolvedPath = resolvedPath . replace ( "{DeviceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DeviceId." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "tracking." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetDevicePositionHistoryCommand = 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 || "" }` + "/tracking/v0/trackers/{TrackerName}/devices/{DeviceId}/list-positions" ; if ( input . TrackerName !== undefined ) { const labelValue = input . TrackerName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TrackerName." ) ; } resolvedPath = resolvedPath . replace ( "{TrackerName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TrackerName." ) ; } if ( input . DeviceId !== undefined ) { const labelValue = input . DeviceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: DeviceId." ) ; } resolvedPath = resolvedPath . replace ( "{DeviceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: DeviceId." ) ; } let body ; body = JSON . stringify ( { ... ( input . EndTimeExclusive !== undefined && input . EndTimeExclusive !== null && { EndTimeExclusive : input . EndTimeExclusive . toISOString ( ) . split ( "." ) [ 0 ] + "Z" , } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , ... ( input . StartTimeInclusive !== undefined && input . StartTimeInclusive !== null && { StartTimeInclusive : input . StartTimeInclusive . toISOString ( ) . split ( "." ) [ 0 ] + "Z" , } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "tracking." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetGeofenceCommand = 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 || "" }` + "/geofencing/v0/collections/{CollectionName}/geofences/{GeofenceId}" ; if ( input . CollectionName !== undefined ) { const labelValue = input . CollectionName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CollectionName." ) ; } resolvedPath = resolvedPath . replace ( "{CollectionName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CollectionName." ) ; } if ( input . GeofenceId !== undefined ) { const labelValue = input . GeofenceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GeofenceId." ) ; } resolvedPath = resolvedPath . replace ( "{GeofenceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GeofenceId." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "geofencing." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetMapGlyphsCommand = 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 || "" }` + "/maps/v0/maps/{MapName}/glyphs/{FontStack}/{FontUnicodeRange}" ; if ( input . MapName !== undefined ) { const labelValue = input . MapName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: MapName." ) ; } resolvedPath = resolvedPath . replace ( "{MapName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: MapName." ) ; } if ( input . FontStack !== undefined ) { const labelValue = input . FontStack ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: FontStack." ) ; } resolvedPath = resolvedPath . replace ( "{FontStack}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: FontStack." ) ; } if ( input . FontUnicodeRange !== undefined ) { const labelValue = input . FontUnicodeRange ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: FontUnicodeRange." ) ; } resolvedPath = resolvedPath . replace ( "{FontUnicodeRange}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: FontUnicodeRange." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "maps." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetMapSpritesCommand = 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 || "" }` + "/maps/v0/maps/{MapName}/sprites/{FileName}" ; if ( input . MapName !== undefined ) { const labelValue = input . MapName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: MapName." ) ; } resolvedPath = resolvedPath . replace ( "{MapName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: MapName." ) ; } if ( input . FileName !== undefined ) { const labelValue = input . FileName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: FileName." ) ; } resolvedPath = resolvedPath . replace ( "{FileName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: FileName." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "maps." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetMapStyleDescriptorCommand = 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 || "" }` + "/maps/v0/maps/{MapName}/style-descriptor" ; if ( input . MapName !== undefined ) { const labelValue = input . MapName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: MapName." ) ; } resolvedPath = resolvedPath . replace ( "{MapName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: MapName." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "maps." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1GetMapTileCommand = 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 || "" }` + "/maps/v0/maps/{MapName}/tiles/{Z}/{X}/{Y}" ; if ( input . MapName !== undefined ) { const labelValue = input . MapName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: MapName." ) ; } resolvedPath = resolvedPath . replace ( "{MapName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: MapName." ) ; } if ( input . Z !== undefined ) { const labelValue = input . Z ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Z." ) ; } resolvedPath = resolvedPath . replace ( "{Z}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Z." ) ; } if ( input . X !== undefined ) { const labelValue = input . X ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: X." ) ; } resolvedPath = resolvedPath . replace ( "{X}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: X." ) ; } if ( input . Y !== undefined ) { const labelValue = input . Y ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: Y." ) ; } resolvedPath = resolvedPath . replace ( "{Y}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: Y." ) ; } let body ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "maps." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListDevicePositionsCommand = 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 || "" }` + "/tracking/v0/trackers/{TrackerName}/list-positions" ; if ( input . TrackerName !== undefined ) { const labelValue = input . TrackerName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TrackerName." ) ; } resolvedPath = resolvedPath . replace ( "{TrackerName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TrackerName." ) ; } let body ; body = JSON . stringify ( { ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "tracking." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListGeofenceCollectionsCommand = 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 || "" }` + "/geofencing/v0/list-collections" ; let body ; body = JSON . stringify ( { ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "geofencing." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListGeofencesCommand = 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 || "" }` + "/geofencing/v0/collections/{CollectionName}/list-geofences" ; if ( input . CollectionName !== undefined ) { const labelValue = input . CollectionName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CollectionName." ) ; } resolvedPath = resolvedPath . replace ( "{CollectionName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CollectionName." ) ; } let body ; body = JSON . stringify ( { ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "geofencing." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListMapsCommand = 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 || "" }` + "/maps/v0/list-maps" ; let body ; body = JSON . stringify ( { ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "maps." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListPlaceIndexesCommand = 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 || "" }` + "/places/v0/list-indexes" ; let body ; body = JSON . stringify ( { ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "places." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListRouteCalculatorsCommand = 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 || "" }` + "/routes/v0/list-calculators" ; let body ; body = JSON . stringify ( { ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "routes." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListTagsForResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; 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 ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "metadata." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "GET" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListTrackerConsumersCommand = 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 || "" }` + "/tracking/v0/trackers/{TrackerName}/list-consumers" ; if ( input . TrackerName !== undefined ) { const labelValue = input . TrackerName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TrackerName." ) ; } resolvedPath = resolvedPath . replace ( "{TrackerName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TrackerName." ) ; } let body ; body = JSON . stringify ( { ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "tracking." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1ListTrackersCommand = 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 || "" }` + "/tracking/v0/list-trackers" ; let body ; body = JSON . stringify ( { ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . NextToken !== undefined && input . NextToken !== null && { NextToken : input . NextToken } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "tracking." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1PutGeofenceCommand = 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 || "" }` + "/geofencing/v0/collections/{CollectionName}/geofences/{GeofenceId}" ; if ( input . CollectionName !== undefined ) { const labelValue = input . CollectionName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CollectionName." ) ; } resolvedPath = resolvedPath . replace ( "{CollectionName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CollectionName." ) ; } if ( input . GeofenceId !== undefined ) { const labelValue = input . GeofenceId ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: GeofenceId." ) ; } resolvedPath = resolvedPath . replace ( "{GeofenceId}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: GeofenceId." ) ; } let body ; body = JSON . stringify ( { ... ( input . Geometry !== undefined && input . Geometry !== null && { Geometry : serializeAws_restJson1GeofenceGeometry ( input . Geometry , context ) } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "geofencing." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "PUT" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1SearchPlaceIndexForPositionCommand = 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 || "" }` + "/places/v0/indexes/{IndexName}/search/position" ; if ( input . IndexName !== undefined ) { const labelValue = input . IndexName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: IndexName." ) ; } resolvedPath = resolvedPath . replace ( "{IndexName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: IndexName." ) ; } let body ; body = JSON . stringify ( { ... ( input . Language !== undefined && input . Language !== null && { Language : input . Language } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . Position !== undefined && input . Position !== null && { Position : serializeAws_restJson1Position ( input . Position , context ) } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "places." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1SearchPlaceIndexForSuggestionsCommand = 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 || "" }` + "/places/v0/indexes/{IndexName}/search/suggestions" ; if ( input . IndexName !== undefined ) { const labelValue = input . IndexName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: IndexName." ) ; } resolvedPath = resolvedPath . replace ( "{IndexName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: IndexName." ) ; } let body ; body = JSON . stringify ( { ... ( input . BiasPosition !== undefined && input . BiasPosition !== null && { BiasPosition : serializeAws_restJson1Position ( input . BiasPosition , context ) } ) , ... ( input . FilterBBox !== undefined && input . FilterBBox !== null && { FilterBBox : serializeAws_restJson1BoundingBox ( input . FilterBBox , context ) } ) , ... ( input . FilterCountries !== undefined && input . FilterCountries !== null && { FilterCountries : serializeAws_restJson1CountryCodeList ( input . FilterCountries , context ) , } ) , ... ( input . Language !== undefined && input . Language !== null && { Language : input . Language } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . Text !== undefined && input . Text !== null && { Text : input . Text } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "places." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1SearchPlaceIndexForTextCommand = 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 || "" }` + "/places/v0/indexes/{IndexName}/search/text" ; if ( input . IndexName !== undefined ) { const labelValue = input . IndexName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: IndexName." ) ; } resolvedPath = resolvedPath . replace ( "{IndexName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: IndexName." ) ; } let body ; body = JSON . stringify ( { ... ( input . BiasPosition !== undefined && input . BiasPosition !== null && { BiasPosition : serializeAws_restJson1Position ( input . BiasPosition , context ) } ) , ... ( input . FilterBBox !== undefined && input . FilterBBox !== null && { FilterBBox : serializeAws_restJson1BoundingBox ( input . FilterBBox , context ) } ) , ... ( input . FilterCountries !== undefined && input . FilterCountries !== null && { FilterCountries : serializeAws_restJson1CountryCodeList ( input . FilterCountries , context ) , } ) , ... ( input . Language !== undefined && input . Language !== null && { Language : input . Language } ) , ... ( input . MaxResults !== undefined && input . MaxResults !== null && { MaxResults : input . MaxResults } ) , ... ( input . Text !== undefined && input . Text !== null && { Text : input . Text } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "places." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1TagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { "content-type" : "application/json" , } ; 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 ) } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "metadata." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "POST" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UntagResourceCommand = async ( input , context ) : Promise < __HttpRequest > => { const { hostname , protocol = "https" , port , path : basePath } = await context . endpoint ( ) ; const headers = { } ; 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 ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "metadata." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "DELETE" , headers , path : resolvedPath , query , body , } ) ; } ; export const serializeAws_restJson1UpdateGeofenceCollectionCommand = 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 || "" }` + "/geofencing/v0/collections/{CollectionName}" ; if ( input . CollectionName !== undefined ) { const labelValue = input . CollectionName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CollectionName." ) ; } resolvedPath = resolvedPath . replace ( "{CollectionName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CollectionName." ) ; } let body ; body = JSON . stringify ( { ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . PricingPlan !== undefined && input . PricingPlan !== null && { PricingPlan : input . PricingPlan } ) , ... ( input . PricingPlanDataSource !== undefined && input . PricingPlanDataSource !== null && { PricingPlanDataSource : input . PricingPlanDataSource } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "geofencing." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateMapCommand = 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 || "" }` + "/maps/v0/maps/{MapName}" ; if ( input . MapName !== undefined ) { const labelValue = input . MapName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: MapName." ) ; } resolvedPath = resolvedPath . replace ( "{MapName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: MapName." ) ; } let body ; body = JSON . stringify ( { ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . PricingPlan !== undefined && input . PricingPlan !== null && { PricingPlan : input . PricingPlan } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "maps." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdatePlaceIndexCommand = 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 || "" }` + "/places/v0/indexes/{IndexName}" ; if ( input . IndexName !== undefined ) { const labelValue = input . IndexName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: IndexName." ) ; } resolvedPath = resolvedPath . replace ( "{IndexName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: IndexName." ) ; } let body ; body = JSON . stringify ( { ... ( input . DataSourceConfiguration !== undefined && input . DataSourceConfiguration !== null && { DataSourceConfiguration : serializeAws_restJson1DataSourceConfiguration ( input . DataSourceConfiguration , context ) , } ) , ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . PricingPlan !== undefined && input . PricingPlan !== null && { PricingPlan : input . PricingPlan } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "places." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateRouteCalculatorCommand = 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 || "" }` + "/routes/v0/calculators/{CalculatorName}" ; if ( input . CalculatorName !== undefined ) { const labelValue = input . CalculatorName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: CalculatorName." ) ; } resolvedPath = resolvedPath . replace ( "{CalculatorName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: CalculatorName." ) ; } let body ; body = JSON . stringify ( { ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . PricingPlan !== undefined && input . PricingPlan !== null && { PricingPlan : input . PricingPlan } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "routes." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const serializeAws_restJson1UpdateTrackerCommand = 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 || "" }` + "/tracking/v0/trackers/{TrackerName}" ; if ( input . TrackerName !== undefined ) { const labelValue = input . TrackerName ; if ( labelValue . length <= 0 ) { throw new Error ( "Empty value provided for input HTTP label: TrackerName." ) ; } resolvedPath = resolvedPath . replace ( "{TrackerName}" , __extendedEncodeURIComponent ( labelValue ) ) ; } else { throw new Error ( "No value provided for input HTTP label: TrackerName." ) ; } let body ; body = JSON . stringify ( { ... ( input . Description !== undefined && input . Description !== null && { Description : input . Description } ) , ... ( input . PositionFiltering !== undefined && input . PositionFiltering !== null && { PositionFiltering : input . PositionFiltering } ) , ... ( input . PricingPlan !== undefined && input . PricingPlan !== null && { PricingPlan : input . PricingPlan } ) , ... ( input . PricingPlanDataSource !== undefined && input . PricingPlanDataSource !== null && { PricingPlanDataSource : input . PricingPlanDataSource } ) , } ) ; let { hostname : resolvedHostname } = await context . endpoint ( ) ; if ( context . disableHostPrefix !== true ) { resolvedHostname = "tracking." + resolvedHostname ; if ( ! __isValidHostname ( resolvedHostname ) ) { throw new Error ( "ValidationError: prefixed hostname must be hostname compatible." ) ; } } return new __HttpRequest ( { protocol , hostname : resolvedHostname , port , method : "PATCH" , headers , path : resolvedPath , body , } ) ; } ; export const deserializeAws_restJson1AssociateTrackerConsumerCommand = async ( output , context ) : Promise < AssociateTrackerConsumerCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1AssociateTrackerConsumerCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1AssociateTrackerConsumerCommandError = async ( output , context ) : Promise < AssociateTrackerConsumerCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.location#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ServiceQuotaExceededException" : case "com.amazonaws.location#ServiceQuotaExceededException" : response = { ... ( await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1BatchDeleteDevicePositionHistoryCommand = async ( output , context ) : Promise < BatchDeleteDevicePositionHistoryCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1BatchDeleteDevicePositionHistoryCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Errors : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Errors !== undefined && data . Errors !== null ) { contents . Errors = deserializeAws_restJson1BatchDeleteDevicePositionHistoryErrorList ( data . Errors , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1BatchDeleteDevicePositionHistoryCommandError = async ( output , context ) : Promise < BatchDeleteDevicePositionHistoryCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1BatchDeleteGeofenceCommand = async ( output , context ) : Promise < BatchDeleteGeofenceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1BatchDeleteGeofenceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Errors : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Errors !== undefined && data . Errors !== null ) { contents . Errors = deserializeAws_restJson1BatchDeleteGeofenceErrorList ( data . Errors , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1BatchDeleteGeofenceCommandError = async ( output , context ) : Promise < BatchDeleteGeofenceCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1BatchEvaluateGeofencesCommand = async ( output , context ) : Promise < BatchEvaluateGeofencesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1BatchEvaluateGeofencesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Errors : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Errors !== undefined && data . Errors !== null ) { contents . Errors = deserializeAws_restJson1BatchEvaluateGeofencesErrorList ( data . Errors , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1BatchEvaluateGeofencesCommandError = async ( output , context ) : Promise < BatchEvaluateGeofencesCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1BatchGetDevicePositionCommand = async ( output , context ) : Promise < BatchGetDevicePositionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1BatchGetDevicePositionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DevicePositions : undefined , Errors : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DevicePositions !== undefined && data . DevicePositions !== null ) { contents . DevicePositions = deserializeAws_restJson1DevicePositionList ( data . DevicePositions , context ) ; } if ( data . Errors !== undefined && data . Errors !== null ) { contents . Errors = deserializeAws_restJson1BatchGetDevicePositionErrorList ( data . Errors , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1BatchGetDevicePositionCommandError = async ( output , context ) : Promise < BatchGetDevicePositionCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1BatchPutGeofenceCommand = async ( output , context ) : Promise < BatchPutGeofenceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1BatchPutGeofenceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Errors : undefined , Successes : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Errors !== undefined && data . Errors !== null ) { contents . Errors = deserializeAws_restJson1BatchPutGeofenceErrorList ( data . Errors , context ) ; } if ( data . Successes !== undefined && data . Successes !== null ) { contents . Successes = deserializeAws_restJson1BatchPutGeofenceSuccessList ( data . Successes , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1BatchPutGeofenceCommandError = async ( output , context ) : Promise < BatchPutGeofenceCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1BatchUpdateDevicePositionCommand = async ( output , context ) : Promise < BatchUpdateDevicePositionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1BatchUpdateDevicePositionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Errors : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Errors !== undefined && data . Errors !== null ) { contents . Errors = deserializeAws_restJson1BatchUpdateDevicePositionErrorList ( data . Errors , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1BatchUpdateDevicePositionCommandError = async ( output , context ) : Promise < BatchUpdateDevicePositionCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1CalculateRouteCommand = async ( output , context ) : Promise < CalculateRouteCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CalculateRouteCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Legs : undefined , Summary : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Legs !== undefined && data . Legs !== null ) { contents . Legs = deserializeAws_restJson1LegList ( data . Legs , context ) ; } if ( data . Summary !== undefined && data . Summary !== null ) { contents . Summary = deserializeAws_restJson1CalculateRouteSummary ( data . Summary , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CalculateRouteCommandError = async ( output , context ) : Promise < CalculateRouteCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1CreateGeofenceCollectionCommand = async ( output , context ) : Promise < CreateGeofenceCollectionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateGeofenceCollectionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CollectionArn : undefined , CollectionName : undefined , CreateTime : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CollectionArn !== undefined && data . CollectionArn !== null ) { contents . CollectionArn = __expectString ( data . CollectionArn ) ; } if ( data . CollectionName !== undefined && data . CollectionName !== null ) { contents . CollectionName = __expectString ( data . CollectionName ) ; } if ( data . CreateTime !== undefined && data . CreateTime !== null ) { contents . CreateTime = __expectNonNull ( __parseRfc3339DateTime ( data . CreateTime ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateGeofenceCollectionCommandError = async ( output , context ) : Promise < CreateGeofenceCollectionCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.location#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1CreateMapCommand = async ( output , context ) : Promise < CreateMapCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateMapCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CreateTime : undefined , MapArn : undefined , MapName : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CreateTime !== undefined && data . CreateTime !== null ) { contents . CreateTime = __expectNonNull ( __parseRfc3339DateTime ( data . CreateTime ) ) ; } if ( data . MapArn !== undefined && data . MapArn !== null ) { contents . MapArn = __expectString ( data . MapArn ) ; } if ( data . MapName !== undefined && data . MapName !== null ) { contents . MapName = __expectString ( data . MapName ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateMapCommandError = async ( output , context ) : Promise < CreateMapCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.location#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1CreatePlaceIndexCommand = async ( output , context ) : Promise < CreatePlaceIndexCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreatePlaceIndexCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CreateTime : undefined , IndexArn : undefined , IndexName : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CreateTime !== undefined && data . CreateTime !== null ) { contents . CreateTime = __expectNonNull ( __parseRfc3339DateTime ( data . CreateTime ) ) ; } if ( data . IndexArn !== undefined && data . IndexArn !== null ) { contents . IndexArn = __expectString ( data . IndexArn ) ; } if ( data . IndexName !== undefined && data . IndexName !== null ) { contents . IndexName = __expectString ( data . IndexName ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreatePlaceIndexCommandError = async ( output , context ) : Promise < CreatePlaceIndexCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.location#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1CreateRouteCalculatorCommand = async ( output , context ) : Promise < CreateRouteCalculatorCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateRouteCalculatorCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CalculatorArn : undefined , CalculatorName : undefined , CreateTime : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CalculatorArn !== undefined && data . CalculatorArn !== null ) { contents . CalculatorArn = __expectString ( data . CalculatorArn ) ; } if ( data . CalculatorName !== undefined && data . CalculatorName !== null ) { contents . CalculatorName = __expectString ( data . CalculatorName ) ; } if ( data . CreateTime !== undefined && data . CreateTime !== null ) { contents . CreateTime = __expectNonNull ( __parseRfc3339DateTime ( data . CreateTime ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateRouteCalculatorCommandError = async ( output , context ) : Promise < CreateRouteCalculatorCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.location#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1CreateTrackerCommand = async ( output , context ) : Promise < CreateTrackerCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1CreateTrackerCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CreateTime : undefined , TrackerArn : undefined , TrackerName : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CreateTime !== undefined && data . CreateTime !== null ) { contents . CreateTime = __expectNonNull ( __parseRfc3339DateTime ( data . CreateTime ) ) ; } if ( data . TrackerArn !== undefined && data . TrackerArn !== null ) { contents . TrackerArn = __expectString ( data . TrackerArn ) ; } if ( data . TrackerName !== undefined && data . TrackerName !== null ) { contents . TrackerName = __expectString ( data . TrackerName ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1CreateTrackerCommandError = async ( output , context ) : Promise < CreateTrackerCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.location#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1DeleteGeofenceCollectionCommand = async ( output , context ) : Promise < DeleteGeofenceCollectionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteGeofenceCollectionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteGeofenceCollectionCommandError = async ( output , context ) : Promise < DeleteGeofenceCollectionCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1DeleteMapCommand = async ( output , context ) : Promise < DeleteMapCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteMapCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteMapCommandError = async ( output , context ) : Promise < DeleteMapCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1DeletePlaceIndexCommand = async ( output , context ) : Promise < DeletePlaceIndexCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeletePlaceIndexCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeletePlaceIndexCommandError = async ( output , context ) : Promise < DeletePlaceIndexCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1DeleteRouteCalculatorCommand = async ( output , context ) : Promise < DeleteRouteCalculatorCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteRouteCalculatorCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteRouteCalculatorCommandError = async ( output , context ) : Promise < DeleteRouteCalculatorCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1DeleteTrackerCommand = async ( output , context ) : Promise < DeleteTrackerCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DeleteTrackerCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DeleteTrackerCommandError = async ( output , context ) : Promise < DeleteTrackerCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1DescribeGeofenceCollectionCommand = async ( output , context ) : Promise < DescribeGeofenceCollectionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeGeofenceCollectionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CollectionArn : undefined , CollectionName : undefined , CreateTime : undefined , Description : undefined , KmsKeyId : undefined , PricingPlan : undefined , PricingPlanDataSource : undefined , Tags : undefined , UpdateTime : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CollectionArn !== undefined && data . CollectionArn !== null ) { contents . CollectionArn = __expectString ( data . CollectionArn ) ; } if ( data . CollectionName !== undefined && data . CollectionName !== null ) { contents . CollectionName = __expectString ( data . CollectionName ) ; } if ( data . CreateTime !== undefined && data . CreateTime !== null ) { contents . CreateTime = __expectNonNull ( __parseRfc3339DateTime ( data . CreateTime ) ) ; } if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . KmsKeyId !== undefined && data . KmsKeyId !== null ) { contents . KmsKeyId = __expectString ( data . KmsKeyId ) ; } if ( data . PricingPlan !== undefined && data . PricingPlan !== null ) { contents . PricingPlan = __expectString ( data . PricingPlan ) ; } if ( data . PricingPlanDataSource !== undefined && data . PricingPlanDataSource !== null ) { contents . PricingPlanDataSource = __expectString ( data . PricingPlanDataSource ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1TagMap ( data . Tags , context ) ; } if ( data . UpdateTime !== undefined && data . UpdateTime !== null ) { contents . UpdateTime = __expectNonNull ( __parseRfc3339DateTime ( data . UpdateTime ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeGeofenceCollectionCommandError = async ( output , context ) : Promise < DescribeGeofenceCollectionCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1DescribeMapCommand = async ( output , context ) : Promise < DescribeMapCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeMapCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Configuration : undefined , CreateTime : undefined , DataSource : undefined , Description : undefined , MapArn : undefined , MapName : undefined , PricingPlan : undefined , Tags : undefined , UpdateTime : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Configuration !== undefined && data . Configuration !== null ) { contents . Configuration = deserializeAws_restJson1MapConfiguration ( data . Configuration , context ) ; } if ( data . CreateTime !== undefined && data . CreateTime !== null ) { contents . CreateTime = __expectNonNull ( __parseRfc3339DateTime ( data . CreateTime ) ) ; } if ( data . DataSource !== undefined && data . DataSource !== null ) { contents . DataSource = __expectString ( data . DataSource ) ; } if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . MapArn !== undefined && data . MapArn !== null ) { contents . MapArn = __expectString ( data . MapArn ) ; } if ( data . MapName !== undefined && data . MapName !== null ) { contents . MapName = __expectString ( data . MapName ) ; } if ( data . PricingPlan !== undefined && data . PricingPlan !== null ) { contents . PricingPlan = __expectString ( data . PricingPlan ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1TagMap ( data . Tags , context ) ; } if ( data . UpdateTime !== undefined && data . UpdateTime !== null ) { contents . UpdateTime = __expectNonNull ( __parseRfc3339DateTime ( data . UpdateTime ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeMapCommandError = async ( output , context ) : Promise < DescribeMapCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1DescribePlaceIndexCommand = async ( output , context ) : Promise < DescribePlaceIndexCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribePlaceIndexCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CreateTime : undefined , DataSource : undefined , DataSourceConfiguration : undefined , Description : undefined , IndexArn : undefined , IndexName : undefined , PricingPlan : undefined , Tags : undefined , UpdateTime : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CreateTime !== undefined && data . CreateTime !== null ) { contents . CreateTime = __expectNonNull ( __parseRfc3339DateTime ( data . CreateTime ) ) ; } if ( data . DataSource !== undefined && data . DataSource !== null ) { contents . DataSource = __expectString ( data . DataSource ) ; } if ( data . DataSourceConfiguration !== undefined && data . DataSourceConfiguration !== null ) { contents . DataSourceConfiguration = deserializeAws_restJson1DataSourceConfiguration ( data . DataSourceConfiguration , context ) ; } if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . IndexArn !== undefined && data . IndexArn !== null ) { contents . IndexArn = __expectString ( data . IndexArn ) ; } if ( data . IndexName !== undefined && data . IndexName !== null ) { contents . IndexName = __expectString ( data . IndexName ) ; } if ( data . PricingPlan !== undefined && data . PricingPlan !== null ) { contents . PricingPlan = __expectString ( data . PricingPlan ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1TagMap ( data . Tags , context ) ; } if ( data . UpdateTime !== undefined && data . UpdateTime !== null ) { contents . UpdateTime = __expectNonNull ( __parseRfc3339DateTime ( data . UpdateTime ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribePlaceIndexCommandError = async ( output , context ) : Promise < DescribePlaceIndexCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1DescribeRouteCalculatorCommand = async ( output , context ) : Promise < DescribeRouteCalculatorCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeRouteCalculatorCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CalculatorArn : undefined , CalculatorName : undefined , CreateTime : undefined , DataSource : undefined , Description : undefined , PricingPlan : undefined , Tags : undefined , UpdateTime : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CalculatorArn !== undefined && data . CalculatorArn !== null ) { contents . CalculatorArn = __expectString ( data . CalculatorArn ) ; } if ( data . CalculatorName !== undefined && data . CalculatorName !== null ) { contents . CalculatorName = __expectString ( data . CalculatorName ) ; } if ( data . CreateTime !== undefined && data . CreateTime !== null ) { contents . CreateTime = __expectNonNull ( __parseRfc3339DateTime ( data . CreateTime ) ) ; } if ( data . DataSource !== undefined && data . DataSource !== null ) { contents . DataSource = __expectString ( data . DataSource ) ; } if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . PricingPlan !== undefined && data . PricingPlan !== null ) { contents . PricingPlan = __expectString ( data . PricingPlan ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1TagMap ( data . Tags , context ) ; } if ( data . UpdateTime !== undefined && data . UpdateTime !== null ) { contents . UpdateTime = __expectNonNull ( __parseRfc3339DateTime ( data . UpdateTime ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeRouteCalculatorCommandError = async ( output , context ) : Promise < DescribeRouteCalculatorCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1DescribeTrackerCommand = async ( output , context ) : Promise < DescribeTrackerCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DescribeTrackerCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CreateTime : undefined , Description : undefined , KmsKeyId : undefined , PositionFiltering : undefined , PricingPlan : undefined , PricingPlanDataSource : undefined , Tags : undefined , TrackerArn : undefined , TrackerName : undefined , UpdateTime : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CreateTime !== undefined && data . CreateTime !== null ) { contents . CreateTime = __expectNonNull ( __parseRfc3339DateTime ( data . CreateTime ) ) ; } if ( data . Description !== undefined && data . Description !== null ) { contents . Description = __expectString ( data . Description ) ; } if ( data . KmsKeyId !== undefined && data . KmsKeyId !== null ) { contents . KmsKeyId = __expectString ( data . KmsKeyId ) ; } if ( data . PositionFiltering !== undefined && data . PositionFiltering !== null ) { contents . PositionFiltering = __expectString ( data . PositionFiltering ) ; } if ( data . PricingPlan !== undefined && data . PricingPlan !== null ) { contents . PricingPlan = __expectString ( data . PricingPlan ) ; } if ( data . PricingPlanDataSource !== undefined && data . PricingPlanDataSource !== null ) { contents . PricingPlanDataSource = __expectString ( data . PricingPlanDataSource ) ; } if ( data . Tags !== undefined && data . Tags !== null ) { contents . Tags = deserializeAws_restJson1TagMap ( data . Tags , context ) ; } if ( data . TrackerArn !== undefined && data . TrackerArn !== null ) { contents . TrackerArn = __expectString ( data . TrackerArn ) ; } if ( data . TrackerName !== undefined && data . TrackerName !== null ) { contents . TrackerName = __expectString ( data . TrackerName ) ; } if ( data . UpdateTime !== undefined && data . UpdateTime !== null ) { contents . UpdateTime = __expectNonNull ( __parseRfc3339DateTime ( data . UpdateTime ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DescribeTrackerCommandError = async ( output , context ) : Promise < DescribeTrackerCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1DisassociateTrackerConsumerCommand = async ( output , context ) : Promise < DisassociateTrackerConsumerCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1DisassociateTrackerConsumerCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1DisassociateTrackerConsumerCommandError = async ( output , context ) : Promise < DisassociateTrackerConsumerCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1GetDevicePositionCommand = async ( output , context ) : Promise < GetDevicePositionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDevicePositionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Accuracy : undefined , DeviceId : undefined , Position : undefined , PositionProperties : undefined , ReceivedTime : undefined , SampleTime : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Accuracy !== undefined && data . Accuracy !== null ) { contents . Accuracy = deserializeAws_restJson1PositionalAccuracy ( data . Accuracy , context ) ; } if ( data . DeviceId !== undefined && data . DeviceId !== null ) { contents . DeviceId = __expectString ( data . DeviceId ) ; } if ( data . Position !== undefined && data . Position !== null ) { contents . Position = deserializeAws_restJson1Position ( data . Position , context ) ; } if ( data . PositionProperties !== undefined && data . PositionProperties !== null ) { contents . PositionProperties = deserializeAws_restJson1PropertyMap ( data . PositionProperties , context ) ; } if ( data . ReceivedTime !== undefined && data . ReceivedTime !== null ) { contents . ReceivedTime = __expectNonNull ( __parseRfc3339DateTime ( data . ReceivedTime ) ) ; } if ( data . SampleTime !== undefined && data . SampleTime !== null ) { contents . SampleTime = __expectNonNull ( __parseRfc3339DateTime ( data . SampleTime ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDevicePositionCommandError = async ( output , context ) : Promise < GetDevicePositionCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1GetDevicePositionHistoryCommand = async ( output , context ) : Promise < GetDevicePositionHistoryCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetDevicePositionHistoryCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , DevicePositions : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . DevicePositions !== undefined && data . DevicePositions !== null ) { contents . DevicePositions = deserializeAws_restJson1DevicePositionList ( data . DevicePositions , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetDevicePositionHistoryCommandError = async ( output , context ) : Promise < GetDevicePositionHistoryCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1GetGeofenceCommand = async ( output , context ) : Promise < GetGeofenceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetGeofenceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CreateTime : undefined , GeofenceId : undefined , Geometry : undefined , Status : undefined , UpdateTime : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CreateTime !== undefined && data . CreateTime !== null ) { contents . CreateTime = __expectNonNull ( __parseRfc3339DateTime ( data . CreateTime ) ) ; } if ( data . GeofenceId !== undefined && data . GeofenceId !== null ) { contents . GeofenceId = __expectString ( data . GeofenceId ) ; } if ( data . Geometry !== undefined && data . Geometry !== null ) { contents . Geometry = deserializeAws_restJson1GeofenceGeometry ( data . Geometry , context ) ; } if ( data . Status !== undefined && data . Status !== null ) { contents . Status = __expectString ( data . Status ) ; } if ( data . UpdateTime !== undefined && data . UpdateTime !== null ) { contents . UpdateTime = __expectNonNull ( __parseRfc3339DateTime ( data . UpdateTime ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetGeofenceCommandError = async ( output , context ) : Promise < GetGeofenceCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1GetMapGlyphsCommand = async ( output , context ) : Promise < GetMapGlyphsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetMapGlyphsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Blob : undefined , ContentType : undefined , } ; if ( output . headers [ "content-type" ] !== undefined ) { contents . ContentType = output . headers [ "content-type" ] ; } const data = await collectBody ( output . body , context ) ; contents . Blob = data ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetMapGlyphsCommandError = async ( output , context ) : Promise < GetMapGlyphsCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1GetMapSpritesCommand = async ( output , context ) : Promise < GetMapSpritesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetMapSpritesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Blob : undefined , ContentType : undefined , } ; if ( output . headers [ "content-type" ] !== undefined ) { contents . ContentType = output . headers [ "content-type" ] ; } const data = await collectBody ( output . body , context ) ; contents . Blob = data ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetMapSpritesCommandError = async ( output , context ) : Promise < GetMapSpritesCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1GetMapStyleDescriptorCommand = async ( output , context ) : Promise < GetMapStyleDescriptorCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetMapStyleDescriptorCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Blob : undefined , ContentType : undefined , } ; if ( output . headers [ "content-type" ] !== undefined ) { contents . ContentType = output . headers [ "content-type" ] ; } const data = await collectBody ( output . body , context ) ; contents . Blob = data ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetMapStyleDescriptorCommandError = async ( output , context ) : Promise < GetMapStyleDescriptorCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1GetMapTileCommand = async ( output , context ) : Promise < GetMapTileCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1GetMapTileCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Blob : undefined , ContentType : undefined , } ; if ( output . headers [ "content-type" ] !== undefined ) { contents . ContentType = output . headers [ "content-type" ] ; } const data = await collectBody ( output . body , context ) ; contents . Blob = data ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1GetMapTileCommandError = async ( output , context ) : Promise < GetMapTileCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1ListDevicePositionsCommand = async ( output , context ) : Promise < ListDevicePositionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListDevicePositionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Entries : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Entries !== undefined && data . Entries !== null ) { contents . Entries = deserializeAws_restJson1ListDevicePositionsResponseEntryList ( data . Entries , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListDevicePositionsCommandError = async ( output , context ) : Promise < ListDevicePositionsCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1ListGeofenceCollectionsCommand = async ( output , context ) : Promise < ListGeofenceCollectionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListGeofenceCollectionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Entries : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Entries !== undefined && data . Entries !== null ) { contents . Entries = deserializeAws_restJson1ListGeofenceCollectionsResponseEntryList ( data . Entries , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListGeofenceCollectionsCommandError = async ( output , context ) : Promise < ListGeofenceCollectionsCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1ListGeofencesCommand = async ( output , context ) : Promise < ListGeofencesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListGeofencesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Entries : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Entries !== undefined && data . Entries !== null ) { contents . Entries = deserializeAws_restJson1ListGeofenceResponseEntryList ( data . Entries , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListGeofencesCommandError = async ( output , context ) : Promise < ListGeofencesCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1ListMapsCommand = async ( output , context ) : Promise < ListMapsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListMapsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Entries : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Entries !== undefined && data . Entries !== null ) { contents . Entries = deserializeAws_restJson1ListMapsResponseEntryList ( data . Entries , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListMapsCommandError = async ( output , context ) : Promise < ListMapsCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1ListPlaceIndexesCommand = async ( output , context ) : Promise < ListPlaceIndexesCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListPlaceIndexesCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Entries : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Entries !== undefined && data . Entries !== null ) { contents . Entries = deserializeAws_restJson1ListPlaceIndexesResponseEntryList ( data . Entries , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListPlaceIndexesCommandError = async ( output , context ) : Promise < ListPlaceIndexesCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1ListRouteCalculatorsCommand = async ( output , context ) : Promise < ListRouteCalculatorsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListRouteCalculatorsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Entries : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Entries !== undefined && data . Entries !== null ) { contents . Entries = deserializeAws_restJson1ListRouteCalculatorsResponseEntryList ( data . Entries , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListRouteCalculatorsCommandError = async ( output , context ) : Promise < ListRouteCalculatorsCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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 "AccessDeniedException" : case "com.amazonaws.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1ListTrackerConsumersCommand = async ( output , context ) : Promise < ListTrackerConsumersCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTrackerConsumersCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , ConsumerArns : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . ConsumerArns !== undefined && data . ConsumerArns !== null ) { contents . ConsumerArns = deserializeAws_restJson1ArnList ( data . ConsumerArns , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListTrackerConsumersCommandError = async ( output , context ) : Promise < ListTrackerConsumersCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1ListTrackersCommand = async ( output , context ) : Promise < ListTrackersCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1ListTrackersCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Entries : undefined , NextToken : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Entries !== undefined && data . Entries !== null ) { contents . Entries = deserializeAws_restJson1ListTrackersResponseEntryList ( data . Entries , context ) ; } if ( data . NextToken !== undefined && data . NextToken !== null ) { contents . NextToken = __expectString ( data . NextToken ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1ListTrackersCommandError = async ( output , context ) : Promise < ListTrackersCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1PutGeofenceCommand = async ( output , context ) : Promise < PutGeofenceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1PutGeofenceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CreateTime : undefined , GeofenceId : undefined , UpdateTime : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CreateTime !== undefined && data . CreateTime !== null ) { contents . CreateTime = __expectNonNull ( __parseRfc3339DateTime ( data . CreateTime ) ) ; } if ( data . GeofenceId !== undefined && data . GeofenceId !== null ) { contents . GeofenceId = __expectString ( data . GeofenceId ) ; } if ( data . UpdateTime !== undefined && data . UpdateTime !== null ) { contents . UpdateTime = __expectNonNull ( __parseRfc3339DateTime ( data . UpdateTime ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1PutGeofenceCommandError = async ( output , context ) : Promise < PutGeofenceCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ConflictException" : case "com.amazonaws.location#ConflictException" : response = { ... ( await deserializeAws_restJson1ConflictExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1SearchPlaceIndexForPositionCommand = async ( output , context ) : Promise < SearchPlaceIndexForPositionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1SearchPlaceIndexForPositionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Results : undefined , Summary : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Results !== undefined && data . Results !== null ) { contents . Results = deserializeAws_restJson1SearchForPositionResultList ( data . Results , context ) ; } if ( data . Summary !== undefined && data . Summary !== null ) { contents . Summary = deserializeAws_restJson1SearchPlaceIndexForPositionSummary ( data . Summary , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1SearchPlaceIndexForPositionCommandError = async ( output , context ) : Promise < SearchPlaceIndexForPositionCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1SearchPlaceIndexForSuggestionsCommand = async ( output , context ) : Promise < SearchPlaceIndexForSuggestionsCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1SearchPlaceIndexForSuggestionsCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Results : undefined , Summary : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Results !== undefined && data . Results !== null ) { contents . Results = deserializeAws_restJson1SearchForSuggestionsResultList ( data . Results , context ) ; } if ( data . Summary !== undefined && data . Summary !== null ) { contents . Summary = deserializeAws_restJson1SearchPlaceIndexForSuggestionsSummary ( data . Summary , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1SearchPlaceIndexForSuggestionsCommandError = async ( output , context ) : Promise < SearchPlaceIndexForSuggestionsCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1SearchPlaceIndexForTextCommand = async ( output , context ) : Promise < SearchPlaceIndexForTextCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1SearchPlaceIndexForTextCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , Results : undefined , Summary : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . Results !== undefined && data . Results !== null ) { contents . Results = deserializeAws_restJson1SearchForTextResultList ( data . Results , context ) ; } if ( data . Summary !== undefined && data . Summary !== null ) { contents . Summary = deserializeAws_restJson1SearchPlaceIndexForTextSummary ( data . Summary , context ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1SearchPlaceIndexForTextCommandError = async ( output , context ) : Promise < SearchPlaceIndexForTextCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; export const deserializeAws_restJson1TagResourceCommand = async ( output , context ) : Promise < TagResourceCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1TagResourceCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , } ; await collectBody ( output . body , context ) ; return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1TagResourceCommandError = async ( output , context ) : Promise < TagResourceCommandOutput > => { const parsedOutput = { ... output , body : await parseBody ( output . body , context ) , } ; let response ; let errorCode = "UnknownError" ; errorCode = loadRestJsonErrorCode ( output , parsedOutput . body ) ; switch ( errorCode ) { case "AccessDeniedException" : case "com.amazonaws.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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 "AccessDeniedException" : case "com.amazonaws.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1UpdateGeofenceCollectionCommand = async ( output , context ) : Promise < UpdateGeofenceCollectionCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateGeofenceCollectionCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CollectionArn : undefined , CollectionName : undefined , UpdateTime : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CollectionArn !== undefined && data . CollectionArn !== null ) { contents . CollectionArn = __expectString ( data . CollectionArn ) ; } if ( data . CollectionName !== undefined && data . CollectionName !== null ) { contents . CollectionName = __expectString ( data . CollectionName ) ; } if ( data . UpdateTime !== undefined && data . UpdateTime !== null ) { contents . UpdateTime = __expectNonNull ( __parseRfc3339DateTime ( data . UpdateTime ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateGeofenceCollectionCommandError = async ( output , context ) : Promise < UpdateGeofenceCollectionCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1UpdateMapCommand = async ( output , context ) : Promise < UpdateMapCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateMapCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , MapArn : undefined , MapName : undefined , UpdateTime : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . MapArn !== undefined && data . MapArn !== null ) { contents . MapArn = __expectString ( data . MapArn ) ; } if ( data . MapName !== undefined && data . MapName !== null ) { contents . MapName = __expectString ( data . MapName ) ; } if ( data . UpdateTime !== undefined && data . UpdateTime !== null ) { contents . UpdateTime = __expectNonNull ( __parseRfc3339DateTime ( data . UpdateTime ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateMapCommandError = async ( output , context ) : Promise < UpdateMapCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1UpdatePlaceIndexCommand = async ( output , context ) : Promise < UpdatePlaceIndexCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdatePlaceIndexCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , IndexArn : undefined , IndexName : undefined , UpdateTime : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . IndexArn !== undefined && data . IndexArn !== null ) { contents . IndexArn = __expectString ( data . IndexArn ) ; } if ( data . IndexName !== undefined && data . IndexName !== null ) { contents . IndexName = __expectString ( data . IndexName ) ; } if ( data . UpdateTime !== undefined && data . UpdateTime !== null ) { contents . UpdateTime = __expectNonNull ( __parseRfc3339DateTime ( data . UpdateTime ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdatePlaceIndexCommandError = async ( output , context ) : Promise < UpdatePlaceIndexCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1UpdateRouteCalculatorCommand = async ( output , context ) : Promise < UpdateRouteCalculatorCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateRouteCalculatorCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , CalculatorArn : undefined , CalculatorName : undefined , UpdateTime : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . CalculatorArn !== undefined && data . CalculatorArn !== null ) { contents . CalculatorArn = __expectString ( data . CalculatorArn ) ; } if ( data . CalculatorName !== undefined && data . CalculatorName !== null ) { contents . CalculatorName = __expectString ( data . CalculatorName ) ; } if ( data . UpdateTime !== undefined && data . UpdateTime !== null ) { contents . UpdateTime = __expectNonNull ( __parseRfc3339DateTime ( data . UpdateTime ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateRouteCalculatorCommandError = async ( output , context ) : Promise < UpdateRouteCalculatorCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#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_restJson1UpdateTrackerCommand = async ( output , context ) : Promise < UpdateTrackerCommandOutput > => { if ( output . statusCode !== 200 && output . statusCode >= 300 ) { return deserializeAws_restJson1UpdateTrackerCommandError ( output , context ) ; } const contents = { $metadata : deserializeMetadata ( output ) , TrackerArn : undefined , TrackerName : undefined , UpdateTime : undefined , } ; const data = __expectNonNull ( __expectObject ( await parseBody ( output . body , context ) ) , "body" ) ; if ( data . TrackerArn !== undefined && data . TrackerArn !== null ) { contents . TrackerArn = __expectString ( data . TrackerArn ) ; } if ( data . TrackerName !== undefined && data . TrackerName !== null ) { contents . TrackerName = __expectString ( data . TrackerName ) ; } if ( data . UpdateTime !== undefined && data . UpdateTime !== null ) { contents . UpdateTime = __expectNonNull ( __parseRfc3339DateTime ( data . UpdateTime ) ) ; } return Promise . resolve ( contents ) ; } ; const deserializeAws_restJson1UpdateTrackerCommandError = async ( output , context ) : Promise < UpdateTrackerCommandOutput > => { 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.location#AccessDeniedException" : response = { ... ( await deserializeAws_restJson1AccessDeniedExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "InternalServerException" : case "com.amazonaws.location#InternalServerException" : response = { ... ( await deserializeAws_restJson1InternalServerExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ResourceNotFoundException" : case "com.amazonaws.location#ResourceNotFoundException" : response = { ... ( await deserializeAws_restJson1ResourceNotFoundExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ThrottlingException" : case "com.amazonaws.location#ThrottlingException" : response = { ... ( await deserializeAws_restJson1ThrottlingExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; case "ValidationException" : case "com.amazonaws.location#ValidationException" : response = { ... ( await deserializeAws_restJson1ValidationExceptionResponse ( parsedOutput , context ) ) , name : errorCode , $metadata : deserializeMetadata ( output ) , } ; break ; default : const parsedBody = parsedOutput . body ; errorCode = parsedBody . code || parsedBody . Code || errorCode ; response = { ... parsedBody , name : `${ errorCode }` , message : parsedBody . message || parsedBody . Message || errorCode , $fault : "client" , $metadata : deserializeMetadata ( output ) , } as any ; } const message = response . message || response . Message || errorCode ; response . message = message ; delete response . Message ; return Promise . reject ( Object . assign ( new Error ( message ) , response ) ) ; } ; const deserializeAws_restJson1AccessDeniedExceptionResponse = async ( parsedOutput , context ) : Promise < AccessDeniedException > => { const contents = { name : "AccessDeniedException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . Message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ConflictExceptionResponse = async ( parsedOutput , context ) : Promise < ConflictException > => { const contents = { name : "ConflictException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . Message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1InternalServerExceptionResponse = async ( parsedOutput , context ) : Promise < InternalServerException > => { const contents = { name : "InternalServerException" , $fault : "server" , $retryable : { } , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . Message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async ( parsedOutput , context ) : Promise < ResourceNotFoundException > => { const contents = { name : "ResourceNotFoundException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . Message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async ( parsedOutput , context ) : Promise < ServiceQuotaExceededException > => { const contents = { name : "ServiceQuotaExceededException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . Message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ThrottlingExceptionResponse = async ( parsedOutput , context ) : Promise < ThrottlingException > => { const contents = { name : "ThrottlingException" , $fault : "client" , $retryable : { } , $metadata : deserializeMetadata ( parsedOutput ) , Message : undefined , } ; const data = parsedOutput . body ; if ( data . message !== undefined && data . message !== null ) { contents . Message = __expectString ( data . message ) ; } return contents ; } ; const deserializeAws_restJson1ValidationExceptionResponse = async ( parsedOutput , context ) : Promise < ValidationException > => { const contents = { name : "ValidationException" , $fault : "client" , $metadata : deserializeMetadata ( parsedOutput ) , FieldList : undefined , Message : undefined , Reason : undefined , } ; const data = parsedOutput . body ; if ( data . fieldList !== undefined && data . fieldList !== null ) { contents . FieldList = deserializeAws_restJson1ValidationExceptionFieldList ( data . fieldList , 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_restJson1BatchPutGeofenceRequestEntry = ( input , context ) : any => { return { ... ( input . GeofenceId !== undefined && input . GeofenceId !== null && { GeofenceId : input . GeofenceId } ) , ... ( input . Geometry !== undefined && input . Geometry !== null && { Geometry : serializeAws_restJson1GeofenceGeometry ( input . Geometry , context ) } ) , } ; } ; const serializeAws_restJson1BatchPutGeofenceRequestEntryList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1BatchPutGeofenceRequestEntry ( entry , context ) ; } ) ; } ; const serializeAws_restJson1BoundingBox = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __serializeFloat ( entry ) ; } ) ; } ; const serializeAws_restJson1CalculateRouteCarModeOptions = ( input , context ) : any => { return { ... ( input . AvoidFerries !== undefined && input . AvoidFerries !== null && { AvoidFerries : input . AvoidFerries } ) , ... ( input . AvoidTolls !== undefined && input . AvoidTolls !== null && { AvoidTolls : input . AvoidTolls } ) , } ; } ; const serializeAws_restJson1CalculateRouteTruckModeOptions = ( input , context ) : any => { return { ... ( input . AvoidFerries !== undefined && input . AvoidFerries !== null && { AvoidFerries : input . AvoidFerries } ) , ... ( input . AvoidTolls !== undefined && input . AvoidTolls !== null && { AvoidTolls : input . AvoidTolls } ) , ... ( input . Dimensions !== undefined && input . Dimensions !== null && { Dimensions : serializeAws_restJson1TruckDimensions ( input . Dimensions , context ) } ) , ... ( input . Weight !== undefined && input . Weight !== null && { Weight : serializeAws_restJson1TruckWeight ( input . Weight , context ) } ) , } ; } ; const serializeAws_restJson1CountryCodeList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1DataSourceConfiguration = ( input , context ) : any => { return { ... ( input . IntendedUse !== undefined && input . IntendedUse !== null && { IntendedUse : input . IntendedUse } ) , } ; } ; const serializeAws_restJson1DeviceIdsList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1DevicePositionUpdate = ( input , context ) : any => { return { ... ( input . Accuracy !== undefined && input . Accuracy !== null && { Accuracy : serializeAws_restJson1PositionalAccuracy ( input . Accuracy , context ) } ) , ... ( input . DeviceId !== undefined && input . DeviceId !== null && { DeviceId : input . DeviceId } ) , ... ( input . Position !== undefined && input . Position !== null && { Position : serializeAws_restJson1Position ( input . Position , context ) } ) , ... ( input . PositionProperties !== undefined && input . PositionProperties !== null && { PositionProperties : serializeAws_restJson1PropertyMap ( input . PositionProperties , context ) , } ) , ... ( input . SampleTime !== undefined && input . SampleTime !== null && { SampleTime : input . SampleTime . toISOString ( ) . split ( "." ) [ 0 ] + "Z" } ) , } ; } ; const serializeAws_restJson1DevicePositionUpdateList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1DevicePositionUpdate ( entry , context ) ; } ) ; } ; const serializeAws_restJson1GeofenceGeometry = ( input , context ) : any => { return { ... ( input . Polygon !== undefined && input . Polygon !== null && { Polygon : serializeAws_restJson1LinearRings ( input . Polygon , context ) } ) , } ; } ; const serializeAws_restJson1IdList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return entry ; } ) ; } ; const serializeAws_restJson1LinearRing = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1Position ( entry , context ) ; } ) ; } ; const serializeAws_restJson1LinearRings = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1LinearRing ( entry , context ) ; } ) ; } ; const serializeAws_restJson1MapConfiguration = ( input , context ) : any => { return { ... ( input . Style !== undefined && input . Style !== null && { Style : input . Style } ) , } ; } ; const serializeAws_restJson1Position = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __serializeFloat ( entry ) ; } ) ; } ; const serializeAws_restJson1PositionalAccuracy = ( input , context ) : any => { return { ... ( input . Horizontal !== undefined && input . Horizontal !== null && { Horizontal : __serializeFloat ( input . Horizontal ) } ) , } ; } ; const serializeAws_restJson1PropertyMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1TagMap = ( input , context ) : any => { return Object . entries ( input ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : value , } ; } , { } ) ; } ; const serializeAws_restJson1TruckDimensions = ( input , context ) : any => { return { ... ( input . Height !== undefined && input . Height !== null && { Height : __serializeFloat ( input . Height ) } ) , ... ( input . Length !== undefined && input . Length !== null && { Length : __serializeFloat ( input . Length ) } ) , ... ( input . Unit !== undefined && input . Unit !== null && { Unit : input . Unit } ) , ... ( input . Width !== undefined && input . Width !== null && { Width : __serializeFloat ( input . Width ) } ) , } ; } ; const serializeAws_restJson1TruckWeight = ( input , context ) : any => { return { ... ( input . Total !== undefined && input . Total !== null && { Total : __serializeFloat ( input . Total ) } ) , ... ( input . Unit !== undefined && input . Unit !== null && { Unit : input . Unit } ) , } ; } ; const serializeAws_restJson1WaypointPositionList = ( input , context ) : any => { return input . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return serializeAws_restJson1Position ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ArnList = ( 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_restJson1BatchDeleteDevicePositionHistoryError = ( output , context ) : BatchDeleteDevicePositionHistoryError => { return { DeviceId : __expectString ( output . DeviceId ) , Error : output . Error !== undefined && output . Error !== null ? deserializeAws_restJson1BatchItemError ( output . Error , context ) : undefined , } as any ; } ; const deserializeAws_restJson1BatchDeleteDevicePositionHistoryErrorList = ( output , context ) : BatchDeleteDevicePositionHistoryError [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BatchDeleteDevicePositionHistoryError ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1BatchDeleteGeofenceError = ( output , context ) : BatchDeleteGeofenceError => { return { Error : output . Error !== undefined && output . Error !== null ? deserializeAws_restJson1BatchItemError ( output . Error , context ) : undefined , GeofenceId : __expectString ( output . GeofenceId ) , } as any ; } ; const deserializeAws_restJson1BatchDeleteGeofenceErrorList = ( output , context ) : BatchDeleteGeofenceError [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BatchDeleteGeofenceError ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1BatchEvaluateGeofencesError = ( output , context ) : BatchEvaluateGeofencesError => { return { DeviceId : __expectString ( output . DeviceId ) , Error : output . Error !== undefined && output . Error !== null ? deserializeAws_restJson1BatchItemError ( output . Error , context ) : undefined , SampleTime : output . SampleTime !== undefined && output . SampleTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . SampleTime ) ) : undefined , } as any ; } ; const deserializeAws_restJson1BatchEvaluateGeofencesErrorList = ( output , context ) : BatchEvaluateGeofencesError [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BatchEvaluateGeofencesError ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1BatchGetDevicePositionError = ( output , context ) : BatchGetDevicePositionError => { return { DeviceId : __expectString ( output . DeviceId ) , Error : output . Error !== undefined && output . Error !== null ? deserializeAws_restJson1BatchItemError ( output . Error , context ) : undefined , } as any ; } ; const deserializeAws_restJson1BatchGetDevicePositionErrorList = ( output , context ) : BatchGetDevicePositionError [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BatchGetDevicePositionError ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1BatchItemError = ( output , context ) : BatchItemError => { return { Code : __expectString ( output . Code ) , Message : __expectString ( output . Message ) , } as any ; } ; const deserializeAws_restJson1BatchPutGeofenceError = ( output , context ) : BatchPutGeofenceError => { return { Error : output . Error !== undefined && output . Error !== null ? deserializeAws_restJson1BatchItemError ( output . Error , context ) : undefined , GeofenceId : __expectString ( output . GeofenceId ) , } as any ; } ; const deserializeAws_restJson1BatchPutGeofenceErrorList = ( output , context ) : BatchPutGeofenceError [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BatchPutGeofenceError ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1BatchPutGeofenceSuccess = ( output , context ) : BatchPutGeofenceSuccess => { return { CreateTime : output . CreateTime !== undefined && output . CreateTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . CreateTime ) ) : undefined , GeofenceId : __expectString ( output . GeofenceId ) , UpdateTime : output . UpdateTime !== undefined && output . UpdateTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . UpdateTime ) ) : undefined , } as any ; } ; const deserializeAws_restJson1BatchPutGeofenceSuccessList = ( output , context ) : BatchPutGeofenceSuccess [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BatchPutGeofenceSuccess ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1BatchUpdateDevicePositionError = ( output , context ) : BatchUpdateDevicePositionError => { return { DeviceId : __expectString ( output . DeviceId ) , Error : output . Error !== undefined && output . Error !== null ? deserializeAws_restJson1BatchItemError ( output . Error , context ) : undefined , SampleTime : output . SampleTime !== undefined && output . SampleTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . SampleTime ) ) : undefined , } as any ; } ; const deserializeAws_restJson1BatchUpdateDevicePositionErrorList = ( output , context ) : BatchUpdateDevicePositionError [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1BatchUpdateDevicePositionError ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1BoundingBox = ( output , context ) : number [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __limitedParseDouble ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1CalculateRouteSummary = ( output , context ) : CalculateRouteSummary => { return { DataSource : __expectString ( output . DataSource ) , Distance : __limitedParseDouble ( output . Distance ) , DistanceUnit : __expectString ( output . DistanceUnit ) , DurationSeconds : __limitedParseDouble ( output . DurationSeconds ) , RouteBBox : output . RouteBBox !== undefined && output . RouteBBox !== null ? deserializeAws_restJson1BoundingBox ( output . RouteBBox , context ) : undefined , } as any ; } ; const deserializeAws_restJson1CountryCodeList = ( 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_restJson1DataSourceConfiguration = ( output , context ) : DataSourceConfiguration => { return { IntendedUse : __expectString ( output . IntendedUse ) , } as any ; } ; const deserializeAws_restJson1DevicePosition = ( output , context ) : DevicePosition => { return { Accuracy : output . Accuracy !== undefined && output . Accuracy !== null ? deserializeAws_restJson1PositionalAccuracy ( output . Accuracy , context ) : undefined , DeviceId : __expectString ( output . DeviceId ) , Position : output . Position !== undefined && output . Position !== null ? deserializeAws_restJson1Position ( output . Position , context ) : undefined , PositionProperties : output . PositionProperties !== undefined && output . PositionProperties !== null ? deserializeAws_restJson1PropertyMap ( output . PositionProperties , context ) : undefined , ReceivedTime : output . ReceivedTime !== undefined && output . ReceivedTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . ReceivedTime ) ) : undefined , SampleTime : output . SampleTime !== undefined && output . SampleTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . SampleTime ) ) : undefined , } as any ; } ; const deserializeAws_restJson1DevicePositionList = ( output , context ) : DevicePosition [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1DevicePosition ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1GeofenceGeometry = ( output , context ) : GeofenceGeometry => { return { Polygon : output . Polygon !== undefined && output . Polygon !== null ? deserializeAws_restJson1LinearRings ( output . Polygon , context ) : undefined , } as any ; } ; const deserializeAws_restJson1Leg = ( output , context ) : Leg => { return { Distance : __limitedParseDouble ( output . Distance ) , DurationSeconds : __limitedParseDouble ( output . DurationSeconds ) , EndPosition : output . EndPosition !== undefined && output . EndPosition !== null ? deserializeAws_restJson1Position ( output . EndPosition , context ) : undefined , Geometry : output . Geometry !== undefined && output . Geometry !== null ? deserializeAws_restJson1LegGeometry ( output . Geometry , context ) : undefined , StartPosition : output . StartPosition !== undefined && output . StartPosition !== null ? deserializeAws_restJson1Position ( output . StartPosition , context ) : undefined , Steps : output . Steps !== undefined && output . Steps !== null ? deserializeAws_restJson1StepList ( output . Steps , context ) : undefined , } as any ; } ; const deserializeAws_restJson1LegGeometry = ( output , context ) : LegGeometry => { return { LineString : output . LineString !== undefined && output . LineString !== null ? deserializeAws_restJson1LineString ( output . LineString , context ) : undefined , } as any ; } ; const deserializeAws_restJson1LegList = ( output , context ) : Leg [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Leg ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1LinearRing = ( output , context ) : number [ ] [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Position ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1LinearRings = ( output , context ) : number [ ] [ ] [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1LinearRing ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1LineString = ( output , context ) : number [ ] [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Position ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListDevicePositionsResponseEntry = ( output , context ) : ListDevicePositionsResponseEntry => { return { Accuracy : output . Accuracy !== undefined && output . Accuracy !== null ? deserializeAws_restJson1PositionalAccuracy ( output . Accuracy , context ) : undefined , DeviceId : __expectString ( output . DeviceId ) , Position : output . Position !== undefined && output . Position !== null ? deserializeAws_restJson1Position ( output . Position , context ) : undefined , PositionProperties : output . PositionProperties !== undefined && output . PositionProperties !== null ? deserializeAws_restJson1PropertyMap ( output . PositionProperties , context ) : undefined , SampleTime : output . SampleTime !== undefined && output . SampleTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . SampleTime ) ) : undefined , } as any ; } ; const deserializeAws_restJson1ListDevicePositionsResponseEntryList = ( output , context ) : ListDevicePositionsResponseEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ListDevicePositionsResponseEntry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListGeofenceCollectionsResponseEntry = ( output , context ) : ListGeofenceCollectionsResponseEntry => { return { CollectionName : __expectString ( output . CollectionName ) , CreateTime : output . CreateTime !== undefined && output . CreateTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . CreateTime ) ) : undefined , Description : __expectString ( output . Description ) , PricingPlan : __expectString ( output . PricingPlan ) , PricingPlanDataSource : __expectString ( output . PricingPlanDataSource ) , UpdateTime : output . UpdateTime !== undefined && output . UpdateTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . UpdateTime ) ) : undefined , } as any ; } ; const deserializeAws_restJson1ListGeofenceCollectionsResponseEntryList = ( output , context ) : ListGeofenceCollectionsResponseEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ListGeofenceCollectionsResponseEntry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListGeofenceResponseEntry = ( output , context ) : ListGeofenceResponseEntry => { return { CreateTime : output . CreateTime !== undefined && output . CreateTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . CreateTime ) ) : undefined , GeofenceId : __expectString ( output . GeofenceId ) , Geometry : output . Geometry !== undefined && output . Geometry !== null ? deserializeAws_restJson1GeofenceGeometry ( output . Geometry , context ) : undefined , Status : __expectString ( output . Status ) , UpdateTime : output . UpdateTime !== undefined && output . UpdateTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . UpdateTime ) ) : undefined , } as any ; } ; const deserializeAws_restJson1ListGeofenceResponseEntryList = ( output , context ) : ListGeofenceResponseEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ListGeofenceResponseEntry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListMapsResponseEntry = ( output , context ) : ListMapsResponseEntry => { return { CreateTime : output . CreateTime !== undefined && output . CreateTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . CreateTime ) ) : undefined , DataSource : __expectString ( output . DataSource ) , Description : __expectString ( output . Description ) , MapName : __expectString ( output . MapName ) , PricingPlan : __expectString ( output . PricingPlan ) , UpdateTime : output . UpdateTime !== undefined && output . UpdateTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . UpdateTime ) ) : undefined , } as any ; } ; const deserializeAws_restJson1ListMapsResponseEntryList = ( output , context ) : ListMapsResponseEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ListMapsResponseEntry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListPlaceIndexesResponseEntry = ( output , context ) : ListPlaceIndexesResponseEntry => { return { CreateTime : output . CreateTime !== undefined && output . CreateTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . CreateTime ) ) : undefined , DataSource : __expectString ( output . DataSource ) , Description : __expectString ( output . Description ) , IndexName : __expectString ( output . IndexName ) , PricingPlan : __expectString ( output . PricingPlan ) , UpdateTime : output . UpdateTime !== undefined && output . UpdateTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . UpdateTime ) ) : undefined , } as any ; } ; const deserializeAws_restJson1ListPlaceIndexesResponseEntryList = ( output , context ) : ListPlaceIndexesResponseEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ListPlaceIndexesResponseEntry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListRouteCalculatorsResponseEntry = ( output , context ) : ListRouteCalculatorsResponseEntry => { return { CalculatorName : __expectString ( output . CalculatorName ) , CreateTime : output . CreateTime !== undefined && output . CreateTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . CreateTime ) ) : undefined , DataSource : __expectString ( output . DataSource ) , Description : __expectString ( output . Description ) , PricingPlan : __expectString ( output . PricingPlan ) , UpdateTime : output . UpdateTime !== undefined && output . UpdateTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . UpdateTime ) ) : undefined , } as any ; } ; const deserializeAws_restJson1ListRouteCalculatorsResponseEntryList = ( output , context ) : ListRouteCalculatorsResponseEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ListRouteCalculatorsResponseEntry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1ListTrackersResponseEntry = ( output , context ) : ListTrackersResponseEntry => { return { CreateTime : output . CreateTime !== undefined && output . CreateTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . CreateTime ) ) : undefined , Description : __expectString ( output . Description ) , PricingPlan : __expectString ( output . PricingPlan ) , PricingPlanDataSource : __expectString ( output . PricingPlanDataSource ) , TrackerName : __expectString ( output . TrackerName ) , UpdateTime : output . UpdateTime !== undefined && output . UpdateTime !== null ? __expectNonNull ( __parseRfc3339DateTime ( output . UpdateTime ) ) : undefined , } as any ; } ; const deserializeAws_restJson1ListTrackersResponseEntryList = ( output , context ) : ListTrackersResponseEntry [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1ListTrackersResponseEntry ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1MapConfiguration = ( output , context ) : MapConfiguration => { return { Style : __expectString ( output . Style ) , } as any ; } ; const deserializeAws_restJson1Place = ( output , context ) : Place => { return { AddressNumber : __expectString ( output . AddressNumber ) , Country : __expectString ( output . Country ) , Geometry : output . Geometry !== undefined && output . Geometry !== null ? deserializeAws_restJson1PlaceGeometry ( output . Geometry , context ) : undefined , Interpolated : __expectBoolean ( output . Interpolated ) , Label : __expectString ( output . Label ) , Municipality : __expectString ( output . Municipality ) , Neighborhood : __expectString ( output . Neighborhood ) , PostalCode : __expectString ( output . PostalCode ) , Region : __expectString ( output . Region ) , Street : __expectString ( output . Street ) , SubRegion : __expectString ( output . SubRegion ) , TimeZone : output . TimeZone !== undefined && output . TimeZone !== null ? deserializeAws_restJson1TimeZone ( output . TimeZone , context ) : undefined , } as any ; } ; const deserializeAws_restJson1PlaceGeometry = ( output , context ) : PlaceGeometry => { return { Point : output . Point !== undefined && output . Point !== null ? deserializeAws_restJson1Position ( output . Point , context ) : undefined , } as any ; } ; const deserializeAws_restJson1Position = ( output , context ) : number [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return __limitedParseDouble ( entry ) as any ; } ) ; } ; const deserializeAws_restJson1PositionalAccuracy = ( output , context ) : PositionalAccuracy => { return { Horizontal : __limitedParseDouble ( output . Horizontal ) , } as any ; } ; const deserializeAws_restJson1PropertyMap = ( 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_restJson1SearchForPositionResult = ( output , context ) : SearchForPositionResult => { return { Distance : __limitedParseDouble ( output . Distance ) , Place : output . Place !== undefined && output . Place !== null ? deserializeAws_restJson1Place ( output . Place , context ) : undefined , } as any ; } ; const deserializeAws_restJson1SearchForPositionResultList = ( output , context ) : SearchForPositionResult [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1SearchForPositionResult ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1SearchForSuggestionsResult = ( output , context ) : SearchForSuggestionsResult => { return { Text : __expectString ( output . Text ) , } as any ; } ; const deserializeAws_restJson1SearchForSuggestionsResultList = ( output , context ) : SearchForSuggestionsResult [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1SearchForSuggestionsResult ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1SearchForTextResult = ( output , context ) : SearchForTextResult => { return { Distance : __limitedParseDouble ( output . Distance ) , Place : output . Place !== undefined && output . Place !== null ? deserializeAws_restJson1Place ( output . Place , context ) : undefined , Relevance : __limitedParseDouble ( output . Relevance ) , } as any ; } ; const deserializeAws_restJson1SearchForTextResultList = ( output , context ) : SearchForTextResult [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1SearchForTextResult ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1SearchPlaceIndexForPositionSummary = ( output , context ) : SearchPlaceIndexForPositionSummary => { return { DataSource : __expectString ( output . DataSource ) , Language : __expectString ( output . Language ) , MaxResults : __expectInt32 ( output . MaxResults ) , Position : output . Position !== undefined && output . Position !== null ? deserializeAws_restJson1Position ( output . Position , context ) : undefined , } as any ; } ; const deserializeAws_restJson1SearchPlaceIndexForSuggestionsSummary = ( output , context ) : SearchPlaceIndexForSuggestionsSummary => { return { BiasPosition : output . BiasPosition !== undefined && output . BiasPosition !== null ? deserializeAws_restJson1Position ( output . BiasPosition , context ) : undefined , DataSource : __expectString ( output . DataSource ) , FilterBBox : output . FilterBBox !== undefined && output . FilterBBox !== null ? deserializeAws_restJson1BoundingBox ( output . FilterBBox , context ) : undefined , FilterCountries : output . FilterCountries !== undefined && output . FilterCountries !== null ? deserializeAws_restJson1CountryCodeList ( output . FilterCountries , context ) : undefined , Language : __expectString ( output . Language ) , MaxResults : __expectInt32 ( output . MaxResults ) , Text : __expectString ( output . Text ) , } as any ; } ; const deserializeAws_restJson1SearchPlaceIndexForTextSummary = ( output , context ) : SearchPlaceIndexForTextSummary => { return { BiasPosition : output . BiasPosition !== undefined && output . BiasPosition !== null ? deserializeAws_restJson1Position ( output . BiasPosition , context ) : undefined , DataSource : __expectString ( output . DataSource ) , FilterBBox : output . FilterBBox !== undefined && output . FilterBBox !== null ? deserializeAws_restJson1BoundingBox ( output . FilterBBox , context ) : undefined , FilterCountries : output . FilterCountries !== undefined && output . FilterCountries !== null ? deserializeAws_restJson1CountryCodeList ( output . FilterCountries , context ) : undefined , Language : __expectString ( output . Language ) , MaxResults : __expectInt32 ( output . MaxResults ) , ResultBBox : output . ResultBBox !== undefined && output . ResultBBox !== null ? deserializeAws_restJson1BoundingBox ( output . ResultBBox , context ) : undefined , Text : __expectString ( output . Text ) , } as any ; } ; const deserializeAws_restJson1Step = ( output , context ) : Step => { return { Distance : __limitedParseDouble ( output . Distance ) , DurationSeconds : __limitedParseDouble ( output . DurationSeconds ) , EndPosition : output . EndPosition !== undefined && output . EndPosition !== null ? deserializeAws_restJson1Position ( output . EndPosition , context ) : undefined , GeometryOffset : __expectInt32 ( output . GeometryOffset ) , StartPosition : output . StartPosition !== undefined && output . StartPosition !== null ? deserializeAws_restJson1Position ( output . StartPosition , context ) : undefined , } as any ; } ; const deserializeAws_restJson1StepList = ( output , context ) : Step [ ] => { return ( output || [ ] ) . filter ( ( e ) => e != null ) . map ( ( entry ) => { if ( entry === null ) { return null as any ; } return deserializeAws_restJson1Step ( entry , context ) ; } ) ; } ; const deserializeAws_restJson1TagMap = ( output , context ) : { [ key ] : string ; } => { return Object . entries ( output ) . reduce ( ( acc , [ key , value ] ) => { if ( value === null ) { return acc ; } return { ... acc , [ key ] : __expectString ( value ) as any , } ; } , { } ) ; } ; const deserializeAws_restJson1TimeZone = ( output , context ) : TimeZone => { return { Name : __expectString ( output . Name ) , Offset : __expectInt32 ( output . Offset ) , } 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 "" ; } ;