Package org.jclouds.cloudstack.domain

Examples of org.jclouds.cloudstack.domain.AsyncCreateResponse


         HttpResponse.builder()
            .statusCode(200)
            .payload(payloadFromResource("/createfirewallrulesresponse.json"))
            .build());

      AsyncCreateResponse response = client.createFirewallRuleForIpAndProtocol("2", FirewallRule.Protocol.TCP);
      assertEquals(response.getJobId(), "2036");
      assertEquals(response.getId(), "2017");
   }
View Full Code Here


         HttpResponse.builder()
            .statusCode(200)
            .payload(payloadFromResource("/createportforwardingrulesresponse.json"))
            .build());

      AsyncCreateResponse response = client.createPortForwardingRuleForVirtualMachine(
         "2", PortForwardingRule.Protocol.TCP, 22, "1234", 22);
      assertEquals(response.getJobId(), "2035");
      assertEquals(response.getId(), "2015");
   }
View Full Code Here

              HttpResponse.builder()
                      .statusCode(200)
                      .payload(payloadFromResource("/createegressfirewallrulesresponse.json"))
                      .build());

      AsyncCreateResponse response = client.createEgressFirewallRuleForNetworkAndProtocol("2", FirewallRule.Protocol.TCP);
      assertEquals(response.getJobId(), "2036");
      assertEquals(response.getId(), "2017");
   }
View Full Code Here

            "ip %s should be static NATed to a virtual machine before applying rules", ip);
      if (Iterables.size(ports) == 0)
         return ImmutableSet.<IPForwardingRule> of();
      Builder<AsyncCreateResponse> responses = ImmutableSet.builder();
      for (int port : ports) {
         AsyncCreateResponse response = client.getNATApi().createIPForwardingRule(ip.getId(), protocol, port);
         logger.debug(">> creating IP forwarding rule IPAddress(%s) for protocol(%s), port(%s); response(%s)",
               ip.getId(), protocol, port, response);
         responses.add(response);
      }
      Builder<IPForwardingRule> rules = ImmutableSet.builder();
View Full Code Here

            "ip %s should be static NATed to a virtual machine before applying rules", ip);
      if (Iterables.size(ports) == 0)
         return ImmutableSet.<FirewallRule> of();
      Builder<AsyncCreateResponse> responses = ImmutableSet.builder();
      for (int port : ports) {
          AsyncCreateResponse response = client.getFirewallApi().createFirewallRuleForIpAndProtocol(ip.getId(), FirewallRule.Protocol.fromValue(protocol),
                                                                                                       CreateFirewallRuleOptions.Builder.startPort(port).endPort(port));
         logger.debug(">> creating firewall rule IPAddress(%s) for protocol(%s), port(%s); response(%s)",
               ip.getId(), protocol, port, response);
         responses.add(response);
      }
View Full Code Here

      if (networksDisabled)
         return;
      while (portForwardingRule == null) {
         ip = reuseOrAssociate.apply(network);
         try {
            AsyncCreateResponse job = client.getFirewallApi()
               .createPortForwardingRuleForVirtualMachine(ip.getId(), PortForwardingRule.Protocol.TCP, 22, vm.getId(), 22);
            assertTrue(jobComplete.apply(job.getJobId()));
            portForwardingRule = client.getFirewallApi().getPortForwardingRule(job.getId());

         } catch (IllegalStateException e) {
            Logger.CONSOLE.error("Failed while trying to allocate ip: " + e);
            // very likely an ip conflict, so retry;
         }
View Full Code Here

   @Test(dependsOnMethods = "testCreatePortForwardingRule")
   public void testCreateFirewallRule() {
      if (networksDisabled)
         return;

      AsyncCreateResponse job = client.getFirewallApi().createFirewallRuleForIpAndProtocol(
         ip.getId(), FirewallRule.Protocol.TCP, CreateFirewallRuleOptions.Builder.startPort(30).endPort(35));
      assertTrue(jobComplete.apply(job.getJobId()));
      firewallRule = client.getFirewallApi().getFirewallRule(job.getId());

      assertEquals(firewallRule.getStartPort(), 30);
      assertEquals(firewallRule.getEndPort(), 35);
      assertEquals(firewallRule.getProtocol(), FirewallRule.Protocol.TCP);
View Full Code Here

   @Test(dependsOnMethods = "testCreatePortForwardingRule")
   public void testCreateEgressFirewallRule() {
      if (networksDisabled)
         return;

      AsyncCreateResponse job = client.getFirewallApi().createEgressFirewallRuleForNetworkAndProtocol(
              network.getId(), FirewallRule.Protocol.TCP, CreateFirewallRuleOptions.Builder.startPort(30).endPort(35));
      assertTrue(jobComplete.apply(job.getJobId()));
      egressFirewallRule = client.getFirewallApi().getEgressFirewallRule(job.getId());

      assertEquals(egressFirewallRule.getStartPort(), 30);
      assertEquals(egressFirewallRule.getEndPort(), 35);
      assertEquals(egressFirewallRule.getProtocol(), FirewallRule.Protocol.TCP);
View Full Code Here

         Predicate<VirtualMachine> virtualMachineRunning) {
      String serviceOfferingId = DEFAULT_SIZE_ORDERING.min(client.getOfferingApi().listServiceOfferings()).getId();

      System.out.printf("serviceOfferingId %s, templateId %s, zoneId %s, options %s%n", serviceOfferingId, templateId,
            zoneId, options);
      AsyncCreateResponse job = client.getVirtualMachineApi().deployVirtualMachineInZone(zoneId, serviceOfferingId,
            templateId, options);
      assertTrue(jobComplete.apply(job.getJobId()));
      AsyncJob<VirtualMachine> jobWithResult = client.getAsyncJobApi().<VirtualMachine> getAsyncJob(job.getJobId());
      if (jobWithResult.getError() != null)
         Throwables.propagate(new ExecutionException(String.format("job %s failed with exception %s", job.getId(),
               jobWithResult.getError().toString())) {
         });
      VirtualMachine vm = jobWithResult.getResult();
      if (vm.isPasswordEnabled()) {
         assert vm.getPassword() != null : vm;
View Full Code Here

   private PublicIPAddress ip = null;

   public void testAssociateDisassociatePublicIPAddress() throws Exception {
      if (!networksEnabled)
         return;
      AsyncCreateResponse job = client.getAddressApi().associateIPAddressInZone(
            Iterables.get(client.getNetworkApi().listNetworks(), 0).getZoneId());
      checkState(jobComplete.apply(job.getJobId()), "job %s failed to complete", job.getJobId());
      ip = client.getAsyncJobApi().<PublicIPAddress> getAsyncJob(job.getJobId()).getResult();
      checkIP(ip);
   }
View Full Code Here

TOP

Related Classes of org.jclouds.cloudstack.domain.AsyncCreateResponse

Copyright © 2018 www.massapicom. 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.