删除集群实例

接口

deleteClusterInstance

参数

参数

类型

是否必需

说明

clusterId

String

集群ID

groupName

String

实例组名称

id

String

集群实例ID

返回值

创建成功后返回一个 DeleteClusterInstanceResponse 实例。创建失败后,抛出异常: ClientException

例子

Java 源码:

import com.aliyuncs.batchcompute.main.v20151111.*;
import com.aliyuncs.batchcompute.model.v20151111.*;
import com.aliyuncs.exceptions.ClientException;

public class DeleteClusterInstance {
    static String ACCESS_KEY_ID = "xxx";  //这里填写您的 AccessKeyId
    static String ACCESS_KEY_SECRET = "xxx"; //这里填写您的 AccessKeySecret
    static String REGION_ID = "cn-xxx";   //这里填写 region
    static String ClusterId = "cls-xxx";

    public static void main(String[] args) {
        BatchCompute client = new BatchComputeClient(REGION_ID, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
        try {
            String groupName = "group1";
            String id = "ins-xxx"; //需要删除的实例Id

            DeleteClusterInstanceResponse response = client.deleteClusterInstance(ClusterId, groupName, id);
            //删除请求接受
            System.out.println("RequestId: " + response.getRequestId());
            System.out.println("StatusCode: " + response.getStatusCode());

        } catch (ClientException e) {
            e.printStackTrace();
            //删除失败
        }
    }
}

执行结果:

{
  RequestId: null
  StatusCode: 204
}
  • 注意:这是个异步接口,删除后,相应Group的DesiredVMCount会减1。