Examples of ImageBuilder


Examples of org.jclouds.compute.domain.ImageBuilder

   @Override
   public Image apply(@Nullable VAppTemplate from) {
      if (from == null)
         return null;
      ImageBuilder builder = new ImageBuilder();
      builder.ids(from.getHref().toASCIIString());
      builder.uri(from.getHref());
      builder.name(from.getName());
      builder.location(findLocationForResource.apply(checkNotNull(parent, "parent")));
      builder.description(from.getDescription() != null ? from.getDescription() : from.getName());
      builder.operatingSystem(osParser.apply(from.getName()));
      builder.status(toPortableImageStatus.get(from.getStatus()));
      builder.defaultCredentials(credentialsProvider.apply(from));
      return builder.build();
   }
View Full Code Here

Examples of org.jclouds.compute.domain.ImageBuilder

public class ImageToImageTest {

   @Test
   public void testConvertImage() {
      Image image = new Image(1, "Ubuntu 14.04 x64", "Ubuntu 14.04 x64", true, "ubuntu-1404-x86");
      org.jclouds.compute.domain.Image expected = new ImageBuilder()
            .id("ubuntu-1404-x86")
            .providerId("1")
            .name("Ubuntu 14.04 x64")
            .status(AVAILABLE)
            .operatingSystem(
View Full Code Here

Examples of org.jclouds.compute.domain.ImageBuilder

   private DropletToNodeMetadata function;

   @BeforeMethod
   public void setup() {
      images = ImmutableSet.of(new ImageBuilder()
            .id("ubuntu-1404-x86")
            .providerId("1")
            .name("mock image")
            .status(AVAILABLE)
            .operatingSystem(
View Full Code Here

Examples of org.jclouds.compute.domain.ImageBuilder

               // our group
               Set<? extends NodeMetadata> nodes = Sets.filter(input.listNodesDetailsMatching(NodePredicates.all()),
                        NodePredicates.inGroup(poolGroupPrefix));
               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() {
View Full Code Here

Examples of org.jclouds.compute.domain.ImageBuilder

@Singleton
public class ImageToImage implements Function<Image, org.jclouds.compute.domain.Image> {

   @Override
   public org.jclouds.compute.domain.Image apply(final Image input) {
      ImageBuilder builder = new ImageBuilder();
      // Private images don't have a slug
      builder.id(input.getSlug() != null ? input.getSlug() : String.valueOf(input.getId()));
      builder.providerId(String.valueOf(input.getId()));
      builder.name(input.getName());
      builder.description(input.getName());
      builder.status(Status.AVAILABLE);

      OperatingSystem os = input.getOs();

      builder.operatingSystem(builder()
            .name(input.getName())
            .family(os.getDistribution().getOsFamily())
            .description(input.getName())
            .arch(os.getArch())
            .version(os.getVersion())
            .is64Bit(os.is64bit())
            .build());

      ImmutableMap.Builder<String, String> metadata = ImmutableMap.builder();
      metadata.put("publicImage", String.valueOf(input.isPublicImage()));
      builder.userMetadata(metadata.build());

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

Examples of org.jclouds.compute.domain.ImageBuilder

              .family(osFamily)
              .version(osVersion)
              .is64Bit(is64bit(from))
              .build();

      return new ImageBuilder()
              .ids(from.getId())
              .name(get(Splitter.on(":").split(description), 0))
              .description(description)
              .operatingSystem(os)
              .status(Image.Status.AVAILABLE)
View Full Code Here

Examples of org.jclouds.compute.domain.ImageBuilder

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

   @Override
   public Image apply(final VirtualMachineTemplate template) {
      ImageBuilder builder = new ImageBuilder();
      builder.ids(template.getId().toString());
      builder.name(template.getName());
      builder.description(template.getDescription());

      // Location information
      Datacenter region = regionMap.get().get(template.unwrap().getIdFromLink(ParentLinkName.DATACENTER));
      builder.location(datacenterToLocation.apply(region));

      // Only conversions have a status
      builder.status(Status.AVAILABLE);
      builder.backendStatus(Status.AVAILABLE.name()); // Abiquo images do not
                                                      // have a status

      RESTLink downloadLink = template.unwrap().searchLink("diskfile");
      builder.uri(downloadLink == null ? null : URI.create(downloadLink.getHref()));

      // TODO: Operating system not implemented in Abiquo Templates
      // TODO: Image credentials still not present in Abiquo template metadata
      // Will be added in Abiquo 2.4:
      // http://jira.abiquo.com/browse/ABICLOUDPREMIUM-3647
      builder.operatingSystem(OperatingSystem.builder().description(template.getName()).build());

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

Examples of org.jclouds.compute.domain.ImageBuilder

   @Override
   public Image apply(DiskImage from) {
      checkNotNull(from, "disk image");

      ImageBuilder builder = new ImageBuilder();

      builder.ids(from.getId());
      builder.name(from.getName());
      builder.description(from.getDescription());
      // in fgcp, if the image is listed it is available
      builder.status(Status.AVAILABLE);
      OperatingSystem os = diskImageToOperatingSystem.apply(from);
      builder.operatingSystem(os);
      String user = os.getFamily() == OsFamily.WINDOWS ? "Administrator" : "root";
      builder.defaultCredentials(LoginCredentials.builder().identity(user).noPassword().build());
      return builder.build();
   }
View Full Code Here

Examples of org.jclouds.compute.domain.ImageBuilder

   @Test
   public void testWhenNoHardwareOrImageMatchImageIdIsStillSet() {

      Hardware existingHardware = new HardwareBuilder().id("us-sw-1/FOOOOOOOO").providerId("FOOOOOOOO").location(zone)
            .build();
      Image existingImage = new ImageBuilder().id("us-sw-1/FOOOOOOOO")
            .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
            .providerId("FOOOOOOOO").description("foobuntu").location(zone).status(Image.Status.AVAILABLE).build();

      checkHardwareAndImageStatus(null, existingHardware, "us-sw-1/sdc:sdc:centos-5.7:1.2.1", null, existingImage);
   }
View Full Code Here

Examples of org.jclouds.compute.domain.ImageBuilder

   @Test
   public void testWhenHardwareAndImageMatchHardwareOperatingSystemAndImageIdAreSet() {

      Hardware existingHardware = new HardwareBuilder().id("us-sw-1/Small 1GB").providerId("Small 1GB").ram(1024)
            .volume(new VolumeImpl(Float.valueOf(61440), true, true)).location(zone).build();
      Image existingImage = new ImageBuilder().id("us-sw-1/sdc:sdc:centos-5.7:1.2.1")
            .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
            .providerId("sdc:sdc:centos-5.7:1.2.1").description("foobuntu").status(Image.Status.AVAILABLE)
            .location(zone).build();

      checkHardwareAndImageStatus(existingHardware, existingHardware, existingImage.getId(),
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.