Query Cluster

GET/zstack/v1/clusters
GET/zstack/v1/clusters/{uuid}

Headers

Authorization: OAuth the-session-uuid

Curl Example

curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 815c808ecfb5461b953544d4bcefea31" \
-X GET http://localhost:8080/zstack/v1/clusters?q=hypervisorType=KVM
curl -H "Content-Type: application/json;charset=UTF-8" \
-H "Authorization: OAuth 663eef55906d4b6e9750f9b4ed65f5f9" \
-X GET http://localhost:8080/zstack/v1/clusters/a8d5ea1ceda34616a26bec2fce3b4d8a

Queryable Fields

Run the CLI command tool, enter QueryCluster and press Tab to view all queryable fields and resource names that can be queried across tables.

API Response

Response Example

{
  "inventories": [
    {
      "name": "cluster1",
      "uuid": "41f3a4eb130347a2af6d7f2e0d21fab0",
      "description": "test",
      "state": "Enabled",
      "hypervisorType": "KVM",
      "createDate": "Jun 7, 2017 9:20:13 PM",
      "lastOpDate": "Jun 7, 2017 9:20:13 PM",
      "zoneUuid": "aad01c8b25774796b2e341ec51a7c9c1",
      "type": "zstack"
    }
  ]
}
NameTypeDescriptionStarting Version
errorErrorCodeError code. If not null, the operation failed. If null, the operation succeeded. See details error0.6
inventoriesListSee details inventories0.6

error

NameTypeDescriptionStarting Version
codeStringError code number, globally unique identifier of the error, e.g. SYS.1000, HOST.10010.6
descriptionStringBrief description of the error0.6
detailsStringDetailed error information0.6
elaborationStringReserved field, default is null0.6
opaqueLinkedHashMapReserved field, default is null0.6
causeErrorCodeRoot cause, the error that caused the current error. If there is no original error, this field is null0.6

inventories

NameTypeDescriptionStarting Version
nameStringResource name0.6
uuidStringResource UUID, uniquely identifies the resource0.6
descriptionStringResource description0.6
stateStringCluster state0.6
hypervisorTypeStringHypervisor type0.6
createDateTimestampCreation time0.6
lastOpDateTimestampLast modification time0.6
zoneUuidStringData Center UUID0.6
typeStringReserved field0.6

SDK Examples

Java SDK

QueryClusterAction action = new QueryClusterAction();
action.conditions = asList("hypervisorType=KVM");
action.sessionId = "3e214b652cc947ea9e1aa256d05752ea";
QueryClusterAction.Result res = action.call();

Python SDK

QueryClusterAction action = QueryClusterAction()
action.conditions = ["hypervisorType=KVM"]
action.sessionId = "ad8f3cd4b5bc4da0a3a91dc8bcbdd18c"
QueryClusterAction.Result res = action.call()