删除镜像

DELETE/zstack/v1/images/{uuid}?backupStorageUuids={backupStorageUuids}&deleteMode={deleteMode}

Headers

Authorization: OAuth the-session-uuid

Body

{
  "params": {
    "backupStorageUuids": [
      "2499cd48fc33450a8737efff67ccb920"
    ],
    "deleteMode": "Permissive"
  },
  "systemTags": [],
  "userTags": []
}

上述示例中systemTagsuserTags字段可以省略。列出是为了表示body中可以包含这两个字段。

Curl示例

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth fb8be86094544022ad3e3abd0027b420" \
-X DELETE http://localhost:8080/zstack/v1/images/f92e888c970c4f739d91e59f6dd94b1e?backupStorageUuids=b5a48099da3e3423a8e41bf25b073ce0&deleteMode=Permissive

参数列表

名字类型位置描述可选值起始版本
uuidStringurl镜像的UUID,唯一标示该子资源 0.6
backupStorageUuids (可选)Listbody镜像仓库UUID列表 0.6
deleteMode (可选)Stringbody删除模式(Permissive 或者 Enforcing, 默认 Permissive) 0.6
systemTags (可选)Listbody系统标签 0.6
userTags (可选)Listbody用户标签 0.6

API返回

该API成功时返回一个空的JSON结构**{}**,出错时返回的JSON结构包含一个error字段,例如:

{
  "error": {
    "code": "SYS.1001",
    "description": "A message or a operation timeout",
    "details": "Create VM on KVM timeout after 300s"
  }
}

SDK示例

Java SDK

DeleteImageAction action = new DeleteImageAction();
action.uuid = "22850dff70934ffdaa839a950cb5a470";
action.backupStorageUuids = asList("32974c8955cd4ed79d13458e41490883");
action.deleteMode = "Permissive";
action.sessionId = "517a458b87ca49cf80bf26e6000bc611";
DeleteImageAction.Result res = action.call();

Python SDK

DeleteImageAction action = DeleteImageAction()
action.uuid = "5bbd892e048b48b283e5d2f49a6a4e94"
action.backupStorageUuids = [fd127191bf504e3daf5292800c1ea2d8]
action.deleteMode = "Permissive"
action.sessionId = "cf5cf2689379496aaa4449fd14dc8330"
DeleteImageAction.Result res = action.call()