addTagsToResource method

Future<TagListMessage> addTagsToResource({
  1. required String resourceName,
  2. required List<Tag> tags,
})

Adds up to 50 cost allocation tags to the named resource. A cost allocation tag is a key-value pair where the key and value are case-sensitive. You can use cost allocation tags to categorize and track your AWS costs.

When you apply tags to your ElastiCache resources, AWS generates a cost allocation report as a comma-separated value (CSV) file with your usage and costs aggregated by your tags. You can apply tags that represent business categories (such as cost centers, application names, or owners) to organize your costs across multiple services. For more information, see Using Cost Allocation Tags in Amazon ElastiCache in the ElastiCache User Guide.

May throw CacheClusterNotFoundFault. May throw SnapshotNotFoundFault. May throw TagQuotaPerResourceExceeded. May throw InvalidARNFault.

Parameter resourceName : The Amazon Resource Name (ARN) of the resource to which the tags are to be added, for example arn:aws:elasticache:us-west-2:0123456789:cluster:myCluster or arn:aws:elasticache:us-west-2:0123456789:snapshot:mySnapshot. ElastiCache resources are cluster and snapshot.

For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces.

Parameter tags : A list of cost allocation tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value.

Implementation

Future<TagListMessage> addTagsToResource({
  required String resourceName,
  required List<Tag> tags,
}) async {
  ArgumentError.checkNotNull(resourceName, 'resourceName');
  ArgumentError.checkNotNull(tags, 'tags');
  final $request = <String, dynamic>{};
  $request['ResourceName'] = resourceName;
  $request['Tags'] = tags;
  final $result = await _protocol.send(
    $request,
    action: 'AddTagsToResource',
    version: '2015-02-02',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['AddTagsToResourceMessage'],
    shapes: shapes,
    resultWrapper: 'AddTagsToResourceResult',
  );
  return TagListMessage.fromXml($result);
}