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

com.seeq.api.LogsApi 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.LogMessage;
import com.seeq.model.SupportRequestInputV1;
import com.seeq.model.SupportRequestOutputV1;


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

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

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

  public LogsApi(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;
  }

    /**
    * Download the log files in zipped form.
    * 
      * @param downloadLogsCookie The value to return as a cookie. (optional)
    * @throws ApiException if fails to make API call
    */
    public void downloadLogs(String downloadLogsCookie) throws ApiException {
        downloadLogsWithHttpInfo(downloadLogsCookie);
    }
    
    /**
    * Download the log files in zipped form.
    * 
      * @param downloadLogsCookie The value to return as a cookie. (optional)
    * @throws ApiException if fails to make API call
    */
    public void downloadLogsWithHttpInfo(String downloadLogsCookie) throws ApiException {
      Map localVarHeaderParams = new HashMap();
      
       downloadLogsWithHeadersAndHttpInfo(downloadLogsCookie, localVarHeaderParams);
    }

    /**
    * Download the log files in zipped form.
    * 
      * @param downloadLogsCookie The value to return as a cookie. (optional)
      * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public void downloadLogsWithHeadersAndHttpInfo(String downloadLogsCookie, Map customHeaders) throws ApiException {
    Object localVarPostBody = null;
    // create path and map variables
    String localVarPath = "/logs/download";

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

      localVarQueryParams.addAll(apiClient.parameterToPairs("", "downloadLogsCookie", downloadLogsCookie));

    
    
      final String[] localVarAccepts = {
    "application/zip"
      };
      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 {
      apiClient.invokeAPIWithHttpInfo(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);
      return;
          // 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
      }
    /**
    * Get a list of available log files.
    * 
      * @return List<String>
    * @throws ApiException if fails to make API call
    */
    public List getAvailableLogFiles() throws ApiException {
        ApiClient.ApiResponse> localVarResponse = getAvailableLogFilesWithHttpInfo();
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Get a list of available log files.
    * 
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse> getAvailableLogFilesWithHttpInfo() throws ApiException {
      Map localVarHeaderParams = new HashMap();
      return getAvailableLogFilesWithHeadersAndHttpInfo(localVarHeaderParams);
      
    }

    /**
    * Get a list of available log files.
    * 
      * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse> getAvailableLogFilesWithHeadersAndHttpInfo(Map customHeaders) throws ApiException {
    Object localVarPostBody = null;
    // create path and map variables
    String localVarPath = "/logs";

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


    
    
      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
      }
    /**
    * Get a collection of log messages
    * 
      * @param log ID of the log to retrieve (required)
      * @param startTime Starting time to filter log messages on. (required)
      * @param endTime Ending time to filter log messages on. It will default to the current time if none is specified. (optional)
      * @param limit The (soft) limit for the number of log messages to return. (required)
      * @param sorted Whether log messages should be sorted in ascending order, 'ASC', by their time or descending order, 'DESC'. (optional, default to ASC)
      * @param level The minimum log level to include. (optional, default to DEBUG)
      * @param sourceContains A substring that the source field of the log messages must contain to be returned. (optional)
      * @param messageContains A substring that the message field of the log messages must contain to be returned. (optional)
      * @return List<LogMessage>
    * @throws ApiException if fails to make API call
    */
    public List getLogs(String log, String startTime, String endTime, Integer limit, String sorted, String level, String sourceContains, String messageContains) throws ApiException {
        ApiClient.ApiResponse> localVarResponse = getLogsWithHttpInfo(log, startTime, endTime, limit, sorted, level, sourceContains, messageContains);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Get a collection of log messages
    * 
      * @param log ID of the log to retrieve (required)
      * @param startTime Starting time to filter log messages on. (required)
      * @param endTime Ending time to filter log messages on. It will default to the current time if none is specified. (optional)
      * @param limit The (soft) limit for the number of log messages to return. (required)
      * @param sorted Whether log messages should be sorted in ascending order, 'ASC', by their time or descending order, 'DESC'. (optional, default to ASC)
      * @param level The minimum log level to include. (optional, default to DEBUG)
      * @param sourceContains A substring that the source field of the log messages must contain to be returned. (optional)
      * @param messageContains A substring that the message field of the log messages must contain to be returned. (optional)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse> getLogsWithHttpInfo(String log, String startTime, String endTime, Integer limit, String sorted, String level, String sourceContains, String messageContains) throws ApiException {
      Map localVarHeaderParams = new HashMap();
      return getLogsWithHeadersAndHttpInfo(log, startTime, endTime, limit, sorted, level, sourceContains, messageContains, localVarHeaderParams);
      
    }

    /**
    * Get a collection of log messages
    * 
      * @param log ID of the log to retrieve (required)
      * @param startTime Starting time to filter log messages on. (required)
      * @param endTime Ending time to filter log messages on. It will default to the current time if none is specified. (optional)
      * @param limit The (soft) limit for the number of log messages to return. (required)
      * @param sorted Whether log messages should be sorted in ascending order, 'ASC', by their time or descending order, 'DESC'. (optional, default to ASC)
      * @param level The minimum log level to include. (optional, default to DEBUG)
      * @param sourceContains A substring that the source field of the log messages must contain to be returned. (optional)
      * @param messageContains A substring that the message field of the log messages must contain to be returned. (optional)
      * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse> getLogsWithHeadersAndHttpInfo(String log, String startTime, String endTime, Integer limit, String sorted, String level, String sourceContains, String messageContains, Map customHeaders) throws ApiException {
    Object localVarPostBody = null;
      // verify the required parameter 'log' is set
      if (log == null) {
      throw new ApiException(400, "Missing the required parameter 'log' when calling getLogs");
      }
      // verify the required parameter 'startTime' is set
      if (startTime == null) {
      throw new ApiException(400, "Missing the required parameter 'startTime' when calling getLogs");
      }
      // verify the required parameter 'limit' is set
      if (limit == null) {
      throw new ApiException(400, "Missing the required parameter 'limit' when calling getLogs");
      }
    // create path and map variables
    String localVarPath = "/logs/{log}"
      .replaceAll("\\{" + "log" + "\\}", apiClient.escapeString(log.toString()));

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

      localVarQueryParams.addAll(apiClient.parameterToPairs("", "startTime", startTime));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "endTime", endTime));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "limit", limit));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "sorted", sorted));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "level", level));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "sourceContains", sourceContains));
      localVarQueryParams.addAll(apiClient.parameterToPairs("", "messageContains", messageContains));

    
    
      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
      }
    /**
    * Send a support request along with the log files to Seeq.
    * 
      * @param body Support request information (required)
      * @return SupportRequestOutputV1
    * @throws ApiException if fails to make API call
    */
    public SupportRequestOutputV1 send(SupportRequestInputV1 body) throws ApiException {
        ApiClient.ApiResponse localVarResponse = sendWithHttpInfo(body);
        return localVarResponse != null ? localVarResponse.getData() : null;
    }
    
    /**
    * Send a support request along with the log files to Seeq.
    * 
      * @param body Support request information (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse sendWithHttpInfo(SupportRequestInputV1 body) throws ApiException {
      Map localVarHeaderParams = new HashMap();
      return sendWithHeadersAndHttpInfo(body, localVarHeaderParams);
      
    }

    /**
    * Send a support request along with the log files to Seeq.
    * 
      * @param body Support request information (required)
      * @param customHeaders a map with custom headers for the HTTP request (required)
    * @throws ApiException if fails to make API call
    */
    public ApiClient.ApiResponse sendWithHeadersAndHttpInfo(SupportRequestInputV1 body, Map customHeaders) throws ApiException {
    Object localVarPostBody = body;
      // verify the required parameter 'body' is set
      if (body == null) {
      throw new ApiException(400, "Missing the required parameter 'body' when calling send");
      }
    // create path and map variables
    String localVarPath = "/logs/send";

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


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

      final String[] localVarContentTypes = {
    "application/vnd.seeq.v1+json"
      };
      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, "POST", 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