Examples of DropletCreation


Examples of org.jclouds.digitalocean.domain.DropletCreation

         public boolean apply(Region input) {
            return input.getSlug().equals(locationId);
         }
      });

      DropletCreation dropletCreation = api.getDropletApi().create(name,
            Integer.parseInt(template.getImage().getProviderId()),
            Integer.parseInt(template.getHardware().getProviderId()), region.getId(), options.build());

      // We have to actively wait until the droplet has been provisioned until
      // we can build the entire Droplet object we want to return
      nodeRunningPredicate.apply(dropletCreation.getEventId());
      Droplet droplet = api.getDropletApi().get(dropletCreation.getId());

      LoginCredentials defaultCredentials = LoginCredentials.builder().user("root")
            .privateKey(defaultKeys.get("private")).build();

      return new NodeAndInitialCredentials<Droplet>(droplet, String.valueOf(droplet.getId()), defaultCredentials);
View Full Code Here

Examples of org.jclouds.digitalocean.domain.DropletCreation

      DigitalOceanApi api = api(server.getUrl("/"));
      DropletApi dropletApi = api.getDropletApi();

      try {
         DropletCreation droplet = dropletApi.create("test", 419, 32, 1);

         assertRequestHasParameters(server.takeRequest(), "/droplets/new",
               ImmutableMultimap.of("name", "test", "image_id", "419", "size_id", "32", "region_id", "1"));

         assertNotNull(droplet);
         assertEquals(droplet.getName(), "test");
      } finally {
         api.close();
         server.shutdown();
      }
   }
View Full Code Here

Examples of org.jclouds.digitalocean.domain.DropletCreation

      DropletApi dropletApi = api.getDropletApi();

      try {
         CreateDropletOptions options = CreateDropletOptions.builder().addSshKeyId(5).addSshKeyId(4)
               .privateNetworking(true).backupsEnabled(false).build();
         DropletCreation droplet = dropletApi.create("test", 419, 32, 1, options);

         ImmutableMultimap.Builder<String, String> params = ImmutableMultimap.builder();
         params.put("name", "test");
         params.put("image_id", "419");
         params.put("size_id", "32");
         params.put("region_id", "1");
         params.put("ssh_key_ids", "5,4");
         params.put("private_networking", "true");
         params.put("backups_enabled", "false");

         assertRequestHasParameters(server.takeRequest(), "/droplets/new", params.build());

         assertNotNull(droplet);
         assertEquals(droplet.getName(), "test");
      } finally {
         api.close();
         server.shutdown();
      }
   }
View Full Code Here

Examples of org.jclouds.digitalocean.domain.DropletCreation

      super.initialize();
      initializeImageSizeAndRegion();
   }

   public void testGetEvent() {
      DropletCreation droplet = null;

      try {
         droplet = api.getDropletApi().create("eventtest", defaultImage.getId(), defaultSize.getId(),
               defaultRegion.getId());
         Event event = api.getEventApi().get(droplet.getEventId());
         assertNotNull(event, "Droplet creation event should not be null");
         assertTrue(event.getId() > 0, "Event id should be > 0");
      } finally {
         if (droplet != null) {
            waitForEvent(droplet.getEventId());
            api.getDropletApi().destroy(droplet.getId(), true);
         }
      }
   }
View Full Code Here

Examples of org.jclouds.digitalocean.domain.DropletCreation

      }

      // Find the location where the Droplet has to be created
      int regionId = extractRegionId(template.getLocation());

      DropletCreation dropletCreation = api.getDropletApi().create(name,
            Integer.parseInt(template.getImage().getProviderId()),
            Integer.parseInt(template.getHardware().getProviderId()), regionId, options.build());

      // We have to actively wait until the droplet has been provisioned until
      // we can build the entire Droplet object we want to return
      nodeRunningPredicate.apply(dropletCreation.getEventId());
      Droplet droplet = api.getDropletApi().get(dropletCreation.getId());

      LoginCredentials defaultCredentials = LoginCredentials.builder().user("root")
            .privateKey(defaultKeys.get("private")).build();

      return new NodeAndInitialCredentials<Droplet>(droplet, String.valueOf(droplet.getId()), defaultCredentials);
