Garbage Collection Operations
TriggerGCJob
API Request
URLs
PUT zstack/v1/gc-jobs/{uuid}/actionsHeaders
Authorization: OAuth the-session-uuidBody
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.
{
"triggerGCJob": {},
"systemTags": [],
"userTags": []
}
Note: In
the preceding sample, both systemTags and userTags are optional.
These two fields can be included in the body structure.Curl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \
-X PUT -d '{"triggerGCJob":{}}' \
http://localhost:8080/zstack/v1/gc-jobs/1450275537b53cfeba9e6ac79ebadb16/actionsRequest Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
When the API succeeded, an empty JSON structure {} is returned. When the API
failed, the returned JSON structure includes an error field. For
example,
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
Java
SDK
TriggerGCJobAction action = new TriggerGCJobAction();
action.uuid = "ff4eb99f62364bcab4cbcebe4dea7de7";
action.sessionId = "7a51dbf52d5d41b0a877491143b6937a";
TriggerGCJobAction.Result res = action.call();Python
SDK
TriggerGCJobAction action = TriggerGCJobAction()
action.uuid = "a1d1ab14128e4f7398924591915ac65c"
action.sessionId = "6dcc50cb3dc5401b8ce03540a225f623"
TriggerGCJobAction.Result res = action.call()DeleteGCJob
API Request
URLs
DELETE zstack/v1/gc-jobs/{uuid}Headers
Authorization: OAuth the-session-uuidCurl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth ea06449412a24699955ea802430000f3" \
-X DELETE http://localhost:8080/zstack/v1/gc-jobs/3a5d968dd8d743c280888a4973ea71d5Request Parameters
| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
API Response
When the API succeeded, an empty JSON structure {} is returned. When the API
failed, the returned JSON structure includes an error field. For
example,
{
"error": {
"code": "SYS.1001",
"description": "A message or a operation timeout",
"details": "Create VM on KVM timeout after 300s"
}
}SDK Sample
Java
SDK
DeleteGCJobAction action = new DeleteGCJobAction();
action.uuid = "6bac0ebceac44a198609b0019c40a8eb";
action.sessionId = "78e46c7bfe0249fe9613223642222085";
DeleteGCJobAction.Result res = action.call();Python
SDK
DeleteGCJobAction action = DeleteGCJobAction()
action.uuid = "42db77385ebf4768bf105011ec8e6aaf"
action.sessionId = "331167c4de264088862128e5043c5a93"
DeleteGCJobAction.Result res = action.call()QueryGCJob
API Request
URLs
GET zstack/v1/gc-jobs
GET zstack/v1/gc-jobs/{uuid}Headers
Authorization: OAuth the-session-uuidCurl
Sample
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 8a590138fd064e5b8747e9fa75dd6c63" \
-X GET http://localhost:8080/zstack/v1/gc-jobs?q=name=gc&q=state=Enabledcurl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 68ab95870cb4460fb9c82360f9ed64b2" \
-X GET http://localhost:8080/zstack/v1/gc-jobs/b41ea820e0bd47d5a028ddb3eb10bb98Queryable Fields
You can check all queryable fields and resource names that can be queried across tables by using zstack-cli, entering QueryGCJob, and pressing the Tab key.
API Response
Sample
Response
{
"inventories": [
{
"uuid": "c7606f2ed20b4212aa3d1ce4e00acc1c",
"name": "TestGC",
"type": "TimeBased",
"createDate": "Jun 7, 2017 9:21:16 PM",
"lastOpDate": "Jun 7, 2017 9:21:16 PM"
}
]
}| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 0.6 |
| inventories | List | See inventories. | 0.6 |
#error
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | The error code, which is a numbered or alphanumeric code that specifies an error. For example, SYS.1000, HOST.1001. | 0.6 |
| description | String | The brief description of the error. | 0.6 |
| details | String | The details about the error. | 0.6 |
| elaboration | String | The reserved field. Default value: null. | 0.6 |
| opaque | LinkedHashMap | The reserved field. Default value: null. | 0.6 |
| cause | ErrorCode | The root error, which is the associated root cause of the current error. If no root error exists, this parameter is null. | 0.6 |
#inventories
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| name | String | The resource name. | 0.6 |
| runnerClass | String | 0.6 | |
| context | String | 0.6 | |
| status | String | 0.6 | |
| managementNodeUuid | String | 0.6 | |
| type | String | 0.6 | |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
SDK Sample
Java
SDK
QueryGCJobAction action = new QueryGCJobAction();
action.conditions = asList("name=gc","state=Enabled");
action.sessionId = "3b403b588a96471cbee74a19d4a846aa";
QueryGCJobAction.Result res = action.call();Python
SDK
QueryGCJobAction action = QueryGCJobAction()
action.conditions = ["name=gc","state=Enabled"]
action.sessionId = "76af9b84c87f4dcf9aa8f9042a982a6b"
QueryGCJobAction.Result res = action.call()