Add A Vcenter Server Entity To The 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

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">
<Hierarchies>
<Hierarchy>
</Hierarchy>
</Hierarchies>
</Request>
If successful, the API returns details of the new hierarchy.
The following is an example program that calls the API.
/**
* This method is to add a vCenter-ChargeBack hierarchy in
* vCenter-ChargeBack
*
* @param requestFilePath
* @param baseURL
* @throws IOException
* @throws JDOMException
* @throws NoSuchAlgorithmException
* @throws KeyManagementException
* @throws HttpException
*/
public static void sampleAddHierarchyMethod(String requestFilePath, String baseURL)
PostMethod post = null;
Document requestDocument = CommonUtil.getXMLDocument(requestFilePath);
String bodyString = CommonUtil.xmlAsString(requestDocument);
Protocol.registerProtocol("https", new Protocol("https", (ProtocolSocketFactory) new
HttpClient client = new HttpClient();
String uri = "https://" + baseURL + "/vCenter-CB/api/hierarchy";
System.out.println(uri);
System.out.println(bodyString);
try {
} finally {
}
}

Add a vCenter Server Entity to the Chargeback Hierarchy

This task helps you add a vCenter Server entity under a specified parent entity in a Chargeback hierarchy.
To add a vCenter Server entity to the Chargeback hierarchy
1
Call the API by using the following syntax.
<HTTP_request_method> <Base_URL>/hierarchy/{hierarchyId}/entity/{parentEntityId}
For example, you can define a call like this:
POST https://123.123.123.123/vCenter-CB/api/hierarchy/11/entity/101
2
In the request XML, specify the hierarchy ID, entity name, and description for the hierarchy. 
VMware, Inc.
<Name>Test_Hierarchy</Name>
<Description>Test Hierarchy</Description>
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();
}
Chapter 2 Understanding the Workflow
17

Advertisement

Table of Contents
loading

Table of Contents