全部产品

删除集群实例

更新时间:2018-11-18 12:15:52

接口

deleteClusterInstance

参数

参数 类型 是否必需 说明
clusterId String 集群ID
groupName String 实例组名称
id String 集群实例ID

返回值

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

例子

Java 源码:

  1. import com.aliyuncs.batchcompute.main.v20151111.*;
  2. import com.aliyuncs.batchcompute.model.v20151111.*;
  3. import com.aliyuncs.exceptions.ClientException;
  4. public class DeleteClusterInstance {
  5. static String ACCESS_KEY_ID = "xxx"; //这里填写您的 AccessKeyId
  6. static String ACCESS_KEY_SECRET = "xxx"; //这里填写您的 AccessKeySecret
  7. static String REGION_ID = "cn-xxx"; //这里填写 region
  8. static String ClusterId = "cls-xxx";
  9. public static void main(String[] args) {
  10. BatchCompute client = new BatchComputeClient(REGION_ID, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
  11. try {
  12. String groupName = "group1";
  13. String id = "ins-xxx"; //需要删除的实例Id
  14. DeleteClusterInstanceResponse response = client.deleteClusterInstance(ClusterId, groupName, id);
  15. //删除请求接受
  16. System.out.println("RequestId: " + response.getRequestId());
  17. System.out.println("StatusCode: " + response.getStatusCode());
  18. } catch (ClientException e) {
  19. e.printStackTrace();
  20. //删除失败
  21. }
  22. }
  23. }

执行结果:

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