updateThingGroupsForThing method
Updates the groups to which the thing belongs.
May throw InvalidRequestException. May throw ThrottlingException. May throw InternalFailureException. May throw ResourceNotFoundException.
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 {
_s.validateStringLength(
'thingName',
thingName,
1,
128,
);
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,
);
}