Package org.jclouds.digitalocean.domain

Examples of org.jclouds.digitalocean.domain.Region


         options.backupsEnabled(templateOptions.getBackupsEnabled());
      }

      // Find the location where the Droplet has to be created
      final String locationId = template.getLocation().getId();
      Region region = find(api.getRegionApi().list(), new Predicate<Region>() {
         @Override
         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());
View Full Code Here


      int snapshotEvent = api.getDropletApi().snapshot(droplet.getId(), "imagetransfersnapshot");
      waitForEvent(snapshotEvent);

      snapshot = find(api.getImageApi().list(), byName("imagetransfersnapshot"));

      Region newRegion = regions.get(1);
      int transferEvent = api.getImageApi().transfer(snapshot.getId(), newRegion.getId());
      assertTrue(transferEvent > 0, "Transfer event id should be > 0");
      waitForEvent(transferEvent);
   }
View Full Code Here

   public void testConvertRegion() {
      DigitalOceanProviderMetadata metadata = new DigitalOceanProviderMetadata();
      JustProvider locationsSupplier = new JustProvider(metadata.getId(), Suppliers.<URI> ofInstance(URI
            .create(metadata.getEndpoint())), ImmutableSet.<String> of());

      Region region = new Region(1, "Region 1", "reg1");
      Location expected = new LocationBuilder().id("reg1").description("1/Region 1")
            .parent(getOnlyElement(locationsSupplier.get())).scope(LocationScope.REGION).build();

      RegionToLocation function = new RegionToLocation(locationsSupplier);
      assertEquals(function.apply(region), expected);
View Full Code Here

      int snapshotEvent = api.getDropletApi().snapshot(droplet.getId(), "imagetransfersnapshot");
      waitForEvent(snapshotEvent);

      snapshot = find(api.getImageApi().list(), byName("imagetransfersnapshot"));

      Region newRegion = regions.get(1);
      int transferEvent = api.getImageApi().transfer(snapshot.getId(), newRegion.getId());
      assertTrue(transferEvent > 0, "Transfer event id should be > 0");
      waitForEvent(transferEvent);
   }
View Full Code Here

      int snapshotEvent = api.getDropletApi().snapshot(dropletUsingSlug.getId(), "imagetransfersnapshotusingslug");
      waitForEvent(snapshotEvent);

      snapshotUsingSlug = find(api.getImageApi().list(), byName("imagetransfersnapshotusingslug"));

      Region newRegion = regions.get(1);
      int transferEvent = api.getImageApi().transfer(snapshotUsingSlug.getId(), newRegion.getId());
      assertTrue(transferEvent > 0, "Transfer event id should be > 0");
      waitForEvent(transferEvent);
   }
View Full Code Here

      encodeRegionIdAndName(null);
   }

   @Test
   public void testEncodeRegionAndName() {
      assertEquals("1/foo", encodeRegionIdAndName(new Region(1, "foo", "bar")));
      assertEquals("1/1", encodeRegionIdAndName(new Region(1, "1", "1")));
      assertEquals("1///", encodeRegionIdAndName(new Region(1, "//", "1")));
   }
View Full Code Here

   public void testConvertRegion() {
      DigitalOceanProviderMetadata metadata = new DigitalOceanProviderMetadata();
      JustProvider locationsSupplier = new JustProvider(metadata.getId(), Suppliers.<URI> ofInstance(URI
            .create(metadata.getEndpoint())), ImmutableSet.<String> of());

      Region region = new Region(1, "Region 1", "reg1");
      Location expected = new LocationBuilder().id("reg1").description("1/Region 1")
            .parent(getOnlyElement(locationsSupplier.get())).scope(LocationScope.REGION).build();

      RegionToLocation function = new RegionToLocation(locationsSupplier);
      assertEquals(function.apply(region), expected);
View Full Code Here

      encodeRegionIdAndName(null);
   }

   @Test
   public void testEncodeRegionAndName() {
      assertEquals("1/foo", encodeRegionIdAndName(new Region(1, "foo", "bar")));
      assertEquals("1/1", encodeRegionIdAndName(new Region(1, "1", "1")));
      assertEquals("1///", encodeRegionIdAndName(new Region(1, "//", "1")));
   }
View Full Code Here

      int snapshotEvent = api.getDropletApi().snapshot(droplet.getId(), "imagetransfersnapshot");
      waitForEvent(snapshotEvent);

      snapshot = find(api.getImageApi().list(), byName("imagetransfersnapshot"));

      Region newRegion = regions.get(1);
      int transferEvent = api.getImageApi().transfer(snapshot.getId(), newRegion.getId());
      assertTrue(transferEvent > 0, "Transfer event id should be > 0");
      waitForEvent(transferEvent);
   }
View Full Code Here

      int snapshotEvent = api.getDropletApi().snapshot(dropletUsingSlug.getId(), "imagetransfersnapshotusingslug");
      waitForEvent(snapshotEvent);

      snapshotUsingSlug = find(api.getImageApi().list(), byName("imagetransfersnapshotusingslug"));

      Region newRegion = regions.get(1);
      int transferEvent = api.getImageApi().transfer(snapshotUsingSlug.getId(), newRegion.getId());
      assertTrue(transferEvent > 0, "Transfer event id should be > 0");
      waitForEvent(transferEvent);
   }
View Full Code Here

TOP

Related Classes of org.jclouds.digitalocean.domain.Region

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.