@Override
  public Iterable<VM> listNodes() {
    Builder<VM> builder = ImmutableSet.builder();
    for (Resource org1 : client.listOrgs()) {
      Org org = client.getBrowsingClient().getOrg(org1.getId());
      for (Resource vdc : org.getVDCs()) {
        VDC VDC = client.getBrowsingClient().getVDCInOrg(org.getId(), vdc.getId());
        for (Resource vApp :
            Iterables.filter(
                VDC.getResourceEntities(),
                new Predicate<Resource>() {

                  @Override
                  public boolean apply(Resource arg0) {
                    return VCloudMediaType.VAPP_XML.equals(arg0.getType());
                  }
                })) {
          builder.add(
              client
                  .getBrowsingClient()
                  .getVMInVDC(org.getId(), vdc.getId(), vApp.getId(), withPowerState()));
        }
      }
    }
    return builder.build();
  }
 @Override
 public Iterable<Network> listLocations() {
   Builder<Network> builder = ImmutableSet.builder();
   for (Resource org1 : client.listOrgs()) {
     Org org = client.getBrowsingClient().getOrg(org1.getId());
     for (Resource vdc : org.getVDCs()) {
       VDC VDC = client.getBrowsingClient().getVDCInOrg(org.getId(), vdc.getId());
       // optionally constrain locations
       if (email != null && VDC.getDescription().indexOf(email) != -1) continue;
       for (Resource network : VDC.getAvailableNetworks()) {
         builder.add(
             client
                 .getBrowsingClient()
                 .getNetworkInVDC(org.getId(), vdc.getId(), network.getId()));
       }
     }
   }
   return builder.build();
 }
 @Override
 public VM getNode(String id) {
   return client.getBrowsingClient().getVM(URI.create(checkNotNull(id, "id")), withPowerState());
 }
Esempio n. 4
0
 private Task refresh(String taskId) {
   return client.getBrowsingClient().getTask(taskId);
 }