updateTagsForResource method
Update the list of tags applied to an AWS Elastic Beanstalk resource. Two
lists can be passed: TagsToAdd
for tags to add or update, and
TagsToRemove
.
Elastic Beanstalk supports tagging of all of its resources. For details about resource tagging, see Tagging Application Resources.
If you create a custom IAM user policy to control permission to this operation, specify one of the following two virtual actions (or both) instead of the API operation name:
- elasticbeanstalk:AddTags
-
Controls permission to call
UpdateTagsForResource
and pass a list of tags to add in theTagsToAdd
parameter. - elasticbeanstalk:RemoveTags
-
Controls permission to call
UpdateTagsForResource
and pass a list of tag keys to remove in theTagsToRemove
parameter.
May throw InsufficientPrivilegesException. May throw OperationInProgressException. May throw TooManyTagsException. May throw ResourceNotFoundException. May throw ResourceTypeNotSupportedException.
Parameter resourceArn
:
The Amazon Resource Name (ARN) of the resouce to be updated.
Must be the ARN of an Elastic Beanstalk resource.
Parameter tagsToAdd
:
A list of tags to add or update. If a key of an existing tag is added, the
tag's value is updated.
Specify at least one of these parameters: TagsToAdd
,
TagsToRemove
.
Parameter tagsToRemove
:
A list of tag keys to remove. If a tag key doesn't exist, it is silently
ignored.
Specify at least one of these parameters: TagsToAdd
,
TagsToRemove
.
Implementation
Future<void> updateTagsForResource({
required String resourceArn,
List<Tag>? tagsToAdd,
List<String>? tagsToRemove,
}) async {
ArgumentError.checkNotNull(resourceArn, 'resourceArn');
final $request = <String, dynamic>{};
$request['ResourceArn'] = resourceArn;
tagsToAdd?.also((arg) => $request['TagsToAdd'] = arg);
tagsToRemove?.also((arg) => $request['TagsToRemove'] = arg);
await _protocol.send(
$request,
action: 'UpdateTagsForResource',
version: '2010-12-01',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
shape: shapes['UpdateTagsForResourceMessage'],
shapes: shapes,
);
}