Modify Billing Policy

This API enables you to modify the billing policy in a cost model for a given time period. For a list of supported billing policy IDs, see Appendix.

Syntax

The syntax for calling this method is:

PUT <Base_Url>/billingPolicy/{billingPolicyId}

A sample API call is as follows:

PUT https://123.123.123.123/vCenter-CB/api/billingPolicy/5

User Privilege

You must have a role with Update privilege on the billing policy .

Request Body Parameters

The request XML includes the following parameters.

XPath

Type

Min Occurs

Max Occurs

Description

BillingPolicies/BillingPolicy

1

1

Represents the billing policy that you want to modify.

BillingPolicies/BillingPolicy/@id

xs:int

1

1

ID of the billing policy that you want to modify.

BillingPolicies/BillingPolicy/Name

xs:string

1

1

Name of the billing policy that you want to modify. The name must not exceed 255 characters.

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

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.

API Response

XPath

Type

Min Occurs

Max Occurs

Description

BillingPolicies/BillingPolicy

1

1

Represents the billing policy that is modified.

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

Description of the billing policy. Description should not exceed 512 characters.

BillingPolicies/BillingPolicy/Expression

xs:string

1

1

Expression used to calculate the cost. The expressions should follow the correct syntax

A sample response is provided here.

Error Response

The following table explains the error codes displayed by the API.

Error Code

Description

VCB_ERR_INVALID_BILLING_POLICY_ID

Billing policy ID is invalid.

VCB_ERR_INVALID_TIME_PERIOD

Start date is not specified or is specified as later than the end date.

VCB_ERR_INVALID_EXPRESSION

The expression does not compile or is invalid.

VCB_ERR_INVALID_BILLING_POLICY_NAME

Policy name is invalid

VCB_ERR_INVALID_BILLING_POLICY_DESCRIPTION

Description is invalid

VCB_ERR_INVALID_BILLING_POLICY_EXPRESSION

The given expression is invalid.