ZStack Cloud Platform
Single Server, Free Trial for One Year
POST zstack/v1/zones
Authorization: OAuth the-session-uuid
{ "params": { "name": "TestZone", "description": "test zone" }, "systemTags": [], "userTags": [] }
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \ -X POST -d '{"params":{"name":"TestZone","description":"test zone"}}' \ http://localhost:8080/zstack/v1/zones
Name | Type | Location | Description | Optional Value | Starting Version |
---|---|---|---|---|---|
name | String | body (contained in the params structure) | The resource name. | 0.6 | |
description | String | body (contained in the params structure) | Optional. The detailed description of the resource. | 0.6 | |
resourceUuid | String | body (contained in the params structure) | Optional. The specified resource UUID. | 0.6 | |
systemTags | List | body | Optional. The system tags. | 0.6 | |
userTags | List | body | Optional. The user tags. | 0.6 |
Sample Response
{ "inventory": { "uuid": "0d26522305c34d07b5661ccda62053c0", "name": "TestZone", "description": "Test", "state": "Enabled", "type": "zstack", "createDate": "Jun 7, 2017 9:20:28 PM", "lastOpDate": "Jun 7, 2017 9:20:28 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 |
inventory | ZoneInventory | See inventory. | 0.6 |
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 short 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 |
Name | Type | Description | Starting Version |
---|---|---|---|
uuid | String | The resource UUID. | 0.6 |
name | String | The resource name. | 0.6 |
description | String | The detailed description of the resource. | 0.6 |
state | String | 0.6 | |
type | String | 0.6 | |
createDate | Timestamp | The creation date. | 0.6 |
lastOpDate | Timestamp | The last operation date. | 0.6 |
CreateZoneAction action = new CreateZoneAction(); action.name = "TestZone"; action.description = "test zone"; action.sessionId = "982a09118de64ef7a9051fde346270c5"; CreateZoneAction.Result res = action.call();
CreateZoneAction action = CreateZoneAction() action.name = "TestZone" action.description = "test zone" action.sessionId = "79e260dca17b4bdf9b7d7b4e150883df" CreateZoneAction.Result res = action.call()
DELETE zstack/v1/zones/{uuid}?deleteMode={deleteMode}
Authorization: OAuth the-session-uuid
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth 05fc0a34be264877a9dc8dfb5f90d619" \ -X DELETE http://localhost:8080/zstack/v1/zones/d3483ca440334af3acc09d8631e814c6?deleteMode=Permissive
Name | Type | Location | Description | Optional Value | Starting Version |
---|---|---|---|---|---|
uuid | String | url | The resource UUID. | 0.6 | |
deleteMode | String | body | Optional. The delete mode. Options: Permissive | Enforcing. Default mode: Permissive.
| 0.6 | |
systemTags | List | body | Optional. The system tags. | 0.6 | |
userTags | List | body | Optional. The user tags. | 0.6 |
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" } }
DeleteZoneAction action = new DeleteZoneAction(); action.uuid = "8987020fccd14191a5a89dda6f3db81e"; action.deleteMode = "Permissive"; action.sessionId = "835b1b72c4554a7e92c425ad9eaebc6d"; DeleteZoneAction.Result res = action.call();
DeleteZoneAction action = DeleteZoneAction() action.uuid = "a4bcb439c99a42e197cac90be83e706e" action.deleteMode = "Permissive" action.sessionId = "6eaf02e52c884e378a3730ce4267d83a" DeleteZoneAction.Result res = action.call()