Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.VolumeBuilder


         this.cache = checkNotNull(cache, "cache");
      }

      @Override
      public Volume apply(Device input) {
         VolumeBuilder builder = new VolumeBuilder();
         builder.id(input.getId());
         try {
            DriveInfo drive = cache.getUnchecked(input.getDriveUuid());
            builder.size(drive.getSize() / (float) (1024 * 1024));
         } catch (NullPointerException e) {
            logger.debug("drive %s not found", input.getDriveUuid());
         } catch (UncheckedExecutionException e) {
            logger.warn(e, "error finding drive %s: %s", input.getDriveUuid(), e.getMessage());
         }
         return new VolumeBuilder().durable(true).type(Volume.Type.NAS).build();
      }
View Full Code Here


         this.cache = checkNotNull(cache, "cache");
      }

      @Override
      public Volume apply(Device input) {
         VolumeBuilder builder = new VolumeBuilder();
         builder.id(input.getId());
         try {
            DriveInfo drive = cache.getUnchecked(input.getDriveUuid());
            builder.size((float) drive.getSize());
         } catch (NullPointerException e) {
            logger.debug("drive %s not found", input.getDriveUuid());
         } catch (UncheckedExecutionException e) {
            logger.warn(e, "error finding drive %s: %s", input.getDriveUuid(), e.getMessage());
         }
         return builder.durable(true).type(Volume.Type.NAS).build();
      }
View Full Code Here

                              .ids("1")
                              .name("256 MB Server")
                              .processors(ImmutableList.of(new Processor(1.0, 1.0)))
                              .ram(256)
                              .volumes(
                                    ImmutableList.of(new VolumeBuilder().type(Volume.Type.LOCAL).size(10.0f)
                                          .durable(true).bootDevice(true).build())).build())
                  .operatingSystem(
                        new OperatingSystem.Builder().family(OsFamily.CENTOS).description("CentOS 5.2").version("5.2")
                              .is64Bit(true).build())
                  .id("1234")
View Full Code Here

   @Test
   public void test() throws UnknownHostException {
      assertEquals(convertFlavor(), new HardwareBuilder().ids("1").name("256 MB Server").processors(
               ImmutableList.of(new Processor(1.0, 1.0))).ram(256).volumes(
               ImmutableList.of(new VolumeBuilder().type(Volume.Type.LOCAL).size(10.0f).durable(true).bootDevice(true)
                        .build())).build());
   }
View Full Code Here

         this.cache = checkNotNull(cache, "cache");
      }

      @Override
      public Volume apply(Device input) {
         VolumeBuilder builder = new VolumeBuilder();
         builder.id(input.getId());
         try {
            DriveInfo drive = cache.getUnchecked(input.getDriveUuid());
            builder.size(drive.getSize() / (float) (1024 * 1024));
         } catch (NullPointerException e) {
            logger.debug("drive %s not found", input.getDriveUuid());
         } catch (UncheckedExecutionException e) {
            logger.warn(e, "error finding drive %s: %s", input.getDriveUuid(), e.getMessage());
         }
         return new VolumeBuilder().durable(true).type(Volume.Type.NAS).build();
      }
View Full Code Here

                  OperatingSystem.builder().name("Ubuntu 14.04 x86_64").description("Ubuntu").family(OsFamily.UBUNTU)
                        .version("10.04").arch("x86_64").is64Bit(true).build()).build());

      hardwares = ImmutableSet.of(new HardwareBuilder().id("2gb").providerId("1").name("mock hardware")
            .processor(new Processor(1.0, 1.0)).ram(2048)
            .volume(new VolumeBuilder().size(20f).type(Type.LOCAL).build()).build());

      locations = ImmutableSet.of(new LocationBuilder()
            .id("1")
            .description("1/mock location")
            .scope(LocationScope.REGION)
View Full Code Here

   @Test
   public void testConvertSize() {
      Size size = new Size(1, "Medium", "2gb", 2048, 1, 20, "0.05", "10");
      Hardware expected = new HardwareBuilder().id("2gb").providerId("1").name("Medium")
            .processor(new Processor(1.0, 1.0)).ram(2048)
            .volume(new VolumeBuilder().size(20f).type(Type.LOCAL).build())
            .userMetadata(ImmutableMap.of("costPerHour", "0.05", "costPerMonth", "10")).build();

      SizeToHardware function = new SizeToHardware();
      assertEquals(function.apply(size), expected);
   }
View Full Code Here

      builder.ram(input.getMemory());
      // DigitalOcean does not provide the processor speed. We configure it to
      // make the bigger template the faster.
      builder.processor(new Processor(input.getCpu(), input.getCpu()));

      builder.volume(new VolumeBuilder()
            .size(Float.valueOf(input.getDisk()))
            .type(Type.LOCAL)
            .build());

      ImmutableMap.Builder<String, String> metadata = ImmutableMap.builder();
View Full Code Here

      hardwares = ImmutableSet.of(new HardwareBuilder().id("my_id")
         .uri(URI.create("https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a/machineTypes/"
               + "n1-standard-1"))
         .providerId("1")
         .name("mock hardware").processor(new Processor(1.0, 1.0)).ram(2048)
         .volume(new VolumeBuilder().size(20f).type(Type.LOCAL).build()).build());

      locations = ImmutableSet.of(new LocationBuilder()
         .id("id")
         .description("https://www.googleapis.com/compute/v1/projects/myproject/zones/us-central1-a")
         .scope(LocationScope.REGION)
View Full Code Here

   }

   private Iterable<Volume> collectVolumes(MachineType input) {
      ImmutableSet.Builder<Volume> volumes = ImmutableSet.builder();
      for (MachineType.ScratchDisk disk : input.getScratchDisks()) {
         volumes.add(new VolumeBuilder()
                 .type(Volume.Type.LOCAL)
                 .size(new Integer(disk.getDiskGb()).floatValue())
                 .bootDevice(true)
                 .durable(false).build());
      }
View Full Code Here

TOP

Related Classes of org.jclouds.compute.domain.VolumeBuilder

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.