Skip to content

tag_resource async

tag_resource(
    resource_arn: AmazonResourceName,
    tags: TagList,
    *,
    config_overrides: Optional[AsyncSNSClientConfig] = None,
) -> TagResourceResponse

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.

Parameters:

  • resource_arn (AmazonResourceName) –

    The ARN of the topic to which to add tags.

  • tags (TagList) –

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

Raises:

Source code in docs_src/capo_sns/_services/async_sns.py
async def tag_resource(
    self,
    resource_arn: "capo_sns.types.amazon_resource_name.AmazonResourceName",
    tags: "capo_sns.types.tag_list.TagList",
    *,
    config_overrides: Optional[AsyncSNSClientConfig] = None,
) -> "capo_sns.types.tag_resource_response.TagResourceResponse":
    """<p>Add tags to the specified Amazon SNS topic. For an overview, see <a href="https://docs.aws.amazon.com/sns/latest/dg/sns-tags.html">Amazon SNS Tags</a> in the <i>Amazon SNS Developer Guide</i>.</p> <p>When you use topic tags, keep the following guidelines in mind:</p> <ul> <li> <p>Adding more than 50 tags to a topic isn't recommended.</p> </li> <li> <p>Tags don't have any semantic meaning. Amazon SNS interprets tags as character strings.</p> </li> <li> <p>Tags are case-sensitive.</p> </li> <li> <p>A new tag with a key identical to that of an existing tag overwrites the existing tag.</p> </li> <li> <p>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 <a href="https://console.aws.amazon.com/support/home#/case/create?issueType=technical">technical support request</a>.</p> </li> </ul>

    Args:
        resource_arn: <p>The ARN of the topic to which to add tags.</p>
        tags: <p>The tags to be added to the specified topic. A tag consists of a required key and an optional value.</p>

    Raises:
        capo_sns.errors.authorization_error_exception.AuthorizationErrorException: <p>Indicates that the user has been denied access to the requested resource.</p>
        capo_sns.errors.concurrent_access_exception.ConcurrentAccessException: <p>Can't perform multiple operations on a tag simultaneously. Perform the operations sequentially.</p>
        capo_sns.errors.invalid_parameter_exception.InvalidParameterException: <p>Indicates that a request parameter does not comply with the associated constraints.</p>
        capo_sns.errors.resource_not_found_exception.ResourceNotFoundException: <p>Can’t perform the action on the specified resource. Make sure that the resource exists.</p>
        capo_sns.errors.stale_tag_exception.StaleTagException: <p>A tag has been added to a resource with the same ARN as a deleted resource. Wait a short while and then retry the operation.</p>
        capo_sns.errors.tag_limit_exceeded_exception.TagLimitExceededException: <p>Can't add more than 50 tags to a topic.</p>
        capo_sns.errors.tag_policy_exception.TagPolicyException: <p>The request doesn't comply with the IAM tag policy. Correct your request and then retry it.</p>
        capo_sns.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_sns.types.tag_resource_request.TagResourceRequest]",
    ) -> AsyncOperationResponse[
        "capo_sns.types.tag_resource_response.TagResourceResponse"
    ]:
        import capo_sns._operations.amazon_simple_notification_service.tag_resource

        (
            output,
            http_response,
        ) = await capo_sns._operations.amazon_simple_notification_service.tag_resource.async_tag_resource(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("TagResource")
    )
    input_: capo_sns.types.tag_resource_request.TagResourceRequest = {
        "resource_arn": resource_arn,
        "tags": tags,
    }

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output