Skip to content

create_tracker async

create_tracker(
    tracker_name: ResourceName,
    *,
    config_overrides: Optional[AsyncLocationClientConfig] = None,
    pricing_plan: Optional[PricingPlan] = None,
    kms_key_id: Optional[KmsKeyId] = None,
    pricing_plan_data_source: Optional[str] = None,
    description: Optional[ResourceDescription] = None,
    tags: Optional[TagMap] = None,
    position_filtering: Optional[PositionFiltering] = None,
    event_bridge_enabled: Optional[bool] = None,
    kms_key_enable_geospatial_queries: Optional[bool] = None,
) -> CreateTrackerResponse

Creates a tracker resource in your Amazon Web Services account, which lets you retrieve current and historical location of devices.

Parameters:

  • tracker_name (ResourceName) –

    The name for the tracker resource.

    Requirements:

    • Contain only alphanumeric characters (A-Z, a-z, 0-9) , hyphens (-), periods (.), and underscores (_).

    • Must be a unique tracker resource name.

    • No spaces allowed. For example, ExampleTracker.

  • pricing_plan (Optional[PricingPlan], default: None ) –

    No longer used. If included, the only allowed value is RequestBasedUsage.

  • kms_key_id (Optional[KmsKeyId], default: None ) –

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

  • pricing_plan_data_source (Optional[str], default: None ) –

    This parameter is no longer used.

  • description (Optional[ResourceDescription], default: None ) –

    An optional description for the tracker resource.

  • tags (Optional[TagMap], default: None ) –

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

    Format: "key" : "value"

    Restrictions:

    • Maximum 50 tags per resource

    • Each resource tag must be unique with a maximum of one value.

    • Maximum key length: 128 Unicode characters in UTF-8

    • Maximum value length: 256 Unicode characters in UTF-8

    • Can use alphanumeric characters (A–Z, a–z, 0–9), and the following characters: + - = . _ : / @.

    • Cannot use "aws:" as a prefix for a key.

  • position_filtering (Optional[PositionFiltering], default: None ) –

    Specifies the position filtering for the tracker resource.

    Valid values:

    • TimeBased - Location updates are evaluated against linked geofence collections, but not every location update is stored. If your update frequency is more often than 30 seconds, only one update per 30 seconds is stored for each unique device ID.

    • DistanceBased - If the device has moved less than 30 m (98.4 ft), location updates are ignored. Location updates within this area are neither evaluated against linked geofence collections, nor stored. This helps control costs by reducing the number of geofence evaluations and historical device positions to paginate through. Distance-based filtering can also reduce the effects of GPS noise when displaying device trajectories on a map.

    • AccuracyBased - If the device has moved less than the measured accuracy, location updates are ignored. For example, if two consecutive updates from a device have a horizontal accuracy of 5 m and 10 m, the second update is ignored if the device has moved less than 15 m. Ignored location updates are neither evaluated against linked geofence collections, nor stored. This can reduce the effects of GPS noise when displaying device trajectories on a map, and can help control your costs by reducing the number of geofence evaluations.

    This field is optional. If not specified, the default value is TimeBased.

  • event_bridge_enabled (Optional[bool], default: None ) –

    Whether to enable position UPDATE events from this tracker to be sent to EventBridge.

    You do not need enable this feature to get ENTER and EXIT events for geofences with this tracker. Those events are always sent to EventBridge.

  • kms_key_enable_geospatial_queries (Optional[bool], default: None ) –

    Enables GeospatialQueries for a tracker that uses a Amazon Web Services KMS customer managed key.

    This parameter is only used if you are using a KMS customer managed key.

    If you wish to encrypt your data using your own KMS customer managed key, then the Bounding Polygon Queries feature will be disabled by default. This is because by using this feature, a representation of your device positions will not be encrypted using the your KMS managed key. The exact device position, however; is still encrypted using your managed key.

    You can choose to opt-in to the Bounding Polygon Quseries feature. This is done by setting the KmsKeyEnableGeospatialQueries parameter to true when creating or updating a Tracker.

Raises:

