updateThingGroupsForThing method
Updates the groups to which the thing belongs.
Requires permission to access the UpdateThingGroupsForThing action.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
Parameter overrideDynamicGroups :
Override dynamic thing groups with static thing groups when 10-group limit
is reached. If a thing belongs to 10 thing groups, and one or more of
those groups are dynamic thing groups, adding a thing to a static group
removes the thing from the last dynamic group.
Parameter thingGroupsToAdd :
The groups to which the thing will be added.
Parameter thingGroupsToRemove :
The groups from which the thing will be removed.
Parameter thingName :
The thing whose group memberships will be updated.
Implementation
Future<void> updateThingGroupsForThing({
bool? overrideDynamicGroups,
List<String>? thingGroupsToAdd,
List<String>? thingGroupsToRemove,
String? thingName,
}) async {
final $payload = <String, dynamic>{
if (overrideDynamicGroups != null)
'overrideDynamicGroups': overrideDynamicGroups,
if (thingGroupsToAdd != null) 'thingGroupsToAdd': thingGroupsToAdd,
if (thingGroupsToRemove != null)
'thingGroupsToRemove': thingGroupsToRemove,
if (thingName != null) 'thingName': thingName,
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri: '/thing-groups/updateThingGroupsForThing',
exceptionFnMap: _exceptionFns,
);
}