tagResource method
Adds one or more tags to the specified resource.
Currently, you can attach tags to the following resources in Organizations.
- Amazon Web Services account
- Organization root
- Organizational unit (OU)
- Policy (any type)
May throw AccessDeniedException.
May throw AWSOrganizationsNotInUseException.
May throw ConcurrentModificationException.
May throw ConstraintViolationException.
May throw InvalidInputException.
May throw ServiceException.
May throw TargetNotFoundException.
May throw TooManyRequestsException.
Parameter resourceId :
The ID of the resource to add a tag to.
You can specify any of the following taggable resources.
- Amazon Web Services account – specify the account ID number.
-
Organizational unit – specify the OU ID that begins with
ou-and looks similar to:ou-1a2b-34uvwxyz -
Root – specify the root ID that begins with
r-and looks similar to:r-1a2b -
Policy – specify the policy ID that begins with
p-andlooks similar to:p-12abcdefg3
Parameter tags :
A list of tags to add to the specified resource.
For each tag in the list, you must specify both a tag key and a value. The
value can be an empty string, but you can't set it to null.
Implementation
Future<void> tagResource({
required String resourceId,
required List<Tag> tags,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSOrganizationsV20161128.TagResource'
};
await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ResourceId': resourceId,
'Tags': tags,
},
);
}