ExAws.Location.Geofences (ex_aws_location v0.1.0)

Copy Markdown

API calls for Amazon Location Service Geofences.

Geofence collections and the geofences stored in them, plus evaluating and forecasting device positions against those geofences.

Every function returns an operation struct to be passed to ExAws.request/2.

Operations

  • batch_delete_geofence - BatchDeleteGeofence
  • batch_evaluate_geofences - BatchEvaluateGeofences
  • batch_put_geofence - BatchPutGeofence
  • create_geofence_collection - CreateGeofenceCollection
  • delete_geofence_collection - DeleteGeofenceCollection
  • describe_geofence_collection - DescribeGeofenceCollection
  • forecast_geofence_events - ForecastGeofenceEvents
  • get_geofence - GetGeofence
  • list_geofence_collections - ListGeofenceCollections
  • list_geofences - ListGeofences
  • put_geofence - PutGeofence
  • update_geofence_collection - UpdateGeofenceCollection

See https://docs.aws.amazon.com/location/previous/APIReference/API_Operations.html

Summary

Functions

Deletes a batch of geofences from a geofence collection.

Evaluates device positions against the geofence geometries from a given geofence collection.

A batch request for storing geofence geometries into a given geofence collection, or updates the geometry of an existing geofence if a geofence ID is included in the request.

Creates a geofence collection, which manages and stores geofences.

Deletes a geofence collection from your Amazon Web Services account.

Retrieves the geofence collection details.

This action forecasts future geofence events that are likely to occur within a specified time horizon if a device continues moving at its current speed. Each forecasted event is associated with a geofence from a provided geofence collection. A forecast event can have one of the following states

Retrieves the geofence details from a geofence collection.

Lists geofence collections in your Amazon Web Services account.

Lists geofences stored in a given geofence collection.

Stores a geofence geometry in a given geofence collection, or updates the geometry of an existing geofence if a geofence ID is included in the request.

Updates the specified properties of a given geofence collection.

Types

create_geofence_collection_opts()

@type create_geofence_collection_opts() :: [
  description: String.t(),
  kms_key_id: String.t(),
  tags: %{optional(String.t()) => String.t()}
]

forecast_geofence_events_opts()

@type forecast_geofence_events_opts() :: [
  distance_unit: String.t(),
  max_results: integer(),
  next_token: String.t(),
  speed_unit: String.t(),
  time_horizon_minutes: number()
]

list_geofence_collections_opts()

@type list_geofence_collections_opts() :: [
  max_results: integer(),
  next_token: String.t()
]

list_geofences_opts()

@type list_geofences_opts() :: [max_results: integer(), next_token: String.t()]

put_geofence_opts()

@type put_geofence_opts() :: [
  {:geofence_properties, %{optional(String.t()) => String.t()}}
]

update_geofence_collection_opts()

@type update_geofence_collection_opts() :: [{:description, String.t()}]

Functions

batch_delete_geofence(collection_name, geofence_ids)

@spec batch_delete_geofence(String.t(), [String.t()]) :: ExAws.Operation.JSON.t()

Deletes a batch of geofences from a geofence collection.

This operation deletes the resource permanently.

Parameters

  • collection_name - The geofence collection storing the geofences to be deleted.

  • geofence_ids - The batch of geofences to be deleted.

See https://docs.aws.amazon.com/location/previous/APIReference/API_BatchDeleteGeofence.html

batch_evaluate_geofences(collection_name, device_position_updates)

@spec batch_evaluate_geofences(String.t(), [ExAws.Location.DevicePositionUpdate.t()]) ::
  ExAws.Operation.JSON.t()

Evaluates device positions against the geofence geometries from a given geofence collection.

This operation always returns an empty response because geofences are asynchronously evaluated. The evaluation determines if the device has entered or exited a geofenced area, and then publishes one of the following events to Amazon EventBridge:

  • ENTER if Amazon Location determines that the tracked device has entered a geofenced area.

  • EXIT if Amazon Location determines that the tracked device has exited a geofenced area.

The last geofence that a device was observed within is tracked for 30 days after the most recent device position update.

Geofence evaluation uses the given device position. It does not account for the optional Accuracy of a DevicePositionUpdate.

The DeviceID is used as a string to represent the device. You do not need to have a Tracker associated with the DeviceID.

Parameters

  • collection_name - The geofence collection used in evaluating the position of devices against its geofences.

  • device_position_updates - Contains device details for each device to be evaluated against the given geofence collection.

See https://docs.aws.amazon.com/location/previous/APIReference/API_BatchEvaluateGeofences.html

batch_put_geofence(collection_name, entries)

A batch request for storing geofence geometries into a given geofence collection, or updates the geometry of an existing geofence if a geofence ID is included in the request.

Parameters

  • collection_name - The geofence collection storing the geofences.

  • entries - The batch of geofences to be stored in a geofence collection.

See https://docs.aws.amazon.com/location/previous/APIReference/API_BatchPutGeofence.html

create_geofence_collection(collection_name, opts \\ [])

@spec create_geofence_collection(String.t(), create_geofence_collection_opts()) ::
  ExAws.Operation.JSON.t()

Creates a geofence collection, which manages and stores geofences.

Parameters

  • collection_name - A custom name for the geofence collection.

Options

  • :description - An optional description for the geofence collection.

  • :kms_key_id - A key identifier for an Amazon Web Services KMS customer managed key. Enter a key ID, key ARN, alias name, or alias ARN.

  • :tags - Applies one or more tags to the geofence collection. A tag is a key-value pair helps manage, identify, search, and filter your resources by labelling them.

See https://docs.aws.amazon.com/location/previous/APIReference/API_CreateGeofenceCollection.html

