Image Storage Related InterfacesImage Related Interfaces
Change Image State
Headers
Authorization: OAuth the-session-uuidBody
{
"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/actionsParameter 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 |
| 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"
}
]
}
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | Error code. If not null, the operation failed. This field is null when the operation succeeds. See error | 0.6 |
| inventory | ImageInventory | See inventory | 0.6 |
error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number, a globally unique identifier for the error, for example SYS.1000, HOST.1001 | 0.6 |
| description | String | Brief description of the error | 0.6 |
| details | String | Detailed error information | 0.6 |
| elaboration | String | Reserved field, defaults to null | 0.6 |
| opaque | LinkedHashMap | Reserved field, defaults to null | 0.6 |
| cause | ErrorCode | Root cause. The source error that triggered the current error. This field is null if there is no original error | 0.6 |
inventory
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | Resource UUID, uniquely identifies the resource | 0.6 |
| name | String | Resource name | 0.6 |
| description | String | Detailed description of the resource | 0.6 |
| state | String | 0.6 | |
| status | String | 0.6 | |
| size | Long | 0.6 | |
| actualSize | Long | 0.6 | |
| md5Sum | String | 0.6 | |
| url | String | 0.6 | |
| mediaType | String | 0.6 | |
| guestOsType | String | 0.6 | |
| type | String | 0.6 | |
| platform | String | 0.6 | |
| format | String | 0.6 | |
| system | Boolean | 0.6 | |
| createDate | Timestamp | Creation time | 0.6 |
| lastOpDate | Timestamp | Last modification time | 0.6 |
| backupStorageRefs | List | See backupStorageRefs | 0.6 |
backupStorageRefs
| Name | Type | Description | Starting Version |
|---|---|---|---|
| imageUuid | String | Image UUID | 0.6 |
| backupStorageUuid | String | Image Storage UUID | 0.6 |
| installPath | String | 0.6 | |
| exportUrl | String | 0.6 | |
| exportMd5Sum | String | 0.6 | |
| status | String | 0.6 | |
| createDate | Timestamp | Creation time | 0.6 |
| lastOpDate | Timestamp | Last modification time | 0.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()