Image Storage Related InterfacesImage Related Interfaces

Change Image State

PUT/zstack/v1/images/{uuid}/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "changeImageState": {
    "stateEvent": "disable"
  },
  "systemTags": [],
  "userTags": []
}

In the above example, systemTags and userTags fields can be omitted. They are listed to indicate that the body can contain these two fields.

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"changeImageState":{"stateEvent":"disable"}}' \
http://localhost:8080/zstack/v1/images/5a4e7e1f1a653505925da09d0a64936b/actions

Parameter List

Name

Type

Location

Description

Allowed Values

Starting Version

uuid

String

url

Image UUID, uniquely identifies the Image

 

0.6

stateEvent

String

body (contained in params structure)

Image state

  • enable
  • disable

0.6

systemTags (Optional)

List

body

System Tags

 

0.6

userTags (Optional)

List

body

User Tags

 

0.6

API Response

Response Example

{
  "inventory": {
    "uuid": "e4891e6ef3a64ea08ce91ab379a5c856",
    "name": "TinyLinux",
    "url": "http://192.168.1.20/share/images/tinylinux.qcow2",
    "mediaType": "RootVolumeTemplate",
    "platform": "Linux",
    "format": "qcow2",
    "backupStorageRefs": [
      {
        "id": 0.0,
        "imageUuid": "e4891e6ef3a64ea08ce91ab379a5c856",
        "backupStorageUuid": "8bf8f2f17e7c4cca8d684ae5d89eee9e",
        "installPath": "ceph://zs-images/f0b149e053b34c7eb7fe694b182ebffd",
        "status": "Ready"
      }
    ]
  }
}
NameTypeDescriptionStarting Version
errorErrorCodeError code. If not null, the operation failed. This field is null when the operation succeeds. See error0.6
inventoryImageInventorySee inventory0.6

error

NameTypeDescriptionStarting Version
codeStringError code number, a globally unique identifier for the error, for example SYS.1000, HOST.10010.6
descriptionStringBrief description of the error0.6
detailsStringDetailed error information0.6
elaborationStringReserved field, defaults to null0.6
opaqueLinkedHashMapReserved field, defaults to null0.6
causeErrorCodeRoot cause. The source error that triggered the current error. This field is null if there is no original error0.6

inventory

NameTypeDescriptionStarting Version
uuidStringResource UUID, uniquely identifies the resource0.6
nameStringResource name0.6
descriptionStringDetailed description of the resource0.6
stateString 0.6
statusString 0.6
sizeLong 0.6
actualSizeLong 0.6
md5SumString 0.6
urlString 0.6
mediaTypeString 0.6
guestOsTypeString 0.6
typeString 0.6
platformString 0.6
formatString 0.6
systemBoolean 0.6
createDateTimestampCreation time0.6
lastOpDateTimestampLast modification time0.6
backupStorageRefsListSee backupStorageRefs0.6

backupStorageRefs

NameTypeDescriptionStarting Version
imageUuidStringImage UUID0.6
backupStorageUuidStringImage Storage UUID0.6
installPathString 0.6
exportUrlString 0.6
exportMd5SumString 0.6
statusString 0.6
createDateTimestampCreation time0.6
lastOpDateTimestampLast modification time0.6

SDK Examples

Java SDK

ChangeImageStateAction action = new ChangeImageStateAction();
action.uuid = "d6d3cf3feace41ae9fe519fcfdf337e1";
action.stateEvent = "disable";
action.sessionId = "e510317dfbf64f7c9423652cefba6583";
ChangeImageStateAction.Result res = action.call();

Python SDK

ChangeImageStateAction action = ChangeImageStateAction()
action.uuid = "d33d29f7695a4376a9a37a094f89d9f2"
action.stateEvent = "disable"
action.sessionId = "ae3587d0cbf844c2921a97798d4dc37b"
ChangeImageStateAction.Result res = action.call()