View Full Code Here

Examples of org.jclouds.digitalocean.domain.DropletCreation

      super.initialize();
      initializeImageSizeAndRegion();
   }

   public void testGetEvent() {
      DropletCreation droplet = null;

      try {
         droplet = api.getDropletApi().create("eventtest", defaultImage.getId(), defaultSize.getId(),
               defaultRegion.getId());
         Event event = api.getEventApi().get(droplet.getEventId());
         assertNotNull(event, "Droplet creation event should not be null");
         assertTrue(event.getId() > 0, "Event id should be > 0");
      } finally {
         if (droplet != null) {
            waitForEvent(droplet.getEventId());
            api.getDropletApi().destroy(droplet.getId(), true);
         }
      }
   }
View Full Code Here

Examples of org.jclouds.digitalocean.domain.DropletCreation

      DigitalOceanApi api = api(server.getUrl("/"));
      DropletApi dropletApi = api.getDropletApi();

      try {
         DropletCreation droplet = dropletApi.create("test", "img-1", "size-1", "region-1");

         assertRequestHasParameters(server.takeRequest(), "/droplets/new", ImmutableMultimap.of("name", "test",
               "image_slug", "img-1", "size_slug", "size-1", "region_slug", "region-1"));

         assertNotNull(droplet);
         assertEquals(droplet.getName(), "test");
      } finally {
         api.close();
         server.shutdown();
      }
   }
View Full Code Here

Examples of org.jclouds.digitalocean.domain.DropletCreation

      DropletApi dropletApi = api.getDropletApi();

      try {
         CreateDropletOptions options = CreateDropletOptions.builder().addSshKeyId(5).addSshKeyId(4)
               .privateNetworking(true).backupsEnabled(false).build();
         DropletCreation droplet = dropletApi.create("test", "img-1", "size-1", "region-1", options);

         ImmutableMultimap.Builder<String, String> params = ImmutableMultimap.builder();
         params.put("name", "test");
         params.put("image_slug", "img-1");
         params.put("size_slug", "size-1");
         params.put("region_slug", "region-1");
         params.put("ssh_key_ids", "5,4");
         params.put("private_networking", "true");
         params.put("backups_enabled", "false");

         assertRequestHasParameters(server.takeRequest(), "/droplets/new", params.build());

         assertNotNull(droplet);
         assertEquals(droplet.getName(), "test");
      } finally {
         api.close();
         server.shutdown();
      }
   }
View Full Code Here

Examples of org.jclouds.digitalocean.domain.DropletCreation

      DigitalOceanApi api = api(server.getUrl("/"));
      DropletApi dropletApi = api.getDropletApi();

      try {
         DropletCreation droplet = dropletApi.create("test", 419, 32, 1);

         assertRequestHasParameters(server.takeRequest(), "/droplets/new",
               ImmutableMultimap.of("name", "test", "image_id", "419", "size_id", "32", "region_id", "1"));

         assertNotNull(droplet);
         assertEquals(droplet.getName(), "test");
      } finally {
         api.close();
         server.shutdown();
      }
   }
View Full Code Here

Examples of org.jclouds.digitalocean.domain.DropletCreation

      DropletApi dropletApi = api.getDropletApi();

      try {
         CreateDropletOptions options = CreateDropletOptions.builder().addSshKeyId(5).addSshKeyId(4)
               .privateNetworking(true).backupsEnabled(false).build();
         DropletCreation droplet = dropletApi.create("test", 419, 32, 1, options);

         ImmutableMultimap.Builder<String, String> params = ImmutableMultimap.builder();
         params.put("name", "test");
         params.put("image_id", "419");
         params.put("size_id", "32");
         params.put("region_id", "1");
         params.put("ssh_key_ids", "5,4");
         params.put("private_networking", "true");
         params.put("backups_enabled", "false");

         assertRequestHasParameters(server.takeRequest(), "/droplets/new", params.build());

         assertNotNull(droplet);
         assertEquals(droplet.getName(), "test");
      } finally {
         api.close();
         server.shutdown();
      }
   }
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.