createGeofenceCollection method

Future<CreateGeofenceCollectionResponse> createGeofenceCollection({
  1. required String collectionName,
  2. String? description,
  3. String? kmsKeyId,
  4. PricingPlan? pricingPlan,
  5. String? pricingPlanDataSource,
  6. Map<String, String>? tags,
})

Creates a geofence collection, which manages and stores geofences.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter collectionName : 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.

Parameter description : An optional description for the geofence collection.

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

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

Parameter pricingPlanDataSource : This parameter is no longer used.

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

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.

Implementation

Future<CreateGeofenceCollectionResponse> createGeofenceCollection({
  required String collectionName,
  String? description,
  String? kmsKeyId,
  PricingPlan? pricingPlan,
  String? pricingPlanDataSource,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'CollectionName': collectionName,
    if (description != null) 'Description': description,
    if (kmsKeyId != null) 'KmsKeyId': kmsKeyId,
    if (pricingPlan != null) 'PricingPlan': pricingPlan.value,
    if (pricingPlanDataSource != null)
      'PricingPlanDataSource': pricingPlanDataSource,
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/geofencing/v0/collections',
    hostPrefix: 'cp.geofencing.',
    exceptionFnMap: _exceptionFns,
  );
  return CreateGeofenceCollectionResponse.fromJson(response);
}