Examples of HardwareBuilder


Examples of org.jclouds.compute.domain.HardwareBuilder

                              OperatingSystem.builder().name("Ubuntu 11.04 x64").description("Ubuntu 11.04 x64")
                                    .is64Bit(true).version("11.04").family(OsFamily.UBUNTU).build()).build()));

      final Supplier<Set<? extends Hardware>> hardwares = Suppliers.<Set<? extends Hardware>> ofInstance(ImmutableSet
            .<Hardware> of(
                  new HardwareBuilder()
                        .ids("m1.small").ram(512)
                        .processors(ImmutableList.of(new Processor(1, 1.0)))
                        .volumes(ImmutableList.<Volume> of(new VolumeImpl((float) 5, true, true))).build()));

      final Provider<TemplateOptions> optionsProvider = new Provider<TemplateOptions>() {
View Full Code Here

Examples of org.jclouds.compute.domain.HardwareBuilder

                  Splitter.on('\n').withKeyValueSeparator("=").split(decoded));
      }

      builder.imageId(from.getTemplateName() + "");
      builder.operatingSystem(parseOperatingSystem(from));
      builder.hardware(new HardwareBuilder().ids(from.getId() + "").ram(from.getMemorySizeMB())
            .processors(ImmutableList.of(new Processor(from.getCpuCores(), 1.0)))
            .volumes(ImmutableList.<Volume> of(new VolumeImpl((float) from.getDiskSizeGB(), true, true)))
            .hypervisor(from.getPlatform()).build());
      builder.status(serverStateToNodeStatus.get(from.getState()));
      Iterable<String> addresses = Iterables.filter(Iterables.transform(from.getIps(), new Function<Ip, String>() {
View Full Code Here

Examples of org.jclouds.compute.domain.HardwareBuilder

      double cores = ProductItems.capacity().apply(coresItem).doubleValue();
      Matcher cpuMatcher = cpuDescriptionRegex.matcher(coresItem.getDescription());
      double coreSpeed = (cpuMatcher.matches()) ? Double.parseDouble(cpuMatcher.group(cpuMatcher.groupCount())) : DEFAULT_CORE_SPEED;
      int ram = ProductItems.capacity().apply(ramItem).intValue();

      return new HardwareBuilder().ids(hardwareId).processors(ImmutableList.of(new Processor(cores, coreSpeed))).ram(
               ram)
               .hypervisor("XenServer")
               .volumes(
                  Iterables.transform(filter(items, categoryCodeMatches(diskCategoryRegex)),
                        new Function<ProductItem, Volume>() {
View Full Code Here

Examples of org.jclouds.compute.domain.HardwareBuilder

         super(createNiceMock(SoftLayerClient.class), createNiceMock(Function.class));
      }

      @Override
      public Hardware getHardware(VirtualGuest guest) {
         return new HardwareBuilder().ids("mocked hardware").build();
      }
View Full Code Here

Examples of org.jclouds.compute.domain.HardwareBuilder

   @Override
   public Hardware apply(VApp from) {
      checkNotNull(from, "VApp");
      try {
         HardwareBuilder builder = rasdToHardwareBuilder.apply(from.getResourceAllocations());
         builder.location(findLocationForResource.apply(checkNotNull(from, "from").getVDC()));
         builder.ids(from.getHref().toASCIIString()).name(from.getName())
               .supportsImage(ImagePredicates.idEquals(from.getHref().toASCIIString()));
         builder.hypervisor("VMware");
         return builder.build();
      } catch (NoSuchElementException e) {
         logger.debug("incomplete data to form vApp %s", from.getHref());
         return null;
      }
   }
View Full Code Here

Examples of org.jclouds.compute.domain.HardwareBuilder

   public Set<? extends Hardware> get() {
      Set<Hardware> hardware = Sets.newHashSet();
      for (int cpus : new int[] { 1, 2, 4, 8 })
         for (int ram : new int[] { 512, 1024, 2048, 4096, 8192, 16384 }) {
            String id = String.format("cpu=%d,ram=%s,disk=%d", cpus, ram, 10);
            hardware.add(new HardwareBuilder().ids(id).ram(ram).processors(ImmutableList.of(new Processor(cpus, 1.0)))
                     .volumes(ImmutableList.<Volume> of(new VolumeImpl(10f, true, true))).hypervisor("VMware").build());
         }
      return hardware;
   }
View Full Code Here

Examples of org.jclouds.compute.domain.HardwareBuilder

@Singleton
public class SizeToHardware implements Function<Size, Hardware> {

   @Override
   public Hardware apply(Size input) {
      HardwareBuilder builder = new HardwareBuilder();
      builder.id(input.getSlug());
      builder.providerId(String.valueOf(input.getId()));
      builder.name(input.getName());
      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();
      metadata.put("costPerHour", input.getCostPerHour());
      metadata.put("costPerMonth", input.getCostPerMonth());
      builder.userMetadata(metadata.build());

      return builder.build();
   }
View Full Code Here

Examples of org.jclouds.compute.domain.HardwareBuilder

            .status(AVAILABLE)
            .operatingSystem(
                  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")
View Full Code Here

Examples of org.jclouds.compute.domain.HardwareBuilder

public class SizeToHardwareTest {

   @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();
View Full Code Here

Examples of org.jclouds.compute.domain.HardwareBuilder

               checkState(!nodes.isEmpty(), "service provided no template and no node was in this nodepool's group.");
               final NodeMetadata node = Iterables.get(nodes, 0);
               final Image image = new ImageBuilder().id(node.getId()).location(node.getLocation())
                        .operatingSystem(node.getOperatingSystem()).status(Status.AVAILABLE)
                        .description("physical node").build();
               final Hardware hardware = new HardwareBuilder().id(node.getId()).build();
               return new Template() {

                  @Override
                  public Image getImage() {
                     return image;
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.