Protocol.registerProtocol("https", new Protocol("https", (ProtocolSocketFactory) new
String uri = "https://" + baseURL + "/vCenter-CB/api/login";
System.out.println(uri);
try {
} finally {
}
}
Add vCenter Server Information
You can add the vCenter Server instances in your virtualized environment to vCenter Chargeback. This helps
determine the computing resource utilization for the virtual machines and calculate the total costs.
To add vCenter Server information
1
Call the API by using the following syntax.
<HTTP_request_method> <Base_URL>/vCenterServer
For example, you can define a call as follows:
POST https://123.123.123.123/vCenter-CB/api/vCenterServer
2
In the request XML, specify the following information:
vCenter Server URL
vCenter Server Name
vCenter Server Description
vCenter Server Username
vCenter Server Password
PluginRegistered
StatsSync
Datasource URL
Data Source Name
Data Source User Name
Data Source Password
Data Source Type
DataSourceAuthType
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">
<VCenterServers>
<VCenterServer>
VMware, Inc.
FakeSSLCertificateSocketFactory(), 443));
post = new PostMethod(uri);
post.setQueryString(parameters);
post.setRequestBody(bodyString);
client.executeMethod(post);
System.out.println(post.getResponseBodyAsString());
if (post != null) {
post.releaseConnection();
}
<Url>101.102.107.21:443</Url>
<Name>vc1</Name>
<Description>vc1</Description>
<UserName>administrator</UserName>
<Password>xxxx</Password>
<PluginRegistered>true</PluginRegistered>
<StatsSync>true</StatsSync>
<DataSourceUrl>
10.112.107.21\sqlexp_vim
Chapter 2 Understanding the Workflow
15