Billing Management
Overview
Bills of different resources under different projects, departments, and accounts are calculated and displayed in real time based on the unit price and time of usage defined in a pricing list. The time is accurate to seconds.
Pricing list, also known as price table, defines the unit price of different resources based on the resource specification and time of usage. After you attach a pricing list to a project or an account, the corresponding bills of resources will be generated accordingly.
Inventory
Resource Price Inventory
| Name | Description | Optional | Valid Value | Starting Version |
|---|---|---|---|---|
| uuid | The UUID. For more information, see Resource Property. | 0.6 | ||
| resourceName | The resource name. |
|
0.6 | |
| resourceUnit | The billing resource unit. | Yes | 0.6 | |
| timeUnit | The billing time unit. | 0.6 | ||
| price | The unit price. | 0.6 | ||
| dateInLong | The long-integer time. | Yes | 0.6 | |
| tableuuid | The price table UUID. | 3.7.2 | ||
| pciDeviceOfferings | The PCI device list. | 2.4 | ||
| createDate | The creation date. For more information, see Resource Property. | 0.6 | ||
| lastOpDate | The last operation date. For more information, see Resource Property. | 0.6 |
Sample
{
"inventories": [],
"success": true
}
Price Table Inventory
| Name | Description | Optional | Valid Value | Starting Version |
|---|---|---|---|---|
| uuid | The UUID. For more information, see Resource Property. | 3.7.1 | ||
| name | The name. For more information, see Resource Property. | 3.7.1 | ||
| description | The description. For more information, see Resource Property. | Yes | 3.7.1 | |
| groupBy | Groups rows into subgroups based on values of columns or expressions. This field is equivalent to the Group By clause in MySQL, such as groupBy=type. | Yes | 3.7.1 | |
| createDate | The creation date. For more information, see Resource Property. | 3.7.1 | ||
| lastOpDate | The last operation date. For more information, see Resource Property. | 3.7.1 | ||
| userTags | The user tags. For more information, see CreateUserTag. | Yes | 3.7.1 | |
| systemTags | The system tags. For more information, see CreateSystemTag. | Yes | 3.7.1 |
Sample
{
"inventories": [
{
"uuid": "3e78d076698438a6a68aa2eabdde8adf",
"name": "price table",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
]
}
Account and Price Table Reference Inventory
| Name | Description | Optional | Valid Value | Starting Version |
|---|---|---|---|---|
| accountUuid | The account UUID. | 3.7.1 | ||
| tableUuid | The price table UUID. | 3.7.1 | ||
| groupBy | Groups rows into subgroups based on values of columns or expressions. This field is equivalent to the Group By clause in MySQL, such as groupBy=type. | Yes | 3.7.1 | |
| createDate | The creation date. For more information, see Resource Property. | 3.7.1 | ||
| lastOpDate | The last operation date. For more information, see Resource Property. | 3.7.1 | ||
| userTags | The user tags. For more information, see CreateUserTag. | Yes | 3.7.1 | |
| systemTags | The system tags. For more information, see CreateSystemTag. | Yes | 3.7.1 |
Sample
{
"inventories": [
{
"accountUuid": "3dd9565ef61137c2a8615c26da6ddd4c",
"tableUuid": "b0c83f78e0323aea8969e5b879ffbe5f",
"createDate": "Nov 14, 2017 10:20:57 PM",
"lastOpDate": "Nov 14, 2017 10:20:57 PM"
}
]
}
Operations
CreateResourcePrice
Creates a resource price. For example,
CreateResourcePrice resourceName=memory price=60 timeUnit=d resourceUnit=G
Parameters
| Name | Description | Optional | Valid Value | Starting Version |
|---|---|---|---|---|
| resourceName | The resource name. |
|
0.6 | |
| resourceUnit | The billing unit of the resource. | Yes | 0.6 | |
| timeUnit | The billing time unit. | 0.6 | ||
| price | The unit price. | 0.6 | ||
| accountUuid | The account UUID. | Yes | 0.6 | |
| dateInLong | The long-integer time. | Yes | 0.6 | |
| tableuuid | The price table UUID. | Yes | 3.7.2 | |
| userTags | The user tags. For more information, see CreateUserTag. | Yes | 0.6 | |
| systemTags | The system tags. For more information, see CreateSystemTag. | Yes | 0.6 | |
| timeout | Yes |
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
- Format of the PCI device option:
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.
- Format of the priceUserConfig option:
DeleteResourcePrice
Deletes a resource price. For example,
DeleteResourcePrice uuid=7c9a496360c040819dbaa5abd9c074b8
Parameters
| Name | Description | Optional | Valid Value | Starting Version |
|---|---|---|---|---|
| uuid | The resource UUID. | 0.6 | ||
| deleteMode | The delete mode. For more information, see DeleteResources. | Yes |
|
0.6 |
| userTags | The user tags. For more information, see CreateUserTag. | Yes | 0.6 | |
| systemTags | The system tags. For more information, see CreateSystemTag. | Yes | 0.6 | |
| timeout | Yes |
UpdateResourcePrice
Updates a resource price. For example,
UpdateResourcePrice uuid=bed31eb3ba76325ba6a1cef1a64c97a3 setEndDateInLongBaseOnCurrentTime=false
Parameters
| Name | Description | Optional | Valid Value | Starting Version |
|---|---|---|---|---|
| uuid | The resource price UUID. | 3.7.2 | ||
| endDateInLong | The resource price expiration date. | Yes | 3.7.2 | |
| setEndDateInLongBaseOnCurrentTime | Sets the resource price expiration date to the current time. | Yes | 3.7.2 | |
| userTags | The user tags. For more information, see CreateUserTag. | Yes | 3.7.2 | |
| systemTags | The system tags. For more information, see CreateSystemTag. | Yes | 3.7.2 | |
| timeout | Yes |
QueryResourcePrice
Queries a resource price. For example,
QueryResourcePrice resourceName=datavolume
Primitive Fields of Query
CalculateAccountSpending
Calculates the spending of an account. For example,
CalculateAccountSpending accountUuid=36c27e8ff05c4780bf6d2fa65700f22e
Parameters
| Name | Description | Optional | Valid Value | Starting Version |
|---|---|---|---|---|
| accountUuid | The account UUID. | 0.6 | ||
| dateStart | The start date. | Yes | 0.6 | |
| dateEnd | The end date. | Yes | 0.6 | |
| userTags | The user tags. For more information, see CreateUserTag. | Yes | 0.6 | |
| systemTags | The system tags. For more information, see CreateSystemTag. | Yes | 0.6 | |
| timeout | Yes |
QueryAccountBilling
Queries bills of an account. For example,
QueryAccountBilling accountUuid=2533823b9a764cd89f141f7bbcb78430
Primitive Fields of Query
See Account Billing Inventory.
QueryAccountBilling only queries all bills, you can use CalculateAccountSpending to query bills by time.
CreatePriceTable
Creates a price table. For example,
CreatePriceTable name=table_1 prices='[{"resourceName": "cpu","timeUnit": "s","price": 1.0}]'
Parameters
| Name | Description | Optional | Valid Value | Starting Version |
|---|---|---|---|---|
| name | The name of the price table. | 3.7.1 | ||
| description | The detailed description of the price table. | Yes | 3.7.1 | |
| prices | 3.7.1 | |||
| resourceUuid | The UUID of the price table. | Yes | 3.7.1 | |
| tagUuids | The tag UUID list. | Yes | 3.7.1 | |
| userTags | The user tags. For more information, see CreateUserTag. | Yes | 3.7.1 | |
| systemTags | The system tags. For more information, see CreateSystemTag. | Yes | 3.7.1 | |
| timeout | Yes |
DeletePriceTable
Deletes a price table. For example,
DeletePriceTable uuid=81bd5aa16d203ca39bc5e79e2bbc6de2
Parameters
| Name | Description | Optional | Valid Value | Starting Version |
|---|---|---|---|---|
| uuid | The UUID of the price table. | 3.7.1 | ||
| userTags | The user tags. For more information, see CreateUserTag. | Yes | 3.7.1 | |
| systemTags | The system tags. For more information, see CreateSystemTag. | Yes | 3.7.1 | |
| timeout | Yes |
UpdatePriceTable
Modifies a price table. For example,
UpdatePriceTable name=table_1 prices='[{"resourceName": "cpu","timeUnit": "s","price": 1.2}]'
Parameters
| Name | Description | Optional | Valid Value | Starting Version |
|---|---|---|---|---|
| uuid | The UUID of the price table. | 3.7.1 | ||
| name | The name of the price table. | Yes | 3.7.1 | |
| description | The detailed description of the price table. | Yes | 3.7.1 | |
| userTags | The user tags. For more information, see CreateUserTag. | Yes | 3.7.1 | |
| systemTags | The system tags. For more information, see CreateSystemTag. | Yes | 3.7.1 | |
| timeout | Yes |
QueryPriceTable
Queries a price table. For example,
QueryPriceTable uuid=86b5cece6d0f3534a0a995ab8e60289f
Primitive Fields of Query
AttachPriceTableToAccount
Attaches a price table to an account or a project. For example,
AttachPriceTableToAccount accountUuid=e32698fcb57d34d68bbf1c4963af95a0 tableUuid=f354e135276d3e77a46f47c5c0e47b1a
Parameters
| Name | Description | Optional | Valid Value | Starting Version |
|---|---|---|---|---|
| accountUuid | The account UUID. | 3.7.1 | ||
| tableUuid | The price table UUID. | 3.7.1 | ||
| tagUuids | The tag UUID list. | Yes | 3.7.1 | |
| userTags | The user tags. For more information, see CreateUserTag. | Yes | 3.7.1 | |
| systemTags | The system tags. For more information, see CreateSystemTag. | Yes | 3.7.1 | |
| timeout | Yes |
DetachPriceTableFromAccount
Detaches a price table from an account or a project. For example,
DetachPriceTableFromAccount accountUuid=c27d5d1d46ce3b548ec0755d0b354084 tableUuid=5b81c2a13b2f319ea97a4568575b0266
Parameters
| Name | Description | Optional | Valid Value | Starting Version |
|---|---|---|---|---|
| accountUuid | The account UUID. | 3.7.1 | ||
| tableUuid | The price table UUID. | 3.7.1 | ||
| tagUuids | The tag UUID list. | Yes | 3.7.1 | |
| userTags | The user tags. For more information, see CreateUserTag. | Yes | 3.7.1 | |
| systemTags | The system tags. For more information, see CreateSystemTag. | Yes | 3.7.1 | |
| timeout | Yes |
ChangeAccountPriceTableBinding
Changes the price table that is attached to an account or a project. For example,
ChangeAccountPriceTableBinding accountUuid=ca0f8310310e351f8590e4d9f03106bc tableUuid=082289755ebe363daa52eb2aa10cbb01
Parameters
| Name | Description | Optional | Valid Value | Starting Version |
|---|---|---|---|---|
| accountUuid | The account UUID. | 3.7.1 | ||
| tableUuid | The price table UUID. | 3.7.1 | ||
| resourceUuid | Yes | 3.7.1 | ||
| tagUuids | The tag UUID list. | Yes | 3.7.1 | |
| userTags | The user tags. For more information, see CreateUserTag. | Yes | 3.7.1 | |
| systemTags | The system tags. For more information, see CreateSystemTag. | Yes | 3.7.1 | |
| timeout | Yes |
GetAccountPriceTableRef
Queries the price table used by an account or a project. For example,
GetAccountPriceTableRef accountUuid=67fcb4c5fa0c36adba411d7258d4557e
Parameters
| Name | Description | Optional | Valid Value | Starting Version |
|---|---|---|---|---|
| tableUuid | The price table UUID. | Yes | 3.7.2 | |
| accountUuid | The account UUID. | Yes | 3.7.2 | |
| userTags | The user tags. For more information, see CreateUserTag. | Yes | 3.7.2 | |
| systemTags | The system tags. For more information, see CreateSystemTag. | Yes | 3.7.2 | |
| timeout | Yes |
QueryAccountPriceTableRef
Queries the reference between a price table and an account or a project. For example,
QueryAccountPriceTableRef accountUuid=b86c9016b4f24953a9edefb53ca0678c
Primitive Fields of Query
GenerateAccountBilling
Generates bills. For example,
GenerateAccountBilling accountUuid=54caddf06e1e3b7c995df5e99d8ca9d9
Parameters
| Name | Description | Optional | Valid Value | Starting Version |
|---|---|---|---|---|
| accountUuid | The account UUID. | 3.7.2 | ||
| userTags | The user tags. For more information, see CreateUserTag. | Yes | 3.7.2 | |
| systemTags | The system tags. For more information, see CreateSystemTag. | Yes | 3.7.2 | |
| timeout | Yes |
Tags
You can create a user tag on a resource price by using CreateUserTag resourceType=PriceVO. For example,
CreateUserTag resourceType=PriceVO tag=Test1 \
resourceUuid=3214e0dcd01d4e2aa8407968e1c51d58
