Associates the specified tags to an Amazon EKS resource with the specified resourceArn. If existing tags on a resource are not specified in the request parameters, they aren't changed. When a resource is deleted, the tags associated with that resource are also deleted. Tags that you create for Amazon EKS resources don't propagate to any other resources associated with the cluster. For example, if you tag a cluster with this operation, that tag doesn't automatically propagate to the subnets and nodes associated with the cluster.
Parameters:
-
resource_arn
(String)
–
The Amazon Resource Name (ARN) of the resource to add tags to.
-
tags
(TagMap)
–
Metadata that assists with categorization and organization. Each tag consists of a key and an optional value. You define both. Tags don't propagate to any other cluster or Amazon Web Services resources.
Raises:
-
BadRequestException
–
This exception is thrown if the request contains a semantic error. The precise meaning will depend on the API, and will be documented in the error message.
-
NotFoundException
–
A service resource associated with the request could not be found. Clients should not retry such requests.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Source code in docs_src/capo_eks/_services/eks.py
| def tag_resource(
self,
resource_arn: "capo_eks.types.string.String",
tags: "capo_eks.types.tag_map.TagMap",
*,
config_overrides: Optional[EKSClientConfig] = None,
) -> "capo_eks.types.tag_resource_response.TagResourceResponse":
"""<p>Associates the specified tags to an Amazon EKS resource with the specified <code>resourceArn</code>. If existing tags on a resource are not specified in the request parameters, they aren't changed. When a resource is deleted, the tags associated with that resource are also deleted. Tags that you create for Amazon EKS resources don't propagate to any other resources associated with the cluster. For example, if you tag a cluster with this operation, that tag doesn't automatically propagate to the subnets and nodes associated with the cluster.</p>
Args:
resource_arn: <p>The Amazon Resource Name (ARN) of the resource to add tags to.</p>
tags: <p>Metadata that assists with categorization and organization. Each tag consists of a key and an optional value. You define both. Tags don't propagate to any other cluster or Amazon Web Services resources.</p>
Raises:
capo_eks.errors.bad_request_exception.BadRequestException: <p>This exception is thrown if the request contains a semantic error. The precise meaning will depend on the API, and will be documented in the error message.</p>
capo_eks.errors.not_found_exception.NotFoundException: <p>A service resource associated with the request could not be found. Clients should not retry such requests.</p>
capo_eks.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_eks.types.tag_resource_request.TagResourceRequest]",
) -> OperationResponse[
"capo_eks.types.tag_resource_response.TagResourceResponse"
]:
import capo_eks._operations.aws_wesley_frontend.tag_resource
output, http_response = (
capo_eks._operations.aws_wesley_frontend.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_eks.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
|