createThingGroup method
Create a thing group.
If the ThingGroup that you create has the exact same
attributes as an existing ThingGroup, you will get a 200
success response.
Requires permission to access the CreateThingGroup
action.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw ResourceAlreadyExistsException.
May throw ThrottlingException.
Parameter thingGroupName :
The thing group name to create.
Parameter parentGroupName :
The name of the parent thing group.
Parameter tags :
Metadata which can be used to manage the thing group.
Parameter thingGroupProperties :
The thing group properties.
Implementation
Future<CreateThingGroupResponse> createThingGroup({
required String thingGroupName,
String? parentGroupName,
List<Tag>? tags,
ThingGroupProperties? thingGroupProperties,
}) async {
final $payload = <String, dynamic>{
if (parentGroupName != null) 'parentGroupName': parentGroupName,
if (tags != null) 'tags': tags,
if (thingGroupProperties != null)
'thingGroupProperties': thingGroupProperties,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/thing-groups/${Uri.encodeComponent(thingGroupName)}',
exceptionFnMap: _exceptionFns,
);
return CreateThingGroupResponse.fromJson(response);
}