Package org.jclouds.googlecomputeengine.domain

Examples of org.jclouds.googlecomputeengine.domain.SlashEncodedIds


      });
   }

   @Override
   public void destroyNode(final String name) {
      SlashEncodedIds slashEncodedIds = SlashEncodedIds.fromSlashEncoded(name);

      waitOperationDone(api.getInstanceApiForProject(userProject.get()).deleteInZone(slashEncodedIds.getFirstId(),
              slashEncodedIds.getSecondId()));
   }
View Full Code Here


              slashEncodedIds.getSecondId()));
   }

   @Override
   public void rebootNode(final String name) {
      SlashEncodedIds slashEncodedIds = SlashEncodedIds.fromSlashEncoded(name);

      waitOperationDone(api.getInstanceApiForProject(userProject.get()).resetInZone(slashEncodedIds.getFirstId(),
              slashEncodedIds.getSecondId()));
   }
View Full Code Here

      return api.getZoneApiForProject(userProject.get()).list().concat();
   }

   @Override
   public InstanceInZone getNode(String name) {
      SlashEncodedIds slashEncodedIds = SlashEncodedIds.fromSlashEncoded(name);

      Instance instance = api.getInstanceApiForProject(userProject.get()).getInZone(slashEncodedIds.getFirstId(),
              slashEncodedIds.getSecondId());

      return instance == null null : new InstanceInZone(instance, slashEncodedIds.getFirstId());
   }
View Full Code Here

      });
   }

   @Override
   public void destroyNode(final String name) {
      SlashEncodedIds slashEncodedIds = SlashEncodedIds.fromSlashEncoded(name);
      String diskName = null;
      try {
         Instance instance = api.getInstanceApiForProject(userProject.get()).getInZone(slashEncodedIds.getFirstId(),
                                                                              slashEncodedIds.getSecondId());
         if (instance.getMetadata().getItems().get(GCE_DELETE_BOOT_DISK_METADATA_KEY).equals("true")) {
            Optional<AttachedDisk> disk = tryFind(instance.getDisks(), new Predicate<AttachedDisk>() {
               @Override
               public boolean apply(AttachedDisk input) {
                  return PersistentAttachedDisk.class.isInstance(input) &&
                         PersistentAttachedDisk.class.cast(input).isBoot();
               }
            });
            if (disk.isPresent()) {
               diskName = PersistentAttachedDisk.class.cast(disk.get()).getSourceDiskName();
            }
         }
      } catch (Exception e) {
         // TODO: what exception actually gets thrown here if the instance doesn't really exist?
      }
      waitOperationDone(api.getInstanceApiForProject(userProject.get()).deleteInZone(slashEncodedIds.getFirstId(),
              slashEncodedIds.getSecondId()));

      if (diskName != null) {
         waitOperationDone(api.getDiskApiForProject(userProject.get()).deleteInZone(slashEncodedIds.getFirstId(),
                                                                                    diskName));
      }

   }
View Full Code Here

   }

   @Override
   public void rebootNode(final String name) {
      SlashEncodedIds slashEncodedIds = SlashEncodedIds.fromSlashEncoded(name);

      waitOperationDone(api.getInstanceApiForProject(userProject.get()).resetInZone(slashEncodedIds.getFirstId(),
              slashEncodedIds.getSecondId()));
   }
View Full Code Here

      return listSecurityGroups();
   }

   @Override
   public Set<SecurityGroup> listSecurityGroupsForNode(String id) {
      SlashEncodedIds slashEncodedIds = SlashEncodedIds.fromSlashEncoded(id);

      Instance instance = api.getInstanceApiForProject(userProject.get()).getInZone(slashEncodedIds.getFirstId(),
              slashEncodedIds.getSecondId());

      if (instance == null) {
         return ImmutableSet.of();
      }
View Full Code Here

   public Function<String, URI> provideMachineTypeNameToURIFunction(@Provider final Supplier<URI> endpoint,
                                                                    @UserProject final Supplier<String> userProject) {
      return new Function<String, URI>() {
         @Override
         public URI apply(String input) {
            SlashEncodedIds slashEncodedIds = SlashEncodedIds.fromSlashEncoded(input);
            return Uris.uriBuilder(endpoint.get()).appendPath("/projects/").appendPath(userProject.get())
                    .appendPath("/zones/").appendPath(slashEncodedIds.getFirstId())
                    .appendPath("/machineTypes/").appendPath(slashEncodedIds.getSecondId()).build();
         }
      };
   }
View Full Code Here

TOP

Related Classes of org.jclouds.googlecomputeengine.domain.SlashEncodedIds

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.