Skip to content

tag_resource async

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

Associates a specific tag with a resource. A tag is a key-value pair that adds as a metadata to a resource. For more information, see Tagging your resources.

Parameters:

  • resource_arn (ResourceArn) –

    The Amazon Resource Name (ARN) of the given Amazon Translate resource to which you want to associate the tags.

  • tags (TagList) –

    Tags being associated with a specific Amazon Translate resource. There can be a maximum of 50 tags (both existing and pending) associated with a specific resource.

Raises:

  • ConcurrentModificationException –

    Another modification is being made. That modification must complete before you can make your change.

  • InternalServerException –

    An internal server error occurred. Retry your request.

  • InvalidParameterValueException –

    The value of the parameter is not valid. Review the value of the parameter you are using to correct it, and then retry your operation.

  • ResourceNotFoundException –

    The resource you are looking for has not been found. Review the resource you're looking for and see if a different resource will accomplish your needs before retrying the revised request.

  • TooManyTagsException –

    You have added too many tags to this resource. The maximum is 50 tags.

  • UnknownServiceError –

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

Source code in docs_src/capo_translate/_services/async_translate.py
async def tag_resource(
    self,
    resource_arn: "capo_translate.types.resource_arn.ResourceArn",
    tags: "capo_translate.types.tag_list.TagList",
    *,
    config_overrides: Optional[AsyncTranslateClientConfig] = None,
) -> "capo_translate.types.tag_resource_response.TagResourceResponse":
    """<p>Associates a specific tag with a resource. A tag is a key-value pair that adds as a metadata to a resource. For more information, see <a href="https://docs.aws.amazon.com/translate/latest/dg/tagging.html"> Tagging your resources</a>.</p>

    Args:
        resource_arn: <p>The Amazon Resource Name (ARN) of the given Amazon Translate resource to which you want to associate the tags. </p>
        tags: <p>Tags being associated with a specific Amazon Translate resource. There can be a maximum of 50 tags (both existing and pending) associated with a specific resource.</p>

    Raises:
        capo_translate.errors.concurrent_modification_exception.ConcurrentModificationException: <p>Another modification is being made. That modification must complete before you can make your change.</p>
        capo_translate.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_translate.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>The value of the parameter is not valid. Review the value of the parameter you are using to correct it, and then retry your operation.</p>
        capo_translate.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource you are looking for has not been found. Review the resource you're looking for and see if a different resource will accomplish your needs before retrying the revised request.</p>
        capo_translate.errors.too_many_tags_exception.TooManyTagsException: <p>You have added too many tags to this resource. The maximum is 50 tags.</p>
        capo_translate.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

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

        (
            output,
            http_response,
        ) = await capo_translate._operations.aws_shine_frontend_service_20170701.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_translate.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