Package org.jclouds.rest

Examples of org.jclouds.rest.InsufficientResourcesException


      String requestLine = command.getCurrentRequest().getRequestLine();
      String message = content != null ? content : String.format("%s -> %s", requestLine, response.getStatusLine());
      switch (response.getStatusCode()) {
         case 400:
            if (message.indexOf("quota exceeded") != -1)
               exception = new InsufficientResourcesException(message, exception);
            else if (message.indexOf("has no fixed_ips") != -1)
               exception = new IllegalStateException(message, exception);
            else if (message.indexOf("already exists") != -1)
               exception = new IllegalStateException(message, exception);
            break;
         case 401:
         case 403:
            exception = new AuthorizationException(message, exception);
            break;
         case 404:
            if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
               exception = new ResourceNotFoundException(message, exception);
            }
            break;
         case 413:
            if (content == null) {
               exception = new InsufficientResourcesException(message, exception);
               break;
            }
            exception = parseAndBuildRetryException(content, message, exception);
      }
      command.setException(exception);
View Full Code Here


      for (String value : filterKeys(overLimitParser.apply(json), in(retryFields)).values()) {
         Optional<RetryAfterException> retryException = retryAfterParser.tryCreateRetryAfterException(exception, value);
         if (retryException.isPresent())
            return retryException.get();
      }
      return new InsufficientResourcesException(message, exception);
   }
View Full Code Here

               exception = new IllegalStateException(message, exception);
            }
            break;
         case 534:
            if (message.contains("Maximum number of resources of type")) {
               exception = new InsufficientResourcesException(message, exception);
            }
            break;
         case 537:
            exception = new IllegalStateException(message, exception);
            break;
View Full Code Here

            ImmutableSet.<TypeToken<? extends Throwable>> of());
   }

   @Test(expectedExceptions = InsufficientResourcesException.class)
   public void testPropagateStandardExceptionInsufficientResourcesException() throws Throwable {
      Exception e = new InsufficientResourcesException();
      propagateIfPossible(new RuntimeException(e), ImmutableSet.<TypeToken<? extends Throwable>> of());
   }
View Full Code Here

      message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(),
               response.getStatusLine());
      switch (response.getStatusCode()) {
         case 400:
            if (message.contains("quota exceeded"))
               exception = new InsufficientResourcesException(message, exception);
            else if (message.contains("Invalid volume"))
               exception = new IllegalStateException(message, exception);
            break;
         case 401:
         case 403:
            exception = new AuthorizationException(message, exception);
            break;
         case 404:
            if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
               exception = new ResourceNotFoundException(message, exception);
            }
            break;
         case 413:
            exception = new InsufficientResourcesException(message, exception);
            break;
      }
      command.setException(exception);
   }
View Full Code Here

      message = message != null ? message : String.format("%s -> %s", command.getCurrentRequest().getRequestLine(),
            response.getStatusLine());
      switch (response.getStatusCode()) {
      case 400:
         if (message.contains("quota exceeded"))
            exception = new InsufficientResourcesException(message, exception);
         break;
      case 401:
      case 403:
         exception = new AuthorizationException(message, exception);
         break;
      case 404:
         if (!command.getCurrentRequest().getMethod().equals("DELETE")) {
            exception = new ResourceNotFoundException(message, exception);
         }
         break;
      case 413:
         exception = new InsufficientResourcesException(message, exception);
         break;
      }
      command.setException(exception);
   }
View Full Code Here

      FloatingIPApi floatingIpApi = novaApi.getFloatingIPExtensionForZone(zoneId).get();
      Optional<Set<String>> poolNames = input.get().getNovaTemplateOptions().get().getFloatingIpPoolNames();

      Optional<FloatingIP> ip = allocateFloatingIPForNode(floatingIpApi, poolNames, node.getId());
      if (!ip.isPresent()) {
         throw new InsufficientResourcesException("Failed to allocate a FloatingIP for node(" + node.getId() + ")");
      }
      logger.debug(">> adding floatingIp(%s) to node(%s)", ip.get().getIp(), node.getId());

      floatingIpApi.addToServer(ip.get().getIp(), node.getProviderId());
      input.get().getNodeMetadata().set(NodeMetadataBuilder.fromNodeMetadata(node).publicAddresses(ImmutableSet.of(ip.get().getIp())).build());
View Full Code Here

            break;
         case 409:
            exception = new IllegalStateException(exception.getMessage(), exception);
            break;
         case 413:
            exception = new InsufficientResourcesException(exception.getMessage(), exception);
            break;
      }
      command.setException(exception);
   }
View Full Code Here

            break;
         case 409:
            exception = new IllegalStateException(exception.getMessage(), exception);
            break;
         case 413:
            exception = new InsufficientResourcesException(exception.getMessage(), exception);
            break;
      }
      command.setException(exception);
   }
View Full Code Here

                           || (response.getMessage().indexOf("because it is already powered off") != -1)
                           || (response.getMessage().indexOf("exists") != -1)))
            exception = new IllegalStateException(response.getMessage(), exception);
         else if (response.getMessage() != null
                  && ((response.getMessage().indexOf("There are no additional Public IPs available") != -1)))
            exception = new  InsufficientResourcesException(response.getMessage(), exception);
         else
            switch (response.getStatusCode()) {
               case 400:
                  exception = new IllegalArgumentException(response.getMessage(), exception);
                  break;
View Full Code Here

TOP

Related Classes of org.jclouds.rest.InsufficientResourcesException

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.