Skip to content

Commit 7c01057

Browse files
author
awstools
committed
feat(client-location): Added two new APIs, VerifyDevicePosition and ForecastGeofenceEvents. Added support for putting larger geofences up to 100,000 vertices with Geobuf fields.
1 parent f7b019e commit 7c01057

15 files changed

+2245
-316
lines changed

clients/client-location/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,14 @@ DisassociateTrackerConsumer
426426

427427
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/location/command/DisassociateTrackerConsumerCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-location/Interface/DisassociateTrackerConsumerCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-location/Interface/DisassociateTrackerConsumerCommandOutput/)
428428

429+
</details>
430+
<details>
431+
<summary>
432+
ForecastGeofenceEvents
433+
</summary>
434+
435+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/location/command/ForecastGeofenceEventsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-location/Interface/ForecastGeofenceEventsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-location/Interface/ForecastGeofenceEventsCommandOutput/)
436+
429437
</details>
430438
<details>
431439
<summary>
@@ -667,3 +675,11 @@ UpdateTracker
667675
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/location/command/UpdateTrackerCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-location/Interface/UpdateTrackerCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-location/Interface/UpdateTrackerCommandOutput/)
668676

669677
</details>
678+
<details>
679+
<summary>
680+
VerifyDevicePosition
681+
</summary>
682+
683+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/location/command/VerifyDevicePositionCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-location/Interface/VerifyDevicePositionCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-location/Interface/VerifyDevicePositionCommandOutput/)
684+
685+
</details>

clients/client-location/src/Location.ts

