Skip to content

tag_resource async

tag_resource(
    resource_arn: Arn,
    tags: TagList,
    *,
    config_overrides: Optional[AsyncAppMeshClientConfig] = None,
) -> TagResourceOutput

Associates the specified tags to a resource with the specified resourceArn. If existing tags on a resource aren't specified in the request parameters, they aren't changed. When a resource is deleted, the tags associated with that resource are also deleted.

Parameters:

  • resource_arn (Arn) –

    The Amazon Resource Name (ARN) of the resource to add tags to.

  • tags (TagList) –

    The tags to add to the resource. A tag is an array of key-value pairs. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.

Raises:

  • BadRequestException –

    The request syntax was malformed. Check your request syntax and try again.

  • ForbiddenException –

    You don't have permissions to perform this action.

  • InternalServerErrorException –

    The request processing has failed because of an unknown error, exception, or failure.

  • NotFoundException –

    The specified resource doesn't exist. Check your request syntax and try again.

  • ServiceUnavailableException –

    The request has failed due to a temporary failure of the service.

  • TooManyRequestsException –

    The maximum request rate permitted by the App Mesh APIs has been exceeded for your account. For best results, use an increasing or variable sleep interval between requests.

  • TooManyTagsException –

    The request exceeds the maximum allowed number of tags allowed per resource. The current limit is 50 user tags per resource. You must reduce the number of tags in the request. None of the tags in this request were applied.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_app_mesh/_services/async_app_mesh.py
async def tag_resource(
    self,
    resource_arn: "capo_app_mesh.types.arn.Arn",
    tags: "capo_app_mesh.types.tag_list.TagList",
    *,
    config_overrides: Optional[AsyncAppMeshClientConfig] = None,
) -> "capo_app_mesh.types.tag_resource_output.TagResourceOutput":
    """<p>Associates the specified tags to a resource with the specified <code>resourceArn</code>. If existing tags on a resource aren't specified in the request parameters, they aren't changed. When a resource is deleted, the tags associated with that resource are also deleted.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the resource to add tags to.</p>
        tags: <p>The tags to add to the resource. A tag is an array of key-value pairs. Tag keys can have a maximum character length of 128 characters, and tag values can have a maximum length of 256 characters.</p>

    Raises:
        capo_app_mesh.errors.bad_request_exception.BadRequestException: <p>The request syntax was malformed. Check your request syntax and try again.</p>
        capo_app_mesh.errors.forbidden_exception.ForbiddenException: <p>You don't have permissions to perform this action.</p>
        capo_app_mesh.errors.internal_server_error_exception.InternalServerErrorException: <p>The request processing has failed because of an unknown error, exception, or failure.</p>
        capo_app_mesh.errors.not_found_exception.NotFoundException: <p>The specified resource doesn't exist. Check your request syntax and try again.</p>
        capo_app_mesh.errors.service_unavailable_exception.ServiceUnavailableException: <p>The request has failed due to a temporary failure of the service.</p>
        capo_app_mesh.errors.too_many_requests_exception.TooManyRequestsException: <p>The maximum request rate permitted by the App Mesh APIs has been exceeded for your account. For best results, use an increasing or variable sleep interval between requests.</p>
        capo_app_mesh.errors.too_many_tags_exception.TooManyTagsException: <p>The request exceeds the maximum allowed number of tags allowed per resource. The current limit is 50 user tags per resource. You must reduce the number of tags in the request. None of the tags in this request were applied.</p>
        capo_app_mesh.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_app_mesh.types.tag_resource_input.TagResourceInput]",
    ) -> AsyncOperationResponse[
        "capo_app_mesh.types.tag_resource_output.TagResourceOutput"
    ]:
        import capo_app_mesh._operations.app_mesh.tag_resource

        (
            output,
            http_response,
        ) = await capo_app_mesh._operations.app_mesh.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_app_mesh.types.tag_resource_input.TagResourceInput = {
        "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