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/translate.py
| def tag_resource(
self,
resource_arn: "capo_translate.types.resource_arn.ResourceArn",
tags: "capo_translate.types.tag_list.TagList",
*,
config_overrides: Optional[TranslateClientConfig] = 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.
"""
def _handler(
req: "OperationRequest[capo_translate.types.tag_resource_request.TagResourceRequest]",
) -> OperationResponse[
"capo_translate.types.tag_resource_response.TagResourceResponse"
]:
import capo_translate._operations.aws_shine_frontend_service_20170701.tag_resource
output, http_response = (
capo_translate._operations.aws_shine_frontend_service_20170701.tag_resource.tag_resource(
req.options, req.input
)
)
return OperationResponse(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 = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|