ZStack Cloud Platform
Single Server, Free Trial for One Year
POST zstack/v1/clustersAuthorization: OAuth the-session-uuid{ "params": { "zoneUuid": "d5629a75f0a24280ac669d93d38a7dcd", "name": "cluster1", "description": "test", "hypervisorType": "KVM" }, "systemTags": [], "userTags": [] }
Note: In the above example, systemTags and userTags fields can be omitted. They are listed to indicate that these two fields can be included in the body.curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \ -X POST -d '{"params":{"zoneUuid":"e1fb7d87073b397c857eaeeb16243103","name":"cluster1","description":"test","hypervisorType":"KVM"}}' \ http://localhost:8080/zstack/v1/clusters| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| zoneUuid | String | body (contained in params structure) | Data Center UUID | 0.6 | |
| name | String | body (contained in params structure) | Resource name | 0.6 | |
| description (optional) | String | body (contained in params structure) | Resource description | 0.6 | |
| hypervisorType | String | body (contained in params structure) | Hypervisor type |
| 4.0.0 |
| type (optional) | String | body (contained in params structure) | Reserved field. Do not use. |
| 0.6 |
| resourceUuid (optional) | String | body (contained in params structure) |
| 0.6 | |
| architecture (optional) | String | body (contained in params structure) |
| 4.0.0 | |
| tagUuids (optional) | List | body (contained in params structure) | 4.0.0 | ||
| systemTags (optional) | List | body | System tag | 0.6 | |
| userTags (optional) | List | body | User tag | 0.6 |
{ "inventory": { "name": "cluster1", "uuid": "dc7442bb39674d779d688369329ba845", "description": "test", "state": "Enabled", "hypervisorType": "KVM", "createDate": "Jun 7, 2017 9:20:31 PM", "lastOpDate": "Jun 7, 2017 9:20:31 PM", "zoneUuid": "342b68c14869412984d6327a58b18f9b", "type": "zstack" } }| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | Error code. If not null, the operation failed. If null, the operation succeeded. See details error | 0.6 |
| inventory | ClusterInventory | See details inventory | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number, globally unique identifier of the error, e.g. 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, default is null | 0.6 |
| opaque | LinkedHashMap | Reserved field, default is null | 0.6 |
| cause | ErrorCode | Root cause, the error that caused the current error. If there is no original error, this field is null | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | Resource name | 0.6 |
| uuid | String | Resource UUID, uniquely identifies the resource | 0.6 |
| description | String | Resource description | 0.6 |
| state | String | Cluster state | 0.6 |
| hypervisorType | String | Hypervisor type | 0.6 |
| createDate | Timestamp | Creation time | 0.6 |
| lastOpDate | Timestamp | Last modification time | 0.6 |
| zoneUuid | String | Data Center UUID | 0.6 |
| type | String | Reserved field | 0.6 |
CreateClusterAction action = new CreateClusterAction(); action.zoneUuid = "70fd596da027478eb22ac9357aed23f4"; action.name = "cluster1"; action.description = "test"; action.hypervisorType = "KVM"; action.sessionId = "894477861bcc45488978b584908e4ee3"; CreateClusterAction.Result res = action.call();CreateClusterAction action = CreateClusterAction() action.zoneUuid = "cfe698802c87486986878daa2da7e02f" action.name = "cluster1" action.description = "test" action.hypervisorType = "KVM" action.sessionId = "0664130c5d36414bbb3a7a59ef87ea5a" CreateClusterAction.Result res = action.call()DELETE zstack/v1/clusters/{uuid}?deleteMode={deleteMode}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth d55b1a48ad2348ceb3bea95b407a8bde" \ -X DELETE http://localhost:8080/zstack/v1/clusters/a5bb7e5ca83f41748538d953709ba3c3?deleteMode=Permissive| Name | Type | Location | Description | Allowed Values | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | Resource UUID, uniquely identifies the resource | 0.6 | |
| deleteMode (optional) | String | body | Delete mode | 0.6 | |
| systemTags (optional) | List | body | System tag | 0.6 | |
| userTags (optional) | List | body | User tag | 0.6 |
On success, this API returns an empty JSON structure {}. On error, the returned JSON structure contains an error field, for example:
{ "error": { "code": "SYS.1001", "description": "A message or a operation timeout", "details": "Create VM on KVM timeout after 300s" } } DeleteClusterAction action = new DeleteClusterAction(); action.uuid = "51b6e91ce692487ea582418f52835061"; action.deleteMode = "Permissive"; action.sessionId = "41695ae924854a3abfc1e681e092f744"; DeleteClusterAction.Result res = action.call();DeleteClusterAction action = DeleteClusterAction() action.uuid = "2e9d94bbe3d240d3a660e86a7cd6aff8" action.deleteMode = "Permissive" action.sessionId = "386fba061d404eeb830a772e31fd4faf" DeleteClusterAction.Result res = action.call()GET zstack/v1/clusters GET zstack/v1/clusters/{uuid}Authorization: OAuth the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth 815c808ecfb5461b953544d4bcefea31" \ -X GET http://localhost:8080/zstack/v1/clusters?q=hypervisorType=KVMcurl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth 663eef55906d4b6e9750f9b4ed65f5f9" \ -X GET http://localhost:8080/zstack/v1/clusters/a8d5ea1ceda34616a26bec2fce3b4d8aQueryable 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.
{ "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" } ] }| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | Error code. If not null, the operation failed. If null, the operation succeeded. See details error | 0.6 |
| inventories | List | See details inventories | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| code | String | Error code number, globally unique identifier of the error, e.g. 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, default is null | 0.6 |
| opaque | LinkedHashMap | Reserved field, default is null | 0.6 |
| cause | ErrorCode | Root cause, the error that caused the current error. If there is no original error, this field is null | 0.6 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| name | String | Resource name | 0.6 |
| uuid | String | Resource UUID, uniquely identifies the resource | 0.6 |
| description | String | Resource description | 0.6 |
| state | String | Cluster state | 0.6 |
| hypervisorType | String | Hypervisor type | 0.6 |
| createDate | Timestamp | Creation time | 0.6 |
| lastOpDate | Timestamp | Last modification time | 0.6 |
| zoneUuid | String | Data Center UUID | 0.6 |
| type | String | Reserved field | 0.6 |
QueryClusterAction action = new QueryClusterAction(); action.conditions = asList("hypervisorType=KVM"); action.sessionId = "3e214b652cc947ea9e1aa256d05752ea"; QueryClusterAction.Result res = action.call();QueryClusterAction action = QueryClusterAction() action.conditions = ["hypervisorType=KVM"] action.sessionId = "ad8f3cd4b5bc4da0a3a91dc8bcbdd18c" QueryClusterAction.Result res = action.call()