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 AWS account, per AWS region. If your application requires a higher throughput, file a technical support request.

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

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 {
  ArgumentError.checkNotNull(resourceArn, 'resourceArn');
  _s.validateStringLength(
    'resourceArn',
    resourceArn,
    1,
    1011,
    isRequired: true,
  );
  ArgumentError.checkNotNull(tags, 'tags');
  final $request = <String, dynamic>{};
  $request['ResourceArn'] = resourceArn;
  $request['Tags'] = tags;
  await _protocol.send(
    $request,
    action: 'TagResource',
    version: '2010-03-31',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['TagResourceRequest'],
    shapes: shapes,
    resultWrapper: 'TagResourceResult',
  );
}