tagResource method

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

Associates the specified tags to a resource with the specified resourceArn. If existing tags on a resource aren't specified in the request parameters, they aren't changed. When a resource is deleted, the tags associated with that resource are also deleted.

May throw BadRequestException. May throw ForbiddenException. May throw InternalServerErrorException. May throw NotFoundException. May throw ServiceUnavailableException. May throw TooManyRequestsException. May throw TooManyTagsException.

Parameter resourceArn : The Amazon Resource Name (ARN) of the resource to add tags to.

Parameter tags : The tags to add to the resource. A tag is an array of key-value pairs. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

Implementation

Future<void> tagResource({
  required String resourceArn,
  required List<TagRef> tags,
}) async {
  final $query = <String, List<String>>{
    'resourceArn': [resourceArn],
  };
  final $payload = <String, dynamic>{
    'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PUT',
    requestUri: '/v20190125/tag',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
}