Deletes an Amazon EKS cluster control plane.
If you have active services and ingress resources in your cluster that are associated with a load balancer, you must delete those services before deleting the cluster so that the load balancers are deleted properly. Otherwise, you can have orphaned resources in your VPC that prevent you from being able to delete the VPC. For more information, see Deleting a cluster in the Amazon EKS User Guide.
If you have managed node groups or Fargate profiles attached to the cluster, you must delete them first. For more information, see DeleteNodgroup and DeleteFargateProfile.
Parameters:
-
name
(String)
–
The name of the cluster to delete.
Raises:
-
ClientException
–
These errors are usually caused by a client action. Actions can include using an action or resource on behalf of an IAM principal that doesn't have permissions to use the action or resource or specifying an identifier that is not valid.
-
InvalidRequestException
–
The request is invalid given the state of the cluster. Check the state of the cluster and the associated operations.
-
ResourceInUseException
–
The specified resource is in use.
-
ResourceNotFoundException
–
The specified resource could not be found. You can view your available clusters with ListClusters. You can view your available managed node groups with ListNodegroups. Amazon EKS clusters and node groups are Amazon Web Services Region specific.
-
ServerException
–
These errors are usually caused by a server-side issue.
-
ServiceUnavailableException
–
The service is unavailable. Back off and retry the operation.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
To delete a cluster
This example command deletes a cluster named devel in your default region.
>>> client.delete_cluster(name='devel')
Source code in docs_src/capo_eks/_services/eks.py
| def delete_cluster(
self,
name: "capo_eks.types.string.String",
*,
config_overrides: Optional[EKSClientConfig] = None,
) -> "capo_eks.types.delete_cluster_response.DeleteClusterResponse":
"""<p>Deletes an Amazon EKS cluster control plane.</p> <p>If you have active services and ingress resources in your cluster that are associated with a load balancer, you must delete those services before deleting the cluster so that the load balancers are deleted properly. Otherwise, you can have orphaned resources in your VPC that prevent you from being able to delete the VPC. For more information, see <a href="https://docs.aws.amazon.com/eks/latest/userguide/delete-cluster.html">Deleting a cluster</a> in the <i>Amazon EKS User Guide</i>.</p> <p>If you have managed node groups or Fargate profiles attached to the cluster, you must delete them first. For more information, see <code>DeleteNodgroup</code> and <code>DeleteFargateProfile</code>.</p>
Args:
name: <p>The name of the cluster to delete.</p>
Raises:
capo_eks.errors.client_exception.ClientException: <p>These errors are usually caused by a client action. Actions can include using an action or resource on behalf of an <a href="https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_terms-and-concepts.html">IAM principal</a> that doesn't have permissions to use the action or resource or specifying an identifier that is not valid.</p>
capo_eks.errors.invalid_request_exception.InvalidRequestException: <p>The request is invalid given the state of the cluster. Check the state of the cluster and the associated operations.</p>
capo_eks.errors.resource_in_use_exception.ResourceInUseException: <p>The specified resource is in use.</p>
capo_eks.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource could not be found. You can view your available clusters with <code>ListClusters</code>. You can view your available managed node groups with <code>ListNodegroups</code>. Amazon EKS clusters and node groups are Amazon Web Services Region specific.</p>
capo_eks.errors.server_exception.ServerException: <p>These errors are usually caused by a server-side issue.</p>
capo_eks.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is unavailable. Back off and retry the operation.</p>
capo_eks.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To delete a cluster
This example command deletes a cluster named `devel` in your default region.
>>> client.delete_cluster(name='devel')
"""
def _handler(
req: "OperationRequest[capo_eks.types.delete_cluster_request.DeleteClusterRequest]",
) -> OperationResponse[
"capo_eks.types.delete_cluster_response.DeleteClusterResponse"
]:
import capo_eks._operations.aws_wesley_frontend.delete_cluster
output, http_response = (
capo_eks._operations.aws_wesley_frontend.delete_cluster.delete_cluster(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DeleteCluster")
)
input_: capo_eks.types.delete_cluster_request.DeleteClusterRequest = {
"name": name
}
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|