文档

删除集群

更新时间:

接口

接口名称:delete_cluster

参数

参数 类型 是否必需 说明
clusterId String 集群ID

返回值

成功返回 DeleteClusterResponse 对象,对象内容

失败抛出异常和错误,参考 SDK的使用说明 中的异常类型。

例子

下面例子您需要制定集群标识码。

Java 源码:

  1. package demo;
  2. import com.aliyuncs.batchcompute.main.v20151111.*;
  3. import com.aliyuncs.batchcompute.model.v20151111.*;
  4. import com.aliyuncs.exceptions.ClientException;
  5. public class DeleteCluster {
  6. static String ACCESS_KEY_ID = "xxx"; //这里填写您的 AccessKeyId
  7. static String ACCESS_KEY_SECRET = "xxx"; //这里填写您的 AccessKeySecret
  8. static String REGION_ID = "cn-xxx"; //这里填写集群所在 region
  9. static String ClusterId = "cls-xxx" //这里填写需要删除的集群的ID
  10. public static void main(String[] args) {
  11. BatchCompute client = new BatchComputeClient(REGION_ID, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
  12. try{
  13. DeleteClusterResponse response = client.deleteCluster(ClusterId);
  14. //调用成功
  15. System.out.println("RequestId: " + response.getRequestId());
  16. System.out.println("StatusCode: " + response.getStatusCode());
  17. }catch(ClientException e) {
  18. e.printStackTrace();
  19. //调用失败
  20. }
  21. }
  22. }

执行结果:

  1. {
  2. RequestId: null
  3. StatusCode: 204
  4. }