tagResource method

Future<void> tagResource({
  1. required String resourceArn,
  2. required List<Tag> tags,
})

Add tags to the specified Amazon SNS topic. For an overview, see Amazon SNS Tags in the Amazon SNS Developer Guide.

When you use topic tags, keep the following guidelines in mind:

  • Adding more than 50 tags to a topic isn't recommended.
  • Tags don't have any semantic meaning. Amazon SNS interprets tags as character strings.
  • Tags are case-sensitive.
  • A new tag with a key identical to that of an existing tag overwrites the existing tag.
  • Tagging actions are limited to 10 TPS per Amazon Web Services account, per Amazon Web Services Region. If your application requires a higher throughput, file a technical support request.

May throw AuthorizationErrorException. May throw ConcurrentAccessException. May throw InvalidParameterException. May throw ResourceNotFoundException. May throw StaleTagException. May throw TagLimitExceededException. May throw TagPolicyException.

Parameter resourceArn : The ARN of the topic to which to add tags.

Parameter tags : The tags to be added to the specified topic. A tag consists of a required key and an optional value.

Implementation

Future<void> tagResource({
  required String resourceArn,
  required List<Tag> tags,
}) async {
  final $request = <String, String>{
    'ResourceArn': resourceArn,
    if (tags.isEmpty)
      'Tags': ''
    else
      for (var i1 = 0; i1 < tags.length; i1++)
        for (var e3 in tags[i1].toQueryMap().entries)
          'Tags.member.${i1 + 1}.${e3.key}': e3.value,
  };
  await _protocol.send(
    $request,
    action: 'TagResource',
    version: '2010-03-31',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'TagResourceResult',
  );
}