Added method to get public IP addresses

git-svn-id: http://jclouds.googlecode.com/svn/trunk@2643 3d8758e0-26b5-11de-8745-db77d3ebf521
This commit is contained in:
lili.recusant 2010-01-12 04:53:04 +00:00
parent e3c6b0e4e1
commit c781f16f0e
1 changed files with 18 additions and 0 deletions

View File

@ -109,6 +109,24 @@ public class TerremarkVCloudComputeClient {
return Iterables.getLast(vApp.getNetworkToAddresses().values()); return Iterables.getLast(vApp.getNetworkToAddresses().values());
} }
public Set<InetAddress> getPublicAddresses(String id) {
TerremarkVApp vApp = tmClient.getVApp(id);
Set<InetAddress> ipAddresses = Sets.newHashSet();
SERVICE: for (InternetService service : tmClient.getAllInternetServicesInVDC(vApp.getVDC()
.getId())) {
for (Node node : tmClient.getNodes(service.getId()))
{
if (vApp.getNetworkToAddresses().containsValue(node.getIpAddress()))
{
ipAddresses.add(service.getPublicIpAddress().getAddress());
}
}
}
return ipAddresses;
}
public void reboot(String id) { public void reboot(String id) {
TerremarkVApp vApp = tmClient.getVApp(id); TerremarkVApp vApp = tmClient.getVApp(id);
logger.debug(">> rebooting vApp(%s)", vApp.getId()); logger.debug(">> rebooting vApp(%s)", vApp.getId());