This API enables you to add a computing resource with the specified name, description, unit, and attributes.
The syntax for calling this method is:
POST <Base_Url>/computingResource
A sample API call is as follows:
POST https://123.123.123.123/vCenter-CB/api/computingResource
You must have the Super User role.
The request XML for this API contains the parameters described in the following table.
XPath |
Type |
Min Occurs |
Max occurs |
Description |
---|---|---|---|---|
ComputingResources/ComputingResource/Name |
xs:string |
1 |
1 |
Name of the computing resource that you want to add. The computing resource name must be unique and not exceed 255 characters. The name must contain only alphanumeric characters and can contain spaces. |
ComputingResources/ComputingResource/Description |
xs:string |
0 |
1 |
An optional description of the computing resource. The description must not exceed |
ComputingResources/ComputingResource/Unit |
xs:string |
1 |
1 |
Unit in which the computing resource is measured. |
ComputingResources/ComputingResource/ConversionFactor |
xs:double |
0 |
1 |
Specifies the conversion factor for the data collected for a particular computing resource. Default value of 1.0 is used in case no conversion factor is explicitly specified. |
ComputingResources/ComputingResource/RollUpType |
xs:string |
0 |
1 |
Specifies the computation method for the computing resource. Possible values are: ‘Average’(Computation is based upon Timed Average of usage); ‘Sum’(Computation is based upon summation of usage). |
ComputingResources/ComputingResource/Enabled |
xs:boolean |
0 |
1 |
Specifies whether the computing resource is enabled in vCenter Chargeback Manager. Default value is true. |
ComputingResources/ComputingResource/Attributes/Attribute |
|
1 |
unbounded |
Attributes based on which the computing resource will be calculated. |
ComputingResources/ComputingResource/Attributes/Attribute/Name |
xs:string |
1 |
1 |
Name of the attribute based on which the computing resource will be calculated. For custom computing resources, only ‘allocation’ is supported. |
A sample request XML is provided here.
If the operation is successful, the API returns an XML that provides the following details of the new computing resource.
XPath |
Type |
Min Occurs |
Max occurs |
Description |
---|---|---|---|---|
ComputingResources/ComputingResource/@Id |
xs:long |
1 |
1 |
ID of the new computing resource which is created. |
ComputingResources/ComputingResource/Name |
xs:string |
1 |
1 |
Name of the computing resource added. |
ComputingResources/ComputingResource/Description |
xs:string |
1 |
1 |
Description of the computing resource added. |
ComputingResources/ComputingResource/Unit |
xs:string |
1 |
1 |
Unit in which the computer resource is measured. |
ComputingResources/ComputingResource/ConversionFactor |
xs:double |
0 |
1 |
Specifies the conversion factor for the data collected for a particular computing resource. Default value of 1.0 is used in case no conversion factor is explicitly specified. |
ComputingResources/ComputingResource/RollUpType |
xs:string |
0 |
1 |
Specifies the computation method for the computing resource. In this release, this is not a user modifiable parameter. Possible values are: ‘Average’(Computation is based upon Timed Average of usage); ‘Sum’(Computation is based upon summation of usage) |
ComputingResources/ComputingResource/Enabled |
xs:boolean |
0 |
1 |
Specifies whether the computing resource is enabled in vCenter Chargeback Manager. Default value is true. |
ComputingResources/ComputingResource/Attributes/Attribute |
1 |
unbounded |
Attributes that were added for the computing resource. |
|
ComputingResources/ComputingResource/Attributes/Attribute/Name |
xs:string |
1 |
1 |
Name of the attribute added for the computing resource. |
A sample response is provided here.
The following table explains the error codes displayed by the API.
Error Code |
Description |
VCB_ERR_INVALID_COMPUTING_RESOURCE_NAME |
Computing resource name is not specified or the name contains more than 255 characters. |
VCB_ERR_INVALID_COMPUTING_RESOURCE_DESCRIPTION |
Computing resource description is specified and contains more than 512 characters. |
VCB_ERR_INVALID_COMPUTING_RESOURCE_UNIT |
Computing Resource Unit is not specified or contains more than 255 characters. |
COMPUTING_RESOURCE_ALREADY_EXISTS_NAME |
The computing resource name specified already exists. |
VCB_ERR_INVALID_COMPUTING_RESOURCE_ATTRIBUTE |
Attribute name is not specified or the name contains more than 255 characters. |
VCB_ERR_INVALID_CONVERSION_FACTOR_IN_COUNTER_DETAIL |
Conversion factor is less than or equal to zero. |
VCB_ERR_INVALID_ROLL_UP_TYPE_IN_COUNTER_DETAIL |
A roll up type other than "average" or "sum" is specified. |