Skip to content

tag_resource async

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

Applies tags to an existing Amazon Web Services X-Ray group or sampling rule.

Parameters:

  • resource_arn (AmazonResourceName) –

    The Amazon Resource Number (ARN) of an X-Ray group or sampling rule.

  • tags (TagList) –

    A map that contains one or more tag keys and tag values to attach to an X-Ray group or sampling rule. For more information about ways to use tags, see Tagging Amazon Web Services resources in the Amazon Web Services General Reference.

    The following restrictions apply to tags:

    • Maximum number of user-applied tags per resource: 50

    • Maximum tag key length: 128 Unicode characters

    • Maximum tag value length: 256 Unicode characters

    • Valid values for key and value: a-z, A-Z, 0-9, space, and the following characters: _ . : / = + - and @

    • Tag keys and values are case sensitive.

    • Don't use aws: as a prefix for keys; it's reserved for Amazon Web Services use. You cannot edit or delete system tags.

Raises:

Source code in docs_src/capo_xray/_services/async_x_ray.py
async def tag_resource(
    self,
    resource_arn: "capo_xray.types.amazon_resource_name.AmazonResourceName",
    tags: "capo_xray.types.tag_list.TagList",
    *,
    config_overrides: Optional[AsyncXRayClientConfig] = None,
) -> "capo_xray.types.tag_resource_response.TagResourceResponse":
    """<p>Applies tags to an existing Amazon Web Services X-Ray group or sampling rule.</p>

    Args:
        resource_arn: <p>The Amazon Resource Number (ARN) of an X-Ray group or sampling rule.</p>
        tags: <p>A map that contains one or more tag keys and tag values to attach to an X-Ray group or sampling rule. For more information about ways to use tags, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html">Tagging Amazon Web Services resources</a> in the <i>Amazon Web Services General Reference</i>.</p> <p>The following restrictions apply to tags:</p> <ul> <li> <p>Maximum number of user-applied tags per resource: 50</p> </li> <li> <p>Maximum tag key length: 128 Unicode characters</p> </li> <li> <p>Maximum tag value length: 256 Unicode characters</p> </li> <li> <p>Valid values for key and value: a-z, A-Z, 0-9, space, and the following characters: _ . : / = + - and @</p> </li> <li> <p>Tag keys and values are case sensitive.</p> </li> <li> <p>Don't use <code>aws:</code> as a prefix for keys; it's reserved for Amazon Web Services use. You cannot edit or delete system tags.</p> </li> </ul>

    Raises:
        capo_xray.errors.invalid_request_exception.InvalidRequestException: <p>The request is missing required parameters or has invalid parameters.</p>
        capo_xray.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource was not found. Verify that the name or Amazon Resource Name (ARN) of the resource is correct.</p>
        capo_xray.errors.throttled_exception.ThrottledException: <p>The request exceeds the maximum number of requests per second.</p>
        capo_xray.errors.too_many_tags_exception.TooManyTagsException: <p>You have exceeded the maximum number of tags you can apply to this resource.</p>
        capo_xray.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        (
            output,
            http_response,
        ) = await capo_xray._operations.awsx_ray.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_xray.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