Examples of ZoneAndId


Examples of org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId

      throw new UnsupportedOperationException("resume requires installation of the Admin Actions extension");
   }

   @Override
   public void suspendNode(String id) {
      ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
      if (novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).isPresent()) {
         novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).get().suspend(zoneAndId.getId());
      }
      throw new UnsupportedOperationException("suspend requires installation of the Admin Actions extension");
   }
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId

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

   @Override
   public ImageTemplate buildImageTemplateFromNode(String name, final String id) {
      ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
      Server server = novaApi.getServerApiForZone(zoneAndId.getZone()).get(zoneAndId.getId());
      if (server == null)
         throw new NoSuchElementException("Cannot find server with id: " + zoneAndId);
      CloneImageTemplate template = new ImageTemplateBuilder.CloneImageTemplateBuilder().nodeId(id).name(name).build();
      return template;
   }
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId

   @Override
   public ListenableFuture<Image> createImage(ImageTemplate template) {
      checkState(template instanceof CloneImageTemplate,
               " openstack-nova only supports creating images through cloning.");
      CloneImageTemplate cloneTemplate = (CloneImageTemplate) template;
      ZoneAndId sourceImageZoneAndId = ZoneAndId.fromSlashEncoded(cloneTemplate.getSourceNodeId());

      String newImageId = novaApi.getServerApiForZone(sourceImageZoneAndId.getZone()).createImageFromServer(
               cloneTemplate.getName(), sourceImageZoneAndId.getId());

      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())
            .status(Image.Status.PENDING).build());

      return userExecutor.submit(new Callable<Image>() {
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId

      });
   }

   @Override
   public boolean deleteImage(String id) {
      ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
      try {
         this.novaApi.getImageApiForZone(zoneAndId.getZone()).delete(zoneAndId.getId());
      } catch (Exception e) {
         return false;
      }
      return true;
   }
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId

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

   @Override
   public ImageTemplate buildImageTemplateFromNode(String name, final String id) {
      ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
      Server server = novaApi.getServerApiForZone(zoneAndId.getZone()).get(zoneAndId.getId());
      if (server == null)
         throw new NoSuchElementException("Cannot find server with id: " + zoneAndId);
      CloneImageTemplate template = new ImageTemplateBuilder.CloneImageTemplateBuilder().nodeId(id).name(name).build();
      return template;
   }
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId

   @Override
   public ListenableFuture<Image> createImage(ImageTemplate template) {
      checkState(template instanceof CloneImageTemplate,
               " openstack-nova only supports creating images through cloning.");
      CloneImageTemplate cloneTemplate = (CloneImageTemplate) template;
      ZoneAndId sourceImageZoneAndId = ZoneAndId.fromSlashEncoded(cloneTemplate.getSourceNodeId());

      String newImageId = novaApi.getServerApiForZone(sourceImageZoneAndId.getZone()).createImageFromServer(
               cloneTemplate.getName(), sourceImageZoneAndId.getId());

      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())
            .status(Image.Status.PENDING).build());

      return userExecutor.submit(new Callable<Image>() {
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId

      });
   }

   @Override
   public boolean deleteImage(String id) {
      ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
      try {
         this.novaApi.getImageApiForZone(zoneAndId.getZone()).delete(zoneAndId.getId());
      } catch (Exception e) {
         return false;
      }
      return true;
   }
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId

      return ImmutableSet.copyOf(groups);
   }

   @Override
   public Set<SecurityGroup> listSecurityGroupsForNode(String id) {
      ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(checkNotNull(id, "id"));
      String zone = zoneAndId.getZone();
      String instanceId = zoneAndId.getId();

      Optional<? extends ServerWithSecurityGroupsApi> serverApi = api.getServerWithSecurityGroupsExtensionForZone(zone);
      Optional<? extends SecurityGroupApi> sgApi = api.getSecurityGroupExtensionForZone(zone);

      if (!serverApi.isPresent() || !sgApi.isPresent()) {
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId

      return ImmutableSet.copyOf(transform(filter(rawGroups, notNull()), groupConverter));
   }

   @Override
   public SecurityGroup getSecurityGroupById(String id) {
      ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(checkNotNull(id, "id"));
      String zone = zoneAndId.getZone();
      String groupId = zoneAndId.getId();

      Optional<? extends SecurityGroupApi> sgApi = api.getSecurityGroupExtensionForZone(zone);

      if (!sgApi.isPresent()) {
         return null;
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId

   }

   @Override
   public boolean removeSecurityGroup(String id) {
      checkNotNull(id, "id");
      ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
      String zone = zoneAndId.getZone();
      String groupId = zoneAndId.getId();

      Optional<? extends SecurityGroupApi> sgApi = api.getSecurityGroupExtensionForZone(zone);

      if (!sgApi.isPresent()) {
         return false;
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.