Add one or more tags (keys and values) to a specified resource. A tag is a label that you optionally define and associate with a resource. Tags can help you categorize and manage resources in different ways, such as by purpose, owner, environment, or other criteria. A resource can have as many as 50 tags.
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 resource that you want to add one or more tags to.
-
tags
(TagList)
–
A list of the tags that you want to add to the resource. 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_sesv2/_services/se_sv2.py
| def tag_resource(
self,
resource_arn: "capo_sesv2.types.amazon_resource_name.AmazonResourceName",
tags: "capo_sesv2.types.tag_list.TagList",
*,
config_overrides: Optional[SESv2ClientConfig] = None,
) -> "capo_sesv2.types.tag_resource_response.TagResourceResponse":
"""<p>Add one or more tags (keys and values) to a specified resource. A <i>tag</i> is a label that you optionally define and associate with a resource. Tags can help you categorize and manage resources in different ways, such as by purpose, owner, environment, or other criteria. A resource can have as many as 50 tags.</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 resource that you want to add one or more tags to.</p>
tags: <p>A list of the tags that you want to add to the resource. 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_sesv2.errors.bad_request_exception.BadRequestException: <p>The input you provided is invalid.</p>
capo_sesv2.errors.concurrent_modification_exception.ConcurrentModificationException: <p>The resource is being modified by another operation or thread.</p>
capo_sesv2.errors.not_found_exception.NotFoundException: <p>The resource you attempted to access doesn't exist.</p>
capo_sesv2.errors.too_many_requests_exception.TooManyRequestsException: <p>Too many requests have been made to the operation.</p>
capo_sesv2.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_sesv2.types.tag_resource_request.TagResourceRequest]",
) -> OperationResponse[
"capo_sesv2.types.tag_resource_response.TagResourceResponse"
]:
import capo_sesv2._operations.simple_email_service_v2.tag_resource
output, http_response = (
capo_sesv2._operations.simple_email_service_v2.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_sesv2.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
|