Assigns one or more tags (key-value pairs) to the specified CloudWatch resource, such as a service level objective.
Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.
Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.
You can use the TagResource action with an alarm that already has tags. If you specify a new tag key for the alarm, this tag is appended to the list of tags associated with the alarm. If you specify a tag key that is already associated with the alarm, the new tag value that you specify replaces the previous value for that tag.
You can associate as many as 50 tags with a CloudWatch resource.
Parameters:
-
resource_arn
(AmazonResourceName)
–
The Amazon Resource Name (ARN) of the CloudWatch resource that you want to set tags for.
The ARN format of an Application Signals SLO is arn:aws:cloudwatch:Region:account-id:slo:slo-name
For more information about ARN format, see Resource Types Defined by Amazon CloudWatch in the Amazon Web Services General Reference.
-
tags
(TagList)
–
The list of key-value pairs to associate with the alarm.
Raises:
Source code in docs_src/capo_application_signals/_services/async_application_signals.py
| async def tag_resource(
self,
resource_arn: "capo_application_signals.types.amazon_resource_name.AmazonResourceName",
tags: "capo_application_signals.types.tag_list.TagList",
*,
config_overrides: Optional[AsyncApplicationSignalsClientConfig] = None,
) -> "capo_application_signals.types.tag_resource_response.TagResourceResponse":
"""<p>Assigns one or more tags (key-value pairs) to the specified CloudWatch resource, such as a service level objective.</p> <p>Tags can help you organize and categorize your resources. You can also use them to scope user permissions by granting a user permission to access or change only resources with certain tag values.</p> <p>Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.</p> <p>You can use the <code>TagResource</code> action with an alarm that already has tags. If you specify a new tag key for the alarm, this tag is appended to the list of tags associated with the alarm. If you specify a tag key that is already associated with the alarm, the new tag value that you specify replaces the previous value for that tag.</p> <p>You can associate as many as 50 tags with a CloudWatch resource.</p>
Args:
resource_arn: <p>The Amazon Resource Name (ARN) of the CloudWatch resource that you want to set tags for.</p> <p>The ARN format of an Application Signals SLO is <code>arn:aws:cloudwatch:<i>Region</i>:<i>account-id</i>:slo:<i>slo-name</i> </code> </p> <p>For more information about ARN format, see <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/list_amazoncloudwatch.html#amazoncloudwatch-resources-for-iam-policies"> Resource Types Defined by Amazon CloudWatch</a> in the <i>Amazon Web Services General Reference</i>.</p>
tags: <p>The list of key-value pairs to associate with the alarm.</p>
Raises:
capo_application_signals.errors.resource_not_found_exception.ResourceNotFoundException: <p>Resource not found.</p>
capo_application_signals.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>This request exceeds a service quota.</p>
capo_application_signals.errors.throttling_exception.ThrottlingException: <p>The request was throttled because of quota limits.</p>
capo_application_signals.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
async def _handler(
req: "AsyncOperationRequest[capo_application_signals.types.tag_resource_request.TagResourceRequest]",
) -> AsyncOperationResponse[
"capo_application_signals.types.tag_resource_response.TagResourceResponse"
]:
import capo_application_signals._operations.application_signals.tag_resource
(
output,
http_response,
) = await capo_application_signals._operations.application_signals.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_application_signals.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
|