All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.seeq.api.UnstableApi Maven / Gradle / Ivy

There is a newer version: 66.0.0-v202410141803
Show newest version
package com.seeq.api;

import com.seeq.ApiException;
import com.seeq.ApiClient;
import com.seeq.Configuration;
import com.seeq.model.*;
import com.seeq.Pair;

import javax.ws.rs.core.GenericType;
import javax.ws.rs.ProcessingException;

import com.seeq.model.DebugCacheBlockOutputV1;


  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;

  public class UnstableApi {
  private ApiClient apiClient;
  private long retryTimeout = 5_000; // Default of 5 seconds

  public UnstableApi() {
  this(Configuration.getDefaultApiClient());
  }

  public UnstableApi(ApiClient apiClient) {
  this.apiClient = apiClient;
  }

  public void setRetryTimeout(long retryTimeout) {
    this.retryTimeout = retryTimeout;
  }

  public long getRetryTimeout() {
    return this.retryTimeout;
  }

  public ApiClient getApiClient() {
  return apiClient;
  }

  public void setApiClient(ApiClient apiClient) {
  this.apiClient = apiClient;
  }

    /**
    * Get raw cache data associated with the supplied cacheId.
    * 
      * @param cacheId  (required)
      * @param start An 8601 timestamp corresponding to the key at the beginning of the query interval. (required)
      * @param exclusiveEnd An 8601 timestamp corresponding to the key at the end of the query interval. (required)
      * @param maxDatums The maximum number of datums to retrieve from the persistent cache. If a request exceeds this value, the result will be truncated. Cannot be larger than: 1048576 unless `metadataOnly` is true. (optional)
      * @param metadataOnly If set to true, the endpoint will only return cache record metadata (no decompression). (required)
      * @param overrideTimeout A duration, in minutes, that should be used as a timeout for the GRPC connection. Default: 2 minutes. (optional)
      * @return DebugCacheBlockOutputV1
    * @throws ApiException if fails to make API call
    */
    public DebugCacheBlockOutputV1 getCache(String cacheId, String start, String exclusiveEnd, String maxDatums, Boolean metadataOnly, String overrideTimeout) throws ApiException {
        ApiClient.ApiResponse localVarResponse = getCacheWithHttpInfo(cacheId, start, exclusiveEnd, maxDatums, metadataOnly, overrideTimeout);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Get raw cache data associated with the supplied cacheId.
    * 
      * @param cacheId  (required)
      * @param start An 8601 timestamp corresponding to the key at the beginning of the query interval. (required)
      * @param exclusiveEnd An 8601 timestamp corresponding to the key at the end of the query interval. (required)
      * @param maxDatums The maximum number of datums to retrieve from the persistent cache. If a request exceeds this value, the result will be truncated. Cannot be larger than: 1048576 unless `metadataOnly` is true. (optional)
      * @param metadataOnly If set to true, the endpoint will only return cache record metadata (no decompression). (required)
      * @param overrideTimeout A duration, in minutes, that should be used as a timeout for the GRPC connection. Default: 2 minutes. (optional)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getCacheWithHttpInfo(String cacheId, String start, String exclusiveEnd, String maxDatums, Boolean metadataOnly, String overrideTimeout) throws ApiException {
      Map localVarHeaderParams = new HashMap();
      return getCacheWithHeadersAndHttpInfo(cacheId, start, exclusiveEnd, maxDatums, metadataOnly, overrideTimeout, localVarHeaderParams);
      
    }

    /**
    * Get raw cache data associated with the supplied cacheId.
    * 
      * @param cacheId  (required)
      * @param start An 8601 timestamp corresponding to the key at the beginning of the query interval. (required)
      * @param exclusiveEnd An 8601 timestamp corresponding to the key at the end of the query interval. (required)
      * @param maxDatums The maximum number of datums to retrieve from the persistent cache. If a request exceeds this value, the result will be truncated. Cannot be larger than: 1048576 unless `metadataOnly` is true. (optional)
      * @param metadataOnly If set to true, the endpoint will only return cache record metadata (no decompression). (required)
      * @param overrideTimeout A duration, in minutes, that should be used as a timeout for the GRPC connection. Default: 2 minutes. (optional)
      * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse getCacheWithHeadersAndHttpInfo(String cacheId, String start, String exclusiveEnd, String maxDatums, Boolean metadataOnly, String overrideTimeout, Map customHeaders) throws ApiException {
    Object localVarPostBody = null;
      // verify the required parameter 'cacheId' is set
      if (cacheId == null) {
      throw new ApiException(400, "Missing the required parameter 'cacheId' when calling getCache");
      }
      // verify the required parameter 'start' is set
      if (start == null) {
      throw new ApiException(400, "Missing the required parameter 'start' when calling getCache");
      }
      // verify the required parameter 'exclusiveEnd' is set
      if (exclusiveEnd == null) {
      throw new ApiException(400, "Missing the required parameter 'exclusiveEnd' when calling getCache");
      }
      // verify the required parameter 'metadataOnly' is set
      if (metadataOnly == null) {
      throw new ApiException(400, "Missing the required parameter 'metadataOnly' when calling getCache");
      }
    // create path and map variables
    String localVarPath = "/cache/{cacheId}/blocks"
      .replaceAll("\\{" + "cacheId" + "\\}", apiClient.escapeString(cacheId.toString()));

    // query params
    List localVarQueryParams = new ArrayList();
    Map localVarHeaderParams = new HashMap();
    Map localVarFormParams = new HashMap();

      localVarQueryParams.addAll(apiClient.parameterToPairs("", "start", start));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "exclusiveEnd", exclusiveEnd));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "maxDatums", maxDatums));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "metadataOnly", metadataOnly));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "overrideTimeout", overrideTimeout));

    
    
      final String[] localVarAccepts = {
    "application/vnd.seeq.v1+json"
      };
      final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);

      final String[] localVarContentTypes = {
    
      };
      final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);

      String[] localVarAuthNames = new String[] { "api_key" };

      localVarHeaderParams.putAll(customHeaders);

      long apiClientInvocationTime = System.currentTimeMillis();
      while(true) {
        try {
        GenericType localVarReturnType = new GenericType() {};
        return apiClient.invokeAPIWithHttpInfo(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);
          // Possible exceptions:
          // ===================
          // * ResponseProcessingException - in case processing of a received HTTP response fails (e.g. in a filter or
          //    during conversion of the response entity data to an instance of a particular Java type).
          // * ProcessingException - in case the request processing or subsequent I/O operation fails.
          // * WebApplicationException - in case the response status code of the response returned by the server is not
          //    successful and the specified response type is not Response.
          // * ApiException for exceptions wrapped by ApiClient. Most likely all WebApplicationException are wrapped
          //    in ApiException(s)
        } catch (ApiException | ProcessingException e) {
          if (e instanceof ProcessingException || e instanceof ApiException && ((ApiException) e).getCode() == 504) {
            long elapsedTime = System.currentTimeMillis() - apiClientInvocationTime;
            if (elapsedTime <= this.retryTimeout && this.retryTimeout != 0) {
              continue;
            }
          }
          throw e;
        }
      } // while
      }
    }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy