Modify Rate Factors

This API enables you to set rate factors for a specified entity in a cost model for the specified time period.

Unless the rate factor for any computing resource on an entity is set on the entity, the rate factor for that computing resource will be inherited from the parent entity. To unset (that is, to inherit from the parent) the rate factors on an entity, this API must be called with the computing resource element and without the value element.


Syntax

The syntax for calling this method is:

PUT <Base_Url>/costModel/{costModelId}/rateFactors

A sample API call is as follows:

PUT https://123.123.123.123/vCenter-CB/api/costModel/9/rateFactors

User Privilege

You must have Hierarchy Read privilege and Cost Model Update privilege on vCenter Chargeback Manager.

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 rate factors 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 rate factors are to be modified.  If this is not specified, the rate factors will be effective from the specified start time without any end time. If specified, this parameter must be specified after the start-time.

1232649000000

hierarchyId

Integer

Required

Chargeback hierarchy on whose entity these rate factors are to be applied. 1

entityId

Integer

Required

Chargeback entity on which rate factors are to be applied. 11

Request Body Parameters

This API takes an XML request, that captures the following information. The request XML must not have multiple rate factor values for the same computing resource.

XPath

Type

Min Occurs

Max Occurs

Description

RateFactors/RateFactor

1

unbounded

Represents the rate factors set for a specified entity in a cost model for the specified time period.

RateFactors/RateFactor/ComputingResource/@Id

xs:int

1

1

The id of the computing resource for which you want to set the rate factor. For a list of supported computing resources, see the Appendix.

RateFactors/RateFactor/Value

xs:double

1

1

The rate factor set for the computing resource. The rate factor value must a number between 0 and 999.99 with precision up to two decimal places.

A sample request XML is provided here.

API Response

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

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_COST_MODEL_ID

Cost model ID is invalid.

VCB_ERR_INVALID_COMPUTING_RESOURCE_ID

Computing resource ID is invalid.

VCB_ERR_INVALID_HIERARCHY_ID

Hierarchy ID is invalid.

VCB_ERR_INVALID_ENTITY_ID

Entity ID is invalid.

VCB_ERR_INVALID_RATE_FACTOR

Rate factor value is less than zero or more than the maximum allowed (999.99).

VCB_ERR_INVALID_TIME_PERIOD

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