ZStack Cloud Platform
Single Server, Free Trial for One Year
POST zstack/v1/billings/pricesAuthorization: OAuth the-session-uuid{ "params": { "resourceName": "cpu", "timeUnit": "s", "price": 100.0, "dateInLong": 0.0 }, "systemTags": [], "userTags": [] }
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth cc882c434d65428091449452ab5eb2e3" \ -X POST -d '{"params":{"resourceName":"cpu","timeUnit":"s","price":100.0,"dateInLong":0.0}}' \ http://localhost:8080/zstack/v1/billings/prices| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| resourceName | String | body (contained in the params structure) | The resource name. |
| 0.6 |
| resourceUnit | String | body (contained in the params structure) | Optional. The billing unit of the resource. | This parameter can be decided according to resourceName. | 0.6 |
| timeUnit | String | body (contained in the params structure) | The billing time unit. | 0.6 | |
| price | double | body (contained in the params structure) | The unit price. | 0.6 | |
| accountUuid | String | body (contained in the params structure) | Optional. The account UUID. | 0.6 | |
| dateInLong | Long | body (contained in the params structure) | Optional. The long-integer time. | 0.6 | |
| tableUuid | String | body (contained in the params structure) | Optional. The price table UUID. | 3.7.2 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
Note: gpuOfferingUuid::UUIDgpuOfferingUuid::634b48a7bca139d9944a0f95b0c2dddfpriceUserConfig::xxx. Here, xxx must be a JSON string.{ "inventory": { "uuid": "437ade61b17e4c658844fdacfb0fc6de", "resourceName": "Volume", "resourceUnit": "1", "timeUnit": "s", "price": 2.0 } }| 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 | PriceInventory | 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 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| resourceName | String | The resource name. | 0.6 |
| resourceUnit | String | The billing unit of the resource. | 0.6 |
| timeUnit | String | The billing time unit. | 0.6 |
| price | Double | The unit price. | 0.6 |
| dateInLong | Long | The long-integer time. | 0.6 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| tableUuid | String | The price table UUID. | 3.7.1 |
| pciDeviceOfferings | List | See pciDeviceOfferings. | 2.4 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| priceUuid | String | 2.4 | |
| pciDeviceOfferingUuid | String | 2.4 | |
| createDate | Timestamp | The creation date. | 2.4 |
| lastOpDate | Timestamp | The last operation date. | 2.4 |
CreateResourcePriceAction action = new CreateResourcePriceAction(); action.resourceName = "cpu"; action.timeUnit = "s"; action.price = 100.0; action.dateInLong = 0.0; action.sessionId = "1360cf066fd547b9ae2d8f32beba717f"; CreateResourcePriceAction.Result res = action.call();CreateResourcePriceAction action = CreateResourcePriceAction() action.resourceName = "cpu" action.timeUnit = "s" action.price = 100.0 action.dateInLong = 0.0 action.sessionId = "47ca95d22d8645ef8aef8dd0110cbd92" CreateResourcePriceAction.Result res = action.call()DELETE zstack/v1/billings/prices/{uuid}?deleteMode={deleteMode}OAuth: the-session-uuidcurl -H "Content-Type: application/json;charset=UTF-8" \ -H "OAuth: 5332b02080a141cc961457ad3b090fe4" \ -X DELETE http://localhost:8080/zstack/v1/billings/prices/a5c5bd6198824d89894cdd10969843ffdeleteMode=Permissive| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource UUID. | 0.6 | |
| deleteMode | String | url | Optional. The delete mode. | 0.6 | |
| systemTags | List | body | Optional. The system tags. | 0.6 | |
| userTags | List | body | Optional. The user tags. | 0.6 |
{ "error": { "code": "SYS.1001", "description": "A message or a operation timeout", "details": "Create VM on KVM timeout after 300s" } }DeleteResourcePriceAction action = new DeleteResourcePriceAction(); action.uuid = "6a7c1ad952894d5aa2cc6b1add3062ca"; action.deleteMode = "Permissive"; action.sessionId = "e3ffecc95a5b4bcca5ce212826a14ee0"; DeleteResourcePriceAction.Result res = action.call();DeleteResourcePriceAction action = DeleteResourcePriceAction() action.uuid = "14c4eef2f36e4716a279777e503ab772" action.deleteMode = "Permissive" action.sessionId = "fcbca45ec9454200b1d080b0268c17d9" DeleteResourcePriceAction.Result res = action.call()PUT zstack/v1/billings/prices/{uuid}/actionsAuthorization: OAuth the-session-uuid{ "updateResourcePrice": { "setEndDateInLongBaseOnCurrentTime": false }, "systemTags": [], "userTags": [] }
Note: In the preceding sample, both systemTags and userTags are optional. These two fields can be included in the body structure.curl -H "Content-Type: application/json;charset=UTF-8" \ -H "Authorization: OAuth b86c9016b4f24953a9edefb53ca0678c" \ -X PUT -d '{"updateResourcePrice":{"setEndDateInLongBaseOnCurrentTime":false}}' http://localhost:8080/zstack/v1/billings/prices/bed31eb3ba76325ba6a1cef1a64c97a3/actions| Name | Type | Location | Description | Optional Value | Starting Version |
|---|---|---|---|---|---|
| uuid | String | url | The resource price UUID. | 3.7.2 | |
| endDateInLong | Long | body (contained in the updateResourcePrice structure) | Optional. The resource price expiration date. | 3.7.2 | |
| setEndDateInLongBaseOnCurrentTime | boolean | body (contained in the updateResourcePrice structure) | Optional. Sets the resource price expiration date to the current time. | 3.7.2 | |
| systemTags | List | body | Optional. The system tags. | 3.7.2 | |
| userTags | List | body | Optional. The user tags. | 3.7.2 |
{ "inventory": { "uuid": "d7d2b639707c3e158f9f94cdfff8dc88", "resourceName": "Volume", "resourceUnit": "1", "timeUnit": "s", "price": 2.0, "dateInLong": 1.510669257141E12, "endDateInLong": 1.511029257141E12 } }| Name | Type | Description | Starting Version |
|---|---|---|---|
| error | ErrorCode | The error code. If not null, the operation fails, or vice versa. For more information, see error. | 3.7.2 |
| inventory | PriceInventory | See inventory. | 3.7.2 |
| 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 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| uuid | String | The resource UUID. | 0.6 |
| resourceName | String | The resource name. | 0.6 |
| resourceUnit | String | The billing unit of the resource. | 0.6 |
| timeUnit | String | The billing time unit. | 0.6 |
| price | Double | The unit price. | 0.6 |
| dateInLong | Long | The long-integer time. | 0.6 |
| createDate | Timestamp | The creation date. | 0.6 |
| lastOpDate | Timestamp | The last operation date. | 0.6 |
| tableUuid | String | The price table UUID. | 3.7.2 |
| pciDeviceOfferings | List | See pciDeviceOfferings. | 2.4 |
| Name | Type | Description | Starting Version |
|---|---|---|---|
| priceUuid | String | 2.4 | |
| pciDeviceOfferingUuid | String | 2.4 | |
| createDate | Timestamp | The creation date. | 2.4 |
| lastOpDate | Timestamp | The last operation date. | 2.4 |
UpdateResourcePriceAction action = new UpdateResourcePriceAction(); action.uuid = "bed31eb3ba76325ba6a1cef1a64c97a3"; action.setEndDateInLongBaseOnCurrentTime = false; action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"; UpdateResourcePriceAction.Result res = action.call();UpdateResourcePriceAction action = UpdateResourcePriceAction() action.uuid = "bed31eb3ba76325ba6a1cef1a64c97a3" action.setEndDateInLongBaseOnCurrentTime = false action.sessionId = "b86c9016b4f24953a9edefb53ca0678c" UpdateResourcePriceAction.Result res = action.call()