Adds the specified tags to the specified Direct Connect resource. Each resource can have a maximum of 50 tags.
Each tag consists of a key and an optional value. If a tag with the same key is already associated with the resource, this action updates its value.
Parameters:
-
resource_arn
(ResourceArn)
–
The Amazon Resource Name (ARN) of the resource.
-
tags
(TagList)
–
Raises:
Source code in docs_src/capo_direct_connect/_services/direct_connect.py
| def tag_resource(
self,
resource_arn: "capo_direct_connect.types.resource_arn.ResourceArn",
tags: "capo_direct_connect.types.tag_list.TagList",
*,
config_overrides: Optional[DirectConnectClientConfig] = None,
) -> "capo_direct_connect.types.tag_resource_response.TagResourceResponse":
"""<p>Adds the specified tags to the specified Direct Connect resource. Each resource can have a maximum of 50 tags.</p> <p>Each tag consists of a key and an optional value. If a tag with the same key is already associated with the resource, this action updates its value.</p>
Args:
resource_arn: <p>The Amazon Resource Name (ARN) of the resource.</p>
tags: <p>The tags to add.</p>
Raises:
capo_direct_connect.errors.direct_connect_client_exception.DirectConnectClientException: <p>One or more parameters are not valid.</p>
capo_direct_connect.errors.direct_connect_server_exception.DirectConnectServerException: <p>A server-side error occurred.</p>
capo_direct_connect.errors.duplicate_tag_keys_exception.DuplicateTagKeysException: <p>A tag key was specified more than once.</p>
capo_direct_connect.errors.too_many_tags_exception.TooManyTagsException: <p>You have reached the limit on the number of tags that can be assigned.</p>
capo_direct_connect.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_direct_connect.types.tag_resource_request.TagResourceRequest]",
) -> OperationResponse[
"capo_direct_connect.types.tag_resource_response.TagResourceResponse"
]:
import capo_direct_connect._operations.overture_service.tag_resource
output, http_response = (
capo_direct_connect._operations.overture_service.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_direct_connect.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
|