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 in Amazon Pinpoint. 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_pinpoint_email/_services/async_pinpoint_email.py
| async def tag_resource(
self,
resource_arn: "capo_pinpoint_email.types.amazon_resource_name.AmazonResourceName",
tags: "capo_pinpoint_email.types.tag_list.TagList",
*,
config_overrides: Optional[AsyncPinpointEmailClientConfig] = None,
) -> "capo_pinpoint_email.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 in Amazon Pinpoint. 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_pinpoint_email.errors.bad_request_exception.BadRequestException: <p>The input you provided is invalid.</p>
capo_pinpoint_email.errors.concurrent_modification_exception.ConcurrentModificationException: <p>The resource is being modified by another operation or thread.</p>
capo_pinpoint_email.errors.not_found_exception.NotFoundException: <p>The resource you attempted to access doesn't exist.</p>
capo_pinpoint_email.errors.too_many_requests_exception.TooManyRequestsException: <p>Too many requests have been made to the operation.</p>
capo_pinpoint_email.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_pinpoint_email.types.tag_resource_request.TagResourceRequest]",
) -> AsyncOperationResponse[
"capo_pinpoint_email.types.tag_resource_response.TagResourceResponse"
]:
import capo_pinpoint_email._operations.amazon_pinpoint_email_service.tag_resource
(
output,
http_response,
) = await capo_pinpoint_email._operations.amazon_pinpoint_email_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_pinpoint_email.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
|