This API enables you to add a new billing policy. For a list of supported billing policy IDs, see Appendix.
The syntax for calling this method is:
POST <Base_Url>/billingPolicy
A sample API call is as follows:
POST https://123.123.123.123/vCenter-CB/api/billingPolicy
You must have a role with Create privilege on the billing policy.
The request XML includes the following parameters.
XPath |
Type |
Min Occurs |
Max Occurs |
Description |
---|---|---|---|---|
BillingPolicies/BillingPolicy |
1 |
unbounded |
Represents the billing policy that you want to add. |
|
BillingPolicies/BillingPolicy/Name |
xs:string |
1 |
1 |
Name of the billing policy. The name must not exceed 255 characters. |
BillingPolicies/BillingPolicy/Description |
xs:string |
0 |
1 |
The description of the billing policy. The description should not exceed 512 characters. |
BillingPolicies/BillingPolicy/Expression |
xs:string |
1 |
1 |
A billing policy defines an expression that is used for identifying the attribute selected for the computing resources to be considered for calculating the costs. Therefore, a billing policy must account for all the computing resources. In vCenter Chargeback Manager, a billing policy can also account for the fixed costs, the state of the virtual machine and distribution among the linked clones. A billing policy defines an expression for each resource. The expression includes an attribute value that identifies the amount of resource units to be considered for cost calculation. The attribute values can be allocation, reservation, size, and usage. The attribute reservation is available only for CPU and memory and the attribute size is available only for memory. Example: cpu = allocation; rest = usage; |
A sample request XML is provided here.
The API returns an XML that includes the following information.
XPath |
Type |
Min Occurs |
Max Occurs |
Description |
BillingPolicies/BillingPolicy |
1 |
unbounded |
Represents the billing policy that is added. |
|
BillingPolicies/BillingPolicy/@id |
xs:int |
1 |
1 |
ID of the billing policy. |
BillingPolicies/BillingPolicy/Name |
xs:string |
1 |
1 |
Name of the billing policy. |
BillingPolicies/BillingPolicy/Description |
xs:string |
1 |
1 |
The description of the billing policy. The description should not exceed 512 characters |
BillingPolicies/BillingPolicy/Expression |
xs:string |
1 |
1 |
The expression used to calculate the cost. The expressions should follow the correct syntax |
A sample response is provided here.
The following table explains the error codes displayed by the API.
Error Code |
Description |
VCB_ERR_INVALID_BILLING_POLICY_NAME |
The specified billing policy name is invalid. |
VCB_ERR_INVALID_BILLING_POLICY_DESCRIPTION |
The specified description is invalid. |
VCB_ERR_INVALID_BILLING_POLICY_EXPRESSION |
The specified expression is invalid. |