+46
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ import {
118118
DisassociateTrackerConsumerCommandInput,
119119
DisassociateTrackerConsumerCommandOutput,
120120
} from "./commands/DisassociateTrackerConsumerCommand";
121+
import {
122+
ForecastGeofenceEventsCommand,
123+
ForecastGeofenceEventsCommandInput,
124+
ForecastGeofenceEventsCommandOutput,
125+
} from "./commands/ForecastGeofenceEventsCommand";
121126
import {
122127
GetDevicePositionCommand,
123128
GetDevicePositionCommandInput,
@@ -232,6 +237,11 @@ import {
232237
UpdateTrackerCommandInput,
233238
UpdateTrackerCommandOutput,
234239
} from "./commands/UpdateTrackerCommand";
240+
import {
241+
VerifyDevicePositionCommand,
242+
VerifyDevicePositionCommandInput,
243+
VerifyDevicePositionCommandOutput,
244+
} from "./commands/VerifyDevicePositionCommand";
235245
import { LocationClient, LocationClientConfig } from "./LocationClient";
236246

237247
const commands = {
@@ -263,6 +273,7 @@ const commands = {
263273
DescribeRouteCalculatorCommand,
264274
DescribeTrackerCommand,
265275
DisassociateTrackerConsumerCommand,
276+
ForecastGeofenceEventsCommand,
266277
GetDevicePositionCommand,
267278
GetDevicePositionHistoryCommand,
268279
GetGeofenceCommand,
@@ -293,6 +304,7 @@ const commands = {
293304
UpdatePlaceIndexCommand,
294305
UpdateRouteCalculatorCommand,
295306
UpdateTrackerCommand,
307+
VerifyDevicePositionCommand,
296308
};
297309

298310
export interface Location {
@@ -718,6 +730,23 @@ export interface Location {
718730
cb: (err: any, data?: DisassociateTrackerConsumerCommandOutput) => void
719731
): void;
720732

733+
/**
734+
* @see {@link ForecastGeofenceEventsCommand}
735+
*/
736+
forecastGeofenceEvents(
737+
args: ForecastGeofenceEventsCommandInput,
738+
options?: __HttpHandlerOptions
739+
): Promise<ForecastGeofenceEventsCommandOutput>;
740+
forecastGeofenceEvents(
741+
args: ForecastGeofenceEventsCommandInput,
742+
cb: (err: any, data?: ForecastGeofenceEventsCommandOutput) => void
743+
): void;
744+
forecastGeofenceEvents(
745+
args: ForecastGeofenceEventsCommandInput,
746+
options: __HttpHandlerOptions,
747+
cb: (err: any, data?: ForecastGeofenceEventsCommandOutput) => void
748+
): void;
749+
721750
/**
722751
* @see {@link GetDevicePositionCommand}
723752
*/
@@ -1143,6 +1172,23 @@ export interface Location {
11431172
options: __HttpHandlerOptions,
11441173
cb: (err: any, data?: UpdateTrackerCommandOutput) => void
11451174
): void;
1175+
1176+
/**
1177+
* @see {@link VerifyDevicePositionCommand}
1178+
*/
1179+
verifyDevicePosition(
1180+
args: VerifyDevicePositionCommandInput,
1181+
options?: __HttpHandlerOptions
1182+
): Promise<VerifyDevicePositionCommandOutput>;
1183+
verifyDevicePosition(
1184+
args: VerifyDevicePositionCommandInput,
1185+
cb: (err: any, data?: VerifyDevicePositionCommandOutput) => void
1186+
): void;
1187+
verifyDevicePosition(
1188+
args: VerifyDevicePositionCommandInput,
1189+
options: __HttpHandlerOptions,
1190+
cb: (err: any, data?: VerifyDevicePositionCommandOutput) => void
1191+
): void;
11461192
}
11471193

11481194
/**

clients/client-location/src/LocationClient.ts

+14-2
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ import {
123123
DisassociateTrackerConsumerCommandInput,
124124
DisassociateTrackerConsumerCommandOutput,
125125
} from "./commands/DisassociateTrackerConsumerCommand";
126+
import {
127+
ForecastGeofenceEventsCommandInput,
128+
ForecastGeofenceEventsCommandOutput,
129+
} from "./commands/ForecastGeofenceEventsCommand";
126130
import { GetDevicePositionCommandInput, GetDevicePositionCommandOutput } from "./commands/GetDevicePositionCommand";
127131
import {
128132
GetDevicePositionHistoryCommandInput,
@@ -189,6 +193,10 @@ import {
189193
UpdateRouteCalculatorCommandOutput,
190194
} from "./commands/UpdateRouteCalculatorCommand";
191195
import { UpdateTrackerCommandInput, UpdateTrackerCommandOutput } from "./commands/UpdateTrackerCommand";
196+
import {
197+
VerifyDevicePositionCommandInput,
198+
VerifyDevicePositionCommandOutput,
199+
} from "./commands/VerifyDevicePositionCommand";
192200
import {
193201
ClientInputEndpointParameters,
194202
ClientResolvedEndpointParameters,
@@ -232,6 +240,7 @@ export type ServiceInputTypes =
232240
| DescribeRouteCalculatorCommandInput
233241
| DescribeTrackerCommandInput
234242
| DisassociateTrackerConsumerCommandInput
243+
| ForecastGeofenceEventsCommandInput
235244
| GetDevicePositionCommandInput
236245
| GetDevicePositionHistoryCommandInput
237246
| GetGeofenceCommandInput
@@ -261,7 +270,8 @@ export type ServiceInputTypes =
261270
| UpdateMapCommandInput
262271
| UpdatePlaceIndexCommandInput
263272
| UpdateRouteCalculatorCommandInput
264-
| UpdateTrackerCommandInput;
273+
| UpdateTrackerCommandInput
274+
| VerifyDevicePositionCommandInput;
265275

266276
/**
267277
* @public
@@ -295,6 +305,7 @@ export type ServiceOutputTypes =
295305
| DescribeRouteCalculatorCommandOutput
296306
| DescribeTrackerCommandOutput
297307
| DisassociateTrackerConsumerCommandOutput
308+
| ForecastGeofenceEventsCommandOutput
298309
| GetDevicePositionCommandOutput
299310
| GetDevicePositionHistoryCommandOutput
300311
| GetGeofenceCommandOutput
@@ -324,7 +335,8 @@ export type ServiceOutputTypes =
324335
| UpdateMapCommandOutput
325336
| UpdatePlaceIndexCommandOutput
326337
| UpdateRouteCalculatorCommandOutput
327-
| UpdateTrackerCommandOutput;
338+
| UpdateTrackerCommandOutput
339+
| VerifyDevicePositionCommandOutput;
328340

329341
/**
330342
* @public

clients/client-location/src/commands/BatchPutGeofenceCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export interface BatchPutGeofenceCommandOutput extends BatchPutGeofenceResponse,
5959
* ],
6060
* Radius: Number("double"), // required
6161
* },
62+
* Geobuf: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
6263
* },
6364
* GeofenceProperties: { // PropertyMap
6465
* "<keys>": "STRING_VALUE",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { getSerdePlugin } from "@smithy/middleware-serde";
4+
import { Command as $Command } from "@smithy/smithy-client";
5+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
6+
7+
import { commonParams } from "../endpoint/EndpointParameters";
8+
import { LocationClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../LocationClient";
9+
import {
10+
ForecastGeofenceEventsRequest,
11+
ForecastGeofenceEventsRequestFilterSensitiveLog,
12+
ForecastGeofenceEventsResponse,
13+
ForecastGeofenceEventsResponseFilterSensitiveLog,
14+
} from "../models/models_0";
15+
import { de_ForecastGeofenceEventsCommand, se_ForecastGeofenceEventsCommand } from "../protocols/Aws_restJson1";
16+
17+
/**
18+
* @public
19+
*/
20+
export type { __MetadataBearer };
21+
export { $Command };
22+
/**
23+
* @public
24+
*
25+
* The input for {@link ForecastGeofenceEventsCommand}.
26+
*/
27+
export interface ForecastGeofenceEventsCommandInput extends ForecastGeofenceEventsRequest {}
28+
/**
29+
* @public
30+
*
31+
* The output of {@link ForecastGeofenceEventsCommand}.
32+
*/
33+
export interface ForecastGeofenceEventsCommandOutput extends ForecastGeofenceEventsResponse, __MetadataBearer {}
34+
35+
/**
36+
* <p>Evaluates device positions against
37+
* geofence geometries from a given geofence collection. The event forecasts three states for which
38+
* a device can be in relative to a geofence:</p>
39+
* <p>
40+
* <code>ENTER</code>: If a device is outside of a geofence, but would breach the fence if the device is moving at its current speed within time horizon window.</p>
41+
* <p>
42+
* <code>EXIT</code>: If a device is inside of a geofence, but would breach the fence if the device is moving at its current speed within time horizon window.</p>
43+
* <p>
44+
* <code>IDLE</code>: If a device is inside of a geofence, and the device is not moving.</p>
45+
* @example
46+
* Use a bare-bones client and the command you need to make an API call.
47+
* ```javascript
48+
* import { LocationClient, ForecastGeofenceEventsCommand } from "@aws-sdk/client-location"; // ES Modules import
49+
* // const { LocationClient, ForecastGeofenceEventsCommand } = require("@aws-sdk/client-location"); // CommonJS import
50+
* const client = new LocationClient(config);
51+
* const input = { // ForecastGeofenceEventsRequest
52+
* CollectionName: "STRING_VALUE", // required
53+
* DeviceState: { // ForecastGeofenceEventsDeviceState
54+
* Position: [ // Position // required
55+
* Number("double"),
56+
* ],
57+
* Speed: Number("double"),
58+
* },
59+
* TimeHorizonMinutes: Number("double"),
60+
* DistanceUnit: "STRING_VALUE",
61+
* SpeedUnit: "STRING_VALUE",
62+
* NextToken: "STRING_VALUE",
63+
* MaxResults: Number("int"),
64+
* };
65+
* const command = new ForecastGeofenceEventsCommand(input);
66+
* const response = await client.send(command);
67+
* // { // ForecastGeofenceEventsResponse
68+
* // ForecastedEvents: [ // ForecastedEventsList // required
69+
* // { // ForecastedEvent
70+
* // EventId: "STRING_VALUE", // required
71+
* // GeofenceId: "STRING_VALUE", // required
72+
* // IsDeviceInGeofence: true || false, // required
73+
* // NearestDistance: Number("double"), // required
74+
* // EventType: "STRING_VALUE", // required
75+
* // ForecastedBreachTime: new Date("TIMESTAMP"),
76+
* // GeofenceProperties: { // PropertyMap
77+
* // "<keys>": "STRING_VALUE",
78+
* // },
79+
* // },
80+
* // ],
81+
* // NextToken: "STRING_VALUE",
82+
* // DistanceUnit: "STRING_VALUE", // required
83+
* // SpeedUnit: "STRING_VALUE", // required
84+
* // };
85+
*
86+
* ```
87+
*
88+
* @param ForecastGeofenceEventsCommandInput - {@link ForecastGeofenceEventsCommandInput}
89+
* @returns {@link ForecastGeofenceEventsCommandOutput}
90+
* @see {@link ForecastGeofenceEventsCommandInput} for command's `input` shape.
91+
* @see {@link ForecastGeofenceEventsCommandOutput} for command's `response` shape.
92+
* @see {@link LocationClientResolvedConfig | config} for LocationClient's `config` shape.
93+
*
94+
* @throws {@link AccessDeniedException} (client fault)
95+
* <p>The request was denied because of insufficient access or permissions. Check with an
96+
* administrator to verify your permissions.</p>
97+
*
98+
* @throws {@link InternalServerException} (server fault)
99+
* <p>The request has failed to process because of an unknown server error, exception, or failure.</p>
100+
*
101+
* @throws {@link ResourceNotFoundException} (client fault)
102+
* <p>The resource that you've entered was not found in your AWS account.</p>
103+
*
104+
* @throws {@link ThrottlingException} (client fault)
105+
* <p>The request was denied because of request throttling.</p>
106+
*
107+
* @throws {@link ValidationException} (client fault)
108+
* <p>The input failed to meet the constraints specified by the AWS service. </p>
109+
*
110+
* @throws {@link LocationServiceException}
111+
* <p>Base exception class for all service exceptions from Location service.</p>
112+
*
113+
* @public
114+
*/
115+
export class ForecastGeofenceEventsCommand extends $Command
116+
.classBuilder<
117+
ForecastGeofenceEventsCommandInput,
118+
ForecastGeofenceEventsCommandOutput,
119+
LocationClientResolvedConfig,
120+
ServiceInputTypes,
121+
ServiceOutputTypes
122+
>()
123+
.ep({
124+
...commonParams,
125+
})
126+
.m(function (this: any, Command: any, cs: any, config: LocationClientResolvedConfig, o: any) {
127+
return [
128+
getSerdePlugin(config, this.serialize, this.deserialize),
129+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
130+
];
131+
})
132+
.s("LocationService", "ForecastGeofenceEvents", {})
133+
.n("LocationClient", "ForecastGeofenceEventsCommand")
134+
.f(ForecastGeofenceEventsRequestFilterSensitiveLog, ForecastGeofenceEventsResponseFilterSensitiveLog)
135+
.ser(se_ForecastGeofenceEventsCommand)
136+
.de(de_ForecastGeofenceEventsCommand)
137+
.build() {}

clients/client-location/src/commands/GetGeofenceCommand.ts

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ export interface GetGeofenceCommandOutput extends GetGeofenceResponse, __Metadat
2929

3030
/**
3131
* <p>Retrieves the geofence details from a geofence collection.</p>
32+
* <note>
33+
* <p>The returned geometry will always match the geometry format used when the geofence was created.</p>
34+
* </note>
3235
* @example
3336
* Use a bare-bones client and the command you need to make an API call.
3437
* ```javascript
@@ -57,6 +60,7 @@ export interface GetGeofenceCommandOutput extends GetGeofenceResponse, __Metadat
5760
* // ],
5861
* // Radius: Number("double"), // required
5962
* // },
63+
* // Geobuf: new Uint8Array(),
6064
* // },
6165
* // Status: "STRING_VALUE", // required
6266
* // CreateTime: new Date("TIMESTAMP"), // required

clients/client-location/src/commands/ListGeofencesCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export interface ListGeofencesCommandOutput extends ListGeofencesResponse, __Met
6464
* // ],
6565
* // Radius: Number("double"), // required
6666
* // },
67+
* // Geobuf: new Uint8Array(),
6768
* // },
6869
* // Status: "STRING_VALUE", // required
6970
* // CreateTime: new Date("TIMESTAMP"), // required

clients/client-location/src/commands/PutGeofenceCommand.ts

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export interface PutGeofenceCommandOutput extends PutGeofenceResponse, __Metadat
5353
* ],
5454
* Radius: Number("double"), // required
5555
* },
56+
* Geobuf: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
5657
* },
5758
* GeofenceProperties: { // PropertyMap
5859
* "<keys>": "STRING_VALUE",

0 commit comments

Comments
 (0)