Package org.jclouds.rest

Examples of org.jclouds.rest.InsufficientResourcesException


      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


               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

      switch (response.getStatusCode()) {
         case 400:
            if ("UnsupportedOperation".equals(errorCode))
               exception = new UnsupportedOperationException(message, exception);
            else if ("AddressLimitExceeded".equals(errorCode))
               exception = new InsufficientResourcesException(message, exception);
            else if ("TooManyBuckets".equals(errorCode))
               exception = new InsufficientResourcesException(message, exception);
            else if (errorCode != null && (errorCode.indexOf("NotFound") != -1 || errorCode.endsWith(".Unknown")))
               exception = new ResourceNotFoundException(message, exception);
            else if ("IncorrectState".equals(errorCode)
                     || (errorCode != null && (error.getCode().endsWith(".Duplicate") || error.getCode().endsWith(
                              ".InUse")))
View Full Code Here

               ip = existingIp;
               break;
            }
         }
         if (ip == null)
            throw new InsufficientResourcesException(
                     "no more ip addresses available and existing ips all have services attached: " + publicIps, e
                              .getCause());
      }
      is = client.addInternetServiceToExistingIp(ip.getId(), vApp.getName() + "-" + port, protocol, port,
               withDescription(String.format("port %d access to serverId: %s name: %s", port, vApp.getName(), vApp
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

      if ("AccessDeniedException".equals(error.getCode())) {
         return new AuthorizationException(error.getMessage(), exception);
      } else if ("InvalidParameterValueException".equals(error.getCode())) {
         return new IllegalArgumentException(error.getMessage(), exception);
      } else if ("LimitExceededException".equals(error.getCode())) {
         return new InsufficientResourcesException(error.getMessage(), exception);
      } else if ("ResourceNotFoundException".equals(error.getCode())) {
         return new ResourceNotFoundException(error.getMessage(), exception);
      }
      return exception;
   }
View Full Code Here

      String errorCode = in.getError().getCode();
      String message = in.getError().getMessage();

      if (statusCode == 400) {
         if ("LimitExceeded".equals(errorCode)) {
            return new InsufficientResourcesException(message, in);
         } else if ("InvalidFormat".equals(errorCode)) {
            return new IllegalArgumentException(message, in);
         }
      }
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

         return new AuthorizationException(message, in);
      if (statusCode == 400) {
         if (ImmutableSet.of("InvalidAction", "AccessDenied").contains(errorCode))
            return new UnsupportedOperationException(message, in);
         else if ("Throttling".equals(errorCode))
            return new InsufficientResourcesException(message, in);
         else if (message.indexOf("not found") != -1)
            return new ResourceNotFoundException(message, in);
         return new IllegalArgumentException(message, in);
      }
      return in;
View Full Code Here

      switch (response.getStatusCode()) {
         case 400:
            if ("UnsupportedOperation".equals(errorCode))
               exception = new UnsupportedOperationException(message, exception);
            else if ("AddressLimitExceeded".equals(errorCode))
               exception = new InsufficientResourcesException(message, exception);
            else if ("TooManyBuckets".equals(errorCode))
               exception = new InsufficientResourcesException(message, exception);
            else if (errorCode != null && (errorCode.indexOf("NotFound") != -1 || errorCode.endsWith(".Unknown")))
               exception = new ResourceNotFoundException(message, exception);
            else if ("IncorrectState".equals(errorCode)
                     || (errorCode != null && (error.getCode().endsWith(".Duplicate") || error.getCode().endsWith(
                              ".InUse")))
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.