Package org.jclouds.compute.domain

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


public class GoogleComputeEngineImageToImage implements Function<Image, org.jclouds.compute.domain.Image> {


   @Override
   public org.jclouds.compute.domain.Image apply(Image image) {
      ImageBuilder builder = new ImageBuilder()
              .id(image.getName())
              .name(image.getName())
              .providerId(image.getId())
              .description(image.getDescription().orNull())
              .status(Status.AVAILABLE)
              .uri(image.getSelfLink());

      List<String> splits = Lists.newArrayList(image.getName().split("-"));
      OperatingSystem.Builder osBuilder = defaultOperatingSystem(image);
      if (splits == null || splits.size() == 0 || splits.size() < 3) {
         return builder.operatingSystem(osBuilder.build()).build();
      }

      OsFamily family = OsFamily.fromValue(splits.get(0));
      if (family != OsFamily.UNRECOGNIZED) {
         osBuilder.family(family);
      }

      String version = on(".").join(limit(skip(splits, 1), splits.size() - 2));
      osBuilder.version(version);

      if (image.getDeprecated().isPresent()) {
         builder.userMetadata(ImmutableMap.of("deprecatedState", image.getDeprecated().get().getState().orNull()));
      }
      builder.version(getLast(splits));
      return builder.operatingSystem(osBuilder.build()).build();
   }
View Full Code Here

          failedNodes.put(nodeMeta, new Exception("Simulated failing node"));
          LOG.info("{} - Node failing to start: {}", roles, nodeMeta.getId());
        }
      }
      if (failedNodes.size() > 0) {
        Image image = new ImageBuilder().providerId("ec2").name("test").id("testId").location(location)
              .uri(URI.create("http://node")).operatingSystem(OperatingSystem.builder().description("op").build())
              .description("description").status(Image.Status.AVAILABLE).defaultCredentials(loginCredentials).build();
        Hardware hardware = new HardwareBuilder().providerId("ec2").name("test").id("testId").location(location)
              .uri(URI.create("http://node")).ram(1).hypervisor("xen").build();
        Template template = new TemplateImpl(image, hardware, location, TemplateOptions.NONE);
View Full Code Here

      WellKnownImage input = preinstalledImages.get().get(drive.getUuid());
      // set credentials in the store here, as opposed to directly modifying the image. we need to
      // set credentials on the image outside of this function so that they can be for example
      // overridden by properties
      credentialStore.put("image#" + drive.getUuid(), LoginCredentials.builder().user(input.getLoginUser()).build());
      return new ImageBuilder()
            .ids(drive.getUuid())
            .userMetadata(
                  ImmutableMap.<String, String> builder().putAll(drive.getUserMetadata())
                        .put("size", input.getSize() + "").build())
            .location(locationSupplier.get())
View Full Code Here

          failedNodes.put(nodeMeta, new Exception("Simulated failing node"));
          LOG.info("{} - Node failing to start: {}", roles, nodeMeta.getId());
        }
      }
      if (failedNodes.size() > 0) {
        Image image = new ImageBuilder().providerId("ec2").name("test").id("testId").location(location)
              .uri(URI.create("http://node")).operatingSystem(OperatingSystem.builder().description("op").build())
              .description("description").status(Image.Status.AVAILABLE).defaultCredentials(loginCredentials).build();
        Hardware hardware = new HardwareBuilder().providerId("ec2").name("test").id("testId").location(location)
              .uri(URI.create("http://node")).ram(1).hypervisor("xen").build();
        Template template = new TemplateImpl(image, hardware, location, TemplateOptions.NONE);
View Full Code Here

   @Test
   public void testWhenNoHardwareOrImageMatchServerScopedIdsImageIdIsStillSet() {

      Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/FOOOOOOOO").providerId("FOOOOOOOO")
            .location(zone).build();
      Image existingImage = new ImageBuilder().id("az-1.region-a.geo-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, "az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f6f006e54",
            null, existingImage);
View Full Code Here

   @Test
   public void testWhenNoHardwareAndImageMatchServerScopedIdsHardwareOperatingSystemAndImageIdAreSet() {

      Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f216543fd")
            .providerId("52415800-8b69-11e0-9b19-734f216543fd").location(zone).build();
      Image existingImage = new ImageBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f6f006e54")
            .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
            .providerId("52415800-8b69-11e0-9b19-734f6f006e54").description("foobuntu").status(Image.Status.AVAILABLE)
            .location(zone).build();

      checkHardwareAndImageStatus(existingHardware, existingHardware, existingImage.getId(),
View Full Code Here

   @Test
   public void testNullAccessIPs() {
      Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f216543fd")
            .providerId("52415800-8b69-11e0-9b19-734f216543fd").location(zone).build();
      Image existingImage = new ImageBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f6f006e54")
            .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
            .providerId("52415800-8b69-11e0-9b19-734f6f006e54").description("foobuntu").status(Image.Status.AVAILABLE)
            .location(zone).build();

      Set<Image> images = existingImage == null ? ImmutableSet.<Image> of() : ImmutableSet.of(existingImage);
View Full Code Here

   @Test
   public void testDuplicateAccessIPs() {
      Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f216543fd")
            .providerId("52415800-8b69-11e0-9b19-734f216543fd").location(zone).build();
      Image existingImage = new ImageBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f6f006e54")
            .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
            .providerId("52415800-8b69-11e0-9b19-734f6f006e54").description("foobuntu").status(Image.Status.AVAILABLE)
            .location(zone).build();

      Set<Image> images = existingImage == null ? ImmutableSet.<Image> of() : ImmutableSet.of(existingImage);
View Full Code Here

   @Test
   public void testAlternateAccessIPs() {
      Hardware existingHardware = new HardwareBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f216543fd")
            .providerId("52415800-8b69-11e0-9b19-734f216543fd").location(zone).build();
      Image existingImage = new ImageBuilder().id("az-1.region-a.geo-1/52415800-8b69-11e0-9b19-734f6f006e54")
            .operatingSystem(OperatingSystem.builder().family(OsFamily.LINUX).description("foobuntu").build())
            .providerId("52415800-8b69-11e0-9b19-734f6f006e54").description("foobuntu").status(Image.Status.AVAILABLE)
            .location(zone).build();

      Set<Image> images = existingImage == null ? ImmutableSet.<Image> of() : ImmutableSet.of(existingImage);
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.