Examples of PublicIPAddress


Examples of org.jclouds.cloudstack.domain.PublicIPAddress

      assert !available().apply(address);

   }

   public void testIsNotAvailableWhenSourceNAT() {
      PublicIPAddress address = PublicIPAddress.builder().state(PublicIPAddress.State.ALLOCATED).isSourceNAT(true)
            .id("204").build();

      assert !available().apply(address);

   }
View Full Code Here

Examples of org.jclouds.cloudstack.domain.PublicIPAddress

      assert !available().apply(address);

   }

   public void testIsNotAvailableWhenStaticNAT() {
      PublicIPAddress address = PublicIPAddress.builder().state(PublicIPAddress.State.ALLOCATED).isStaticNAT(true)
            .id("204").build();

      assert !available().apply(address);

   }
View Full Code Here

Examples of org.jclouds.cloudstack.domain.PublicIPAddress

         return;
      Set<PublicIPAddress> response = client.getAddressApi().listPublicIPAddresses();
      assert null != response;
      assertTrue(response.size() >= 0);
      for (PublicIPAddress ip : response) {
         PublicIPAddress newDetails = getOnlyElement(client.getAddressApi().listPublicIPAddresses(
               ListPublicIPAddressesOptions.Builder.id(ip.getId())));
         assertEquals(ip.getId(), newDetails.getId());
         checkIP(ip);
      }
   }
View Full Code Here

Examples of org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress

      InputStream is = getClass().getResourceAsStream("/InternetServices.xml");

      Set<InternetService> result = factory.create(injector.getInstance(InternetServicesHandler.class)).parse(is);
      assertEquals(result.toString(), ImmutableSet.of(new InternetService("IS_for_Jim2", URI
               .create("https://services.vcloudexpress.terremark.com/api/v0.8/InternetServices/524"),
               new PublicIpAddress("10.1.22.159", URI
                        .create("https://services.vcloudexpress.terremark.com/api/v0.8/PublicIps/4208")), 45,
               Protocol.HTTP, false, 1, "Some test service")).toString());
   }
View Full Code Here

Examples of org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress

public class PublicIpAddressHandlerTest extends BaseHandlerTest {

   public void test1() throws UnknownHostException {
      InputStream is = getClass().getResourceAsStream("/PublicIpAddress.xml");

      PublicIpAddress result = factory.create(injector.getInstance(PublicIpAddressHandler.class)).parse(is);
      assertEquals(result, new PublicIpAddress("204.51.112.91", URI
            .create("https://services.vcloudexpress.terremark.com/api/v0.8/PublicIps/8720")));
   }
View Full Code Here

Examples of org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress

            vApp.getName() + "-" + port,
            protocol,
            port,
            withDescription(String.format("port %d access to serverId: %s name: %s", port, vApp.getName(),
                  vApp.getName())));
      PublicIpAddress ip = is.getPublicIpAddress();
      Map<InternetService, PublicIpAddress> result = ImmutableMap.<InternetService, PublicIpAddress> of(is, ip);
      Entry<InternetService, PublicIpAddress> entry = Iterables.getOnlyElement(result.entrySet());
      return entry;
   }
View Full Code Here

Examples of org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress

   @Override
   public Entry<InternetService, PublicIpAddress> getNewInternetServiceAndIp(VApp vApp, int port, Protocol protocol) {
      logger.debug(">> creating InternetService in vDC %s:%s:%d", vApp.getVDC().getHref(), protocol, port);
      InternetService is = null;
      PublicIpAddress ip = null;
      try {
         ip = client.activatePublicIpInVDC(vApp.getVDC().getHref());
      } catch (InsufficientResourcesException e) {
         logger.warn(">> no more ip addresses available, looking for one to re-use");
         Set<PublicIpAddress> publicIps = client.getPublicIpsAssociatedWithVDC(vApp.getVDC().getHref());
         for (PublicIpAddress existingIp : publicIps) {
            Set<InternetService> services = client.getInternetServicesOnPublicIp(existingIp.getId());
            if (services.size() == 0) {
               ip = existingIp;
               break;
            }
         }
         if (ip == null)
            throw new InsufficientResourcesException(
                     "no more ip addresses available and existing ips all have services attached: " + publicIps, e
                              .getCause());
      }
      is = client.addInternetServiceToExistingIp(ip.getId(), vApp.getName() + "-" + port, protocol, port,
               withDescription(String.format("port %d access to serverId: %s name: %s", port, vApp.getName(), vApp
                        .getName())));
      Map<InternetService, PublicIpAddress> result = ImmutableMap.<InternetService, PublicIpAddress> of(is, ip);
      Entry<InternetService, PublicIpAddress> entry = Iterables.getOnlyElement(result.entrySet());
      return entry;
View Full Code Here

Examples of org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress

   public void endElement(String uri, String name, String qName) {
      depth--;
      if (equalsOrSuffix(qName, "PublicIpAddress")) {
         inPublicIpAddress = false;
         publicIpAddress = new PublicIpAddress(address, addressLocation);
         address = null;
         addressLocation = null;
      } else {
         String value = currentOrNull(currentText);
         if (value != null && !value.equals("")) {
View Full Code Here

Examples of org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress

      return startAndReturnCredentials(VDC, templateId, name, options, portsToOpen).getNode();
   }

   public String createPublicAddressMappedToPorts(URI vAppId, int... ports) {
      VApp vApp = client.getVApp(vAppId);
      PublicIpAddress ip = null;
      String privateAddress = getLast(vApp.getNetworkToAddresses().values());
      for (int port : ports) {
         InternetService is = null;
         Protocol protocol;
         switch (port) {
         case 22:
            protocol = Protocol.TCP;
            break;
         case 80:
         case 8080:
            protocol = Protocol.HTTP;
            break;
         case 443:
            protocol = Protocol.HTTPS;
            break;
         default:
            protocol = Protocol.HTTP;
            break;
         }
         if (ip == null) {

            Entry<InternetService, PublicIpAddress> entry = internetServiceAndPublicIpAddressSupplier
                  .getNewInternetServiceAndIp(vApp, port, protocol);
            is = entry.getKey();
            ip = entry.getValue();

         } else {
            logger.debug(">> adding InternetService %s:%s:%d", ip.getAddress(), protocol, port);
            is = client.addInternetServiceToExistingIp(
                  ip.getId(),
                  vApp.getName() + "-" + port,
                  protocol,
                  port,
                  withDescription(String.format("port %d access to serverId: %s name: %s", port, vApp.getName(),
                        vApp.getName())));
         }
         logger.debug("<< created InternetService(%s) %s:%s:%d", is.getName(), is.getPublicIpAddress().getAddress(),
               is.getProtocol(), is.getPort());
         logger.debug(">> adding Node %s:%d -> %s:%d", is.getPublicIpAddress().getAddress(), is.getPort(),
               privateAddress, port);
         Node node = client.addNode(is.getId(), privateAddress, vApp.getName() + "-" + port, port);
         logger.debug("<< added Node(%s)", node.getName());
      }
      return ip != null ? ip.getAddress() : null;
   }
View Full Code Here

Examples of org.jclouds.trmk.vcloud_0_8.domain.PublicIpAddress

      return returnVal.equals("") ? null : returnVal;
   }

   @Override
   public PublicIpAddress getResult() {
      return new PublicIpAddress(address, location);
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.