Delete an Apache Kafka® cluster

  1. Go to the Clusters page in the console.

  2. Select the cluster you want to delete.

  3. Click Delete in the upper-right corner of the page.

  4. Check the I want to delete cluster [your cluster name] box.

  5. Click Delete.

Use the ClusterService delete method and pass the cluster ID in the cluster_id request parameter.

To find the cluster ID, get a list of clusters in the project.

github-mark-white

View this example on GitHub

import json
import logging

import doublecloud

from doublecloud.kafka.v1.cluster_service_pb2 import DeleteClusterRequest
from doublecloud.kafka.v1.cluster_service_pb2_grpc import ClusterServiceStub

def delete_cluster(sdk, cluster_id):
   cluster_service = sdk.client(ClusterServiceStub)
   return cluster_service.Delete(DeleteClusterRequest(cluster_id=cluster_id))

For more in-depth examples, check out DoubleCloud API Python SDK repository .

func deleteCluster(ctx context.Context, dc *dc.SDK, clusterID string) (*operation.Operation, error) {
   op, err := dc.WrapOperation(dc.Kafka().Cluster().Delete(ctx, &kafka.DeleteClusterRequest{ClusterId: clusterID}))
   if err != nil {
      log.Fatal(err)
   }
   err = op.Wait(ctx)
   return op, err
}

For more in-depth examples, check out DoubleCloud API Go SDK repository .