updateThingGroup method

Future<UpdateThingGroupResponse> updateThingGroup({
  1. required String thingGroupName,
  2. required ThingGroupProperties thingGroupProperties,
  3. int? expectedVersion,
})

Update a thing group.

May throw InvalidRequestException. May throw VersionConflictException. May throw ThrottlingException. May throw InternalFailureException. May throw ResourceNotFoundException.

Parameter thingGroupName : The thing group to update.

Parameter thingGroupProperties : The thing group properties.

Parameter expectedVersion : The expected version of the thing group. If this does not match the version of the thing group being updated, the update will fail.

Implementation

Future<UpdateThingGroupResponse> updateThingGroup({
  required String thingGroupName,
  required ThingGroupProperties thingGroupProperties,
  int? expectedVersion,
}) async {
  ArgumentError.checkNotNull(thingGroupName, 'thingGroupName');
  _s.validateStringLength(
    'thingGroupName',
    thingGroupName,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(thingGroupProperties, 'thingGroupProperties');
  final $payload = <String, dynamic>{
    'thingGroupProperties': thingGroupProperties,
    if (expectedVersion != null) 'expectedVersion': expectedVersion,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri: '/thing-groups/${Uri.encodeComponent(thingGroupName)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateThingGroupResponse.fromJson(response);
}