CreateResourcePrice

API Request

URLs
POST zstack/v1/billings/prices
Headers
Authorization: OAuth the-session-uuid
Body
{   "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 Sample
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
Request Parameters
Name Type Location Description Optional Value Starting Version
resourceName String body (contained in the params structure) The resource name.
  • cpu
  • memory
  • rootvolume
  • datavolume
  • snapshot
  • gpu
  • pubIpVmNicBandwidthOut
  • pubIpVmNicBandwidthIn
  • pubIpVipBandwidthOut
  • pubIpVipBandwidthIn
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:
  • When you create a resource price in ZStack Cloud, you can specify a PCI device by adding the PCI device option to SystemTags.
    • Format of the PCI device option: gpuOfferingUuid::UUID
    • Example: gpuOfferingUuid::634b48a7bca139d9944a0f95b0c2dddf
  • When you create a resource price in ZStack Cloud, you can define the resource billing type by adding the priceUserConfig option to SystemTags.
    • Format of the priceUserConfig option: priceUserConfig::xxx. Here, xxx must be a JSON string.

API Response

Sample Response
{   "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
#error
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
#inventory
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
#pciDeviceOfferings
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

SDK Sample

Java SDK
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();
Python SDK
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()

DeleteResourcePrice

API Request

URLs
DELETE zstack/v1/billings/prices/{uuid}?deleteMode={deleteMode}
Headers
OAuth: the-session-uuid
Curl Sample
curl -H "Content-Type: application/json;charset=UTF-8" \ -H "OAuth: 5332b02080a141cc961457ad3b090fe4" \ -X DELETE http://localhost:8080/zstack/v1/billings/prices/a5c5bd6198824d89894cdd10969843ffdeleteMode=Permissive
Request Parameters
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

API Response

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"     } }

SDK Sample

Java SDK
DeleteResourcePriceAction action = new DeleteResourcePriceAction(); action.uuid = "6a7c1ad952894d5aa2cc6b1add3062ca"; action.deleteMode = "Permissive"; action.sessionId = "e3ffecc95a5b4bcca5ce212826a14ee0"; DeleteResourcePriceAction.Result res = action.call();
Python SDK
DeleteResourcePriceAction action = DeleteResourcePriceAction() action.uuid = "14c4eef2f36e4716a279777e503ab772" action.deleteMode = "Permissive" action.sessionId = "fcbca45ec9454200b1d080b0268c17d9" DeleteResourcePriceAction.Result res = action.call()

UpdateResourcePrice

API Request

URLs
PUT zstack/v1/billings/prices/{uuid}/actions
Headers
Authorization: OAuth the-session-uuid
Body
{   "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 Sample
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
Request Parameters
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

API Response

Sample Response
{   "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
#error
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
#inventory
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
#pciDeviceOfferings
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

SDK Sample

Java SDK
UpdateResourcePriceAction action = new UpdateResourcePriceAction(); action.uuid = "bed31eb3ba76325ba6a1cef1a64c97a3"; action.setEndDateInLongBaseOnCurrentTime = false; action.sessionId = "b86c9016b4f24953a9edefb53ca0678c"; UpdateResourcePriceAction.Result res = action.call();
Python SDK
UpdateResourcePriceAction action = UpdateResourcePriceAction() action.uuid = "bed31eb3ba76325ba6a1cef1a64c97a3" action.setEndDateInLongBaseOnCurrentTime = false action.sessionId = "b86c9016b4f24953a9edefb53ca0678c" UpdateResourcePriceAction.Result res = action.call()













Archives

Download Document Archives

Back to Top

Download

Already filled the basic info?Click here.

Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

An email with a verification code will be sent to you. Make sure the address you provided is valid and correct.

同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

Download

Not filled the basic info yet? Click here.

Invalid email address or mobile number.
同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

Email Us

contact@zstack.io
ZStack Training and Certification
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

Email Us

contact@zstack.io
Request Trial
Enter at least 2 characters.
Invalid mobile number.
Enter at least 4 characters.
Invalid email address.
Wrong code. Try again. Send Code Resend Code (60s)

同意 不同意

I have read and concur with the Site TermsPrivacy PolicyRules and Conventions on User Management of ZStack Cloud

Email Us

contact@zstack.io

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder. After receiving the email, click the URL to download the documentation.

The download link is sent to your email address.

If you don't see it, check your spam folder, subscription folder, or AD folder.
Or click on the URL below. (For Internet Explorer, right-click the URL and save it.)

Thank you for using ZStack products and services.

Submit successfully.

We'll connect soon.

Thank you for using ZStack products and services.