tagResource method
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 NotFoundException. May throw BadRequestException. May throw TooManyTagsException. May throw TooManyRequestsException. May throw ForbiddenException. May throw ServiceUnavailableException. May throw InternalServerErrorException.
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 {
ArgumentError.checkNotNull(resourceArn, 'resourceArn');
ArgumentError.checkNotNull(tags, 'tags');
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,
);
}