tagResource method
Associates the specified tags to a resource with the specified resourceArn. If existing tags on a resource are not specified in the request parameters, they are not changed. When a resource is deleted, the tags associated with that resource are deleted as well.
May throw ValidationException. May throw ResourceNotFoundException. May throw TooManyTagsException.
Parameter resourceArn
:
The Amazon Resource Name (ARN) that identifies the resource for which to
list the tags. Currently, the supported resources are
ConfigRule
, ConfigurationAggregator
and
AggregatorAuthorization
.
Parameter tags
:
An array of tag object.
Implementation
Future<void> tagResource({
required String resourceArn,
required List<Tag> tags,
}) async {
ArgumentError.checkNotNull(resourceArn, 'resourceArn');
_s.validateStringLength(
'resourceArn',
resourceArn,
1,
1000,
isRequired: true,
);
ArgumentError.checkNotNull(tags, 'tags');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'StarlingDoveService.TagResource'
};
await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ResourceArn': resourceArn,
'Tags': tags,
},
);
}