Skip to content

tag_resource async

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

Add one or more tags (keys and values) to a specified application. A tag is a label that you optionally define and associate with an application. Tags can help you categorize and manage application in different ways, such as by purpose, owner, environment, or other criteria.

Each tag consists of a required tag key and an associated tag value, both of which you define. A tag key is a general label that acts as a category for more specific tag values. A tag value acts as a descriptor within a tag key.

Parameters:

  • resource_arn (AmazonResourceName) –

    The Amazon Resource Name (ARN) of the application that you want to add one or more tags to.

  • tags (TagList) –

    A list of tags that to add to the application. A tag consists of a required tag key (Key) and an associated tag value (Value). The maximum length of a tag key is 128 characters. The maximum length of a tag value is 256 characters.

Raises:

Source code in docs_src/capo_application_insights/_services/async_application_insights.py
async def tag_resource(
    self,
    resource_arn: "capo_application_insights.types.amazon_resource_name.AmazonResourceName",
    tags: "capo_application_insights.types.tag_list.TagList",
    *,
    config_overrides: Optional[AsyncApplicationInsightsClientConfig] = None,
) -> "capo_application_insights.types.tag_resource_response.TagResourceResponse":
    """<p>Add one or more tags (keys and values) to a specified application. A <i>tag</i> is a label that you optionally define and associate with an application. Tags can help you categorize and manage application in different ways, such as by purpose, owner, environment, or other criteria. </p> <p>Each tag consists of a required <i>tag key</i> and an associated <i>tag value</i>, both of which you define. A tag key is a general label that acts as a category for more specific tag values. A tag value acts as a descriptor within a tag key.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the application that you want to add one or more tags to.</p>
        tags: <p>A list of tags that to add to the application. A tag consists of a required tag key (<code>Key</code>) and an associated tag value (<code>Value</code>). The maximum length of a tag key is 128 characters. The maximum length of a tag value is 256 characters.</p>

    Raises:
        capo_application_insights.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource does not exist in the customer account.</p>
        capo_application_insights.errors.too_many_tags_exception.TooManyTagsException: <p>The number of the provided tags is beyond the limit, or the number of total tags you are trying to attach to the specified resource exceeds the limit.</p>
        capo_application_insights.errors.validation_exception.ValidationException: <p>The parameter is not valid.</p>
        capo_application_insights.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        (
            output,
            http_response,
        ) = await capo_application_insights._operations.ec2_windows_barley_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_application_insights.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