Source:
<code>public static void main(String[] args) throws Exception { String endpoint = System.getProperty("API_ENDPOINT", DefaultQdsConfiguration.API_ENDPOINT); QdsConfiguration configuration = new DefaultQdsConfiguration(endpoint, System.getProperty("API_KEY")); QdsClient client = QdsClientFactory.newClient(configuration); String cluster_label = "example"; List<String> cluster_list = new ArrayList<String>(); cluster_list.add(cluster_label); String cluster_label_clone = "example_clone"; List<String> cluster_list_clone = new ArrayList<String>(); cluster_list_clone.add(cluster_label_clone); try { System.out.println("Creating new cluster..."); ClusterItem clusterItem = client.cluster().create(client.cluster().clusterConfig() .label(cluster_list) .ec2_settings().compute_access_key("ACCESS_KEY") .ec2_settings().compute_secret_key("SECRET_ACCESS_KEY")).invoke().get(); System.out.println("Cluster created with id " + clusterItem.getCluster().getId()); System.out.println("The maximum nodes in the cluster are: " + clusterItem.getCluster().getHadoop_settings().getMax_nodes()); System.out.println(); System.out.println("Editing cluster (changing max nodes)..."); clusterItem = client.cluster().edit( cluster_label, client.cluster().clusterConfig().hadoop_settings().max_nodes(5)).invoke().get(); System.out.println("The maximum nodes now are: " + clusterItem.getCluster().getHadoop_settings().getMax_nodes()); System.out.println(); System.out.println("Cloning cluster..."); ClusterItem clonedClusterItem = client.cluster().clone(cluster_label, client.cluster().clusterConfig() .label(cluster_list_clone) .enable_ganglia_monitoring(true)).invoke().get(); System.out.println("Cloned cluster id is: " + clonedClusterItem.getCluster().getId()); System.out.println(); <START> System.out.println("Deleting cluster..."); <END> client.cluster().delete(cluster_label).invoke().get(); System.out.println("Cluster Deleted"); } finally { client.close(); } }</code><technical_language>delete cloned cluster for completeness sake. in case copy pastes run it</technical_language>

Target:
public static void main(String[] args) throws Exception { String endpoint = System.getProperty("API_ENDPOINT", DefaultQdsConfiguration.API_ENDPOINT); QdsConfiguration configuration = new DefaultQdsConfiguration(endpoint, System.getProperty("API_KEY")); QdsClient client = QdsClientFactory.newClient(configuration); String cluster_label = "example"; List<String> cluster_list = new ArrayList<String>(); cluster_list.add(cluster_label); String cluster_label_clone = "example_clone"; List<String> cluster_list_clone = new ArrayList<String>(); cluster_list_clone.add(cluster_label_clone); try { System.out.println("Creating new cluster..."); ClusterItem clusterItem = client.cluster().create(client.cluster().clusterConfig() .label(cluster_list) .ec2_settings().compute_access_key("ACCESS_KEY") .ec2_settings().compute_secret_key("SECRET_ACCESS_KEY")).invoke().get(); System.out.println("Cluster created with id " + clusterItem.getCluster().getId()); System.out.println("The maximum nodes in the cluster are: " + clusterItem.getCluster().getHadoop_settings().getMax_nodes()); System.out.println(); System.out.println("Editing cluster (changing max nodes)..."); clusterItem = client.cluster().edit( cluster_label, client.cluster().clusterConfig().hadoop_settings().max_nodes(5)).invoke().get(); System.out.println("The maximum nodes now are: " + clusterItem.getCluster().getHadoop_settings().getMax_nodes()); System.out.println(); System.out.println("Cloning cluster..."); ClusterItem clonedClusterItem = client.cluster().clone(cluster_label, client.cluster().clusterConfig() .label(cluster_list_clone) .enable_ganglia_monitoring(true)).invoke().get(); System.out.println("Cloned cluster id is: " + clonedClusterItem.getCluster().getId()); client.cluster().delete(String.valueOf(clonedClusterItem.getCluster().getId())).invoke().get(); System.out.println(); System.out.println("Deleting cluster..."); client.cluster().delete(cluster_label).invoke().get(); System.out.println("Cluster Deleted"); } finally { client.close(); } }