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 deleted as well. AWS
Batch resources that support tags are compute environments, jobs, job
definitions, and job queues. ARNs for child jobs of array and multi-node
parallel (MNP) jobs are not supported.
May throw ClientException. May throw ServerException.
Parameter resourceArn
:
The Amazon Resource Name (ARN) of the resource that tags are added to. AWS
Batch resources that support tags are compute environments, jobs, job
definitions, and job queues. ARNs for child jobs of array and multi-node
parallel (MNP) jobs are not supported.
Parameter tags
:
The tags that you apply to the resource to help you categorize and
organize your resources. Each tag consists of a key and an optional value.
For more information, see Tagging
AWS Resources in AWS General Reference.
Implementation
Future<void> tagResource({
required String resourceArn,
required Map<String, String> tags,
}) async {
ArgumentError.checkNotNull(resourceArn, 'resourceArn');
ArgumentError.checkNotNull(tags, 'tags');
final $payload = <String, dynamic>{
'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/v1/tags/${Uri.encodeComponent(resourceArn)}',
exceptionFnMap: _exceptionFns,
);
}