Add Cost Models - VMware VCENTER CHARGEBACK 1.5 - API Manual

Vcenter chargeback api programming guide
Hide thumbs Also See for VCENTER CHARGEBACK 1.5 - API:
Table of Contents

Advertisement

vCenter Chargeback API Programming Guide

Add Cost Models

You can add multiple cost models in vCenter Chargeback. Defining multiple cost models enables you to 
charge different sets of entities or hierarchies differently. It also enables you to compare the costs calculated 
using different cost models for a hierarchy or a set of entities.
To add a cost model
1
Call the Add Cost Model API by specifying the following URL in your program.
POST https://<ipaddress>/vCenter-CB/api/costModel
2
In the request XML, specify the following information.
Name: Specify Networking as the name of the cost model. 
Description: Provide a brief description for the Networking cost model. 
Currency ID: (Optional) Specify the ID of the currency to be set for this cost model. If not specified, 
the currency ID will automatically be set to US Dollars (USD) or the global currency ID that was set 
during Chargeback server upgrade. For a list of currencies supported by vCenter Chargeback, see the 
Appendix of the vCenter Chargeback API Reference Guide.
The following is an example request XML.
<?xml version="1.0" encoding="UTF-8"?>
<Request xmlns="http://www.vmware.com/vcenter/chargeback/1.5.0">
</Request>
3
Add the following cost models.
Allocation Pool
Reservation Pool
Pay as you go
The following is an example program that calls the Add Cost Models API. This program assumes that the 
request XML is populated with the required information.
/**
* This method is to add a cost model in vCenter-ChargeBack
*
* @param requestFilePath
* @param baseURL
* @throws IOException
* @throws JDOMException
* @throws NoSuchAlgorithmException
* @throws KeyManagementException
* @throws HttpException
*/
public static void sampleAddCostModel(String requestFilePath, String baseURL) throws
PostMethod post = null;
Document requestDocument = CommonUtil.getXMLDocument(requestFilePath);
String bodyString = CommonUtil.xmlAsString(requestDocument);
HttpClient client = new HttpClient();
Protocol.registerProtocol("https", new Protocol("https", (ProtocolSocketFactory) new
String uri = "https://" + baseURL + "/vCenter-CB/api/costModel";
26
<CostModels>
<CostModel>
<Name>Networking</Name>
<Description>Networking Cost Model</Description>
<Currency id="1"/>
</CostModel>
</CostModels>
IOException, JDOMException, NoSuchAlgorithmException,
KeyManagementException, HttpException {
FakeSSLCertificateSocketFactory(), 443));
VMware, Inc.

Advertisement

Table of Contents
loading

Table of Contents