delete_geofence_collection(collection_name)

@spec delete_geofence_collection(String.t()) :: ExAws.Operation.RestQuery.t()

Deletes a geofence collection from your Amazon Web Services account.

This operation deletes the resource permanently. If the geofence collection is the target of a tracker resource, the devices will no longer be monitored.

Parameters

  • collection_name - The name of the geofence collection to be deleted.

See https://docs.aws.amazon.com/location/previous/APIReference/API_DeleteGeofenceCollection.html

describe_geofence_collection(collection_name)

@spec describe_geofence_collection(String.t()) :: ExAws.Operation.RestQuery.t()

Retrieves the geofence collection details.

Parameters

  • collection_name - The name of the geofence collection.

See https://docs.aws.amazon.com/location/previous/APIReference/API_DescribeGeofenceCollection.html

forecast_geofence_events(collection_name, device_state, opts \\ [])

This action forecasts future geofence events that are likely to occur within a specified time horizon if a device continues moving at its current speed. Each forecasted event is associated with a geofence from a provided geofence collection. A forecast event can have one of the following states:

ENTER: The device position is outside the referenced geofence, but the device may cross into the geofence during the forecasting time horizon if it maintains its current speed.

EXIT: The device position is inside the referenced geofence, but the device may leave the geofence during the forecasted time horizon if the device maintains it's current speed.

IDLE:The device is inside the geofence, and it will remain inside the geofence through the end of the time horizon if the device maintains it's current speed.

Heading direction is not considered in the current version. The API takes a conservative approach and includes events that can occur for any heading.

Parameters

  • collection_name - The name of the geofence collection.

  • device_state - Represents the device's state, including its current position and speed. When speed is omitted, this API performs a containment check. The containment check operation returns IDLE events for geofences where the device is currently inside of, but no other events.

Options

  • :distance_unit - The distance unit used for the NearestDistance property returned in a forecasted event. The measurement system must match for DistanceUnit and SpeedUnit; if Kilometers is specified for DistanceUnit, then SpeedUnit must be KilometersPerHour. Valid values: Kilometers, Miles.

  • :max_results - An optional limit for the number of resources returned in a single call.

  • :next_token - The pagination token specifying which page of results to return in the response. If no token is provided, the default page is the first page.

  • :speed_unit - The speed unit for the device captured by the device state. The measurement system must match for DistanceUnit and SpeedUnit; if Kilometers is specified for DistanceUnit, then SpeedUnit must be KilometersPerHour. Valid values: KilometersPerHour, MilesPerHour.

  • :time_horizon_minutes - The forward-looking time window for forecasting, specified in minutes. The API only returns events that are predicted to occur within this time horizon. When no value is specified, this API performs a containment check. The containment check operation returns IDLE events for geofences where the device is currently inside of, but no other events.

See https://docs.aws.amazon.com/location/previous/APIReference/API_ForecastGeofenceEvents.html

get_geofence(collection_name, geofence_id)

@spec get_geofence(String.t(), String.t()) :: ExAws.Operation.RestQuery.t()

Retrieves the geofence details from a geofence collection.

The returned geometry will always match the geometry format used when the geofence was created.

Parameters

  • collection_name - The geofence collection storing the target geofence.

  • geofence_id - The geofence you're retrieving details for.

See https://docs.aws.amazon.com/location/previous/APIReference/API_GetGeofence.html

list_geofence_collections(opts \\ [])

@spec list_geofence_collections(list_geofence_collections_opts()) ::
  ExAws.Operation.JSON.t()

Lists geofence collections in your Amazon Web Services account.

Options

  • :max_results - An optional limit for the number of resources returned in a single call.

  • :next_token - The pagination token specifying which page of results to return in the response. If no token is provided, the default page is the first page.

See https://docs.aws.amazon.com/location/previous/APIReference/API_ListGeofenceCollections.html

list_geofences(collection_name, opts \\ [])

@spec list_geofences(String.t(), list_geofences_opts()) :: ExAws.Operation.JSON.t()

Lists geofences stored in a given geofence collection.

Parameters

  • collection_name - The name of the geofence collection storing the list of geofences.

Options

  • :max_results - An optional limit for the number of geofences returned in a single call.

  • :next_token - The pagination token specifying which page of results to return in the response. If no token is provided, the default page is the first page.

See https://docs.aws.amazon.com/location/previous/APIReference/API_ListGeofences.html

put_geofence(collection_name, geofence_id, geometry, opts \\ [])

Stores a geofence geometry in a given geofence collection, or updates the geometry of an existing geofence if a geofence ID is included in the request.

Parameters

  • collection_name - The geofence collection to store the geofence in.

  • geofence_id - An identifier for the geofence. For example, ExampleGeofence-1.

  • geometry - Contains the details to specify the position of the geofence. Can be a circle, a polygon, or a multipolygon. Polygon and MultiPolygon geometries can be defined using their respective parameters, or encoded in Geobuf format using the Geobuf parameter. Including multiple geometry types in the same request will return a validation error.

Options

  • :geofence_properties - Associates one of more properties with the geofence. A property is a key-value pair stored with the geofence and added to any geofence event triggered with that geofence.

See https://docs.aws.amazon.com/location/previous/APIReference/API_PutGeofence.html

update_geofence_collection(collection_name, opts \\ [])

@spec update_geofence_collection(String.t(), update_geofence_collection_opts()) ::
  ExAws.Operation.JSON.t()

Updates the specified properties of a given geofence collection.

Parameters

  • collection_name - The name of the geofence collection to update.

Options

  • :description - Updates the description for the geofence collection.

See https://docs.aws.amazon.com/location/previous/APIReference/API_UpdateGeofenceCollection.html