Modify Base Rates

This API enables you to set the base rates to the cost model for the specified time periods.


Syntax

The syntax for calling this method is:

PUT <Base_Url>/costModel/{costModelID}/baseRates

A sample API call is as follows:

PUT https://123.123.123.123/vCenter-CB/api/costModel/999/baseRates

User Privilege

You must have a role with Update privilege on the cost model.

URL Parameters

Name

Data Type

Required/Optional

Description

Sample Value

startTime

Long

Required

Start-time (in milliseconds, from January 1, 1970 GMT 00:00) of the time period for which the base rates are to be modified.

1232562600000

endTime

Long

Optional

End-time (in milliseconds, from January 1, 1970 GMT 00:00) of the time period for which the base rates are to be modified.  If this is not specified, the base rates will be effective from the specified start time without any end time. If specified, ensure that the end time is later than the start time.

1232649000000

Request Body Parameters

In the request XML, you can specify the following body parameters. Note that the request XML must not have more than one base rate for the same computing resource.

XPath

Type

Min Occurs

Max Occurs

Description

BaseRates/BaseRate

 

1

Unbounded

Represents the base rate information for one computing resource.

BaseRates/BaseRate/ComputingResource/@id

xs:int

1

1

The id of the computing resource for which you want to set the base rate. Refer the Appendix for a complete list of supported computing resources.

BaseRates/BaseRate/Value

xs:double

1

1

The base rate value set for the computing resource. Base rate value must not be less than 0 (zero)

BaseRates/BaseRate/Duration/@id

xs:int

0

1

ID of the duration. The ID indicates whether the base rate is hourly, monthly, or yearly.

BaseRates/BaseRate/Slabs/Slab

 

1

Unbounded

Represents one slab of the base rate.

BaseRates/BaseRate/Slabs/Slab/Start

xs:int

1

1

Start allocation percentage of the slab slice.

BaseRates/BaseRate/Slabs/Slab/End

xs:int

0

1

End allocation percentage of the slab slice.  If this value is not specified, the Slab rate is applicable from slab start allocation percentage to the total consumption.

BaseRates/BaseRate/Slabs/Slab/Value

xs:double

0

1

The base rate value set for the computing resource for this slab. Base rate value must not be less than 0 (zero).  For example, if Resource Consumption = 200 Units, Resource Allocation = 100 Units, Value=3.1, Start=10, End=50, Slab/Value=2.1, then for the first (100*10% = 10) units, base rate = 3.1; for (100*50%-100*10% = 40) units, base rate = 2.1; and for (200 – 100*50% = 150) units, base rate = 3.1.

A sample request XML is provided here.

API Response

The API returns an XML that indicates the status of the operation.

Error Response

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

Error Code

Description

VCB_ERR_INVALID_COST_MODEL_ID

Cost model ID does not exist in vCenter Chargeback Manager.

VCB_ERR_INVALID_COMPUTING_RESOURCE_ID

Computing resource ID does not exist in vCenter Chargeback Manager.

VCB_ERR_INVALID_BASE_RATE

Base rate value is less than zero.

VCB_ERR_INVALID_TIME_PERIOD

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

VCB_ERR_INVALID_DURATION_ID

Duration ID does not exist in vCenter Chargeback Manager.

VCB_ERR_INVALID_SLAB

A slab start is not earlier than its slab end.