Skip to content

Commit

Permalink
feat(client-location): Added two new APIs, VerifyDevicePosition and F…
Browse files Browse the repository at this point in the history
…orecastGeofenceEvents. Added support for putting larger geofences up to 100,000 vertices with Geobuf fields.
  • Loading branch information
awstools committed Jun 6, 2024
1 parent f7b019e commit 7c01057
Show file tree
Hide file tree
Showing 15 changed files with 2,245 additions and 316 deletions.
16 changes: 16 additions & 0 deletions clients/client-location/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,14 @@ DisassociateTrackerConsumer

[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/)

</details>
<details>
<summary>
ForecastGeofenceEvents
</summary>

[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/)

</details>
<details>
<summary>
Expand Down Expand Up @@ -667,3 +675,11 @@ UpdateTracker
[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/)

</details>
<details>
<summary>
VerifyDevicePosition
</summary>

[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/)

</details>
46 changes: 46 additions & 0 deletions clients/client-location/src/Location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ import {
DisassociateTrackerConsumerCommandInput,
DisassociateTrackerConsumerCommandOutput,
} from "./commands/DisassociateTrackerConsumerCommand";
import {
ForecastGeofenceEventsCommand,
ForecastGeofenceEventsCommandInput,
ForecastGeofenceEventsCommandOutput,
} from "./commands/ForecastGeofenceEventsCommand";
import {
GetDevicePositionCommand,
GetDevicePositionCommandInput,
Expand Down Expand Up @@ -232,6 +237,11 @@ import {
UpdateTrackerCommandInput,
UpdateTrackerCommandOutput,
} from "./commands/UpdateTrackerCommand";
import {
VerifyDevicePositionCommand,
VerifyDevicePositionCommandInput,
VerifyDevicePositionCommandOutput,
} from "./commands/VerifyDevicePositionCommand";
import { LocationClient, LocationClientConfig } from "./LocationClient";

const commands = {
Expand Down Expand Up @@ -263,6 +273,7 @@ const commands = {
DescribeRouteCalculatorCommand,
DescribeTrackerCommand,
DisassociateTrackerConsumerCommand,
ForecastGeofenceEventsCommand,
GetDevicePositionCommand,
GetDevicePositionHistoryCommand,
GetGeofenceCommand,
Expand Down Expand Up @@ -293,6 +304,7 @@ const commands = {
UpdatePlaceIndexCommand,
UpdateRouteCalculatorCommand,
UpdateTrackerCommand,
VerifyDevicePositionCommand,
};

export interface Location {
Expand Down Expand Up @@ -718,6 +730,23 @@ export interface Location {
cb: (err: any, data?: DisassociateTrackerConsumerCommandOutput) => void
): void;

/**
* @see {@link ForecastGeofenceEventsCommand}
*/
forecastGeofenceEvents(
args: ForecastGeofenceEventsCommandInput,
options?: __HttpHandlerOptions
): Promise<ForecastGeofenceEventsCommandOutput>;
forecastGeofenceEvents(
args: ForecastGeofenceEventsCommandInput,
cb: (err: any, data?: ForecastGeofenceEventsCommandOutput) => void
): void;
forecastGeofenceEvents(
args: ForecastGeofenceEventsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: ForecastGeofenceEventsCommandOutput) => void
): void;

/**
* @see {@link GetDevicePositionCommand}
*/
Expand Down Expand Up @@ -1143,6 +1172,23 @@ export interface Location {
options: __HttpHandlerOptions,
cb: (err: any, data?: UpdateTrackerCommandOutput) => void
): void;

/**
* @see {@link VerifyDevicePositionCommand}
*/
verifyDevicePosition(
args: VerifyDevicePositionCommandInput,
options?: __HttpHandlerOptions
): Promise<VerifyDevicePositionCommandOutput>;
verifyDevicePosition(
args: VerifyDevicePositionCommandInput,
cb: (err: any, data?: VerifyDevicePositionCommandOutput) => void
): void;
verifyDevicePosition(
args: VerifyDevicePositionCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: VerifyDevicePositionCommandOutput) => void
): void;
}

/**
Expand Down
16 changes: 14 additions & 2 deletions clients/client-location/src/LocationClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ import {
DisassociateTrackerConsumerCommandInput,
DisassociateTrackerConsumerCommandOutput,
} from "./commands/DisassociateTrackerConsumerCommand";
import {
ForecastGeofenceEventsCommandInput,
ForecastGeofenceEventsCommandOutput,
} from "./commands/ForecastGeofenceEventsCommand";
import { GetDevicePositionCommandInput, GetDevicePositionCommandOutput } from "./commands/GetDevicePositionCommand";
import {
GetDevicePositionHistoryCommandInput,
Expand Down Expand Up @@ -189,6 +193,10 @@ import {
UpdateRouteCalculatorCommandOutput,
} from "./commands/UpdateRouteCalculatorCommand";
import { UpdateTrackerCommandInput, UpdateTrackerCommandOutput } from "./commands/UpdateTrackerCommand";
import {
VerifyDevicePositionCommandInput,
VerifyDevicePositionCommandOutput,
} from "./commands/VerifyDevicePositionCommand";
import {
ClientInputEndpointParameters,
ClientResolvedEndpointParameters,
Expand Down Expand Up @@ -232,6 +240,7 @@ export type ServiceInputTypes =
| DescribeRouteCalculatorCommandInput
| DescribeTrackerCommandInput
| DisassociateTrackerConsumerCommandInput
| ForecastGeofenceEventsCommandInput
| GetDevicePositionCommandInput
| GetDevicePositionHistoryCommandInput
| GetGeofenceCommandInput
Expand Down Expand Up @@ -261,7 +270,8 @@ export type ServiceInputTypes =
| UpdateMapCommandInput
| UpdatePlaceIndexCommandInput
| UpdateRouteCalculatorCommandInput
| UpdateTrackerCommandInput;
| UpdateTrackerCommandInput
| VerifyDevicePositionCommandInput;

/**
* @public
Expand Down Expand Up @@ -295,6 +305,7 @@ export type ServiceOutputTypes =
| DescribeRouteCalculatorCommandOutput
| DescribeTrackerCommandOutput
| DisassociateTrackerConsumerCommandOutput
| ForecastGeofenceEventsCommandOutput
| GetDevicePositionCommandOutput
| GetDevicePositionHistoryCommandOutput
| GetGeofenceCommandOutput
Expand Down Expand Up @@ -324,7 +335,8 @@ export type ServiceOutputTypes =
| UpdateMapCommandOutput
| UpdatePlaceIndexCommandOutput
| UpdateRouteCalculatorCommandOutput
| UpdateTrackerCommandOutput;
| UpdateTrackerCommandOutput
| VerifyDevicePositionCommandOutput;

/**
* @public
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export interface BatchPutGeofenceCommandOutput extends BatchPutGeofenceResponse,
* ],
* Radius: Number("double"), // required
* },
* Geobuf: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* },
* GeofenceProperties: { // PropertyMap
* "<keys>": "STRING_VALUE",
Expand Down
137 changes: 137 additions & 0 deletions clients/client-location/src/commands/ForecastGeofenceEventsCommand.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
// smithy-typescript generated code
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
import { getSerdePlugin } from "@smithy/middleware-serde";
import { Command as $Command } from "@smithy/smithy-client";
import { MetadataBearer as __MetadataBearer } from "@smithy/types";

import { commonParams } from "../endpoint/EndpointParameters";
import { LocationClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../LocationClient";
import {
ForecastGeofenceEventsRequest,
ForecastGeofenceEventsRequestFilterSensitiveLog,
ForecastGeofenceEventsResponse,
ForecastGeofenceEventsResponseFilterSensitiveLog,
} from "../models/models_0";
import { de_ForecastGeofenceEventsCommand, se_ForecastGeofenceEventsCommand } from "../protocols/Aws_restJson1";

/**
* @public
*/
export type { __MetadataBearer };
export { $Command };
/**
* @public
*
* The input for {@link ForecastGeofenceEventsCommand}.
*/
export interface ForecastGeofenceEventsCommandInput extends ForecastGeofenceEventsRequest {}
/**
* @public
*
* The output of {@link ForecastGeofenceEventsCommand}.
*/
export interface ForecastGeofenceEventsCommandOutput extends ForecastGeofenceEventsResponse, __MetadataBearer {}

/**
* <p>Evaluates device positions against
* geofence geometries from a given geofence collection. The event forecasts three states for which
* a device can be in relative to a geofence:</p>
* <p>
* <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>
* <p>
* <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>
* <p>
* <code>IDLE</code>: If a device is inside of a geofence, and the device is not moving.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { LocationClient, ForecastGeofenceEventsCommand } from "@aws-sdk/client-location"; // ES Modules import
* // const { LocationClient, ForecastGeofenceEventsCommand } = require("@aws-sdk/client-location"); // CommonJS import
* const client = new LocationClient(config);
* const input = { // ForecastGeofenceEventsRequest
* CollectionName: "STRING_VALUE", // required
* DeviceState: { // ForecastGeofenceEventsDeviceState
* Position: [ // Position // required
* Number("double"),
* ],
* Speed: Number("double"),
* },
* TimeHorizonMinutes: Number("double"),
* DistanceUnit: "STRING_VALUE",
* SpeedUnit: "STRING_VALUE",
* NextToken: "STRING_VALUE",
* MaxResults: Number("int"),
* };
* const command = new ForecastGeofenceEventsCommand(input);
* const response = await client.send(command);
* // { // ForecastGeofenceEventsResponse
* // ForecastedEvents: [ // ForecastedEventsList // required
* // { // ForecastedEvent
* // EventId: "STRING_VALUE", // required
* // GeofenceId: "STRING_VALUE", // required
* // IsDeviceInGeofence: true || false, // required
* // NearestDistance: Number("double"), // required
* // EventType: "STRING_VALUE", // required
* // ForecastedBreachTime: new Date("TIMESTAMP"),
* // GeofenceProperties: { // PropertyMap
* // "<keys>": "STRING_VALUE",
* // },
* // },
* // ],
* // NextToken: "STRING_VALUE",
* // DistanceUnit: "STRING_VALUE", // required
* // SpeedUnit: "STRING_VALUE", // required
* // };
*
* ```
*
* @param ForecastGeofenceEventsCommandInput - {@link ForecastGeofenceEventsCommandInput}
* @returns {@link ForecastGeofenceEventsCommandOutput}
* @see {@link ForecastGeofenceEventsCommandInput} for command's `input` shape.
* @see {@link ForecastGeofenceEventsCommandOutput} for command's `response` shape.
* @see {@link LocationClientResolvedConfig | config} for LocationClient's `config` shape.
*
* @throws {@link AccessDeniedException} (client fault)
* <p>The request was denied because of insufficient access or permissions. Check with an
* administrator to verify your permissions.</p>
*
* @throws {@link InternalServerException} (server fault)
* <p>The request has failed to process because of an unknown server error, exception, or failure.</p>
*
* @throws {@link ResourceNotFoundException} (client fault)
* <p>The resource that you've entered was not found in your AWS account.</p>
*
* @throws {@link ThrottlingException} (client fault)
* <p>The request was denied because of request throttling.</p>
*
* @throws {@link ValidationException} (client fault)
* <p>The input failed to meet the constraints specified by the AWS service. </p>
*
* @throws {@link LocationServiceException}
* <p>Base exception class for all service exceptions from Location service.</p>
*
* @public
*/
export class ForecastGeofenceEventsCommand extends $Command
.classBuilder<
ForecastGeofenceEventsCommandInput,
ForecastGeofenceEventsCommandOutput,
LocationClientResolvedConfig,
ServiceInputTypes,
ServiceOutputTypes
>()
.ep({
...commonParams,
})
.m(function (this: any, Command: any, cs: any, config: LocationClientResolvedConfig, o: any) {
return [
getSerdePlugin(config, this.serialize, this.deserialize),
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
];
})
.s("LocationService", "ForecastGeofenceEvents", {})
.n("LocationClient", "ForecastGeofenceEventsCommand")
.f(ForecastGeofenceEventsRequestFilterSensitiveLog, ForecastGeofenceEventsResponseFilterSensitiveLog)
.ser(se_ForecastGeofenceEventsCommand)
.de(de_ForecastGeofenceEventsCommand)
.build() {}
4 changes: 4 additions & 0 deletions clients/client-location/src/commands/GetGeofenceCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export interface GetGeofenceCommandOutput extends GetGeofenceResponse, __Metadat

/**
* <p>Retrieves the geofence details from a geofence collection.</p>
* <note>
* <p>The returned geometry will always match the geometry format used when the geofence was created.</p>
* </note>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
Expand Down Expand Up @@ -57,6 +60,7 @@ export interface GetGeofenceCommandOutput extends GetGeofenceResponse, __Metadat
* // ],
* // Radius: Number("double"), // required
* // },
* // Geobuf: new Uint8Array(),
* // },
* // Status: "STRING_VALUE", // required
* // CreateTime: new Date("TIMESTAMP"), // required
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export interface ListGeofencesCommandOutput extends ListGeofencesResponse, __Met
* // ],
* // Radius: Number("double"), // required
* // },
* // Geobuf: new Uint8Array(),
* // },
* // Status: "STRING_VALUE", // required
* // CreateTime: new Date("TIMESTAMP"), // required
Expand Down
1 change: 1 addition & 0 deletions clients/client-location/src/commands/PutGeofenceCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export interface PutGeofenceCommandOutput extends PutGeofenceResponse, __Metadat
* ],
* Radius: Number("double"), // required
* },
* Geobuf: new Uint8Array(), // e.g. Buffer.from("") or new TextEncoder().encode("")
* },
* GeofenceProperties: { // PropertyMap
* "<keys>": "STRING_VALUE",
Expand Down
Loading

0 comments on commit 7c01057

Please sign in to comment.