Skip to content

create_geofence_collection async

create_geofence_collection(
    collection_name: ResourceName,
    *,
    config_overrides: Optional[AsyncLocationClientConfig] = None,
    pricing_plan: Optional[PricingPlan] = None,
    pricing_plan_data_source: Optional[str] = None,
    description: Optional[ResourceDescription] = None,
    tags: Optional[TagMap] = None,
    kms_key_id: Optional[KmsKeyId] = None,
) -> CreateGeofenceCollectionResponse

Creates a geofence collection, which manages and stores geofences.

Parameters:

  • collection_name (ResourceName) –

    A custom name for the geofence collection.

    Requirements:

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

    • Must be a unique geofence collection name.

    • No spaces allowed. For example, ExampleGeofenceCollection.

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

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

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

    This parameter is no longer used.

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

    An optional description for the geofence collection.

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

    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.

    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.

  • 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.

Raises:

Source code in docs_src/capo_location/_services/async_location.py
async def create_geofence_collection(
    self,
    collection_name: "capo_location.types.resource_name.ResourceName",
    *,
    config_overrides: Optional[AsyncLocationClientConfig] = None,
    pricing_plan: Optional["capo_location.types.pricing_plan.PricingPlan"] = 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,
    kms_key_id: Optional["capo_location.types.kms_key_id.KmsKeyId"] = None,
) -> "capo_location.types.create_geofence_collection_response.CreateGeofenceCollectionResponse":
    """<p>Creates a geofence collection, which manages and stores geofences.</p>

    Args:
        collection_name: <p>A custom name for the geofence collection.</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 geofence collection name.</p> </li> <li> <p>No spaces allowed. For example, <code>ExampleGeofenceCollection</code>.</p> </li> </ul>
        pricing_plan: <p>No longer used. If included, the only allowed value is <code>RequestBasedUsage</code>.</p>
        pricing_plan_data_source: <p>This parameter is no longer used.</p>
        description: <p>An optional description for the geofence collection.</p>
        tags: <p>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.</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>
        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>

    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_geofence_collection_request.CreateGeofenceCollectionRequest]",
    ) -> AsyncOperationResponse[
        "capo_location.types.create_geofence_collection_response.CreateGeofenceCollectionResponse"
    ]:
        import capo_location._operations.location_service.create_geofence_collection

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

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

        return capo_location.types.create_geofence_collection_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateGeofenceCollection", redact_output=_redact_output),
    )
    input_: capo_location.types.create_geofence_collection_request.CreateGeofenceCollectionRequest = {
        "collection_name": collection_name
    }
    if pricing_plan is not None:
        input_["pricing_plan"] = pricing_plan
    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 kms_key_id is not None:
        input_["kms_key_id"] = kms_key_id

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