createDynamicThingGroup method

Future<CreateDynamicThingGroupResponse> createDynamicThingGroup({
  1. required String queryString,
  2. required String thingGroupName,
  3. String? indexName,
  4. String? queryVersion,
  5. List<Tag>? tags,
  6. ThingGroupProperties? thingGroupProperties,
})

Creates a dynamic thing group.

May throw InvalidRequestException. May throw ResourceAlreadyExistsException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw InternalFailureException. May throw InvalidQueryException. May throw LimitExceededException.

Parameter queryString : The dynamic thing group search query string.

See Query Syntax for information about query string syntax.

Parameter thingGroupName : The dynamic thing group name to create.

Parameter indexName : The dynamic thing group index name.

Parameter queryVersion : The dynamic thing group query version.

Parameter tags : Metadata which can be used to manage the dynamic thing group.

Parameter thingGroupProperties : The dynamic thing group properties.

Implementation

Future<CreateDynamicThingGroupResponse> createDynamicThingGroup({
  required String queryString,
  required String thingGroupName,
  String? indexName,
  String? queryVersion,
  List<Tag>? tags,
  ThingGroupProperties? thingGroupProperties,
}) async {
  ArgumentError.checkNotNull(queryString, 'queryString');
  _s.validateStringLength(
    'queryString',
    queryString,
    1,
    1152921504606846976,
    isRequired: true,
  );
  ArgumentError.checkNotNull(thingGroupName, 'thingGroupName');
  _s.validateStringLength(
    'thingGroupName',
    thingGroupName,
    1,
    128,
    isRequired: true,
  );
  _s.validateStringLength(
    'indexName',
    indexName,
    1,
    128,
  );
  final $payload = <String, dynamic>{
    'queryString': queryString,
    if (indexName != null) 'indexName': indexName,
    if (queryVersion != null) 'queryVersion': queryVersion,
    if (tags != null) 'tags': tags,
    if (thingGroupProperties != null)
      'thingGroupProperties': thingGroupProperties,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/dynamic-thing-groups/${Uri.encodeComponent(thingGroupName)}',
    exceptionFnMap: _exceptionFns,
  );
  return CreateDynamicThingGroupResponse.fromJson(response);
}