删除镜像

接口

deleteImage

参数

参数 类型 是否必需 说明
imageId String 镜像ID

返回值

调用成功后返回一个 DeleteImageResponse 实例。调用失败后,抛出异常: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 DeleteImage {
  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. public static void main(String[] args) {
  9. BatchCompute client = new BatchComputeClient(REGION_ID, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
  10. try{
  11. DeleteImageResponse response = client.deleteImage("img-6kie8e832lnov8gg50k00b");
  12. //
  13. System.out.println("RequestId: " + response.getRequestId());
  14. System.out.println("StatusCode: " + response.getStatusCode());
  15. }catch(ClientException e) {
  16. e.printStackTrace();
  17. //调用失败
  18. }
  19. }
  20. }

执行结果:

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