Source code in docs_src/capo_location/_services/async_location.py
async def create_tracker(
    self,
    tracker_name: "capo_location.types.resource_name.ResourceName",
    *,
    config_overrides: Optional[AsyncLocationClientConfig] = None,
    pricing_plan: Optional["capo_location.types.pricing_plan.PricingPlan"] = None,
    kms_key_id: Optional["capo_location.types.kms_key_id.KmsKeyId"] = None,
    pricing_plan_data_source: Optional[str] = None,
    description: Optional[
        "capo_location.types.resource_description.ResourceDescription"
    ] = None,
    tags: Optional["capo_location.types.tag_map.TagMap"] = None,
    position_filtering: Optional[
        "capo_location.types.position_filtering.PositionFiltering"
    ] = None,
    event_bridge_enabled: Optional[bool] = None,
    kms_key_enable_geospatial_queries: Optional[bool] = None,
) -> "capo_location.types.create_tracker_response.CreateTrackerResponse":
    """<p>Creates a tracker resource in your Amazon Web Services account, which lets you retrieve current and historical location of devices.</p>

    Args:
        tracker_name: <p>The name for the tracker resource.</p> <p>Requirements:</p> <ul> <li> <p>Contain only alphanumeric characters (A-Z, a-z, 0-9) , hyphens (-), periods (.), and underscores (_).</p> </li> <li> <p>Must be a unique tracker resource name.</p> </li> <li> <p>No spaces allowed. For example, <code>ExampleTracker</code>.</p> </li> </ul>
        pricing_plan: <p>No longer used. If included, the only allowed value is <code>RequestBasedUsage</code>.</p>
        kms_key_id: <p>A key identifier for an <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html">Amazon Web Services KMS customer managed key</a>. Enter a key ID, key ARN, alias name, or alias ARN.</p>
        pricing_plan_data_source: <p>This parameter is no longer used.</p>
        description: <p>An optional description for the tracker resource.</p>
        tags: <p>Applies one or more tags to the tracker resource. A tag is a key-value pair helps manage, identify, search, and filter your resources by labelling them.</p> <p>Format: <code>"key" : "value"</code> </p> <p>Restrictions:</p> <ul> <li> <p>Maximum 50 tags per resource</p> </li> <li> <p>Each resource tag must be unique with a maximum of one value.</p> </li> <li> <p>Maximum key length: 128 Unicode characters in UTF-8</p> </li> <li> <p>Maximum value length: 256 Unicode characters in UTF-8</p> </li> <li> <p>Can use alphanumeric characters (A–Z, a–z, 0–9), and the following characters: + - = . _ : / @. </p> </li> <li> <p>Cannot use "aws:" as a prefix for a key.</p> </li> </ul>
        position_filtering: <p>Specifies the position filtering for the tracker resource.</p> <p>Valid values:</p> <ul> <li> <p> <code>TimeBased</code> - Location updates are evaluated against linked geofence collections, but not every location update is stored. If your update frequency is more often than 30 seconds, only one update per 30 seconds is stored for each unique device ID. </p> </li> <li> <p> <code>DistanceBased</code> - If the device has moved less than 30 m (98.4 ft), location updates are ignored. Location updates within this area are neither evaluated against linked geofence collections, nor stored. This helps control costs by reducing the number of geofence evaluations and historical device positions to paginate through. Distance-based filtering can also reduce the effects of GPS noise when displaying device trajectories on a map. </p> </li> <li> <p> <code>AccuracyBased</code> - If the device has moved less than the measured accuracy, location updates are ignored. For example, if two consecutive updates from a device have a horizontal accuracy of 5 m and 10 m, the second update is ignored if the device has moved less than 15 m. Ignored location updates are neither evaluated against linked geofence collections, nor stored. This can reduce the effects of GPS noise when displaying device trajectories on a map, and can help control your costs by reducing the number of geofence evaluations. </p> </li> </ul> <p>This field is optional. If not specified, the default value is <code>TimeBased</code>.</p>
        event_bridge_enabled: <p>Whether to enable position <code>UPDATE</code> events from this tracker to be sent to EventBridge.</p> <note> <p>You do not need enable this feature to get <code>ENTER</code> and <code>EXIT</code> events for geofences with this tracker. Those events are always sent to EventBridge.</p> </note>
        kms_key_enable_geospatial_queries: <p>Enables <code>GeospatialQueries</code> for a tracker that uses a <a href="https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html">Amazon Web Services KMS customer managed key</a>.</p> <p>This parameter is only used if you are using a KMS customer managed key.</p> <note> <p>If you wish to encrypt your data using your own KMS customer managed key, then the Bounding Polygon Queries feature will be disabled by default. This is because by using this feature, a representation of your device positions will not be encrypted using the your KMS managed key. The exact device position, however; is still encrypted using your managed key.</p> <p>You can choose to opt-in to the Bounding Polygon Quseries feature. This is done by setting the <code>KmsKeyEnableGeospatialQueries</code> parameter to true when creating or updating a Tracker.</p> </note>

    Raises:
        capo_location.errors.access_denied_exception.AccessDeniedException: <p>The request was denied because of insufficient access or permissions. Check with an administrator to verify your permissions.</p>
        capo_location.errors.conflict_exception.ConflictException: <p>The request was unsuccessful because of a conflict.</p>
        capo_location.errors.internal_server_exception.InternalServerException: <p>The request has failed to process because of an unknown server error, exception, or failure.</p>
        capo_location.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The operation was denied because the request would exceed the maximum <a href="https://docs.aws.amazon.com/location/previous/developerguide/location-quotas.html">quota</a> set for Amazon Location Service.</p>
        capo_location.errors.throttling_exception.ThrottlingException: <p>The request was denied because of request throttling.</p>
        capo_location.errors.validation_exception.ValidationException: <p>The input failed to meet the constraints specified by the AWS service. </p>
        capo_location.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_location.types.create_tracker_request.CreateTrackerRequest]",
    ) -> AsyncOperationResponse[
        "capo_location.types.create_tracker_response.CreateTrackerResponse"
    ]:
        import capo_location._operations.location_service.create_tracker

        (
            output,
            http_response,
        ) = await capo_location._operations.location_service.create_tracker.async_create_tracker(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_location.types.create_tracker_response.CreateTrackerResponse",
    ) -> dict[str, Any]:
        import capo_location.types.create_tracker_response

        return capo_location.types.create_tracker_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateTracker", redact_output=_redact_output),
    )
    input_: capo_location.types.create_tracker_request.CreateTrackerRequest = {
        "tracker_name": tracker_name
    }
    if pricing_plan is not None:
        input_["pricing_plan"] = pricing_plan
    if kms_key_id is not None:
        input_["kms_key_id"] = kms_key_id
    if pricing_plan_data_source is not None:
        input_["pricing_plan_data_source"] = pricing_plan_data_source
    if description is not None:
        input_["description"] = description
    if tags is not None:
        input_["tags"] = tags
    if position_filtering is not None:
        input_["position_filtering"] = position_filtering
    if event_bridge_enabled is not None:
        input_["event_bridge_enabled"] = event_bridge_enabled
    if kms_key_enable_geospatial_queries is not None:
        input_["kms_key_enable_geospatial_queries"] = (
            kms_key_enable_geospatial_queries
        )

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output