Examples of InstanceApi


Examples of org.jclouds.openstack.trove.v1.features.InstanceApi

    * @param size
    *           Size of the instance.
    * @return Instance object in active state or NULL.
    */
   public Instance getWorkingInstance(String zone, String name, String flavorId, int size) {
      InstanceApi instanceApi = api.getInstanceApiForZone(zone);
      for (int retries = 0; retries < 10; retries++) {
         Instance instance = null;
         try {
            instance = instanceApi.create(flavorId, size, name);
         } catch (Exception e) {

            Uninterruptibles.sleepUninterruptibly(15, TimeUnit.SECONDS);

            logger.error(e.getStackTrace().toString());
            continue;
         }

         Instance updatedInstance = awaitAvailable(instance, instanceApi);
         if (updatedInstance != null) {
            return updatedInstance;
         }
         instanceApi.delete(instance.getId());
         InstancePredicates.awaitDeleted(instanceApi).apply(instance);
        
      }
      return null;
   }
View Full Code Here

Examples of org.jclouds.openstack.trove.v1.features.InstanceApi

    * @param size
    *           Size of the instance.
    * @return Instance object in active state or NULL.
    */
   public Instance getWorkingInstance(String zone, String name, String flavorId, int size) {
      InstanceApi instanceApi = api.getInstanceApiForZone(zone);
      for (int retries = 0; retries < 10; retries++) {
         Instance instance = null;
         try {
            instance = instanceApi.create(flavorId, size, name);
         } catch (Exception e) {

            Uninterruptibles.sleepUninterruptibly(15, TimeUnit.SECONDS);

            logger.error(Arrays.toString(e.getStackTrace()));
            continue;
         }

         Instance updatedInstance = awaitAvailable(instance, instanceApi);
         if (updatedInstance != null) {
            return updatedInstance;
         }
         instanceApi.delete(instance.getId());
         InstancePredicates.awaitDeleted(instanceApi).apply(instance);
        
      }
      return null;
   }
View Full Code Here

Examples of org.jclouds.openstack.trove.v1.features.InstanceApi

    * @param size
    *           Size of the instance.
    * @return Instance object in active state or NULL.
    */
   public Instance getWorkingInstance(String region, String name, String flavorId, int size) {
      InstanceApi instanceApi = api.getInstanceApi(region);
      for (int retries = 0; retries < 10; retries++) {
         Instance instance = null;
         try {
            instance = instanceApi.create(flavorId, size, name);
         } catch (Exception e) {

            Uninterruptibles.sleepUninterruptibly(15, TimeUnit.SECONDS);

            logger.error(Arrays.toString(e.getStackTrace()));
            continue;
         }

         Instance updatedInstance = awaitAvailable(instance, instanceApi);
         if (updatedInstance != null) {
            return updatedInstance;
         }
         instanceApi.delete(instance.getId());
         InstancePredicates.awaitDeleted(instanceApi).apply(instance);

      }
      return null;
   }
View Full Code Here

Examples of org.jclouds.rds.features.InstanceApi

   }

   @Override
   protected Function<Object, IterableWithMarker<Instance>> markerToNextForArg0(Optional<Object> arg0) {
      final String region = arg0.isPresent() ? arg0.get().toString() : null;
      final InstanceApi instanceApi = api.getInstanceApiForRegion(region);
      return new Function<Object, IterableWithMarker<Instance>>() {

         @Override
         public IterableWithMarker<Instance> apply(Object input) {
            return instanceApi.list(ListInstancesOptions.Builder.afterMarker(input));
         }

         @Override
         public String toString() {
            return "listInstancesInRegion(" + region + ")";
View Full Code Here

Examples of org.jclouds.rds.features.InstanceApi

   }

   @Override
   protected Function<Object, IterableWithMarker<Instance>> markerToNextForArg0(Optional<Object> arg0) {
      final String region = arg0.isPresent() ? arg0.get().toString() : null;
      final InstanceApi instanceApi = api.getInstanceApiForRegion(region);
      return new Function<Object, IterableWithMarker<Instance>>() {

         @Override
         public IterableWithMarker<Instance> apply(Object input) {
            return instanceApi.list(ListInstancesOptions.Builder.afterMarker(input));
         }

         @Override
         public String toString() {
            return "listInstancesInRegion(" + region + ")";
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.