Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.ImageBuilder


      return new OperatingSystem(osFamily, osName, osVersion, osArch, osDescription, is64Bit);
   }

   @Override
   public Image apply(ServerImage from) {
      ImageBuilder builder = new ImageBuilder();
      builder.ids(from.getId() + "");
      builder.name(from.getFriendlyName());
      builder.description(from.getDescription());
      builder.operatingSystem(parseOs(from));
      builder.status(toPortableImageStatus.get(from.getState()));
      return builder.build();
   }
View Full Code Here


   public Image apply(Template template) {
      checkNotNull(template, "template");

      OperatingSystem os = templateToOperatingSystem.apply(template);

      ImageBuilder builder = new ImageBuilder().ids(template.getId() + "").name(template.getName())
            .description(template.getDisplayText()).operatingSystem(os);

      if (!template.isCrossZones())
         builder.location(FluentIterable.from(locations.get()).firstMatch(idEquals(template.getZoneId())).orNull());

      //TODO: implement status mapping!!!
      builder.status(Status.AVAILABLE);
      return builder.build();
   }
View Full Code Here

      final ZoneAndId targetImageZoneAndId = ZoneAndId.fromZoneAndId(sourceImageZoneAndId.getZone(), newImageId);

      logger.info(">> Registered new Image %s, waiting for it to become available.", newImageId);
     
      final AtomicReference<Image> image = Atomics.newReference(new ImageBuilder()
            .location(find(locations.get(), idEquals(targetImageZoneAndId.getZone())))
            .id(targetImageZoneAndId.slashEncode())
            .providerId(targetImageZoneAndId.getId())
            .description(cloneTemplate.getName())
            .operatingSystem(OperatingSystem.builder().description(cloneTemplate.getName()).build())
View Full Code Here

      for (org.jclouds.compute.domain.Image image : result) {
         assertEquals(image.getStatus(), Status.AVAILABLE);
         assertEquals(image.getBackendStatus(), "available");
      }
     
      assertImageEquals(Iterables.get(result, 0), new ImageBuilder().operatingSystem(
               new OperatingSystem.Builder().family(OsFamily.UNRECOGNIZED).arch("paravirtual").version("").description(
                        "137112412989/amzn-ami-0.9.7-beta.i386-ebs").is64Bit(false).build()).description("Amazon")
               .defaultCredentials(LoginCredentials.builder().user("ec2-user").build()).id("us-east-1/ami-82e4b5c7").name(
                        "amzn-ami-0.9.7-beta.i386-ebs").providerId("ami-82e4b5c7").location(defaultLocation)
               .userMetadata(ImmutableMap.of("owner", "137112412989", "rootDeviceType", "ebs")).status(
                        Status.AVAILABLE).backendStatus("available").build());

      assertImageEquals(Iterables.get(result, 3), new ImageBuilder().operatingSystem(
               new OperatingSystem.Builder().family(OsFamily.UNRECOGNIZED).arch("paravirtual").version("").description(
                        "amzn-ami-us-west-1/amzn-ami-0.9.7-beta.x86_64.manifest.xml").is64Bit(true).build())
               .description("Amazon Linux AMI x86_64 S3").defaultCredentials(LoginCredentials.builder().user("ec2-user").build())
               .id("us-east-1/ami-f2e4b5b7").providerId("ami-f2e4b5b7").name("amzn-ami-0.9.7-beta.x86_64-S3").location(
                        defaultLocation)
               .userMetadata(ImmutableMap.of("owner", "137112412989", "rootDeviceType", "ebs")).status(
                        Status.AVAILABLE).backendStatus("available").build());
     
      assertImageEquals(Iterables.get(result, 4), new ImageBuilder().operatingSystem(
               new OperatingSystem.Builder().family(OsFamily.WINDOWS).arch("hvm").version("2008").description(
                        "amazon/NameGivesNoClue_Server-2008-R2_SP1-Language_Packs-64Bit-Base-2012.05.10")
                        .is64Bit(true).build())
               .description("Microsoft Windows Server 2008 R2 SP1 Datacenter 64-bit Multi-language AMI provided by Amazon")
               .defaultCredentials(LoginCredentials.builder().user("root").build())
View Full Code Here

   @Override
   public Image apply(ImageInZone imageInZone) {
      Location location = locationIndex.get().get(imageInZone.getZone());
      checkState(location != null, "location %s not in locationIndex: %s", imageInZone.getZone(), locationIndex.get());
      org.jclouds.openstack.nova.v2_0.domain.Image image = imageInZone.getImage();
      return new ImageBuilder().id(imageInZone.slashEncode()).providerId(image.getId()).name(image.getName())
               .userMetadata(image.getMetadata()).operatingSystem(imageToOs.apply(image)).description(image.getName())
               .location(location).status(toPortableImageStatus.get(image.getStatus())).build();
   }
View Full Code Here

            .family(osFamily)
            .version(osVersion)
            .is64Bit(Objects.equal(bits, 64))
            .build();

      return new ImageBuilder()
            .ids(imageId().apply(productItem))
            .description(description)
            .operatingSystem(os)
            .status(Image.Status.AVAILABLE)
            .build();
View Full Code Here

         super(null);
      }

      @Override
      public Image getImage(VirtualGuest guest) {
         return new ImageBuilder().ids("123").description("mocked image")
               .operatingSystem(OperatingSystem.builder().description("foo os").build())
               .status(Image.Status.AVAILABLE).build();
      }
View Full Code Here

   @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

   @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

        ReviseParsedImage rpi = new AWSEC2ReviseParsedImage(osVersionMap);

        Image from = newImage("amazon", "Windows_Server-2008-R2_SP1-English-64Bit-Base-2012.03.13");
        OperatingSystem.Builder osBuilder = OperatingSystem.builder().description("test");
      ImageBuilder builder = new ImageBuilder().id("1").operatingSystem(osBuilder.build()).status(
               org.jclouds.compute.domain.Image.Status.AVAILABLE).description("test");
        OsFamily family = OsFamily.WINDOWS;

        rpi.reviseParsedImage(from, builder, family, osBuilder);
        OperatingSystem os = osBuilder.build();
        assertEquals(os.getFamily(), OsFamily.WINDOWS);
        assertEquals(os.getVersion(), "2008");
        assertEquals(builder.build().getVersion(), "2012.03.13");
    }
View Full Code Here

TOP

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

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.