Adds a tag to a resource. Tags are supported only for monitors in Amazon CloudWatch Internet Monitor. You can add a maximum of 50 tags in Internet Monitor.
A minimum of one tag is required for this call. It returns an error if you use the TagResource request with 0 tags.
Parameters:
-
resource_arn
(MonitorArn)
–
The Amazon Resource Name (ARN) for a tag that you add to a resource. Tags are supported only for monitors in Amazon CloudWatch Internet Monitor.
-
tags
(TagMap)
–
Tags that you add to a resource. You can add a maximum of 50 tags in Internet Monitor.
Raises:
Source code in docs_src/capo_internetmonitor/_services/internet_monitor.py
| def tag_resource(
self,
resource_arn: "capo_internetmonitor.types.monitor_arn.MonitorArn",
tags: "capo_internetmonitor.types.tag_map.TagMap",
*,
config_overrides: Optional[InternetMonitorClientConfig] = None,
) -> "capo_internetmonitor.types.tag_resource_output.TagResourceOutput":
"""<p>Adds a tag to a resource. Tags are supported only for monitors in Amazon CloudWatch Internet Monitor. You can add a maximum of 50 tags in Internet Monitor.</p> <p>A minimum of one tag is required for this call. It returns an error if you use the <code>TagResource</code> request with 0 tags.</p>
Args:
resource_arn: <p>The Amazon Resource Name (ARN) for a tag that you add to a resource. Tags are supported only for monitors in Amazon CloudWatch Internet Monitor.</p>
tags: <p>Tags that you add to a resource. You can add a maximum of 50 tags in Internet Monitor.</p>
Raises:
capo_internetmonitor.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient permission to perform this action.</p>
capo_internetmonitor.errors.bad_request_exception.BadRequestException: <p>A bad request was received.</p>
capo_internetmonitor.errors.internal_server_error_exception.InternalServerErrorException: <p>There was an internal server error.</p>
capo_internetmonitor.errors.not_found_exception.NotFoundException: <p>The request specifies something that doesn't exist.</p>
capo_internetmonitor.errors.too_many_requests_exception.TooManyRequestsException: <p>There were too many requests.</p>
capo_internetmonitor.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_internetmonitor.types.tag_resource_input.TagResourceInput]",
) -> OperationResponse[
"capo_internetmonitor.types.tag_resource_output.TagResourceOutput"
]:
import capo_internetmonitor._operations.internet_monitor20210603.tag_resource
output, http_response = (
capo_internetmonitor._operations.internet_monitor20210603.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_internetmonitor.types.tag_resource_input.TagResourceInput = {
"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
|