Clear Data Storage Trash

PUT/zstack/v1/primary-storage/{uuid}/storagetrash/actions

Headers

Authorization: OAuth the-session-uuid

Body

{
  "cleanUpStorageTrashOnPrimaryStorage": {
    "force": false
  },
  "systemTags": [],
  "userTags": []
}

In the example above, 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 '{"cleanUpStorageTrashOnPrimaryStorage":{"force":false}}'\
http://localhost:8080/zstack/v1/primary-storage/238259a845cb344bbb5ad7013f91d644/storagetrash/actions

Parameter List

NameTypeLocationDescriptionAllowed ValuesStarting Version
uuidStringurlData Storage UUID, uniquely identifies the resource 4.8.0
force (Optional)booleanbody(contained in the cleanUpStorageTrashOnPrimaryStorage structure)Whether to force cleanup of Data Storage trash 4.8.0
systemTags (Optional)ListbodySystem Tags 4.8.0
userTags (Optional)ListbodyUser Tags 4.8.0

API Response

Response Example

{
  "result": {
    "pool-2": [
      "E92501AC0F30486282317C3412E27307",
      "876D1F78BB35405DBBFEC61226B13FDA"
    ],
    "pool-1": [
      "09f35ca96dfa4f7d8171a6583bbcc4fe",
      "7ae6b23ab27e48b7b7abd25c22f1f91a"
    ]
  },
  "total": 4
}
NameTypeDescriptionStarting Version
successboolean 4.8.0
resultMapCollection of successfully cleaned storage trash4.8.0
totalIntegerNumber of successfully cleaned storage trash items4.8.0
errorErrorCodeError code. If not null, the operation failed. When the operation succeeds, this field is null. See error4.8.0

error

NameTypeDescriptionStarting Version
codeStringError code number, a globally unique identifier for the error, for example SYS.1000, HOST.10014.8.0
descriptionStringBrief description of the error4.8.0
detailsStringDetailed error information4.8.0
elaborationStringReserved field, defaults to null4.8.0
opaqueLinkedHashMapReserved field, defaults to null4.8.0
causeErrorCodeRoot cause, the source error that caused the current error. If there is no original error, this field is null4.8.0

SDK Examples

Java SDK

CleanUpStorageTrashOnPrimaryStorageAction action = new CleanUpStorageTrashOnPrimaryStorageAction();
action.uuid = "238259a845cb344bbb5ad7013f91d644";
action.force = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CleanUpStorageTrashOnPrimaryStorageAction.Result res = action.call();

Python SDK

CleanUpStorageTrashOnPrimaryStorageAction action = new CleanUpStorageTrashOnPrimaryStorageAction();
action.uuid = "238259a845cb344bbb5ad7013f91d644";
action.force = false;
action.sessionId = "b86c9016b4f24953a9edefb53ca0678c";
CleanUpStorageTrashOnPrimaryStorageAction.Result res = action.call();