All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
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.
com.sumologic.client.searchjob.SearchJobClient Maven / Gradle / Ivy
package com.sumologic.client.searchjob;
import org.apache.http.HttpStatus;
import com.sumologic.client.ConnectionConfig;
import com.sumologic.client.UrlParameters;
import com.sumologic.client.searchjob.model.*;
import com.sumologic.client.util.DeserializingResponseHandler;
import com.sumologic.client.util.HttpUtils;
/**
* @author Christian Beedgen ([email protected] )
*/
public class SearchJobClient {
// Implementation.
private HttpUtils httpUtils;
public SearchJobClient(HttpUtils httpUtils) {
this.httpUtils = httpUtils;
}
public String createSearchJob(
ConnectionConfig connection,
CreateSearchJobRequest createSearchJobRequest) {
String uri = UrlParameters.SEARCH_JOBS_SERVICE;
return httpUtils.post(
connection,
uri,
createSearchJobRequest,
HttpUtils.toRequestHeaders(
"Content-type", "application/json",
"Accept", "application/json"),
new DeserializingResponseHandler(CreateSearchJobResponse.class),
HttpStatus.SC_ACCEPTED).getId();
}
public GetSearchJobStatusResponse getSearchJobStatus(
ConnectionConfig connection,
GetSearchJobStatusRequest getSearchJobStatusRequest) {
String uri = UrlParameters.SEARCH_JOBS_SERVICE +
"/" + getSearchJobStatusRequest.getId();
return httpUtils.get(
connection,
uri,
getSearchJobStatusRequest,
HttpUtils.toRequestHeaders(
"Accept", "application/json"),
new DeserializingResponseHandler(GetSearchJobStatusResponse.class),
HttpStatus.SC_OK);
}
public GetMessagesForSearchJobResponse getMessagesForSearchJob(
ConnectionConfig connection,
GetMessagesForSearchJobRequest getMessagesForSearchJobRequest) {
String uri = UrlParameters.SEARCH_JOBS_SERVICE +
"/" + getMessagesForSearchJobRequest.getId() +
"/" + UrlParameters.SEARCH_JOBS_SERVICE_MESSAGES;
return httpUtils.get(
connection,
uri,
getMessagesForSearchJobRequest,
HttpUtils.toRequestHeaders(
"Accept", "application/json"),
new DeserializingResponseHandler(GetMessagesForSearchJobResponse.class),
HttpStatus.SC_OK);
}
public GetRecordsForSearchJobResponse getRecordsForSearchJob(
ConnectionConfig connection,
GetRecordsForSearchJobRequest getRecordsForSearchJobRequest) {
String uri = UrlParameters.SEARCH_JOBS_SERVICE +
"/" + getRecordsForSearchJobRequest.getId() +
"/" + UrlParameters.SEARCH_JOBS_SERVICE_RECORDS;
return httpUtils.get(
connection,
uri,
getRecordsForSearchJobRequest,
HttpUtils.toRequestHeaders(
"Accept", "application/json"),
new DeserializingResponseHandler(GetRecordsForSearchJobResponse.class),
HttpStatus.SC_OK);
}
public CancelSearchJobResponse deleteSearchJob(
ConnectionConfig connection,
CancelSearchJobRequest cancelSearchJobRequest) {
String uri = UrlParameters.SEARCH_JOBS_SERVICE +
"/" + cancelSearchJobRequest.getId();
return httpUtils.delete(
connection,
uri,
cancelSearchJobRequest,
new DeserializingResponseHandler(CancelSearchJobResponse.class),
HttpStatus.SC_OK);
}
}