This API enables you to modify a cost template.
The syntax for calling this method is:
PUT <Base_Url>/costTemplate/{costTemplateId}
A sample API call is as follows:
PUT https://123.123.123.123/vCenter-CB/api/costTemplate/15
You must have a role with Update privilege on the cost template.
This API needs a request XML with the following information.
XPath |
Type |
Min Occurs |
Max Occurs |
Description |
---|---|---|---|---|
CostTemplates/CostTemplate |
1 |
1 |
Represents the cost template to be modified. |
|
CostTemplates/CostTemplate/Name |
xs:string |
1 |
1 |
Name of the cost template to be modified. |
CostTemplates/CostTemplate/Description |
xs:string |
0 |
1 |
A brief description of the cost template. |
CostTemplates/CostTemplate/RateFactors |
0 |
1 |
Represents the rate factors to be set. |
|
CostTemplates/CostTemplate/RateFactors/RateFactor |
1 |
unbounded |
Represents the rate factor to be set for the computing resource. |
|
CostTemplates/CostTemplate/RateFactors/RateFactor/ComputingResource |
1 |
1 |
Represents the computing resource for which the rate factor is set. |
|
CostTemplates/CostTemplate/RateFactors/RateFactor/ComputingResource/@id |
xs:int |
1 |
1 |
ID of the computing resource for which the rate factor is set. |
CostTemplates/CostTemplate/RateFactors/RateFactor/ComputingResource/Value |
xs:double |
1 |
1 |
The rate factor applied to the computing resource. The rate factor value must be a number between 0 and 999.99 with precision up to two decimal places. |
CostTemplates/CostTemplate/FixedCosts/FixedCost |
1 |
unbounded |
Represents the fixed cost. |
|
CostTemplates/CostTemplate/FixedCosts/FixedCost/@id |
xs:int |
1 |
1 |
ID of the fixed cost. |
CostTemplates/CostTemplate/FixedCosts/FixedCost/Propagate |
xs:boolean |
1 |
1 |
Indicates if the fixed cost value is propagated to the child entities. Applicable values are true and false. If the value is false, the fixed cost is applied only on the entity. If the value is true, the fixed cost is applied on the descendents of the entity. By default, the fixed cost is applied only on the immediate children. |
CostTemplates/CostTemplate/FixedCosts/FixedCost/Depth |
xs:int |
0 |
1 |
Specifies how deep in the tree fixed cost should be propagated. Default value is 1. For example, if a fixed cost with depth 2 is applied on a folder, only its children and grand children will be applied with this fixed cost. 0 indicates any depth. |
CostTemplates/CostTemplate/FixedCosts/FixedCost/EntityTypeIdFilter |
xs:int |
0 |
1 |
Specifies the filter on entity type for which propagated fixed cost should be applied. Default value is -1. For example, if you apply a propagated fixed cost at a hierarchy level and choose entity type id as 0, then the fixed cost will be applied only on the virtual machines in the hierarchy. -1 signifies any entity type.. |
A sample request XML is provided here.
The API returns a response XML that provides the following details of the modified cost template.
XPath |
Type |
Min Occurs |
Max Occurs |
Description |
---|---|---|---|---|
CostTemplates/CostTemplate |
1 |
1 |
Represents the cost template that is added. |
|
CostTemplates/CostTemplate/@id |
xs:int |
1 |
1 |
ID of the cost template that is added. |
CostTemplates/CostTemplate/Name |
xs:string |
1 |
1 |
Unique name of the cost template |
CostTemplates/CostTemplate/Description |
xs:string |
1 |
1 |
A brief description of the cost template. |
CostTemplates/CostTemplate/Currency |
1 |
1 |
Represents the currency. |
|
CostTemplates/CostTemplate/Currency/@id |
xs:int |
1 |
1 |
ID of the currency |
CostTemplates/CostTemplate/Currency/Name |
xs:string |
1 |
1 |
Name of the currency. |
CostTemplates/CostTemplate/RateFactors/RateFactor |
1 |
unbounded |
Represents the rate factor to be set. |
|
CostTemplates/CostTemplate/RateFactors/RateFactor/ComputingResource |
1 |
1 |
Represents the computing resource for which the rate factor is set. |
|
CostTemplates/CostTemplate/RateFactors/RateFactor/ComputingResource/@id |
xs:int |
1 |
1 |
ID of the computing resource for which the rate factor is set. |
CostTemplates/CostTemplate/RateFactors/RateFactor/ComputingResource/Name |
xs:string |
1 |
1 |
Name of the computing resource for which the rate factor is set. |
CostTemplates/CostTemplate/RateFactors/RateFactor/Value |
xs:double |
1 |
1 |
Rate factor applied to the computing resource. |
CostTemplates/CostTemplate/FixedCosts/FixedCost |
1 |
unbounded |
Represents the fixed cost. |
|
CostTemplates/CostTemplate/FixedCosts/FixedCost/@id |
xs:int |
1 |
1 |
ID of the fixed cost. |
CostTemplates/CostTemplate/FixedCosts/FixedCost/Name |
xs:string |
1 |
1 |
Name of the fixed cost. |
CostTemplates/CostTemplate/FixedCosts/FixedCost/Description |
xs:string |
1 |
1 |
Description of the fixed cost. |
CostTemplates/CostTemplate/FixedCosts/FixedCost/Type |
1 |
1 |
Represents the fixed cost type. |
|
CostTemplates/CostTemplate/FixedCosts/FixedCost/Type/@id |
xs:int |
1 |
1 |
ID of the fixed cost type. |
CostTemplates/CostTemplate/FixedCosts/FixedCost/Type/Name |
xs:string |
1 |
1 |
Name of the fixed cost type. |
CostTemplates/CostTemplate/FixedCosts/FixedCost/Currency |
1 |
1 |
Represents the currency set for the fixed cost. |
|
CostTemplates/CostTemplate/FixedCosts/FixedCost/Currency/@id |
xs:int |
1 |
1 |
ID of the currency set for the fixed cost. |
CostTemplates/CostTemplate/FixedCosts/FixedCost/Currency/Name |
xs:string |
1 |
1 |
Name of the currency set for the fixed cost. |
CostTemplates/CostTemplate/FixedCosts/FixedCost/Propagate |
xs:boolean |
1 |
1 |
Indicates if the fixed cost value is being propagated to the child entities. If the value of this parameter is false, the fixed cost is applicable only to the entity. If the value is true, the fixed cost is applicable to the immediate children of the entity. |
A sample response is provided here.
The following table explains the error codes displayed by the API.
Error Code |
Description |
VCB_ERR_INVALID_COST_TEMPLATE_NAME |
Cost template name is blank, not unique, or contains more than 255 characters. |
VCB_ERR_INVALID_COST_TEMPLATE_DESCRIPTION |
Cost template description is empty or contains more than 512 characters. |
VCB_ERR_INVALID_FIXED_COST_ID |
Fixed cost ID is invalid. |
VCB_ERR_INVALID_COMPUTING_RESOURCE_ID |
Computing resource ID is invalid. |
VCB_ERR_INVALID_RATE_FACTOR |
Rate factor value is negative or is more than the maximum allowed. |