tagResource method

Future<void> tagResource({
  1. required String resourceArn,
  2. required List<Tag> tags,
})

Creates a tag for the specified resource.

May throw InvalidRequestException. May throw ResourceAlreadyExistsException. May throw ThrottlingException. May throw InternalFailureException.

Parameter resourceArn : The Amazon Resource Name (ARN) of the resource whose tags are returned.

Parameter tags : A list of tags to add to the resource.>

Implementation

Future<void> tagResource({
  required String resourceArn,
  required List<Tag> tags,
}) async {
  ArgumentError.checkNotNull(resourceArn, 'resourceArn');
  _s.validateStringLength(
    'resourceArn',
    resourceArn,
    1,
    2048,
    isRequired: true,
  );
  ArgumentError.checkNotNull(tags, 'tags');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'IotThingsGraphFrontEndService.TagResource'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'resourceArn': resourceArn,
      'tags': tags,
    },
  );
}