Package org.iplantc.agave.client

Examples of org.iplantc.agave.client.ApiException


  public MonitorCheckResponse getCheck(String monitorId, String checkId)
      throws ApiException {
    // verify required params are set
    if (monitorId == null || checkId == null) {
      throw new ApiException(400, "missing required params");
    }
    // create path and map variables
    String path = "/monitors/" + Settings.API_VERSION + "/{monitorId}/checks/{checkId}"
        .replaceAll("\\{format\\}", "json")
        .replaceAll("\\{" + "monitorId" + "\\}",
View Full Code Here


    {
      ObjectMapper mapper = new ObjectMapper();
      try {
        JsonNode json = mapper.readTree(authCacheFile);
        if (json.isNull()) {
          throw new ApiException(Status.FORBIDDEN.getStatusCode(),
              "Local authentication cache file " + authCacheFile.getAbsolutePath() + " is empty.");
        } else if (!json.has("access_token")) {
          throw new ApiException(Status.FORBIDDEN.getStatusCode(),
              "No access token found in local cache file " + authCacheFile.getAbsolutePath() + "." );
        } else {
          AccessToken token = new AccessToken();
          token.setAccessToken(json.get("access_token").asText());
          token.setClientSecret(json.get("apisecret").asText());
          token.setClientKey(json.get("apikey").asText());
          token.setRefreshToken(json.get("refresh_token").asText());
          token.setCreatedAt(new DateTime(json.get("created_at").asInt()));
          token.setExpiresAt(token.getCreatedAt().plusSeconds(json.get("expires_in").asInt()));
         
          return token;
        }
      } catch(JsonProcessingException e) {
        throw new ApiException(Status.BAD_REQUEST.getStatusCode(),
            "Unable to parse authentication cache file " + authCacheFile.getAbsolutePath() + " is empty.");
      } catch (IOException e) {
        throw new ApiException(Status.BAD_REQUEST.getStatusCode(),
            "Unable to parse authentication cache file " + authCacheFile.getAbsolutePath() + " is empty.");
      }
    } else {
      throw new ApiException(Status.FORBIDDEN.getStatusCode(),
          "Unable to locate authentication token from "
          + "system cache file " + authCacheFile.getAbsolutePath() + " is empty.");
    }
  }
View Full Code Here

  public MultipleTransformResponse get(String transformId)
      throws ApiException {
    // verify required params are set
    if (transformId == null) {
      throw new ApiException(400, "missing required params");
    }
    // create path and map variables
    String path = "/transforms/" + Settings.API_VERSION + "/{transformId}".replaceAll("\\{format\\}",
        "json").replaceAll("\\{" + "transformId" + "\\}",
        apiInvoker.escapeString(transformId.toString()));
View Full Code Here

      String owner, String filePath, TransformRequest body)
      throws ApiException {
    // verify required params are set
    if (transformId == null || owner == null || filePath == null
        || body == null) {
      throw new ApiException(400, "missing required params");
    }
    // create path and map variables
    String path = "/transforms/" + Settings.API_VERSION + "/{transformId}/async/{owner}/{filePath}"
        .replaceAll("\\{format\\}", "json")
        .replaceAll("\\{" + "transformId" + "\\}",
View Full Code Here

  public void transformAndDownload(String transformId, String owner,
      String filePath, TransformRequest body) throws ApiException {
    // verify required params are set
    if (transformId == null || owner == null || filePath == null
        || body == null) {
      throw new ApiException(400, "missing required params");
    }
    // create path and map variables
    String path = "/transforms/" + Settings.API_VERSION + "/{transformId}/sync/{owner}/{filePath}"
        .replaceAll("\\{format\\}", "json")
        .replaceAll("\\{" + "transformId" + "\\}",
View Full Code Here

  }

  public MultipleTransformResponse listByTag(String tag) throws ApiException {
    // verify required params are set
    if (tag == null) {
      throw new ApiException(400, "missing required params");
    }
    // create path and map variables
    String path = "/transforms/" + Settings.API_VERSION + "/tags/{tag}".replaceAll("\\{format\\}",
        "json").replaceAll("\\{" + "tag" + "\\}",
        apiInvoker.escapeString(tag.toString()));
View Full Code Here

  public TokenResponse createAuthToken(String username, String password, String clientKey, String clientSecret)
  throws ApiException
  {
    if (StringUtils.isEmpty(username)) {
      throw new ApiException(400, "missing required username");
    }
   
    if (StringUtils.isEmpty(password)) {
      throw new ApiException(400, "missing required username");
    }
   
    if (StringUtils.isEmpty(clientKey)) {
      throw new ApiException(400, "missing required clientKey");
    }
   
    if (StringUtils.isEmpty(clientSecret)) {
      throw new ApiException(400, "missing required clientSecret");
    }
   
    // create path and map variables
    String path = "/token";
View Full Code Here

 
  public TokenResponse refreshAuthToken(String clientKey, String clientSecret, String refreshToken)
  throws ApiException
  {
    if (StringUtils.isEmpty(clientKey)) {
      throw new ApiException(400, "missing required clientKey");
    }
   
    if (StringUtils.isEmpty(clientSecret)) {
      throw new ApiException(400, "missing required clientSecret");
    }
   
    if (StringUtils.isEmpty(refreshToken)) {
      throw new ApiException(400, "missing required refreshToken");
    }
   
    // create path and map variables
    String path = "/token";
View Full Code Here

        tokenResponse.setMessage(null);
        tokenResponse.setResult(null);
      }
      return tokenResponse;
    } catch (Exception e) {
      throw new ApiException(500, e.getMessage());
    }
  }
View Full Code Here

  public void downloadFromDefaultSystem(String sourcefilePath)
      throws ApiException {
    // verify required params are set
    if (sourcefilePath == null) {
      throw new ApiException(400, "missing required params");
    }
    // create path and map variables
    String path = "/files/" + Settings.API_VERSION + "/media/{sourcefilePath}".replaceAll(
        "\\{format\\}", "json").replaceAll(
        "\\{" + "sourcefilePath" + "\\}",
View Full Code Here

TOP

Related Classes of org.iplantc.agave.client.ApiException

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.