Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
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.SendLogsInputV1;
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 {
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" };
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 {
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" };
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 {
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" };
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 the log files to Seeq.
*
* @param body Log information (required)
* @throws ApiException if fails to make API call
*/
public void sendLogs(SendLogsInputV1 body) throws ApiException {
sendLogsWithHttpInfo(body);
}
/**
* Send the log files to Seeq.
*
* @param body Log information (required)
* @throws ApiException if fails to make API call
*/
public void sendLogsWithHttpInfo(SendLogsInputV1 body) 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 sendLogs");
}
// 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" };
long apiClientInvocationTime = System.currentTimeMillis();
while(true) {
try {
apiClient.invokeAPIWithHttpInfo(localVarPath, "POST", 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
}
}