Add A Custom Chargeback Hierarchy - 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
</VCenterServer>
</VCenterServers>
</Request>
If the vCenter Server is successfully added, the API returns an XML response that provides the vCenter 
Server ID.
The following is an example program that calls the API.
/**
* This method is to add the vCenter-Server in vCenter-Chargeback application
*
* @param requestFilePath
* @param baseURL
* @throws IOException
* @throws JDOMException
* @throws NoSuchAlgorithmException
* @throws KeyManagementException
* @throws HttpException
*/
public static void sampleAddVCenterServerMethod(String requestFilePath, String baseURL)
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/vCenterServer";
System.out.println(uri);
System.out.println(bodyString);
try {
} finally {
}
}

Add a Custom Chargeback Hierarchy

Use the Add a Chargeback Hierarchy API to create a hierarchy with the given name and description. 
To add a custom Chargeback hierarchy
1
Call the API by using the following syntax.
<HTTP_request_method> <Base_URL>/hierarchy
For example, you can define a call like this:
POST https://123.123.123.123/vCenter-CB/api/hierarchy
2
In the request XML, specify a name and a description for the hierarchy. 
16
</DataSourceUrl>
<DataSourceName>vim_vcdb</DataSourceName>
<DataSourceUserName>sa</DataSourceUserName>
<DataSourcePassword>xxxx</DataSourcePassword>
<DataSourceType id="1" />
<DataSourceAuthType id="1" />
<ForceUpdate>false</ForceUpdate>
throws IOException, JDOMException, NoSuchAlgorithmException,
KeyManagementException, HttpException {
FakeSSLCertificateSocketFactory(), 443));
post = new PostMethod(uri);
post.setRequestBody(bodyString);
client.executeMethod(post);
System.out.println(post.getResponseBodyAsString());
if (post != null) {
post.releaseConnection();
}
VMware, Inc.

Advertisement

Table of Contents
loading

Table of Contents