diff --git a/.gitignore b/.gitignore
index 1d1e345..105617c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,5 @@
/logs
/temp
/.idea
+/.gradle
+/build
\ No newline at end of file
diff --git a/README.md b/README.md
index 1a00baf..4ba5e4f 100644
--- a/README.md
+++ b/README.md
@@ -1,55 +1 @@
-[](http://slack.sumologic.com)
-
-## Introduction
-
-Sumo Logic provides a cloud-based log management solution. It can process and analyze log files in peta-byte scale. This library provides a Java client to execute searches on the data collected by the Sumo Logic service.
-
-## News
- * 2021-08-06: Version 2.8 released to Maven Central.
- * 2018-10-31: Version 2.7 released to Maven Central.
- * 2018-08-30: Version 2.6 released to Maven Central.
- * 2017-09-27: Version 2.4 released to Maven Central.
- * 2017-07-11: [The Search API](https://github.com/SumoLogic/sumo-api-doc/wiki/Search-API) has been removed
- * 2017-03-28: Version 2.3 released to Maven Central.
- * 2017-02-21: [The Search API](https://github.com/SumoLogic/sumo-api-doc/wiki/Search-API) has been deprecated and will be removed in the next release. Please migrate to the [Search Job API](https://help.sumologic.com/APIs/02Search_Job_API/About_the_Search_Job_API) by using the `SearchJobClient` class.
- * 2016-09-16: Version 2.2 released to Maven Central.
- * 2015-11-23: Version 2.1 released to Maven Central.
- * 2014-10-30: Version 2.0 released to Maven Central.
- * 2012-09-12: Version 1.0 released to Maven Central.
-
-## How to use
-
-The Java client library is available on Maven central (http://search.maven.org/). To use it, add:
-
-```
-
- com.sumologic.api.client
- sumo-java-client
- 2.8
-
-```
-
-to your pom.xml
-
-## Making changes to the code
-
-
-`mvn assembly:assembly -DdescriptorId=jar-with-dependencies` to compile the code with all depedencies.
-
-Then edit `bin/run-search-job-result-dumper.sh` to point to `target/sumo-java-client--SNAPSHOT-jar-with-dependencies.jar`
-
-You can test out api changes with
-`bin/run-search-job-result-dumper.sh` and entering the appropriate parameters to connect with and query the api.
-
-### TLS 1.2 Requirement
-
-Sumo Logic only accepts connections from clients using TLS version 1.2 or greater. To utilize the content of this repo, ensure that it's running in an execution environment that is configured to use TLS 1.2 or greater.
-
-## License
-
-The Sumo Logic client library is published under the Apache Software License, Version 2.0. Please visit http://www.apache.org/licenses/LICENSE-2.0.txt for details.
-
-## Support
-
-If you have any problems using our Java client or if you need support please do not hesitate contact us via e-mail at support@sumologic.com
-
+Use the `main` branch
\ No newline at end of file
diff --git a/bin/run-dashboard-search-job-result-dumper.sh b/bin/run-dashboard-search-job-result-dumper.sh
deleted file mode 100755
index d55caec..0000000
--- a/bin/run-dashboard-search-job-result-dumper.sh
+++ /dev/null
@@ -1 +0,0 @@
-java -cp "target/sumo-java-client-1.1-SNAPSHOT-jar-with-dependencies.jar" -server -Xmx128m com.sumologic.client.dashboard.DashboardSearchJobResultDumper $*
diff --git a/bin/run-search-job-result-dumper.sh b/bin/run-search-job-result-dumper.sh
deleted file mode 100755
index 0639a73..0000000
--- a/bin/run-search-job-result-dumper.sh
+++ /dev/null
@@ -1 +0,0 @@
-java -cp "target/sumo-java-client-2.8-SNAPSHOT-jar-with-dependencies.jar" -server -Xmx128m com.sumologic.client.searchjob.SearchJobResultDumper $*
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index b794dac..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,155 +0,0 @@
-
-
- 4.0.0
-
- com.sumologic.api.client
- sumo-java-client
- 2.9-SNAPSHOT
- jar
- Sumo Logic Java Client Library
- The Java client for the Sumo Logic log management service
- http://www.sumologic.com
-
-
- Jacek Migdal
- jacek@sumologic.com
-
-
-
-
-
- The Apache Software License, Version 2.0
- http://www.apache.org/licenses/LICENSE-2.0.txt
- repo
-
-
-
-
-
- sumo-snapshots
- Sumo Snapshots
- https://nexus.kumoroku.com/nexus/content/repositories/sumo-snapshots/
-
-
- sumo-releases
- Sumo Releases
- https://nexus.kumoroku.com/nexus/content/repositories/sumo-releases/
-
-
-
-
- http://github.com/SumoLogic/sumo-java-client
- scm:git:git@github.com:SumoLogic/sumo-java-client.git
- https://github.com/SumoLogic/sumo-java-client.git
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.8.1
-
- 1.8
- 1.8
- true
-
-
-
-
- maven-assembly-plugin
- 2.6
-
-
- jar-with-dependencies
-
-
-
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
- 3.0.1
-
-
- sign-artifacts
- verify
-
- sign
-
-
-
-
-
-
- com.mycila
- license-maven-plugin
- 4.1
-
- ${basedir}
- ${basedir}/src/etc/header.txt
- false
- true
- true
- false
-
- src/**
- **/test/**
-
-
- target/**
-
- true
- true
-
- ${project.inceptionYear}
- opensource@sumologic.com
-
- UTF-8
-
-
-
-
- check
-
-
-
-
-
-
-
- org.sonatype.oss
- oss-parent
- 7
-
-
-
- org.apache.httpcomponents
- httpclient
- 4.5.13
-
-
- com.fasterxml.jackson.core
- jackson-core
- 2.12.4
- compile
-
-
- com.fasterxml.jackson.core
- jackson-databind
- 2.12.4
- compile
-
-
- net.sf.opencsv
- opencsv
- 2.4
-
-
- commons-cli
- commons-cli
- 1.4
-
-
-
-
diff --git a/src/etc/header.txt b/src/etc/header.txt
deleted file mode 100644
index a6301e0..0000000
--- a/src/etc/header.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements. See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership. The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License. You may obtain a copy of the License at
-
-http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing,
-software distributed under the License is distributed on an
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-KIND, either express or implied. See the License for the
-specific language governing permissions and limitations
-under the License.
diff --git a/src/main/java/com/sumologic/client/ConnectionConfig.java b/src/main/java/com/sumologic/client/ConnectionConfig.java
deleted file mode 100644
index f5bb2e1..0000000
--- a/src/main/java/com/sumologic/client/ConnectionConfig.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client;
-
-import org.apache.http.HttpHost;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.UsernamePasswordCredentials;
-
-/**
- * Connection configuration for the client.
- */
-public class ConnectionConfig {
-
- private String protocol;
- private String hostname;
- private int port;
- private Credentials credentials;
- private HttpHost proxy;
-
- public ConnectionConfig(String protocol, String hostname, int port, Credentials credentials) {
- this(protocol, hostname, port, credentials, null, null, 0);
- }
-
- public ConnectionConfig(String protocol, String hostname, int port, Credentials credentials, String proxyProtocol, String proxyHost, int proxyPort) {
- this.protocol = protocol;
- this.hostname = hostname;
- this.port = port;
- this.credentials = credentials;
- if (proxyHost != null) {
- proxy = new HttpHost(proxyHost, proxyPort, proxyProtocol);
- }
- }
-
- public String getProtocol() {
- return protocol;
- }
-
- public String getHostname() {
- return hostname;
- }
-
- public int getPort() {
- return port;
- }
-
- public HttpHost getProxy() {
- return proxy;
- }
-
- public Credentials getCredentials() {
- return credentials;
- }
-
- public AuthScope getAuthScope() {
- return new AuthScope(hostname, port);
- }
-
- public UsernamePasswordCredentials getUsernamePasswordCredentials() {
- return new UsernamePasswordCredentials(getCredentials().getAccessId(), getCredentials().getAccessKey());
- }
-}
diff --git a/src/main/java/com/sumologic/client/Credentials.java b/src/main/java/com/sumologic/client/Credentials.java
deleted file mode 100644
index 6dabf9a..0000000
--- a/src/main/java/com/sumologic/client/Credentials.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client;
-
-/**
- * The sumo credentials to access the web service.
- */
-public class Credentials {
- private String accessId;
- private String accessKey;
-
- /**
- * Constructs the credentials using accessId and accessKey.
- *
- * @param accessId Your access id
- * @param accessKey Your access key
- */
- public Credentials(String accessId, String accessKey) {
- this.accessId = accessId;
- this.accessKey = accessKey;
- }
-
- /**
- * Returns the user name
- *
- * @return The user name
- *
- * @deprecated Replaced by {@link #getAccessId()}
- */
- @Deprecated
- public String getEmail() {
- return getAccessId();
- }
-
- /**
- * Returns the password
- *
- * @return The password
- *
- * @deprecated Replaced by {@link #getAccessKey()}
- */
- @Deprecated
- public String getPassword() {
- return getAccessKey();
- }
-
- /**
- * Returns the access id
- *
- * @return The access id
- */
- public String getAccessId() {
- return this.accessId;
- }
-
- /**
- * Returns the access key
- *
- * @return The access key
- */
- public String getAccessKey() {
- return this.accessKey;
- }
-
-
-}
diff --git a/src/main/java/com/sumologic/client/Defaults.java b/src/main/java/com/sumologic/client/Defaults.java
deleted file mode 100644
index c46fff0..0000000
--- a/src/main/java/com/sumologic/client/Defaults.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client;
-
-/**
- * Default values.
- */
-public interface Defaults {
-
- public static int DEFAULT_HTTP_TIMEOUT = 60 * 1000;
-}
diff --git a/src/main/java/com/sumologic/client/SumoClientException.java b/src/main/java/com/sumologic/client/SumoClientException.java
deleted file mode 100644
index 25cbfae..0000000
--- a/src/main/java/com/sumologic/client/SumoClientException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client;
-
-/**
- * Base class for sumo logic client exceptions.
- */
-public class SumoClientException extends SumoException {
-
- /**
- * Delegation to Exception
- * @see Exception
- */
- public SumoClientException(String message) {
- super(message);
- }
-
- /**
- * Delegation to Exception
- * @see Exception
- */
- public SumoClientException(String message, Throwable cause) {
- super(message, cause);
- }
-}
-
diff --git a/src/main/java/com/sumologic/client/SumoException.java b/src/main/java/com/sumologic/client/SumoException.java
deleted file mode 100644
index b49f208..0000000
--- a/src/main/java/com/sumologic/client/SumoException.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client;
-
-/**
- * The base class for all sumo logic API exceptions.
- */
-public class SumoException extends RuntimeException {
-
- /**
- * Delegation to Exception
- * @see Exception
- */
- public SumoException() {
- super();
- }
-
- /**
- * Delegation to Exception
- * @see Exception
- */
- public SumoException(String message) {
- super(message);
- }
-
- /**
- * Delegation to Exception
- * @see Exception
- */
- public SumoException(String message, Throwable cause) {
- super(message, cause);
- }
-
-}
diff --git a/src/main/java/com/sumologic/client/SumoLogic.java b/src/main/java/com/sumologic/client/SumoLogic.java
deleted file mode 100644
index df580af..0000000
--- a/src/main/java/com/sumologic/client/SumoLogic.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client;
-
-import com.sumologic.client.collectors.model.*;
-import com.sumologic.client.searchjob.model.CancelSearchJobResponse;
-import com.sumologic.client.searchjob.model.GetMessagesForSearchJobResponse;
-import com.sumologic.client.searchjob.model.GetRecordsForSearchJobResponse;
-import com.sumologic.client.searchjob.model.GetSearchJobStatusResponse;
-
-/**
- * Provides an interface for accessing Sumo Logic's log web service.
- */
-public interface SumoLogic {
-
- //
- // Search jobs.
- //
-
- /**
- * Starts a search job and receive a job ID for subsequent
- * polling of the search status.
- *
- * @param query The query.
- * @param fromExpression The from expression.
- * @param toExpression The toExpression.
- * @param timeZone The time zone.
- * @return The search job ID.
- */
- String createSearchJob(
- String query, String fromExpression, String toExpression, String timeZone);
-
- /**
- * Starts a search job and receive a job ID for subsequent
- * polling of the search status.
- *
- * @param query The query.
- * @param fromExpression The from expression.
- * @param toExpression The toExpression.
- * @param timeZone The time zone.
- * @param byReceiptTime Search by receipt time instead of message time
- * @return The search job ID.
- */
- String createSearchJob(
- String query, String fromExpression, String toExpression, String timeZone, String byReceiptTime);
-
- /**
- * Returns the current status of a search job.
- *
- * @param searchJobId The search job ID.
- * @return The status.
- */
- GetSearchJobStatusResponse getSearchJobStatus(String searchJobId);
-
- /**
- * Returns messages for the specified search job.
- *
- * @param searchJobId The search job ID.
- * @param offset The offset.
- * @param limit The length.
- * @return The messages.
- */
- GetMessagesForSearchJobResponse getMessagesForSearchJob(
- String searchJobId, int offset, int limit);
-
- /**
- * Returns records for the specified search job.
- *
- * @param searchJobId The search job ID.
- * @param offset The offset.
- * @param limit The length.
- * @return The records.
- */
- GetRecordsForSearchJobResponse getRecordsForSearchJob(
- String searchJobId, int offset, int limit);
-
- /**
- * Cancels a search job.
- *
- * @param searchJobId The search job ID.
- * @return The response.
- */
- CancelSearchJobResponse cancelSearchJob(String searchJobId);
-
- //
- // Collectors.
- //
-
- /**
- * Gets all available Sumo Logic collectors matching the request.
- *
- * @param request The request.
- * @return The response.
- */
- GetCollectorsResponse getCollectors(GetCollectorsRequest request);
-
- /**
- * Gets all available Sumo Logic collectors.
- *
- * @return The response.
- */
- GetCollectorsResponse getCollectors();
-
- /**
- * Gets a single Sumo Logic collector.
- *
- * @param request The request.
- * @return The response.
- */
- GetCollectorResponse getCollector(GetCollectorRequest request);
-
- /**
- * Convenience method: takes an id as argument.
- *
- * @param id The id.
- * @return The response.
- */
- GetCollectorResponse getCollector(Long id);
-
- /**
- * Creates a Sumo Logic collector.
- *
- * @param request The request.
- * @return The response.
- */
- CreateCollectorResponse createCollector(CreateCollectorRequest request);
-
- /**
- * Convenience method; takes a collector as argument.
- *
- * @param collector The collector.
- * @return The response.
- */
- CreateCollectorResponse createCollector(Collector collector);
-
- /**
- * Updates a Sumo Logic collector.
- *
- * @param request The request.
- * @return The response.
- */
- UpdateCollectorResponse updateCollector(UpdateCollectorRequest request);
-
- /**
- * Convenience method: takes a collector as argument.
- *
- * @param collector The collector.
- * @return The response.
- */
- UpdateCollectorResponse updateCollector(Collector collector);
-
- /**
- * Deletes a Sumo Logic collector.
- *
- * @param request The request.
- * @return The response.
- */
- DeleteCollectorResponse deleteCollector(DeleteCollectorRequest request);
-
- /**
- * Convenience method: takes an id as argument.
- *
- * @param id The id.
- * @return The response.
- */
- DeleteCollectorResponse deleteCollector(Long id);
-
- /**
- * Gets all sources for a Sumo Logic collector matching the request.
- *
- * @param request The request.
- * @return The response.
- */
- GetSourcesResponse getSources(GetSourcesRequest request);
-
- /**
- * Convenience method: takes a collector id as argument.
- *
- * @param collectorId The collector id.
- * @return The response.
- */
- GetSourcesResponse getSources(Long collectorId);
-
- /**
- * Gets a single source for a Sumo Logic collector.
- *
- * @param request The request.
- * @return The response.
- */
- GetSourceResponse getSource(GetSourceRequest request);
-
- /**
- * Convenience method: takes collector id and source id as arguments.
- *
- * @param collectorId The collector id.
- * @param sourceId The source id.
- * @return The response.
- */
- GetSourceResponse getSource(Long collectorId, Long sourceId);
-
- /**
- * Creates a source for a Sumo Logic collector.
- *
- * @param request The request.
- * @return The response.
- */
- CreateSourceResponse createSource(CreateSourceRequest request);
-
- /**
- * Convenience method: takes collector id and source as arguments.
- *
- * @param collectorId The collector id.
- * @param source The source.
- * @return The response.
- */
- CreateSourceResponse createSource(Long collectorId, Source source);
-
- /**
- * Updates a source for a Sumo Logic collector.
- *
- * @param request The request.
- * @return The response.
- */
- UpdateSourceResponse updateSource(UpdateSourceRequest request);
-
- /**
- * Convenience method: takes collector id and source as arguments.
- *
- * @param collectorId The collector id.
- * @param source The source.
- * @return The response.
- */
- UpdateSourceResponse updateSource(Long collectorId, Source source);
-
- /**
- * Deletes a source from a Sumo Logic collector.
- *
- * @param request The request.
- * @return The response.
- */
- DeleteSourceResponse deleteSource(DeleteSourceRequest request);
-
- /**
- * Convenience method: takes collector id and source id as arguments.
- *
- * @param collectorId The collector id.
- * @param sourceId The source id.
- * @return The response.
- */
- DeleteSourceResponse deleteSource(Long collectorId, Long sourceId);
-}
diff --git a/src/main/java/com/sumologic/client/SumoLogicClient.java b/src/main/java/com/sumologic/client/SumoLogicClient.java
deleted file mode 100644
index a9606df..0000000
--- a/src/main/java/com/sumologic/client/SumoLogicClient.java
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client;
-
-import com.sumologic.client.collectors.CollectorsClient;
-import com.sumologic.client.collectors.model.*;
-import com.sumologic.client.dashboard.DashboardClient;
-import com.sumologic.client.dashboard.model.*;
-import com.sumologic.client.searchjob.SearchJobClient;
-import com.sumologic.client.searchjob.model.*;
-import com.sumologic.client.util.HttpUtils;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-/**
- * The Sumo Logic API client implementation.
- */
-public class SumoLogicClient implements SumoLogic {
-
- private HttpUtils httpUtils = new HttpUtils();
-
- private String protocol = "https";
- private String hostname = "api.sumologic.com";
- private int port = 443;
- private Credentials credentials;
- private String proxyHost;
- private int proxyPort;
- private String proxyProtocol;
-
- private CollectorsClient collectorsClient = new CollectorsClient(httpUtils);
- private SearchJobClient searchJobClient = new SearchJobClient(httpUtils);
- private DashboardClient dashboardClient = new DashboardClient(httpUtils);
-
- /**
- * Constructs a Sumo Logic client.
- *
- * @param credentials The credential used to access sumo logic's web service.
- */
- public SumoLogicClient(Credentials credentials) {
- this.credentials = credentials;
- }
-
- /**
- * Convenience: constructs the credentials using accessId and accessKey.
- *
- * @param accessId Your access id.
- * @param accessKey Your access key.
- */
- public SumoLogicClient(String accessId, String accessKey) {
- this.credentials = new Credentials(accessId, accessKey);
- }
-
- /**
- * Sets a custom Sumo Logic API url, i.e.,
- * different from https://api.sumologic.com.
- *
- * @param urlString The custom sumo logic api URL.
- * @throws MalformedURLException On URL syntax error.
- */
- public void setURL(String urlString) throws MalformedURLException {
- URL url = new URL(urlString);
- this.hostname = url.getHost();
- this.port = (url.getPort() == -1) ?
- (url.getDefaultPort() == -1 ? 80 : url.getDefaultPort()) : url.getPort();
- this.protocol = url.getProtocol();
- }
-
- public void setProxyHost(String proxyHost) {
- this.proxyHost = proxyHost;
- }
-
- public void setProxyPort(int proxyPort) {
- this.proxyPort = proxyPort;
- }
-
- public void setProxyProtocol(String proxyProtocol) {
- this.proxyProtocol = proxyProtocol;
- }
-
- private ConnectionConfig getConnectionConfig() {
- return new ConnectionConfig(protocol, hostname, port, credentials, proxyProtocol, proxyHost, proxyPort);
- }
-
- //
- // Search jobs.
- //
-
- /**
- * Starts a search job and receives a job ID for subsequent
- * polling of the search status.
- *
- * @param query The query.
- * @param fromExpression The from expression.
- * @param toExpression The toExpression.
- * @param timeZone The time zone.
- * @return The search job ID.
- */
- @Override
- public String createSearchJob(
- String query, String fromExpression, String toExpression, String timeZone) {
- return createSearchJob(query, fromExpression, toExpression, timeZone, "false");
- }
-
-
- /**
- * Starts a search job and receives a job ID for subsequent
- * polling of the search status.
- *
- * @param query The query.
- * @param fromExpression The from expression.
- * @param toExpression The toExpression.
- * @param timeZone The time zone.
- * @param byReceiptTime Search by receipt time instead of message time
- * @return The search job ID.
- */
- @Override
- public String createSearchJob(
- String query, String fromExpression, String toExpression, String timeZone, String byReceiptTime) {
- CreateSearchJobRequest createSearchJobRequest =
- new CreateSearchJobRequest(query, fromExpression, toExpression, timeZone, byReceiptTime);
- return searchJobClient.createSearchJob(
- getConnectionConfig(), createSearchJobRequest);
- }
-
- /**
- * Returns the current status of a search job.
- *
- * @param searchJobId The search job ID.
- * @return The status.
- */
- @Override
- public GetSearchJobStatusResponse getSearchJobStatus(String searchJobId) {
- GetSearchJobStatusRequest getSearchJobStatusRequest =
- new GetSearchJobStatusRequest(searchJobId);
- return searchJobClient.getSearchJobStatus(
- getConnectionConfig(), getSearchJobStatusRequest);
- }
-
- /**
- * Returns messages for the specified search job.
- *
- * @param searchJobId The search job ID.
- * @param offset The offset.
- * @param limit The length.
- * @return The messages.
- */
- @Override
- public GetMessagesForSearchJobResponse getMessagesForSearchJob(
- String searchJobId, int offset, int limit) {
- GetMessagesForSearchJobRequest getMessagesForSearchJobRequest =
- new GetMessagesForSearchJobRequest(searchJobId, offset, limit);
- return searchJobClient.getMessagesForSearchJob(
- getConnectionConfig(), getMessagesForSearchJobRequest);
- }
-
- /**
- * Returns records for the specified search job.
- *
- * @param searchJobId The search job ID.
- * @param offset The offset.
- * @param limit The length.
- * @return The records.
- */
- @Override
- public GetRecordsForSearchJobResponse getRecordsForSearchJob(String searchJobId, int offset, int limit) {
- GetRecordsForSearchJobRequest getRecordsForSearchJobRequest =
- new GetRecordsForSearchJobRequest(searchJobId, offset, limit);
- return searchJobClient.getRecordsForSearchJob(
- getConnectionConfig(), getRecordsForSearchJobRequest);
- }
-
- /**
- * Cancels a search job.
- *
- * @param searchJobId The search job ID.
- * @return The response.
- */
- @Override
- public CancelSearchJobResponse cancelSearchJob(String searchJobId) {
- CancelSearchJobRequest cancelSearchJobRequest =
- new CancelSearchJobRequest(searchJobId);
- return searchJobClient.deleteSearchJob(
- getConnectionConfig(), cancelSearchJobRequest);
- }
-
- //
- // Collectors.
- //
-
- /**
- * Gets all available Sumo Logic collectors matching the request.
- *
- * @param request The request.
- * @return The response.
- */
- public GetCollectorsResponse getCollectors(GetCollectorsRequest request) {
- return collectorsClient.get(getConnectionConfig(), request);
- }
-
- /**
- * Gets all available Sumo Logic collectors.
- *
- * @return The response.
- */
- public GetCollectorsResponse getCollectors() {
- return getCollectors(new GetCollectorsRequest());
- }
-
- /**
- * Gets a single Sumo Logic collector.
- *
- * @param request The request.
- * @return The response.
- */
- public GetCollectorResponse getCollector(GetCollectorRequest request) {
- return collectorsClient.get(getConnectionConfig(), request);
- }
-
- /**
- * Convenience method: takes an id as argument.
- *
- * @param id The id.
- * @return The response.
- */
- public GetCollectorResponse getCollector(Long id) {
- return getCollector(new GetCollectorRequest(id));
- }
-
- /**
- * Creates a Sumo Logic collector.
- *
- * @param request The request.
- * @return The response.
- */
- public CreateCollectorResponse createCollector(CreateCollectorRequest request) {
- return collectorsClient.create(getConnectionConfig(), request);
- }
-
- /**
- * Convenience method; takes a collector as argument.
- *
- * @param collector The collector.
- * @return The response.
- */
- public CreateCollectorResponse createCollector(Collector collector) {
- return createCollector(new CreateCollectorRequest(collector));
- }
-
- /**
- * Updates a Sumo Logic collector.
- *
- * @param request The request.
- * @return The response.
- */
- public UpdateCollectorResponse updateCollector(UpdateCollectorRequest request) {
- return collectorsClient.update(getConnectionConfig(), request);
- }
-
- /**
- * Convenience method: takes a collector as argument.
- *
- * @param collector The collector.
- * @return The response.
- */
- public UpdateCollectorResponse updateCollector(Collector collector) {
- return updateCollector(new UpdateCollectorRequest(collector.getId(), collector));
- }
-
- /**
- * Deletes a Sumo Logic collector.
- *
- * @param request The request.
- * @return The response.
- */
- public DeleteCollectorResponse deleteCollector(DeleteCollectorRequest request) {
- return collectorsClient.delete(getConnectionConfig(), request);
- }
-
- /**
- * Convenience method: takes an id as argument.
- *
- * @param id The id.
- * @return The response.
- */
- public DeleteCollectorResponse deleteCollector(Long id) {
- return deleteCollector(new DeleteCollectorRequest(id));
- }
-
- /**
- * Gets all sources for a Sumo Logic collector matching the request.
- *
- * @param request The request.
- * @return The response.
- */
- public GetSourcesResponse getSources(GetSourcesRequest request) {
- return collectorsClient.getSources(getConnectionConfig(), request);
- }
-
- /**
- * Convenience method: takes a collector id as argument.
- *
- * @param collectorId The collector id.
- * @return The response.
- */
- public GetSourcesResponse getSources(Long collectorId) {
- return getSources(new GetSourcesRequest(collectorId));
- }
-
- /**
- * Gets a single source for a Sumo Logic collector.
- *
- * @param request The request.
- * @return The response.
- */
- public GetSourceResponse getSource(GetSourceRequest request) {
- return collectorsClient.getSource(getConnectionConfig(), request);
- }
-
- /**
- * Convenience method: takes collector id and source id as arguments.
- *
- * @param collectorId The collector id.
- * @param sourceId The source id.
- * @return The response.
- */
- public GetSourceResponse getSource(Long collectorId, Long sourceId) {
- return getSource(new GetSourceRequest(collectorId, sourceId));
- }
-
- /**
- * Creates a source for a Sumo Logic collector.
- *
- * @param request The request.
- * @return The response.
- */
- public CreateSourceResponse createSource(CreateSourceRequest request) {
- return collectorsClient.createSource(getConnectionConfig(), request);
- }
-
- /**
- * Convenience method: takes collector id and source as arguments.
- *
- * @param collectorId The collector id.
- * @param source The source.
- * @return The response.
- */
- public CreateSourceResponse createSource(Long collectorId, Source source) {
- return createSource(new CreateSourceRequest(collectorId, source));
- }
-
- /**
- * Updates a source for a Sumo Logic collector.
- *
- * @param request The request.
- * @return The response.
- */
- public UpdateSourceResponse updateSource(UpdateSourceRequest request) {
- return collectorsClient.updateSource(getConnectionConfig(), request);
- }
-
- /**
- * Convenience method: takes collector id and source as arguments.
- *
- * @param collectorId The collector id.
- * @param source The source.
- * @return The response.
- */
- public UpdateSourceResponse updateSource(Long collectorId, Source source) {
- return updateSource(new UpdateSourceRequest(collectorId, source.getId(), source));
- }
-
- /**
- * Deletes a source from a Sumo Logic collector.
- *
- * @param request The request.
- * @return The response.
- */
- public DeleteSourceResponse deleteSource(DeleteSourceRequest request) {
- return collectorsClient.deleteSource(getConnectionConfig(), request);
- }
-
- /**
- * Convenience method: takes collector id and source id as arguments.
- *
- * @param collectorId The collector id.
- * @param sourceId The source id.
- * @return The response.
- */
- public DeleteSourceResponse deleteSource(Long collectorId, Long sourceId) {
- return deleteSource(new DeleteSourceRequest(collectorId, sourceId));
- }
-
- //
- // Dashboards.
- //
-
- /**
- * Returns all dashboards.
- *
- * @param includeMonitors Whether to include the monitors in the response.
- * @return The dashboards.
- */
- public GetDashboardsResponse getDashboards(boolean includeMonitors) {
- return dashboardClient.getDashboards(
- getConnectionConfig(), new GetDashboardsRequest(includeMonitors));
- }
-
- /**
- * Returns a dashboard.
- *
- * @param id The ID of the dashboard.
- * @return The dashboard.
- */
- public GetDashboardDataResponse getDashboardData(long id) {
- return dashboardClient.getDashboardData(
- getConnectionConfig(), new GetDashboardDataRequest(id));
- }
-
- /**
- * Returns the data for a dashboard.
- *
- * @param id The ID of the dashboard.
- * @return The data for the dashboard.
- */
- public GetDashboardResponse getDashboard(long id) {
- return dashboardClient.getDashboard(
- getConnectionConfig(), new GetDashboardRequest(id));
- }
-}
diff --git a/src/main/java/com/sumologic/client/SumoSearchErrors.java b/src/main/java/com/sumologic/client/SumoSearchErrors.java
deleted file mode 100644
index 675b5b0..0000000
--- a/src/main/java/com/sumologic/client/SumoSearchErrors.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client;
-
-/**
- * API errors that might occur during a search.
- */
-public enum SumoSearchErrors implements SumoServerError {
- EMPTY_FIELD_LIST("no.fields"),
- INVALID_TIMESTAMP_TO("invalid.timestamp.to"),
- INVALID_TIMESTAMP_FROM("invalid.timestamp.from"),
- TO_SMALLER_THAN_FROM("to.smaller.than.from"),
- UNKNOWN_TIMEZONE("unknown.timezone"),
- EMPTY_TIMEZONE("empty.timezone"),
- NO_QUERY_STRING("no.q"),
- TIMED_OUT("timed.out"),
- CANCELLED("cancelled"),
- RETURNED_ERRORS("errors"),
- NO_COUNTS("no.counts"),
- QUERY_PARSE_ERROR("parse.error"),
- MESSAGE_RETRIEVAL_ERROR("message.retrieval.error"),
- FORMAT_DOES_NOT_ALLOW_AGGREGATION("aggregates.unsupported"),
- FORMAT_DOES_NOT_ALLOW_RAW("raw.unsupported"),
- OUTPUT_CLOSED("output.closed"),
- FORMAT_UNKNOWN("unknown.format");
-
- private String id;
-
- private SumoSearchErrors(String id) {
- this.id = "search." + id;
- }
-
- public String getId() {
- return id;
- }
-}
diff --git a/src/main/java/com/sumologic/client/SumoServerError.java b/src/main/java/com/sumologic/client/SumoServerError.java
deleted file mode 100644
index 7b25ec6..0000000
--- a/src/main/java/com/sumologic/client/SumoServerError.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client;
-
-/**
- * The sumo API error interface for an extensible enum pattern.
- *
- * @see com.sumologic.client.collectors.SumoCollectorErrors
- * @see SumoSearchErrors
- * @see SumoServerErrors
- */
-public interface SumoServerError {
- /**
- * Returns the identifier of the error., e.g.,
- * "unknown.timezone" when the timezone is unknown
- *
- * @return The identifier of the error
- */
- public String getId();
-}
diff --git a/src/main/java/com/sumologic/client/SumoServerErrors.java b/src/main/java/com/sumologic/client/SumoServerErrors.java
deleted file mode 100644
index 368bc45..0000000
--- a/src/main/java/com/sumologic/client/SumoServerErrors.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client;
-
-/**
- * General sumo API web service errors.
- */
-public enum SumoServerErrors implements SumoServerError {
- INTERNAL_SERVER_ERROR("internal.error"),
- UNAUTHORIZED("unauthorized"),
- UNAVAILABLE("service.unavailable"),
- NOT_FOUND("notfound"),
- UNSUPPORTED_METHOD("method.unsupported"),
- INVALID_CONTENT_TYPE("contenttype.invalid"),
-
- ETAG_MISMATCH("service.etagid.mismatch"),
- MISSING_PRECONDITION("service.ifthen.missing"),
- BAD_PRECONDITION("service.ifthen.notquoted"),
-
- INVALID_LIMIT("service.limit.invalid"),
- INVALID_OFFSET("service.offset.invalid"),
- INVALID_JSON("service.json.invalid");
-
- private String id = "";
-
- private SumoServerErrors(String id) {
- this.id = id;
- }
-
- public String getId() {
- return id;
- }
-}
diff --git a/src/main/java/com/sumologic/client/SumoServerException.java b/src/main/java/com/sumologic/client/SumoServerException.java
deleted file mode 100644
index a9ab7ae..0000000
--- a/src/main/java/com/sumologic/client/SumoServerException.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client;
-
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.sumologic.client.util.JacksonUtils;
-
-import java.util.Map;
-
-/**
- * A sumo server-side exception comprising the HTTP status code,
- * error identifier and code, the query uri used and a human-readable
- * message.
- */
-public class SumoServerException extends SumoException {
-
- private String uri;
- private int status;
- // (message, id, code) == null if the server doesn't respond with a nice JSON
- private String message;
- private String id;
- private String code;
-
- /**
- * Constructs a server exception when a JSON error message is not available.
- *
- * @param uri The URI that caused the exception
- * @param status The HTTP status
- */
- public SumoServerException(String uri, int status) {
- super("The server responded with HTTP Status: " + status);
- this.uri = uri;
- this.status = status;
- this.message = null;
- this.id = null;
- this.code = null;
- }
-
-
- /**
- * Constructs a server exception from a JSON error message
- *
- * @param uri The URI that caused the exception
- * @param json The JSON error message
- * @throws SumoClientException Thrown if the JSON error message contains syntactic errors.
- */
- public SumoServerException(String uri, String json) throws SumoClientException {
- super(json);
- this.uri = uri;
-
- // Parse JSON string
- try {
- Map kv = JacksonUtils.MAPPER.readValue(json,
- new TypeReference>() {
- });
-
- // get fields
- status = Integer.parseInt(kv.get("status"));
- message = kv.get("message");
- id = kv.get("id");
- code = kv.get("code");
- } catch (Exception e) {
- throw new SumoClientException("Exception while parsing JSON: \n" + json, e);
- }
- }
-
- /**
- * Returns the HTTP status code.
- *
- * @return The HTTP status code.
- */
- public final int getHTTPStatus() {
- return status;
- }
-
- /**
- * Returns the identifier of the error., e.g.,
- * "unknown.timezone" when the timezone is unknown
- *
- * @return The identifier of the error
- */
- public final String getErrorId() {
- return id;
- }
-
- /**
- * Returns the error code.
- *
- * @return The error code.
- */
- public final String getErrorCode() {
- return code;
- }
-
- /**
- * Returns a the human-readable message associated with
- * this exception.
- *
- * @return A the human-readable message
- */
- public final String getErrorMessage() {
- return message;
- }
-
- /**
- * Returns the URI that caused the exception.
- *
- * @return The URI that caused the exception.
- */
- public final String getURI() {
- return uri;
- }
-
- /**
- * Returns true, if the error is equal to a server error, e.g.,
- * @see SumoSearchErrors#EMPTY_FIELD_LIST
- *
- * @param error The error to compare
- * @return True, if the exception equals the given server error
- */
- public boolean equals(SumoServerError error) {
- return id != null &&
- error.getId().equals(id.toLowerCase().trim());
- }
-}
diff --git a/src/main/java/com/sumologic/client/UrlParameters.java b/src/main/java/com/sumologic/client/UrlParameters.java
deleted file mode 100644
index 003581b..0000000
--- a/src/main/java/com/sumologic/client/UrlParameters.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client;
-
-/**
- * Common url parameters used in the sumo web service API.
- * Contains all magic numbers/strings for performing the HTTP requests.
- */
-public interface UrlParameters {
-
- /**
- * API
- */
- public static String API_SERVICE = "api";
-
- /**
- * API version prefix
- */
- public static String VERSION_PREFIX = "v";
-
- /**
- * Logs sub-tasks
- */
- public static String LOGS_SERVICE = "logs";
-
- /**
- * Collectors sub-tasks
- */
- public static String COLLECTORS_SERVICE = "collectors";
-
- /**
- * Sources sub-tasks
- */
- public static String SOURCES_SERVICE = "sources";
-
- /**
- * Limit for pagination
- */
- public static String LIMIT = "limit";
-
- /**
- * Offset for pagination
- */
- public static String OFFSET = "offset";
-
- /**
- * Search query string
- */
- public static String SEARCH = "search";
-
- /**
- * Search suffix for JSON results
- */
- public static String SEARCH_JSON = ".json";
-
- /**
- * Search suffix for text results
- */
- public static String SEARCH_TEXT = ".text";
-
- /**
- * The search query string
- */
- public static String SEARCH_QUERY = "q";
-
- /**
- * The search order parameter string
- */
- public static String SEARCH_ORDER = "order";
-
- /**
- * Descending search order
- */
- public static String SEARCH_ORDER_DESC = "desc";
-
- /**
- * Ascending search order
- */
- public static String SEARCH_ORDER_ASC = "asc";
-
- /**
- * The search from parameter string
- */
- public static String SEARCH_FROM = "from";
-
- /**
- * The search to parameter string
- */
- public static String SEARCH_TO = "to";
-
- /**
- * The search timezone parameter string
- */
- public static String SEARCH_TIMEZONE = "tz";
-
- /**
- * The search pagination offset parameter string
- */
- public static String SEARCH_OFFSET = "offset";
-
- /**
- * The search pagination limit parameter string
- */
- public static String SEARCH_LIMIT = "limit";
-
- /**
- * The log message text field's key
- */
- public static String LOG_MESSAGE_RAW = "_raw";
-
- /**
- * The log message time field's key
- */
- public static String LOG_MESSAGE_TIME = "_messagetime";
-
- /**
- * The log message receipt time field's key
- */
- public static String LOG_MESSAGE_RECEIPT_TIME = "_receipttime";
-
- /**
- * The log message receipt source host field's key
- */
- public static String LOG_MESSAGE_SOURCE_HOST = "_sourcehost";
-
- /**
- * The log message receipt source category field's key
- */
- public static String LOG_MESSAGE_SOURCE_CATEGORY = "_sourcecategory";
-
- /**
- * The log message receipt source name field's key
- */
- public static String LOG_MESSAGE_SOURCE_NAME = "_sourcename";
-
- /**
- * The log message count field's key (when results are aggregated)
- */
- public static String LOG_MESSAGE_COUNT = "_count";
-
- /**
- * The log message signature field's key
- */
- public static String LOG_MESSAGE_SIGNATURE = "_signature";
-
- /**
- * Search sub-tasks
- */
- public static String SEARCH_JOBS_SERVICE = "search/jobs";
-
- /**
- * Search job messages
- */
- public static String SEARCH_JOBS_SERVICE_MESSAGES = "messages";
-
- /**
- * Search job records
- */
- public static String SEARCH_JOBS_SERVICE_RECORDS = "records";
-
- /**
- * Dashboards sub-tasks
- */
- public static String DASHBOARDS_SERVICE = "dashboards";
-
- /**
- * Dashboards data
- */
- public static String DASHBOARDS_SERVICE_DATA = "data";
-}
diff --git a/src/main/java/com/sumologic/client/collectors/CollectorAndBladeIdDumper.java b/src/main/java/com/sumologic/client/collectors/CollectorAndBladeIdDumper.java
deleted file mode 100644
index 87ff529..0000000
--- a/src/main/java/com/sumologic/client/collectors/CollectorAndBladeIdDumper.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors;
-
-import com.sumologic.client.Credentials;
-import com.sumologic.client.SumoLogicClient;
-import com.sumologic.client.collectors.model.*;
-
-import java.util.List;
-
-public class CollectorAndBladeIdDumper {
-
- public static void main(String[] args) throws Exception {
-
- // Get the commandline arguments.
- // The URL of the Sumo Logic API endpoint. This will usually be
- // https://api.sumologic.com
- String url = args[0];
-
- // The credentials of the user for which to execute the query.
- String accessId = args[1];
- String accessKey = args[2];
- Credentials credential = new Credentials(accessId, accessKey);
- SumoLogicClient sumoClient = new SumoLogicClient(credential);
- sumoClient.setURL(url);
-
- GetCollectorsResponse getCollectorResponse = sumoClient.getCollectors();
- List collectors = getCollectorResponse.getCollectors();
- for (Collector collector : collectors) {
- System.err.printf("Collector ID: '%016X', name: '%s'\n",
- collector.getId(), collector.getName());
- long offset = 0;
- long increment = 50;
- boolean done = false;
- while (!done) {
- GetSourcesRequest getSourcesRequest = new GetSourcesRequest(collector.getId());
- getSourcesRequest.setOffset(offset);
- getSourcesRequest.setLimit(increment);
- GetSourcesResponse getSourcesResponse = sumoClient.getSources(getSourcesRequest);
- List sources = getSourcesResponse.getSources();
- for (Source source : sources) {
- System.err.printf(" Source ID: '%016X', name: '%s'\n",
- source.getId(), source.getName());
- }
- offset += increment;
- if (sources.size() < increment) {
- done = true;
- }
- }
- }
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/CollectorsClient.java b/src/main/java/com/sumologic/client/collectors/CollectorsClient.java
deleted file mode 100644
index ba75c16..0000000
--- a/src/main/java/com/sumologic/client/collectors/CollectorsClient.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors;
-
-import com.sumologic.client.ConnectionConfig;
-import com.sumologic.client.UrlParameters;
-import com.sumologic.client.collectors.model.*;
-import com.sumologic.client.util.DeserializingResponseHandler;
-import com.sumologic.client.util.HttpUtils;
-import com.sumologic.client.util.PassingResponseHandler;
-import com.sumologic.client.util.SumoEntityResponseHandler;
-import org.apache.http.HttpStatus;
-
-public class CollectorsClient {
-
- private HttpUtils httpUtils;
-
- public CollectorsClient(HttpUtils httpUtils) {
- this.httpUtils = httpUtils;
- }
-
- public GetCollectorsResponse get(ConnectionConfig config, GetCollectorsRequest request) {
- return httpUtils.get(config, UrlParameters.COLLECTORS_SERVICE, request,
- HttpUtils.toRequestHeaders(),
- new DeserializingResponseHandler(GetCollectorsResponse.class),
- HttpStatus.SC_OK);
- }
-
- public GetCollectorResponse get(ConnectionConfig config, GetCollectorRequest request) {
- return httpUtils.get(config, getCollectorEndpoint(request.getId()), request,
- HttpUtils.toRequestHeaders(),
- new SumoEntityResponseHandler(GetCollectorResponse.class),
- HttpStatus.SC_OK);
- }
-
- public CreateCollectorResponse create(ConnectionConfig config, CreateCollectorRequest request) {
- return httpUtils.post(config, UrlParameters.COLLECTORS_SERVICE, request,
- HttpUtils.toRequestHeaders(),
- new SumoEntityResponseHandler(CreateCollectorResponse.class),
- HttpStatus.SC_CREATED);
- }
-
- public UpdateCollectorResponse update(ConnectionConfig config, UpdateCollectorRequest request) {
- return httpUtils.put(config, getCollectorEndpoint(request.getId()), request,
- new SumoEntityResponseHandler(UpdateCollectorResponse.class),
- HttpStatus.SC_OK);
- }
-
- public DeleteCollectorResponse delete(ConnectionConfig config, DeleteCollectorRequest request) {
- return httpUtils.delete(config, getCollectorEndpoint(request.getId()), request,
- new PassingResponseHandler(new DeleteCollectorResponse()),
- HttpStatus.SC_OK);
- }
-
- public GetSourcesResponse getSources(ConnectionConfig config, GetSourcesRequest request) {
- return httpUtils.get(config, getSourcesEndpoint(request.getCollectorId()), request,
- HttpUtils.toRequestHeaders(),
- new DeserializingResponseHandler(GetSourcesResponse.class),
- HttpStatus.SC_OK);
- }
-
- public GetSourceResponse getSource(ConnectionConfig config, GetSourceRequest request) {
- String sourceEndpoint = getSourceEndpoint(request.getCollectorId(), request.getSourceId());
- return httpUtils.get(config, sourceEndpoint, request,
- HttpUtils.toRequestHeaders(),
- new SumoEntityResponseHandler(GetSourceResponse.class),
- HttpStatus.SC_OK);
- }
-
- public CreateSourceResponse createSource(ConnectionConfig config, CreateSourceRequest request) {
- return httpUtils.post(config, getSourcesEndpoint(request.getCollectorId()), request,
- HttpUtils.toRequestHeaders(),
- new SumoEntityResponseHandler(CreateSourceResponse.class),
- HttpStatus.SC_CREATED);
- }
-
- public UpdateSourceResponse updateSource(ConnectionConfig config, UpdateSourceRequest request) {
- String sourceEndpoint = getSourceEndpoint(request.getCollectorId(), request.getSourceId());
- return httpUtils.put(config, sourceEndpoint, request,
- new SumoEntityResponseHandler(UpdateSourceResponse.class),
- HttpStatus.SC_OK);
- }
-
- public DeleteSourceResponse deleteSource(ConnectionConfig config, DeleteSourceRequest request) {
- String sourceEndpoint = getSourceEndpoint(request.getCollectorId(), request.getSourceId());
- return httpUtils.delete(config, sourceEndpoint, request,
- new PassingResponseHandler(new DeleteSourceResponse()),
- HttpStatus.SC_OK);
- }
-
- private String getCollectorEndpoint(Long collectorId) {
- return UrlParameters.COLLECTORS_SERVICE + "/" + collectorId;
- }
-
- private String getSourcesEndpoint(Long collectorId) {
- return getCollectorEndpoint(collectorId) + "/" + UrlParameters.SOURCES_SERVICE;
- }
-
- private String getSourceEndpoint(Long collectorId, Long sourceId) {
- return getSourcesEndpoint(collectorId) + "/" + sourceId;
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/SumoCollectorErrors.java b/src/main/java/com/sumologic/client/collectors/SumoCollectorErrors.java
deleted file mode 100644
index 4e7edba..0000000
--- a/src/main/java/com/sumologic/client/collectors/SumoCollectorErrors.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors;
-
-import com.sumologic.client.SumoServerError;
-
-/**
- * Errors that might occur during collector API requests.
- */
-public enum SumoCollectorErrors implements SumoServerError {
- INVALID_COLLECTOR("collector.invalid"),
- INVALID_SOURCE("source.invalid"),
- CANNOT_MODIFY_COLLECTOR("collector.forbidden"),
- BAD_COLLECTOR_ID("collector.request.id.invalid"),
- BAD_SOURCE_ID("source.request.id.invalid"),
- INVALID_COLLECTOR_TYPE("collector.type.invalid"),
- DUPLICATE_RESOURCE_NAME("validation.name.duplicate"),
- MISSING_FIELDS("validation.fields.missing"),
- INVALID_FIELD_VALUE("validation.fields.invalid"),
- INVALID_SOURCE_TYPE("source.type.invalid");
-
- private String id;
-
- private SumoCollectorErrors(String id) {
- this.id = "collectors." + id;
- }
-
- public String getId() {
- return id;
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/AlertSource.java b/src/main/java/com/sumologic/client/collectors/model/AlertSource.java
deleted file mode 100644
index 45814e5..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/AlertSource.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-/**
- * A source used for alerting on saved searches.
- */
-public class AlertSource extends BaseScriptSource {
-
- public AlertSource() {
- setSourceType(SourceType.ALERT.getType());
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/AmazonS3Source.java b/src/main/java/com/sumologic/client/collectors/model/AmazonS3Source.java
deleted file mode 100644
index cf432a3..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/AmazonS3Source.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import com.sumologic.client.util.JacksonUtils;
-
-public class AmazonS3Source extends Source {
-
- private static String KEY_ID = "keyId";
- private static String SECRET_KEY = "secretKey";
- private static String BUCKET_NAME = "bucketName";
- private static String PATH_EXPRESSION = "pathExpression";
- private static String SCAN_INTERVAL = "scanInterval";
-
- public AmazonS3Source() {
- setSourceType(SourceType.AMAZON_S3.getType());
- }
-
- /**
- * Returns the key id (hidden in server response).
- *
- * @return The key id.
- */
- public String getKeyId() {
- return getProperty(KEY_ID);
- }
-
- /**
- * Sets the key id.
- */
- public void setKeyId(String keyId) {
- setProperty(KEY_ID, keyId);
- }
-
- /**
- * Returns the secret key (hidden in server response).
- *
- * @return The secret key.
- */
- public String getSecretKey() {
- return getProperty(SECRET_KEY);
- }
-
- /**
- * Sets the secret key.
- */
- public void setSecretKey(String secretKey) {
- setProperty(SECRET_KEY, secretKey);
- }
-
- /**
- * Returns the bucket name.
- *
- * @return The bucket name.
- */
- public String getBucketName() {
- return getProperty(BUCKET_NAME);
- }
-
- /**
- * Sets the bucket name.
- */
- public void setBucketName(String bucketName) {
- setProperty(BUCKET_NAME, bucketName);
- }
-
- /**
- * Returns the path expression.
- *
- * @return The path expression.
- */
- public String getPathExpression() {
- return getProperty(PATH_EXPRESSION);
- }
-
- /**
- * Sets the path expression.
- */
- public void setPathExpression(String pathExpression) {
- setProperty(PATH_EXPRESSION, pathExpression);
- }
-
- /**
- * Returns the scan interval.
- *
- * @return The scan interval.
- */
- public Long getScanInterval() {
- return JacksonUtils.asLong(getProperty(SCAN_INTERVAL));
- }
-
- /**
- * Sets the scan interval.
- */
- public void setScanInterval(Long scanInterval) {
- setProperty(SCAN_INTERVAL, scanInterval);
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/BaseScriptSource.java b/src/main/java/com/sumologic/client/collectors/model/BaseScriptSource.java
deleted file mode 100644
index 7c63a57..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/BaseScriptSource.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import com.sumologic.client.util.JacksonUtils;
-
-import java.util.List;
-
-public abstract class BaseScriptSource extends Source {
-
- private static String COMMANDS = "commands";
- private static String FILE = "file";
- private static String WORKING_DIR = "workingDir";
- private static String TIMEOUT = "timeout";
-
- /**
- * Returns the list of commands.
- *
- * @return The list of commands.
- */
- public List getCommands() {
- return getProperty(COMMANDS);
- }
-
- /**
- * Sets the list of commands.
- */
- public void setCommands(List commands) {
- setProperty(COMMANDS, commands);
- }
-
- /**
- * Returns the script file (if no contents are specified).
- *
- * @return The script file.
- */
- public String getFile() {
- return getProperty(FILE);
- }
-
- /**
- * Sets the script file.
- */
- public void setFile(String file) {
- setProperty(FILE, file);
- }
-
- /**
- * Returns the working directory.
- *
- * @return The working directory.
- */
- public String getWorkingDir() {
- return getProperty(WORKING_DIR);
- }
-
- /**
- * Sets the working directory.
- */
- public void setWorkingDir(String workingDir) {
- setProperty(WORKING_DIR, workingDir);
- }
-
- /**
- * Returns the script timeout.
- *
- * @return The script timeout.
- */
- public Long getTimeout() {
- return JacksonUtils.asLong(getProperty(TIMEOUT));
- }
-
- /**
- * Sets the script timeout.
- */
- public void setTimeout(Long timeout) {
- setProperty(TIMEOUT, timeout);
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/Collector.java b/src/main/java/com/sumologic/client/collectors/model/Collector.java
deleted file mode 100644
index 891c178..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/Collector.java
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import com.fasterxml.jackson.annotation.JsonSubTypes;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
-import com.sumologic.client.model.SumoEntity;
-
-/**
- * A collector in the Sumo Logic system.
- */
-@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "collectorType")
-@JsonSubTypes({
- @JsonSubTypes.Type(value = InstallableCollector.class, name = "Installable"),
- @JsonSubTypes.Type(value = HostedCollector.class, name = "Hosted")
-})
-public abstract class Collector extends SumoEntity {
-
- private Long id;
- private String name;
- private Boolean alive;
- private String hostName;
- private String timeZone;
- private String category;
- private String status;
- private String description;
- private String collectorVersion;
- private Boolean ephemeral;
-
- /**
- * Returns the id.
- *
- * @return The id.
- */
- public Long getId() {
- return id;
- }
-
- /**
- * Sets the id.
- */
- public void setId(Long id) {
- this.id = id;
- }
-
- /**
- * Returns the name.
- *
- * @return The name.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the name.
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Returns whether the collector is alive.
- *
- * @return Whether the collector is alive.
- */
- public Boolean isAlive() {
- return alive;
- }
-
- /**
- * Returns the host name.
- *
- * @return The host name.
- */
- public String getHostName() {
- return hostName;
- }
-
- /**
- * Sets the host name.
- */
- public void setHostName(String hostName) {
- this.hostName = hostName;
- }
-
- /**
- * Returns the time zone.
- *
- * @return The time zone.
- */
- public String getTimeZone() {
- return timeZone;
- }
-
- /**
- * Sets the time zone.
- */
- public void setTimeZone(String timeZone) {
- this.timeZone = timeZone;
- }
-
- /**
- * Returns the category.
- *
- * @return The category.
- */
- public String getCategory() {
- return category;
- }
-
- /**
- * Sets the category.
- */
- public void setCategory(String category) {
- this.category = category;
- }
-
- /**
- * Returns the status.
- *
- * @return The status.
- */
- public String getStatus() {
- return status;
- }
-
- /**
- * Returns the description.
- *
- * @return The description.
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description.
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Returns the collector version.
- *
- * @return The collector version.
- */
- public String getCollectorVersion() {
- return collectorVersion;
- }
-
- /**
- * Returns whether the collector is ephemeral.
- *
- * @return Whether the collector is ephemeral.
- */
- public Boolean isEphemeral() {
- return ephemeral;
- }
-
- /**
- * Sets whether the collector is ephemeral.
- */
- public void setEphemeral(Boolean ephemeral) {
- this.ephemeral = ephemeral;
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/CreateCollectorRequest.java b/src/main/java/com/sumologic/client/collectors/model/CreateCollectorRequest.java
deleted file mode 100644
index 6cc026d..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/CreateCollectorRequest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import com.sumologic.client.model.HttpPostRequest;
-
-/**
- * A request to create a collector in the Sumo Logic system.
- */
-public class CreateCollectorRequest implements HttpPostRequest {
-
- private Collector collector;
-
- public CreateCollectorRequest(Collector collector) {
- this.collector = collector;
- }
-
- /**
- * Returns the collector.
- *
- * @return The collector.
- */
- public Collector getCollector() {
- return collector;
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/CreateCollectorResponse.java b/src/main/java/com/sumologic/client/collectors/model/CreateCollectorResponse.java
deleted file mode 100644
index b4bb3ea..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/CreateCollectorResponse.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import com.sumologic.client.model.SumoEntity;
-import com.sumologic.client.model.SumoEntityResponse;
-
-/**
- * A response containing the created collector.
- */
-public class CreateCollectorResponse extends SumoEntityResponse {
-
- private Collector collector;
-
- /**
- * Returns the collector.
- *
- * @return The collector.
- */
- public Collector getCollector() {
- return collector;
- }
-
- @Override
- protected SumoEntity getEntity() {
- return collector;
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/CreateSourceRequest.java b/src/main/java/com/sumologic/client/collectors/model/CreateSourceRequest.java
deleted file mode 100644
index 9f69fc2..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/CreateSourceRequest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.sumologic.client.model.HttpPostRequest;
-
-/**
- * A request to add a source for a collector in the Sumo Logic system.
- */
-public class CreateSourceRequest implements HttpPostRequest {
-
- @JsonIgnore
- private Long collectorId;
- private Source source;
-
- public CreateSourceRequest(Long collectorId, Source source) {
- this.collectorId = collectorId;
- this.source = source;
- }
-
- /**
- * Returns the source id.
- *
- * @return The source id.
- */
- public Long getCollectorId() {
- return collectorId;
- }
-
- /**
- * Returns the source.
- *
- * @return The source.
- */
- public Source getSource() {
- return source;
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/CreateSourceResponse.java b/src/main/java/com/sumologic/client/collectors/model/CreateSourceResponse.java
deleted file mode 100644
index 9207a09..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/CreateSourceResponse.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.sumologic.client.model.SumoEntity;
-import com.sumologic.client.model.SumoEntityResponse;
-import com.sumologic.client.util.SourceDeserializer;
-
-/**
- * A response containing the created source.
- */
-public class CreateSourceResponse extends SumoEntityResponse {
-
- @JsonDeserialize(using = SourceDeserializer.class)
- private Source source;
-
- /**
- * Returns the source.
- *
- * @return The source.
- */
- public Source getSource() {
- return source;
- }
-
- @Override
- protected SumoEntity getEntity() {
- return source;
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/DeleteCollectorRequest.java b/src/main/java/com/sumologic/client/collectors/model/DeleteCollectorRequest.java
deleted file mode 100644
index de2826d..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/DeleteCollectorRequest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import com.sumologic.client.model.HttpDeleteRequest;
-
-/**
- * A request to delete a collector from the Sumo Logic system.
- */
-public class DeleteCollectorRequest implements HttpDeleteRequest {
-
- private Long id;
-
- public DeleteCollectorRequest(Long id) {
- this.id = id;
- }
-
- /**
- * Returns the id.
- *
- * @return The id.
- */
- public Long getId() {
- return id;
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/DeleteCollectorResponse.java b/src/main/java/com/sumologic/client/collectors/model/DeleteCollectorResponse.java
deleted file mode 100644
index b683b41..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/DeleteCollectorResponse.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-/**
- * An empty response.
- */
-public class DeleteCollectorResponse {
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/DeleteSourceRequest.java b/src/main/java/com/sumologic/client/collectors/model/DeleteSourceRequest.java
deleted file mode 100644
index 53e3208..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/DeleteSourceRequest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import com.sumologic.client.model.HttpDeleteRequest;
-
-/**
- * A request to delete a source for a collector in the Sumo Logic system.
- */
-public class DeleteSourceRequest implements HttpDeleteRequest {
-
- private Long collectorId;
- private Long sourceId;
-
- public DeleteSourceRequest(Long collectorId, Long sourceId) {
- this.collectorId = collectorId;
- this.sourceId = sourceId;
- }
-
- /**
- * Returns the collector id.
- *
- * @return The collector id.
- */
- public Long getCollectorId() {
- return collectorId;
- }
-
- /**
- * Returns the source id.
- *
- * @return The source id.
- */
- public Long getSourceId() {
- return sourceId;
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/DeleteSourceResponse.java b/src/main/java/com/sumologic/client/collectors/model/DeleteSourceResponse.java
deleted file mode 100644
index 13b7c28..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/DeleteSourceResponse.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-/**
- * An empty response.
- */
-public class DeleteSourceResponse {
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/Filter.java b/src/main/java/com/sumologic/client/collectors/model/Filter.java
deleted file mode 100644
index 08bb423..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/Filter.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-public class Filter {
-
- public static String EXCLUDE = "Exclude";
- public static String INCLUDE = "Include";
- public static String HASH = "Hash";
- public static String MASK = "Mask";
-
- private String filterType;
- private String name;
- private String regexp;
- private String mask;
-
- /**
- * Returns the filter type.
- *
- * @return The filter type.
- */
- public String getFilterType() {
- return filterType;
- }
-
- /**
- * Sets the filter type.
- */
- public void setFilterType(String filterType) {
- this.filterType = filterType;
- }
-
- /**
- * Returns the name.
- *
- * @return The name.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the name.
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Returns the regular expression.
- *
- * @return The regular expression.
- */
- public String getRegexp() {
- return regexp;
- }
-
- /**
- * Sets the regular expression.
- */
- public void setRegexp(String regexp) {
- this.regexp = regexp;
- }
-
- /**
- * Returns the mask.
- *
- * @return The mask.
- */
- public String getMask() {
- return mask;
- }
-
- /**
- * Sets the mask.
- */
- public void setMask(String mask) {
- this.mask = mask;
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/GetCollectorRequest.java b/src/main/java/com/sumologic/client/collectors/model/GetCollectorRequest.java
deleted file mode 100644
index d30fc97..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/GetCollectorRequest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import com.sumologic.client.model.HttpGetRequest;
-import org.apache.http.NameValuePair;
-
-import java.util.Collections;
-import java.util.List;
-
-/**
- * A request to get a single collector from the Sumo Logic system.
- */
-public class GetCollectorRequest implements HttpGetRequest {
-
- private Long id;
-
- public GetCollectorRequest(Long id) {
- this.id = id;
- }
-
- /**
- * Returns the id.
- *
- * @return The id.
- */
- public Long getId() {
- return id;
- }
-
- @Override
- public List toUrlParams() {
- return Collections.emptyList();
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/GetCollectorResponse.java b/src/main/java/com/sumologic/client/collectors/model/GetCollectorResponse.java
deleted file mode 100644
index 1cc567e..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/GetCollectorResponse.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import com.sumologic.client.model.SumoEntity;
-import com.sumologic.client.model.SumoEntityResponse;
-
-/**
- * A response containing the requested collector.
- */
-public class GetCollectorResponse extends SumoEntityResponse {
-
- private Collector collector;
-
- /**
- * Returns the collector.
- *
- * @return The collector.
- */
- public Collector getCollector() {
- return collector;
- }
-
- @Override
- protected SumoEntity getEntity() {
- return collector;
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/GetCollectorsRequest.java b/src/main/java/com/sumologic/client/collectors/model/GetCollectorsRequest.java
deleted file mode 100644
index 12b590d..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/GetCollectorsRequest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import com.sumologic.client.UrlParameters;
-import com.sumologic.client.model.HttpGetRequest;
-import org.apache.http.NameValuePair;
-import org.apache.http.message.BasicNameValuePair;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A request to get collectors from the Sumo Logic system.
- */
-public class GetCollectorsRequest implements HttpGetRequest {
-
- private Long limit;
- private Long offset;
-
- /**
- * Returns the limit.
- *
- * @return The limit.
- */
- public Long getLimit() {
- return limit;
- }
-
- /**
- * Sets the limit.
- */
- public void setLimit(Long limit) {
- this.limit = limit;
- }
-
- /**
- * Sets the limit.
- *
- * @return This object.
- */
- public GetCollectorsRequest withLimit(Long limit) {
- setLimit(limit);
- return this;
- }
-
- /**
- * Returns the offset.
- *
- * @return The offset.
- */
- public Long getOffset() {
- return offset;
- }
-
- /**
- * Sets the offset.
- */
- public void setOffset(Long offset) {
- this.offset = offset;
- }
-
- /**
- * Sets the offset.
- *
- * @return This object.
- */
- public GetCollectorsRequest withOffset(Long offset) {
- setOffset(offset);
- return this;
- }
-
- @Override
- public List toUrlParams() {
- List params = new ArrayList();
- if (limit != null) {
- params.add(new BasicNameValuePair(UrlParameters.LIMIT, String.valueOf(limit)));
- }
- if (offset != null) {
- params.add(new BasicNameValuePair(UrlParameters.OFFSET, String.valueOf(offset)));
- }
- return params;
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/GetCollectorsResponse.java b/src/main/java/com/sumologic/client/collectors/model/GetCollectorsResponse.java
deleted file mode 100644
index ecfb1ae..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/GetCollectorsResponse.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import java.util.List;
-
-/**
- * A response containing a list of collectors.
- */
-public class GetCollectorsResponse {
-
- private List collectors;
-
- /**
- * Returns the collectors.
- *
- * @return The collectors.
- */
- public List getCollectors() {
- return collectors;
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/GetSourceRequest.java b/src/main/java/com/sumologic/client/collectors/model/GetSourceRequest.java
deleted file mode 100644
index 10a0f85..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/GetSourceRequest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import com.sumologic.client.model.HttpGetRequest;
-import org.apache.http.NameValuePair;
-
-import java.util.Collections;
-import java.util.List;
-
-/**
- * A request to get a single source for a collector in the Sumo Logic system.
- */
-public class GetSourceRequest implements HttpGetRequest {
-
- private Long collectorId;
- private Long sourceId;
-
- public GetSourceRequest(Long collectorId, Long sourceId) {
- this.collectorId = collectorId;
- this.sourceId = sourceId;
- }
-
- /**
- * Returns the collector id.
- *
- * @return The collector id.
- */
- public Long getCollectorId() {
- return collectorId;
- }
-
- /**
- * Returns the source id.
- *
- * @return The source id.
- */
- public Long getSourceId() {
- return sourceId;
- }
-
- @Override
- public List toUrlParams() {
- return Collections.emptyList();
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/GetSourceResponse.java b/src/main/java/com/sumologic/client/collectors/model/GetSourceResponse.java
deleted file mode 100644
index 9593526..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/GetSourceResponse.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.sumologic.client.model.SumoEntity;
-import com.sumologic.client.model.SumoEntityResponse;
-import com.sumologic.client.util.SourceDeserializer;
-
-/**
- * A response containing the requested source.
- */
-public class GetSourceResponse extends SumoEntityResponse {
-
- @JsonDeserialize(using = SourceDeserializer.class)
- private Source source;
-
- /**
- * Returns the source.
- *
- * @return The source.
- */
- public Source getSource() {
- return source;
- }
-
- @Override
- protected SumoEntity getEntity() {
- return source;
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/GetSourcesRequest.java b/src/main/java/com/sumologic/client/collectors/model/GetSourcesRequest.java
deleted file mode 100644
index e84cc4b..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/GetSourcesRequest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import com.sumologic.client.UrlParameters;
-import com.sumologic.client.model.HttpGetRequest;
-import org.apache.http.NameValuePair;
-import org.apache.http.message.BasicNameValuePair;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A request to get sources for a collector in the Sumo Logic system.
- */
-public class GetSourcesRequest implements HttpGetRequest {
-
- private Long collectorId;
- private Long limit;
- private Long offset;
-
- public GetSourcesRequest(Long collectorId) {
- this.collectorId = collectorId;
- }
-
- /**
- * Returns the collector id.
- *
- * @return The collector id.
- */
- public Long getCollectorId() {
- return collectorId;
- }
-
- /**
- * Returns the limit.
- *
- * @return The limit.
- */
- public Long getLimit() {
- return limit;
- }
-
- /**
- * Sets the limit.
- */
- public void setLimit(Long limit) {
- this.limit = limit;
- }
-
- /**
- * Sets the limit.
- *
- * @return This object.
- */
- public GetSourcesRequest withLimit(Long limit) {
- setLimit(limit);
- return this;
- }
-
- /**
- * Returns the offset.
- *
- * @return The offset.
- */
- public Long getOffset() {
- return offset;
- }
-
- /**
- * Sets the offset.
- */
- public void setOffset(Long offset) {
- this.offset = offset;
- }
-
- /**
- * Sets the offset.
- *
- * @return This object.
- */
- public GetSourcesRequest withOffset(Long offset) {
- setOffset(offset);
- return this;
- }
-
- @Override
- public List toUrlParams() {
- List params = new ArrayList();
- if (limit != null) {
- params.add(new BasicNameValuePair(UrlParameters.LIMIT, String.valueOf(limit)));
- }
- if (offset != null) {
- params.add(new BasicNameValuePair(UrlParameters.OFFSET, String.valueOf(offset)));
- }
- return params;
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/GetSourcesResponse.java b/src/main/java/com/sumologic/client/collectors/model/GetSourcesResponse.java
deleted file mode 100644
index cf2f41b..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/GetSourcesResponse.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.sumologic.client.util.SourceDeserializer;
-
-import java.util.List;
-
-/**
- * A response containing a list of sources.
- */
-public class GetSourcesResponse {
-
- @JsonDeserialize(contentUsing = SourceDeserializer.class)
- private List sources;
-
- /**
- * Returns the sources.
- *
- * @return The sources.
- */
- public List getSources() {
- return sources;
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/HostedCollector.java b/src/main/java/com/sumologic/client/collectors/model/HostedCollector.java
deleted file mode 100644
index 55ebc8f..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/HostedCollector.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-/**
- * A hosted collector in the Sumo Logic system.
- */
-public class HostedCollector extends Collector {
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/HttpSource.java b/src/main/java/com/sumologic/client/collectors/model/HttpSource.java
deleted file mode 100644
index 7156799..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/HttpSource.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-public class HttpSource extends Source {
-
- public static String ENCODING = "encoding";
- public static String ENDPOINT = "url";
- public static String MESSAGE_PER_REQUEST = "messagePerRequest";
-
- public HttpSource() {
- setSourceType(SourceType.HTTP.getType());
- }
-
- /**
- * Returns the encoding.
- *
- * @return The encoding.
- */
- public String getEncoding() {
- return getProperty(ENCODING);
- }
-
- /**
- * Sets the encoding.
- */
- public void setEncoding(String encoding) {
- setProperty(ENCODING, encoding);
- }
-
- /**
- * Returns the URL endpoint.
- *
- * @return The URL endpoint.
- */
- public String getEndpoint() {
- return getProperty(ENDPOINT);
- }
-
- /**
- * Returns whether each request is a single message.
- *
- * @return Whether each request is a single message.
- */
- public Boolean isMessagePerRequest() {
- return getProperty(MESSAGE_PER_REQUEST);
- }
-
- /**
- * Sets whether each request is a single message.
- */
- public void setMessagePerRequest(Boolean messagePerRequest) {
- setProperty(MESSAGE_PER_REQUEST, messagePerRequest);
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/InstallableCollector.java b/src/main/java/com/sumologic/client/collectors/model/InstallableCollector.java
deleted file mode 100644
index 2a074af..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/InstallableCollector.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-/**
- * An installable collector in the Sumo Logic system.
- */
-public class InstallableCollector extends Collector {
-
- private String osVersion;
- private String osName;
- private String osArch;
- private Long upTime;
-
- /**
- * Returns the OS version.
- *
- * @return The OS version.
- */
- public String getOsVersion() {
- return osVersion;
- }
-
- /**
- * Returns the OS name.
- *
- * @return The OS name.
- */
- public String getOsName() {
- return osName;
- }
-
- /**
- * Returns the OS architecture.
- *
- * @return The OS architecture.
- */
- public String getOsArch() {
- return osArch;
- }
-
- /**
- * Returns the collector's uptime.
- *
- * @return The collector's uptime.
- */
- public Long getUpTime() {
- return upTime;
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/LocalFileSource.java b/src/main/java/com/sumologic/client/collectors/model/LocalFileSource.java
deleted file mode 100644
index f66749f..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/LocalFileSource.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import java.util.List;
-
-/**
- * A source that reads from local files matching a path expression.
- */
-public class LocalFileSource extends Source {
-
- private static String PATH_EXPRESSION = "pathExpression";
- private static String BLACKLIST = "blacklist";
- private static String DENYLIST = "denylist";
-
- public LocalFileSource() {
- setSourceType(SourceType.LOCAL_FILE.getType());
- }
-
- /**
- * Returns the path expression.
- *
- * @return The path expression.
- */
- public String getPathExpression() {
- return getProperty(PATH_EXPRESSION);
- }
-
- /**
- * Sets the path expression.
- */
- public void setPathExpression(String pathExpression) {
- setProperty(PATH_EXPRESSION, pathExpression);
- }
-
- /**
- * Returns the blacklist.
- *
- * @return The blacklist.
- */
- public List getBlacklist() {
- return getProperty(BLACKLIST);
- }
-
- /**
- * Sets the blacklist.
- */
- public void setBlacklist(List blacklist) {
- setProperty(BLACKLIST, blacklist);
- }
-
- /**
- * Returns the denylist.
- *
- * @return The denylist.
- */
- public List getDenylist() {
- return getProperty(DENYLIST);
- }
-
- /**
- * Sets the denylist.
- */
- public void setDenylist(List denylist) {
- setProperty(DENYLIST, denylist);
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/RemoteFileSource.java b/src/main/java/com/sumologic/client/collectors/model/RemoteFileSource.java
deleted file mode 100644
index d4eeefc..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/RemoteFileSource.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import java.util.List;
-
-/**
- * A source that reads from a remote file over SSH.
- */
-public class RemoteFileSource extends Source {
-
- private static String REMOTE_HOSTS = "remoteHosts";
- private static String REMOTE_PORT = "remotePort";
- private static String REMOTE_USER = "remoteUser";
- private static String REMOTE_PASSWORD = "remotePassword";
- private static String KEY_PATH = "keyPath";
- private static String KEY_PASSWORD = "keyPassword";
- private static String REMOTE_PATH = "remotePath";
- private static String AUTH_METHOD = "authMethod";
- private static String DENYLIST = "denylist";
-
- public RemoteFileSource() {
- setSourceType(SourceType.REMOTE_FILE.getType());
- }
-
- /**
- * Returns the remote host.
- *
- * @return The remote host.
- */
- public List getRemoteHosts() {
- return getProperty(REMOTE_HOSTS);
- }
-
- /**
- * Sets the remote host.
- */
- public void setRemoteHosts(List remoteHosts) {
- setProperty(REMOTE_HOSTS, remoteHosts);
- }
-
- /**
- * Returns the remote port.
- *
- * @return The remote port.
- */
- public Integer getRemotePort() {
- return getProperty(REMOTE_PORT);
- }
-
- /**
- * Sets the remote port.
- */
- public void setRemotePort(Integer remotePort) {
- setProperty(REMOTE_PORT, remotePort);
- }
-
- /**
- * Returns the remote user.
- *
- * @return The remote user.
- */
- public String getRemoteUser() {
- return getProperty(REMOTE_USER);
- }
-
- /**
- * Sets the remote user.
- */
- public void setRemoteUser(String remoteUser) {
- setProperty(REMOTE_USER, remoteUser);
- }
-
- /**
- * Returns the remote password (hidden in server response).
- *
- * @return The remote password.
- */
- public String getRemotePassword() {
- return getProperty(REMOTE_PASSWORD);
- }
-
- /**
- * Sets the remote password.
- */
- public void setRemotePassword(String remotePassword) {
- setProperty(REMOTE_PASSWORD, remotePassword);
- }
-
- /**
- * Returns the remote path.
- *
- * @return The remote path.
- */
- public String getKeyPath() {
- return getProperty(KEY_PATH);
- }
-
- /**
- * Sets the key path.
- */
- public void setKeyPath(String keyPath) {
- setProperty(KEY_PATH, keyPath);
- }
-
- /**
- * Returns the key password (hidden in server response).
- *
- * @return The key password.
- */
- public String getKeyPassword() {
- return getProperty(KEY_PASSWORD);
- }
-
- /**
- * Sets the key password.
- */
- public void setKeyPassword(String keyPassword) {
- setProperty(KEY_PASSWORD, keyPassword);
- }
-
- /**
- * Returns the remote file path.
- *
- * @return The remote file path.
- */
- public String getRemotePath() {
- return getProperty(REMOTE_PATH);
- }
-
- /**
- * Sets the remote file path.
- */
- public void setRemotePath(String remotePath) {
- setProperty(REMOTE_PATH, remotePath);
- }
-
- /**
- * Returns the auth method.
- *
- * @return The auth method.
- */
- public String getAuthMethod() {
- return getProperty(AUTH_METHOD);
- }
-
- /**
- * Sets the auth method.
- */
- public void setAuthMethod(String authMethod) {
- setProperty(AUTH_METHOD, authMethod);
- }
-
- /**
- * Returns the denylist.
- *
- * @return The denylist.
- */
- public List getDenylist() {
- return getProperty(DENYLIST);
- }
-
- /**
- * Sets the denylist.
- */
- public void setDenylist(List denylist) {
- setProperty(DENYLIST, denylist);
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/RemoteWindowsEventLogSource.java b/src/main/java/com/sumologic/client/collectors/model/RemoteWindowsEventLogSource.java
deleted file mode 100644
index 3a0d0e0..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/RemoteWindowsEventLogSource.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import java.util.List;
-
-/**
- * A source that reads from remote Windows event logs.
- */
-public class RemoteWindowsEventLogSource extends WindowsEventLogSource {
-
- private static String DOMAIN = "domain";
- private static String USERNAME = "username";
- private static String PASSWORD = "password";
- private static String HOSTS = "hosts";
-
- public RemoteWindowsEventLogSource() {
- setSourceType(SourceType.REMOTE_WINDOWS_EVENT_LOG.getType());
- }
-
- /**
- * Returns the Windows domain.
- *
- * @return The Windows domain.
- */
- public String getDomain() {
- return getProperty(DOMAIN);
- }
-
- /**
- * Sets the Windows domain.
- */
- public void setDomain(String domain) {
- setProperty(DOMAIN, domain);
- }
-
- /**
- * Returns the username.
- *
- * @return The username.
- */
- public String getUsername() {
- return getProperty(USERNAME);
- }
-
- /**
- * Sets the username.
- */
- public void setUsername(String username) {
- setProperty(USERNAME, username);
- }
-
- /**
- * Returns the password (hidden in server response).
- *
- * @return The password.
- */
- public String getPassword() {
- return getProperty(PASSWORD);
- }
-
- /**
- * Sets the password.
- */
- public void setPassword(String password) {
- setProperty(PASSWORD, password);
- }
-
- /**
- * Returns the list of remote Windows hosts.
-
- * @return The list of remote Windows hosts.
- */
- public List getHosts() {
- return getProperty(HOSTS);
- }
-
- /**
- * Sets the list of remote Windows hosts.
- */
- public void setHosts(List hosts) {
- setProperty(HOSTS, hosts);
- }
-
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/ScriptSource.java b/src/main/java/com/sumologic/client/collectors/model/ScriptSource.java
deleted file mode 100644
index 9770473..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/ScriptSource.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-/**
- * A source that executes a script and collects its output.
- */
-public class ScriptSource extends BaseScriptSource {
-
- private static String SCRIPT = "script";
- private static String CRON_EXPRESSION = "cronExpression";
-
- public ScriptSource() {
- setSourceType(SourceType.SCRIPT.getType());
- }
-
- /**
- * Returns the script contents (if no file is specified).
- *
- * @return The script contents.
- */
- public String getScript() {
- return getProperty(SCRIPT);
- }
-
- /**
- * Sets the script contents.
- */
- public void setScript(String script) {
- setProperty(SCRIPT, script);
- }
-
- /**
- * Returns the cron expression.
- *
- * @return The cron expression.
- */
- public String getCronExpression() {
- return getProperty(CRON_EXPRESSION);
- }
-
- /**
- * Sets the cron expression.
- */
- public void setCronExpression(String cronExpression) {
- setProperty(CRON_EXPRESSION, cronExpression);
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/Source.java b/src/main/java/com/sumologic/client/collectors/model/Source.java
deleted file mode 100644
index 119ba1f..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/Source.java
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.sumologic.client.model.SumoEntity;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * A generic source for a collector in the Sumo Logic system.
- */
-public class Source extends SumoEntity {
-
- private Long id;
- private String name;
- private Boolean automaticDateParsing;
- private Boolean multilineProcessingEnabled;
- private Boolean useAutolineMatching;
- private String manualPrefixRegexp;
- private String category;
- private String hostName;
- private String timeZone;
- private String description;
- private Boolean forceTimeZone;
- private String defaultDateFormat;
- private String sourceType;
- private String contentType;
- private Boolean alive;
- private String status;
- private List filters = new ArrayList();
- private Map properties = new HashMap();
-
- /**
- * Returns the id.
- *
- * @return The id.
- */
- public Long getId() {
- return id;
- }
-
- /**
- * Sets the id.
- */
- public void setId(Long id) {
- this.id = id;
- }
-
- /**
- * Returns the name.
- *
- * @return The name.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the name.
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Returns whether automatic date parsing is enabled.
- *
- * @return Whether automatic date parsing is enabled.
- */
- public Boolean isAutomaticDateParsing() {
- return automaticDateParsing;
- }
-
- /**
- * Sets whether automatic date parsing is enabled.
- */
- public void setAutomaticDateParsing(Boolean automaticDateParsing) {
- this.automaticDateParsing = automaticDateParsing;
- }
-
- /**
- * Returns whether multiline processing is enabled.
- *
- * @return Whether multiline processing is enabled.
- */
- public Boolean isMultilineProcessingEnabled() {
- return multilineProcessingEnabled;
- }
-
- /**
- * Sets whether multiline processing is enabled.
- */
- public void setMultilineProcessingEnabled(Boolean multilineProcessingEnabled) {
- this.multilineProcessingEnabled = multilineProcessingEnabled;
- }
-
- /**
- * Returns whether autoline matching is used.
- *
- * @return Whether autoline matching is used.
- */
- public Boolean isUseAutolineMatching() {
- return useAutolineMatching;
- }
-
- /**
- * Sets whether autoline matching is used.
- */
- public void setUseAutolineMatching(Boolean useAutolineMatching) {
- this.useAutolineMatching = useAutolineMatching;
- }
-
- /**
- * Returns the manual prefix regular expression.
- *
- * @return The manual prefix regular expression.
- */
- public String getManualPrefixRegexp() {
- return manualPrefixRegexp;
- }
-
- /**
- * Sets the manual prefix regular expression.
- */
- public void setManualPrefixRegexp(String manualPrefixRegexp) {
- this.manualPrefixRegexp = manualPrefixRegexp;
- }
-
- /**
- * Returns the category.
- *
- * @return The category.
- */
- public String getCategory() {
- return category;
- }
-
- /**
- * Sets the category.
- */
- public void setCategory(String category) {
- this.category = category;
- }
-
- /**
- * Returns the host name.
- *
- * @return The host name.
- */
- public String getHostName() {
- return hostName;
- }
-
- /**
- * Sets the host name.
- */
- public void setHostName(String hostName) {
- this.hostName = hostName;
- }
-
- /**
- * Returns the time zone.
- *
- * @return The time zone.
- */
- public String getTimeZone() {
- return timeZone;
- }
-
- /**
- * Sets the time zone.
- */
- public void setTimeZone(String timeZone) {
- this.timeZone = timeZone;
- }
-
- /**
- * Returns the description.
- *
- * @return The description.
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description.
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Returns whether the time zone is forced.
- *
- * @return Whether the time zone is forced.
- */
- public Boolean isForceTimeZone() {
- return forceTimeZone;
- }
-
- /**
- * Sets whether the time zone is forced.
- */
- public void setForceTimeZone(Boolean forceTimeZone) {
- this.forceTimeZone = forceTimeZone;
- }
-
- /**
- * Returns the default date format.
- *
- * @return The default date format.
- */
- public String getDefaultDateFormat() {
- return defaultDateFormat;
- }
-
- /**
- * Sets the default date format.
- */
- public void setDefaultDateFormat(String defaultDateFormat) {
- this.defaultDateFormat = defaultDateFormat;
- }
-
- /**
- * Returns the source type.
- *
- * @return The source type.
- */
- public String getSourceType() {
- return sourceType;
- }
-
- /**
- * Sets the source type.
- */
- public void setSourceType(String sourceType) {
- this.sourceType = sourceType;
- }
-
- /**
- * Returns the content type.
- *
- * @return The content type.
- */
- public String getContentType() {
- return contentType;
- }
-
- /**
- * Sets the content type.
- */
- public void setContentType(String contentType) {
- this.contentType = contentType;
- }
-
- /**
- * Returns whether the source is alive.
- *
- * @return Whether the source is alive.
- */
- public Boolean isAlive() {
- return alive;
- }
-
- /**
- * Returns the status.
- *
- * @return The status.
- */
- public String getStatus() {
- return status;
- }
-
- /**
- * Returns the filters.
- *
- * @return The filters.
- */
- public List getFilters() {
- return filters;
- }
-
- /**
- * Sets the filters.
- */
- public void setFilters(List filters) {
- this.filters = filters;
- }
-
- /**
- * Returns the value of a property that is specific to the source type.
- *
- * @param name The property name.
- * @return The property value.
- */
- @SuppressWarnings("unchecked")
- public T getProperty(String name) {
- return (T) properties.get(name);
- }
-
- /**
- * Returns a map of all properties that are specific to the source type.
- *
- * @return A map of all properties that are specific to the source type.
- */
- @JsonAnyGetter
- public Map getProperties() {
- return properties;
- }
-
- /**
- * Sets the value of a property that is specific to the source type.
- */
- @JsonAnySetter
- public void setProperty(String name, Object value) {
- properties.put(name, value);
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/SourceType.java b/src/main/java/com/sumologic/client/collectors/model/SourceType.java
deleted file mode 100644
index 6b8de54..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/SourceType.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Enumeration of available source types (not necessarily comprehensive).
- */
-public enum SourceType {
- LOCAL_FILE("LocalFile", LocalFileSource.class),
- REMOTE_FILE("RemoteFile", RemoteFileSource.class),
- SYSLOG("Syslog", SyslogSource.class),
- LOCAL_WINDOWS_EVENT_LOG("LocalWindowsEventLog", WindowsEventLogSource.class),
- REMOTE_WINDOWS_EVENT_LOG("RemoteWindowsEventLog", RemoteWindowsEventLogSource.class),
- SCRIPT("Script", ScriptSource.class),
- ALERT("Alert", AlertSource.class),
- AMAZON_S3("AmazonS3", AmazonS3Source.class),
- HTTP("HTTP", HttpSource.class),
- STREAMING_METRICS("StreamingMetrics", StreamingMetricsSource.class);
-
- private String type;
- private Class extends Source> sourceClass;
-
- private SourceType(String type, Class extends Source> sourceClass) {
- this.type = type;
- this.sourceClass = sourceClass;
- }
-
- public String getType() {
- return type;
- }
-
- public Class extends Source> getSourceClass() {
- return sourceClass;
- }
-
- // Static mapping
-
- private static Map> SOURCE_TYPE_MAP =
- new HashMap>();
-
- static {
- for (SourceType sourceType : values()) {
- SOURCE_TYPE_MAP.put(sourceType.getType(), sourceType.getSourceClass());
- }
- }
-
- public static Class extends Source> getSourceClass(String type) {
- return SOURCE_TYPE_MAP.get(type);
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/StreamingMetricsSource.java b/src/main/java/com/sumologic/client/collectors/model/StreamingMetricsSource.java
deleted file mode 100644
index 0c62831..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/StreamingMetricsSource.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-public class StreamingMetricsSource extends Source {
-
- private static String PROTOCOL = "protocol";
- private static String PORT = "port";
-
- public StreamingMetricsSource() { setSourceType(SourceType.STREAMING_METRICS.getType()); }
-
- /**
- * Returns the protocol.
- *
- * @return The protocol.
- */
- public String getProtocol() {
- return getProperty(PROTOCOL);
- }
-
- /**
- * Sets the protocol.
- */
- public void setProtocol(String protocol) {
- setProperty(PROTOCOL, protocol);
- }
-
- /**
- * Returns the port.
- *
- * @return The port.
- */
- public Integer getPort() {
- return getProperty(PORT);
- }
-
- /**
- * Sets the port.
- */
- public void setPort(Integer port) {
- setProperty(PORT, port);
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/SyslogSource.java b/src/main/java/com/sumologic/client/collectors/model/SyslogSource.java
deleted file mode 100644
index 056080a..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/SyslogSource.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-/**
- * A source that collects messages through syslog.
- */
-public class SyslogSource extends Source {
-
- private static String PROTOCOL = "protocol";
- private static String PORT = "port";
-
- public SyslogSource() {
- setSourceType(SourceType.SYSLOG.getType());
- }
-
- /**
- * Returns the protocol.
- *
- * @return The protocol.
- */
- public String getProtocol() {
- return getProperty(PROTOCOL);
- }
-
- /**
- * Sets the protocol.
- */
- public void setProtocol(String protocol) {
- setProperty(PROTOCOL, protocol);
- }
-
- /**
- * Returns the port.
- *
- * @return The port.
- */
- public Integer getPort() {
- return getProperty(PORT);
- }
-
- /**
- * Sets the port.
- */
- public void setPort(Integer port) {
- setProperty(PORT, port);
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/UpdateCollectorRequest.java b/src/main/java/com/sumologic/client/collectors/model/UpdateCollectorRequest.java
deleted file mode 100644
index 701b3b7..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/UpdateCollectorRequest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.sumologic.client.model.HttpPutRequest;
-
-/**
- * A request to modify a collector in the Sumo Logic system.
- */
-public class UpdateCollectorRequest implements HttpPutRequest {
-
- @JsonIgnore
- private Long id;
- private Collector collector;
-
- public UpdateCollectorRequest(Long id, Collector collector) {
- this.id = id;
- this.collector = collector;
- }
-
- /**
- * Returns the id.
- *
- * @return The id.
- */
- public Long getId() {
- return id;
- }
-
- /**
- * Returns the collector.
- *
- * @return The collector.
- */
- public Collector getCollector() {
- return collector;
- }
-
- @Override
- public String getETag() {
- return collector.getETag();
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/UpdateCollectorResponse.java b/src/main/java/com/sumologic/client/collectors/model/UpdateCollectorResponse.java
deleted file mode 100644
index a442cad..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/UpdateCollectorResponse.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import com.sumologic.client.model.SumoEntity;
-import com.sumologic.client.model.SumoEntityResponse;
-
-/**
- * A response containing the updated collector.
- */
-public class UpdateCollectorResponse extends SumoEntityResponse {
-
- private Collector collector;
-
- /**
- * Returns the collector.
- *
- * @return The collector.
- */
- public Collector getCollector() {
- return collector;
- }
-
- @Override
- protected SumoEntity getEntity() {
- return collector;
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/UpdateSourceRequest.java b/src/main/java/com/sumologic/client/collectors/model/UpdateSourceRequest.java
deleted file mode 100644
index f3344d6..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/UpdateSourceRequest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.sumologic.client.model.HttpPutRequest;
-
-/**
- * A request to modify a source for a collector in the Sumo Logic system.
- */
-public class UpdateSourceRequest implements HttpPutRequest {
-
- @JsonIgnore
- private Long collectorId;
- @JsonIgnore
- private Long sourceId;
- private Source source;
-
- public UpdateSourceRequest(Long collectorId, Long sourceId, Source source) {
- this.collectorId = collectorId;
- this.sourceId = sourceId;
- this.source = source;
- }
-
- /**
- * Returns the source id.
- *
- * @return The source id.
- */
- public Long getCollectorId() {
- return collectorId;
- }
-
- /**
- * Returns the source id.
- *
- * @return The source id.
- */
- public Long getSourceId() {
- return sourceId;
- }
-
- /**
- * Returns the source.
- *
- * @return The source.
- */
- public Source getSource() {
- return source;
- }
-
- @Override
- public String getETag() {
- return source.getETag();
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/UpdateSourceResponse.java b/src/main/java/com/sumologic/client/collectors/model/UpdateSourceResponse.java
deleted file mode 100644
index b2fe7a6..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/UpdateSourceResponse.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.sumologic.client.model.SumoEntity;
-import com.sumologic.client.model.SumoEntityResponse;
-import com.sumologic.client.util.SourceDeserializer;
-
-/**
- * A response containing the updated source.
- */
-public class UpdateSourceResponse extends SumoEntityResponse {
-
- @JsonDeserialize(using = SourceDeserializer.class)
- private Source source;
-
- /**
- * Returns the source.
- *
- * @return The source.
- */
- public Source getSource() {
- return source;
- }
-
- @Override
- protected SumoEntity getEntity() {
- return source;
- }
-}
diff --git a/src/main/java/com/sumologic/client/collectors/model/WindowsEventLogSource.java b/src/main/java/com/sumologic/client/collectors/model/WindowsEventLogSource.java
deleted file mode 100644
index 67e0b92..0000000
--- a/src/main/java/com/sumologic/client/collectors/model/WindowsEventLogSource.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.collectors.model;
-
-import java.util.List;
-
-/**
- * A source that reads from local Windows event logs.
- */
-public class WindowsEventLogSource extends Source {
-
- private static String LOG_NAMES = "logNames";
-
- public WindowsEventLogSource() {
- setSourceType(SourceType.LOCAL_WINDOWS_EVENT_LOG.getType());
- }
-
- /**
- * Returns the list of event types (empty if includeAll = true).
- *
- * @return The list of event types.
- */
- public List getLogNames() {
- return getProperty(LOG_NAMES);
- }
-
- /**
- * Sets the list of event types.
- */
- public void setLogNames(List logNames) {
- setProperty(LOG_NAMES, logNames);
- }
-}
diff --git a/src/main/java/com/sumologic/client/dashboard/DashboardClient.java b/src/main/java/com/sumologic/client/dashboard/DashboardClient.java
deleted file mode 100644
index 3eaacaa..0000000
--- a/src/main/java/com/sumologic/client/dashboard/DashboardClient.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.dashboard;
-
-import com.sumologic.client.ConnectionConfig;
-import com.sumologic.client.UrlParameters;
-import com.sumologic.client.dashboard.model.*;
-import com.sumologic.client.util.DeserializingResponseHandler;
-import com.sumologic.client.util.HttpUtils;
-import org.apache.http.HttpStatus;
-
-public class DashboardClient {
-
- private HttpUtils httpUtils;
-
- public DashboardClient(HttpUtils httpUtils) {
- this.httpUtils = httpUtils;
- }
-
- public GetDashboardsResponse getDashboards(
- ConnectionConfig connection,
- GetDashboardsRequest getDashboardsRequest) {
-
- String uri = UrlParameters.DASHBOARDS_SERVICE;
- return httpUtils.get(
- connection,
- uri,
- getDashboardsRequest,
- HttpUtils.toRequestHeaders(
- "Accept", "application/json"),
- new DeserializingResponseHandler(
- GetDashboardsResponse.class),
- HttpStatus.SC_OK);
- }
-
- public GetDashboardResponse getDashboard(
- ConnectionConfig connection,
- GetDashboardRequest getDashboardRequest) {
-
- String uri = UrlParameters.DASHBOARDS_SERVICE +
- "/" + getDashboardRequest.getId();
- return httpUtils.get(
- connection,
- uri,
- getDashboardRequest,
- HttpUtils.toRequestHeaders(
- "Accept", "application/json"),
- new DeserializingResponseHandler(
- GetDashboardResponse.class),
- HttpStatus.SC_OK);
- }
-
- public GetDashboardDataResponse getDashboardData(
- ConnectionConfig connection,
- GetDashboardDataRequest getDashboardDataRequest) {
-
- String uri = UrlParameters.DASHBOARDS_SERVICE +
- "/" + getDashboardDataRequest.getId() +
- "/" + UrlParameters.DASHBOARDS_SERVICE_DATA;
- return httpUtils.get(
- connection,
- uri,
- getDashboardDataRequest,
- HttpUtils.toRequestHeaders(
- "Accept", "application/json"),
- new DeserializingResponseHandler(
- GetDashboardDataResponse.class),
- HttpStatus.SC_OK);
- }
-}
diff --git a/src/main/java/com/sumologic/client/dashboard/DashboardExample.java b/src/main/java/com/sumologic/client/dashboard/DashboardExample.java
deleted file mode 100644
index 0a5b7e7..0000000
--- a/src/main/java/com/sumologic/client/dashboard/DashboardExample.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.dashboard;
-
-import com.sumologic.client.Credentials;
-import com.sumologic.client.SumoLogicClient;
-import com.sumologic.client.dashboard.model.*;
-import com.sumologic.client.searchjob.model.SearchJobField;
-import com.sumologic.client.searchjob.model.SearchJobRecord;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class DashboardExample {
-
- public static void main(String[] args) throws Exception {
-
-// String url = "http://localhost:23667";
-// String url = "https://long-api.sumologic.net";
- String url = "https://api.sumologic.com";
-
- String accessId = read("AccessId");
- String accessKey = read("AccessKey");
-
- Credentials credential = new Credentials(accessId, accessKey);
- SumoLogicClient sumoClient = new SumoLogicClient(credential);
- sumoClient.setURL(url);
-
- GetDashboardsResponse getDashboardsResponse = sumoClient.getDashboards(true);
- System.out.println();
- for (Dashboard dashboard : getDashboardsResponse.getDashboards()) {
- String title = String.format("Dashboard: %s (%d)", dashboard.getTitle(), dashboard.getId());
- System.out.println(title);
- printCharacter('=', title.length());
- System.out.println();
- GetDashboardDataResponse getDashboardDataResponse =
- sumoClient.getDashboardData(dashboard.getId());
- Map dashboardMonitorDataById = new HashMap();
- for (DashboardMonitorData data : getDashboardDataResponse.getDashboardMonitorDatas()) {
- dashboardMonitorDataById.put(data.getId(), data);
- }
- for (DashboardMonitor dashboardMonitor : dashboard.getDashboardMonitors()) {
- DashboardMonitorData dashboardMonitorData = dashboardMonitorDataById.get(dashboardMonitor.getId());
- title = String.format("Monitor: %s (%d)", dashboardMonitor.getTitle(), dashboardMonitor.getId());
- System.out.println();
- System.out.println(title);
- printCharacter('-', title.length());
- System.out.println();
- System.out.println();
- printTableData(dashboardMonitorData);
- }
- System.out.printf("\n\n");
- }
- }
-
- private static void printTableData(DashboardMonitorData dashboardMonitorData) {
-
- List fields = dashboardMonitorData.getFields();
- List records = dashboardMonitorData.getRecords();
- int[] maxColumnSize = new int[fields.size()];
- for (int i = 0; i < fields.size(); i++) {
- SearchJobField field = fields.get(i);
- maxColumnSize[i] = Math.max(maxColumnSize[i], field.getName().length());
- for (SearchJobRecord record : records) {
- Map recordMap = record.getMap();
- String fieldName = cleanString(field.getName());
- if (recordMap.containsKey(fieldName)) {
- maxColumnSize[i] = Math.max(maxColumnSize[i], recordMap.get(fieldName).length());
- }
- }
- }
-
- printTableSeparator(fields, maxColumnSize);
-
- System.out.print("| ");
- for (int i = 0; i < fields.size(); i++) {
- String formatString = "%-" + maxColumnSize[i] + "s | ";
- String value = cleanString(fields.get(i).getName());
- System.out.printf(formatString, value);
- }
- System.out.println();
-
- printTableSeparator(fields, maxColumnSize);
-
- for (int i = 0; i < records.size(); i++) {
- Map recordMap = records.get(i).getMap();
- System.out.print("| ");
- for (int j = 0; j < fields.size(); j++) {
- String alignment = "%-";
- if (fields.get(j).getFieldType().equals("long") ||
- fields.get(j).getFieldType().equals("int")) {
- alignment = "%";
- }
- String formatString = alignment + maxColumnSize[j] + "s | ";
- String fieldName = fields.get(j).getName();
- String value = " ";
- if (recordMap.containsKey(fieldName)) {
- value = cleanString(recordMap.get(fieldName));
- }
- System.out.printf(formatString, value);
- }
- System.out.println();
- }
-
- printTableSeparator(fields, maxColumnSize);
- }
-
- private static void printCharacter(char c, int count) {
- for (int i = 0; i < count; i++) {
- System.out.print(c);
- }
- }
-
- private static String cleanString(String in) {
- return in.replace("\n", "\\n");
- }
-
- private static void printTableSeparator(List fields, int[] maxColumnSize) {
- System.out.print("+-");
- for (int i = 0; i < fields.size(); i++) {
- for (int j = 0; j < maxColumnSize[i]; j++) {
- System.out.print("-");
- }
- System.out.print("-+");
- if (i < fields.size() - 1) {
- System.out.print("-");
- }
- }
- System.out.println();
- }
-
- /**
- * A simple method to prompt the user for input, and return the entered input.
- *
- * @param prompt The prompt.
- * @return The user input.
- */
- private static String read(String prompt) {
- System.out.print(prompt + ": ");
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- try {
- return br.readLine();
- } catch (IOException ioe) {
- System.out.println("IO error trying to read your name!");
- System.exit(1);
- return null;
- }
- }
-}
-
-
diff --git a/src/main/java/com/sumologic/client/dashboard/model/Dashboard.java b/src/main/java/com/sumologic/client/dashboard/model/Dashboard.java
deleted file mode 100644
index ac459bf..0000000
--- a/src/main/java/com/sumologic/client/dashboard/model/Dashboard.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.dashboard.model;
-
-import java.util.List;
-
-public class Dashboard {
-
- private long id;
- private String title;
- private String description;
- private List dashboardMonitors;
- private String properties;
-
- public long getId() {
- return id;
- }
-
- public void setId(long id) {
- this.id = id;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public List getDashboardMonitors() {
- return dashboardMonitors;
- }
-
- public void setDashboardMonitors(List dashboardMonitors) {
- this.dashboardMonitors = dashboardMonitors;
- }
-
- public String getProperties() {
- return properties;
- }
-
- public void setProperties(String properties) {
- this.properties = properties;
- }
-}
diff --git a/src/main/java/com/sumologic/client/dashboard/model/DashboardMonitor.java b/src/main/java/com/sumologic/client/dashboard/model/DashboardMonitor.java
deleted file mode 100644
index 93226a8..0000000
--- a/src/main/java/com/sumologic/client/dashboard/model/DashboardMonitor.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.dashboard.model;
-
-public class DashboardMonitor {
-
- private long id;
- private long dashboardId;
- private String queryId;
- private String title;
- private String viewerType;
- private int detailLevel;
- private String queryString;
- private String timeRange;
- private long savedSearchId;
- private int x;
- private int y;
- private int width;
- private int height;
- private String properties;
- private boolean isDisabled;
-
- public long getId() {
- return id;
- }
-
- public void setId(long id) {
- this.id = id;
- }
-
- public long getDashboardId() {
- return dashboardId;
- }
-
- public void setDashboardId(long dashboardId) {
- this.dashboardId = dashboardId;
- }
-
- public String getQueryId() {
- return queryId;
- }
-
- public void setQueryId(String queryId) {
- this.queryId = queryId;
- }
-
- public String getTitle() {
- return title;
- }
-
- public void setTitle(String title) {
- this.title = title;
- }
-
- public String getViewerType() {
- return viewerType;
- }
-
- public void setViewerType(String viewerType) {
- this.viewerType = viewerType;
- }
-
- public int getDetailLevel() {
- return detailLevel;
- }
-
- public void setDetailLevel(int detailLevel) {
- this.detailLevel = detailLevel;
- }
-
- public String getQueryString() {
- return queryString;
- }
-
- public void setQueryString(String queryString) {
- this.queryString = queryString;
- }
-
- public String getTimeRange() {
- return timeRange;
- }
-
- public void setTimeRange(String timeRange) {
- this.timeRange = timeRange;
- }
-
- public long getSavedSearchId() {
- return savedSearchId;
- }
-
- public void setSavedSearchId(long savedSearchId) {
- this.savedSearchId = savedSearchId;
- }
-
- public int getX() {
- return x;
- }
-
- public void setX(int x) {
- this.x = x;
- }
-
- public int getY() {
- return y;
- }
-
- public void setY(int y) {
- this.y = y;
- }
-
- public int getWidth() {
- return width;
- }
-
- public void setWidth(int width) {
- this.width = width;
- }
-
- public int getHeight() {
- return height;
- }
-
- public void setHeight(int height) {
- this.height = height;
- }
-
- public String getProperties() {
- return properties;
- }
-
- public void setProperties(String properties) {
- this.properties = properties;
- }
-
- public boolean isDisabled() {
- return isDisabled;
- }
-
- public void setDisabled(boolean disabled) {
- isDisabled = disabled;
- }
-}
diff --git a/src/main/java/com/sumologic/client/dashboard/model/DashboardMonitorData.java b/src/main/java/com/sumologic/client/dashboard/model/DashboardMonitorData.java
deleted file mode 100644
index 4e1482f..0000000
--- a/src/main/java/com/sumologic/client/dashboard/model/DashboardMonitorData.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.dashboard.model;
-
-import com.sumologic.client.searchjob.model.SearchJobField;
-import com.sumologic.client.searchjob.model.SearchJobRecord;
-
-import java.util.List;
-
-public class DashboardMonitorData {
-
- private long id;
- private List fields;
- private List records;
- private ResolvedTimeRange resolvedTimeRange;
- private boolean isRecentlyStarted;
- private long queryStartTime;
- private boolean lastUpdated;
- private List warnings;
-
- public long getId() {
- return id;
- }
-
- public void setId(long id) {
- this.id = id;
- }
-
- public List getFields() {
- return fields;
- }
-
- public void setFields(List fields) {
- this.fields = fields;
- }
-
- public List getRecords() {
- return records;
- }
-
- public void setRecords(List records) {
- this.records = records;
- }
-
- public ResolvedTimeRange getResolvedTimeRange() {
- return resolvedTimeRange;
- }
-
- public void setResolvedTimeRange(ResolvedTimeRange resolvedTimeRange) {
- this.resolvedTimeRange = resolvedTimeRange;
- }
-
- public boolean isRecentlyStarted() {
- return isRecentlyStarted;
- }
-
- public void setRecentlyStarted(boolean recentlyStarted) {
- isRecentlyStarted = recentlyStarted;
- }
-
- public long getQueryStartTime() {
- return queryStartTime;
- }
-
- public void setQueryStartTime(long queryStartTime) {
- this.queryStartTime = queryStartTime;
- }
-
- public boolean isLastUpdated() {
- return lastUpdated;
- }
-
- public void setLastUpdated(boolean lastUpdated) {
- this.lastUpdated = lastUpdated;
- }
-
- public List getWarnings() {
- return warnings;
- }
-
- public void setWarnings(List warnings) {
- this.warnings = warnings;
- }
-}
diff --git a/src/main/java/com/sumologic/client/dashboard/model/GetDashboardDataRequest.java b/src/main/java/com/sumologic/client/dashboard/model/GetDashboardDataRequest.java
deleted file mode 100644
index b2254b3..0000000
--- a/src/main/java/com/sumologic/client/dashboard/model/GetDashboardDataRequest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.dashboard.model;
-
-import com.sumologic.client.model.HttpGetRequest;
-import org.apache.http.NameValuePair;
-
-import java.util.Collections;
-import java.util.List;
-
-public final class GetDashboardDataRequest implements HttpGetRequest {
-
- private long id;
-
- /**
- * Creates a get dashboards request.
- *
- * @param id The ID of the dashboard.
- */
- public GetDashboardDataRequest(long id) {
- this.id = id;
- }
-
- /**
- * Gets the ID of the dashboard.
- *
- * @return The ID of the dashboard.
- */
- public long getId() {
- return id;
- }
-
- /**
- * Sets the ID of the dashboard.
- *
- * @param id The ID of the dashboard.
- */
- public void setId(long id) {
- this.id = id;
- }
-
- // HttpGetRequest implementation.
-
- @Override
- public List toUrlParams() {
- return Collections.emptyList();
- }
-}
diff --git a/src/main/java/com/sumologic/client/dashboard/model/GetDashboardDataResponse.java b/src/main/java/com/sumologic/client/dashboard/model/GetDashboardDataResponse.java
deleted file mode 100644
index 4d4d2df..0000000
--- a/src/main/java/com/sumologic/client/dashboard/model/GetDashboardDataResponse.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.dashboard.model;
-
-import java.util.List;
-
-public class GetDashboardDataResponse {
-
- private long id;
- private List dashboardMonitorDatas;
-
- public long getId() {
- return id;
- }
-
- public void setId(long id) {
- this.id = id;
- }
-
- public List getDashboardMonitorDatas() {
- return dashboardMonitorDatas;
- }
-
- public void setDashboardMonitorDatas(List dashboardMonitorDatas) {
- this.dashboardMonitorDatas = dashboardMonitorDatas;
- }
-}
diff --git a/src/main/java/com/sumologic/client/dashboard/model/GetDashboardRequest.java b/src/main/java/com/sumologic/client/dashboard/model/GetDashboardRequest.java
deleted file mode 100644
index 421e6d9..0000000
--- a/src/main/java/com/sumologic/client/dashboard/model/GetDashboardRequest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.dashboard.model;
-
-import com.sumologic.client.model.HttpGetRequest;
-import org.apache.http.NameValuePair;
-
-import java.util.Collections;
-import java.util.List;
-
-
-public final class GetDashboardRequest implements HttpGetRequest {
-
- private long id;
-
- /**
- * Creates a get dashboards request.
- *
- * @param id The ID of the dashboard.
- */
- public GetDashboardRequest(long id) {
- this.id = id;
- }
-
- /**
- * Gets the ID of the dashboard.
- *
- * @return The ID of the dashboard.
- */
- public long getId() {
- return id;
- }
-
- /**
- * Sets the ID of the dashboard.
- *
- * @param id The ID of the dashboard.
- */
- public void setId(long id) {
- this.id = id;
- }
-
- // HttpGetRequest implementation.
-
- @Override
- public List toUrlParams() {
- return Collections.emptyList();
- }
-}
diff --git a/src/main/java/com/sumologic/client/dashboard/model/GetDashboardResponse.java b/src/main/java/com/sumologic/client/dashboard/model/GetDashboardResponse.java
deleted file mode 100644
index 3ac17c8..0000000
--- a/src/main/java/com/sumologic/client/dashboard/model/GetDashboardResponse.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.dashboard.model;
-
-public class GetDashboardResponse {
-
- private long id;
- private Dashboard dashboard;
-
- public long getId() {
- return id;
- }
-
- public void setId(long id) {
- this.id = id;
- }
-
- public Dashboard getDashboard() {
- return dashboard;
- }
-
- public void setDashboard(Dashboard dashboard) {
- this.dashboard = dashboard;
- }
-}
diff --git a/src/main/java/com/sumologic/client/dashboard/model/GetDashboardsRequest.java b/src/main/java/com/sumologic/client/dashboard/model/GetDashboardsRequest.java
deleted file mode 100644
index 43096a7..0000000
--- a/src/main/java/com/sumologic/client/dashboard/model/GetDashboardsRequest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.dashboard.model;
-
-import com.sumologic.client.model.HttpGetRequest;
-import org.apache.http.NameValuePair;
-
-import java.util.Collections;
-import java.util.List;
-
-public final class GetDashboardsRequest implements HttpGetRequest {
-
- private boolean includeMonitors;
-
- /**
- * Creates a get dashboards request.
- *
- * @param includeMonitors Whether to include the monitors.
- */
- public GetDashboardsRequest(boolean includeMonitors) {
- this.includeMonitors = includeMonitors;
- }
-
- /**
- * Gets whether to include the monitors in the response.
- *
- * @return Whether to include the monitors in the response.
- */
- public boolean isIncludeMonitors() {
- return includeMonitors;
- }
-
- /**
- * Sets whether to include the monitors in the response.
- *
- * @param includeMonitors Whether to include the monitors in the response.
- */
- public void setIncludeMonitors(boolean includeMonitors) {
- this.includeMonitors = includeMonitors;
- }
-
- // HttpGetRequest implementation.
-
- @Override
- public List toUrlParams() {
- return Collections.emptyList();
- }
-}
diff --git a/src/main/java/com/sumologic/client/dashboard/model/GetDashboardsResponse.java b/src/main/java/com/sumologic/client/dashboard/model/GetDashboardsResponse.java
deleted file mode 100644
index 24aa01b..0000000
--- a/src/main/java/com/sumologic/client/dashboard/model/GetDashboardsResponse.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.dashboard.model;
-
-import java.util.List;
-
-public class GetDashboardsResponse {
-
- private List dashboards;
-
- public List getDashboards() {
- return dashboards;
- }
-
- public void setDashboards(List dashboards) {
- this.dashboards = dashboards;
- }
-}
diff --git a/src/main/java/com/sumologic/client/dashboard/model/ResolvedTimeRange.java b/src/main/java/com/sumologic/client/dashboard/model/ResolvedTimeRange.java
deleted file mode 100644
index d1d7bfe..0000000
--- a/src/main/java/com/sumologic/client/dashboard/model/ResolvedTimeRange.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.dashboard.model;
-
-public class ResolvedTimeRange {
-
- private long startMillis;
- private long endMillis;
-
- public long getStartMillis() {
- return startMillis;
- }
-
- public void setStartMillis(long startMillis) {
- this.startMillis = startMillis;
- }
-
- public long getEndMillis() {
- return endMillis;
- }
-
- public void setEndMillis(long endMillis) {
- this.endMillis = endMillis;
- }
-}
diff --git a/src/main/java/com/sumologic/client/model/HttpDeleteRequest.java b/src/main/java/com/sumologic/client/model/HttpDeleteRequest.java
deleted file mode 100644
index 430a5f1..0000000
--- a/src/main/java/com/sumologic/client/model/HttpDeleteRequest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.model;
-
-/**
- * Common interface for HTTP DELETE requests.
- */
-public interface HttpDeleteRequest {
-}
diff --git a/src/main/java/com/sumologic/client/model/HttpGetRequest.java b/src/main/java/com/sumologic/client/model/HttpGetRequest.java
deleted file mode 100644
index 06272af..0000000
--- a/src/main/java/com/sumologic/client/model/HttpGetRequest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.model;
-
-import org.apache.http.NameValuePair;
-
-import java.util.List;
-
-/**
- * Common interface for HTTP GET requests.
- */
-public interface HttpGetRequest {
-
- List toUrlParams();
-}
diff --git a/src/main/java/com/sumologic/client/model/HttpPostRequest.java b/src/main/java/com/sumologic/client/model/HttpPostRequest.java
deleted file mode 100644
index 9351372..0000000
--- a/src/main/java/com/sumologic/client/model/HttpPostRequest.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.model;
-
-/**
- * Common interface for HTTP POST requests.
- */
-public interface HttpPostRequest {
-}
diff --git a/src/main/java/com/sumologic/client/model/HttpPutRequest.java b/src/main/java/com/sumologic/client/model/HttpPutRequest.java
deleted file mode 100644
index a0cceca..0000000
--- a/src/main/java/com/sumologic/client/model/HttpPutRequest.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.model;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-/**
- * Common interface for HTTP PUT requests.
- */
-public interface HttpPutRequest {
-
- @JsonIgnore
- public String getETag();
-}
diff --git a/src/main/java/com/sumologic/client/model/LogMessage.java b/src/main/java/com/sumologic/client/model/LogMessage.java
deleted file mode 100644
index eb209ce..0000000
--- a/src/main/java/com/sumologic/client/model/LogMessage.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.model;
-
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.sumologic.client.UrlParameters;
-
-import java.util.*;
-
-/**
- * This class represents a sumo logic log message which is basically
- * a map of keys and values of type string.
- */
-public class LogMessage {
-
- private Map properties = new HashMap();
-
- @JsonAnyGetter
- public Map getProperties() {
- return properties;
- }
-
- @JsonAnySetter
- public void setProperty(String name, String value) {
- properties.put(name, value);
- }
-
- /**
- * Returns the names of the fields.
- *
- * @return A set of field names.
- */
- public final Set getFieldNames() {
- return Collections.unmodifiableSet(properties.keySet());
- }
-
- /**
- * Returns a text field to the given key
- *
- * @param key The key of the field
- * @return A string
- */
- public final String stringField(String key) {
- return properties.get(key);
- }
-
- /**
- * Returns a long number field to the given key
- *
- * @param key The key of the field
- * @return A long number
- * @throws NumberFormatException Thrown, if field does not contain a long number.
- */
- public final long longField(String key) throws NumberFormatException {
- return Long.parseLong(properties.get(key));
- }
-
- /**
- * Returns a double number field to the given key
- *
- * @param key The key of the field
- * @return A double
- * @throws NumberFormatException Thrown, if field does not contain a double.
- */
- public final double doubleField(String key) throws NumberFormatException {
- return Double.parseDouble(properties.get(key));
- }
-
- /**
- * Returns a Date object by interpreting the field to the given key
- * interpreted as UTC long time
- *
- * @param key The key of the field
- * @return A date object
- * @throws NumberFormatException Thrown, if field does not contain a long number.
- */
- public final Date dateField(String key) throws NumberFormatException {
- return new Date(longField(key));
- }
-
- /**
- * Returns the raw log line human-readable string.
- *
- * @return The raw log line human-readable string.
- */
- public final String getLogLine() {
- return stringField(UrlParameters.LOG_MESSAGE_RAW);
- }
-
-
- /**
- * Returns the log message time
- *
- * @return The log message time
- */
- public final Date getTime() {
- return dateField(UrlParameters.LOG_MESSAGE_TIME);
- }
-
- /**
- * Returns the log message receipt time
- *
- * @return The log message receipt time
- */
- public final Date getReceiptTime() {
- return dateField(UrlParameters.LOG_MESSAGE_RECEIPT_TIME);
- }
-
- /**
- * Returns the log message source host
- *
- * @return The log message source host
- */
- public final String getSourceHost() {
- return stringField(UrlParameters.LOG_MESSAGE_SOURCE_HOST);
- }
-
-
- /**
- * Returns the log message source category
- *
- * @return The log message source category
- */
- public final String getSourceCategory() {
- return stringField(UrlParameters.LOG_MESSAGE_SOURCE_CATEGORY);
- }
-
- /**
- * Returns the log message source name
- *
- * @return The log message source name
- */
- public final String getSourceName() {
- return stringField(UrlParameters.LOG_MESSAGE_SOURCE_NAME);
- }
-
- /**
- * Returns log message line count when results are aggregated.
- *
- * @return log message line count when results are aggregated.
- */
- public final long getLineCount() {
- return longField(UrlParameters.LOG_MESSAGE_COUNT);
- }
-
- /**
- * Returns the log message signature
- *
- * @return The log message signature
- */
- public final String getSignature() {
- return stringField(UrlParameters.LOG_MESSAGE_SIGNATURE);
- }
-
- /**
- * Returns the map of properties.
- * This is needed to support the search job API.
- *
- * @return The map of properties.
- */
- public Map getMap() {
- return properties;
- }
-
- /**
- * Sets the map of properties.
- * This is needed to support the search job API.
- *
- * @param map The map of properties.
- */
- public void setMap(Map map) {
- this.properties = map;
- }
-
- /**
- * Returns the raw text log line.
- *
- * @return The raw text log line.
- */
- @Override
- public String toString() {
- return getLogLine();
- }
-}
diff --git a/src/main/java/com/sumologic/client/model/SumoEntity.java b/src/main/java/com/sumologic/client/model/SumoEntity.java
deleted file mode 100644
index bbd4145..0000000
--- a/src/main/java/com/sumologic/client/model/SumoEntity.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.model;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-
-public abstract class SumoEntity {
-
- private String eTag;
-
- /**
- * Gets the ETag.
- *
- * @return The ETag.
- */
- @JsonIgnore
- public String getETag() {
- return eTag;
- }
-
- /**
- * Sets the ETag. Used for optimistic locking; if an invalid ETag is provided, update
- * operations will fail, so only modify this if you know what you're doing.
- */
- public void setETag(String eTag) {
- this.eTag = eTag;
- }
-}
diff --git a/src/main/java/com/sumologic/client/model/SumoEntityResponse.java b/src/main/java/com/sumologic/client/model/SumoEntityResponse.java
deleted file mode 100644
index d539db2..0000000
--- a/src/main/java/com/sumologic/client/model/SumoEntityResponse.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.model;
-
-public abstract class SumoEntityResponse {
-
- protected abstract SumoEntity getEntity();
-
- public void setETag(String eTag) {
- getEntity().setETag(eTag);
- }
-}
diff --git a/src/main/java/com/sumologic/client/searchjob/SearchJobClient.java b/src/main/java/com/sumologic/client/searchjob/SearchJobClient.java
deleted file mode 100644
index 1450cba..0000000
--- a/src/main/java/com/sumologic/client/searchjob/SearchJobClient.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.searchjob;
-
-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;
-import org.apache.http.HttpStatus;
-
-/**
- * Client for the search jobs API.
- */
-public class SearchJobClient {
-
- 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);
- }
-}
diff --git a/src/main/java/com/sumologic/client/searchjob/SearchJobExample.java b/src/main/java/com/sumologic/client/searchjob/SearchJobExample.java
deleted file mode 100644
index 4dc0e73..0000000
--- a/src/main/java/com/sumologic/client/searchjob/SearchJobExample.java
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.searchjob;
-
-import com.sumologic.client.Credentials;
-import com.sumologic.client.SumoLogicClient;
-import com.sumologic.client.model.LogMessage;
-import com.sumologic.client.searchjob.model.GetMessagesForSearchJobResponse;
-import com.sumologic.client.searchjob.model.GetSearchJobStatusResponse;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.List;
-
-
-/**
- * A simple example showing the basic usage pattern for interacting with the Sumo Logic search job API. This API models
- * closely the asynchronous, interactive nature of search evaluation in the Sumo Logic service. When a search job is
- * being created, a process in the Sumo Logic service will start to process the query. While making process in
- * continuing to process the query, a basic status is exposed via the API which can be polled. The status includes a
- * current state for the search job, how many messages have so far been found, how many records have been produced in
- * case the query contains an aggregation operator, as as any pending warning and errors. Finally, the status also
- * includes any new histogram buckets that have been generated since the last time the status has been polled.
- *
- * As soon as the status indicates more than one message, or more than one record, messages and records, respectively
- * can be requested using a simple paging API. Finally, a search job can and should be cancelled when not used anymore.
- */
-public class SearchJobExample {
-
-
- public static void main(String[] args) throws Exception {
-
- // The API URL should always point to
- //
- // https://api.sumologic.com
- //
- // unless you are developing on the Sumo
- // service itself, in which case
- //
- // http://localhost:23667
- //
- // is a good choice as well.
- String url = "http://localhost:23667";
-// String url = "https://api.sumologic.com";
-// String url = "https://long-api.sumologic.net";
-
- // Read the accessId and the accessKey from
- // the commandline so we don't have to
- // hard-code credentials in this example.
- String accessId = read("AccessId");
- String accessKey = read("AccessKey");
-
- // With url, accessId, and accessKey in hand,
- // we can now construct a Suno Logic API
- // client instance.
- Credentials credential = new Credentials(accessId, accessKey);
- SumoLogicClient sumoClient = new SumoLogicClient(credential);
- sumoClient.setURL(url);
-
- // There's some options in creating a search
- // job. But on the high level, we need to
- // specify a query, a time range, and a
- // time zone.
- String searchJobId = sumoClient.createSearchJob(
- "* | count _sourceHost", // This query will return all messages
- "2013-03-10T13:10:00", // between this start time and
- "2013-03-10T13:11:00", // this end time, specified in ISO 8601 format
- "america/los_angeles", // and assuming we are in California.
- "false"); // use message time by default
-
- // Note - above we are specifying the time
- // range using the ISO 8601 timestamp format.
- // We could alternative also use millisecond
- // values, like so (dynamically compute the
- // time range to cover the last 24 hours):
- //
- // long endTimestamp = System.currentTimeMillis();
- // long startTimestamp = endTimestamp - 24 * 60 * 60 * 1000;
- // String searchJobId = sumoClient.createSearchJob(
- // "| count _sourceCategory",
- // Long.toString(startTimestamp),
- // Long.toString(endTimestamp),
- // "UTC");
-
- // If successful, we will have gotten back
- // a search job ID. We will use this ID to
- // track the process of the search job.
- System.out.printf("Search job ID: '%s'\n", searchJobId);
-
- try {
-
- // The following block shows how to poll
- // the Sumo Logic service for updates on
- // the status of the search job. Once a
- // search job has been started, it will
- // run to completion in the Sumo Logic
- // service, during which time we can get
- // status updates, counts of messages and
- // records produced so far, and we can
- // actually already start getting messages
- // and records that have already been
- // produced.
- int messageCount = 0;
- int recordCount = 0;
- GetSearchJobStatusResponse getSearchJobStatusResponse = null;
-
- // We will loop until the search job status
- // is either "DONE GATHERING RESULTS" or
- // "CANCELLED".
- while (getSearchJobStatusResponse == null ||
- (!getSearchJobStatusResponse.getState().equals("DONE GATHERING RESULTS") &&
- !getSearchJobStatusResponse.getState().equals("CANCELLED"))) {
-
- // Sleep for a little bit, so we don't hammer
- // the Sumo Logic service.
- Thread.sleep(5000);
-
- // Get the latest search job status.
- getSearchJobStatusResponse = sumoClient.getSearchJobStatus(searchJobId);
-
- // Extract the message and record counts for
- // using them later down the road.
- messageCount = getSearchJobStatusResponse.getMessageCount();
- recordCount = getSearchJobStatusResponse.getRecordCount();
-
- // Tell the user what's going on. Class
- // GetSearchJobStatusResponse has a nice toString()
- // implementation that will show the status and
- // the message and record counts.
- System.out.printf(
- "Search job ID: '%s', %s\n",
- searchJobId,
- getSearchJobStatusResponse);
- }
-
- // If the last search job status indicated
- // that the search job was "CANCELLED", we
- // can't get messages or records.
- if (getSearchJobStatusResponse.getState().equals("CANCELLED")) {
- System.out.println("Ugh. Search job was cancelled. Exiting...");
- return;
- }
-
- // Now we can get some messages. We know
- // from polling the search job status that
- // the search job is "DONE GATHERING RESULTS".
- // We don't necessarily have to wait until
- // that time, but to keep this example simple,
- // we will only get the messages produced by
- // the search job once it is actually done.
- // So let's get the first 10 messages.
- int messageOffset = 0;
- int messageLength = Math.min(messageCount, 10);
- GetMessagesForSearchJobResponse getMessagesForSearchJobResponse =
- sumoClient.getMessagesForSearchJob(searchJobId, messageOffset, messageLength);
- System.out.printf(
- "Messages for search job ID: '%s', %s\n",
- searchJobId,
- getMessagesForSearchJobResponse);
-
- // And now we print a summary of each of the
- // messages we got returned. Notice how class
- // LogMessage has accessors for the most common
- // fields, including the raw log line.
- List messages = getMessagesForSearchJobResponse.getMessages();
- for (LogMessage message : messages) {
- System.out.printf(" %s, %s, %s, %s, %s\n",
- message.getTime(),
- message.getSourceHost(),
- message.getSourceName(),
- message.getSourceCategory(),
- message.getLogLine());
- }
-
- // A search job can, depending on the query,
- // return not just messages, but also records.
- // Messages are the raw log lines collected,
- // with some additional meta data, such as the
- // parsed timestamps, and so forth.
- //
- // If the query also included an aggregation
- // operator, for example if the query is
- //
- // * | count by _sourceCategory
- //
- // then the search job result will also include
- // a number of records. The records represent
- // the aggregated result, or in other words,
- // in this case, the number of times each
- // _sourceCategory has appeared across all the
- // messages in the time range. Records are
- // basically a table, much like what we would
- // expect to have returned from a SQL database.
- // Records can be accessed in pretty much the
- // same way as messages:
- //
- // int recordOffset = 0;
- // int recordLength = Math.min(recordCount, 10);
- // GetRecordsForSearchJobResponse getRecordsForSearchJobResponse =
- // sumoClient.getRecordsForSearchJob(searchJobId, recordOffset, recordLength);
- // System.out.printf(
- // "Records for search job ID: '%s', %s\n",
- // searchJobId,
- // getRecordsForSearchJobResponse);
- // List records = getRecordsForSearchJobResponse.getRecords();
- // for (SearchJobRecord record : records) {
- // System.out.printf(" %s, %d\n",
- // record.stringField("_sourcecategory"),
- // record.intField("_count"));
- // }
-
- } catch (Throwable t) {
-
- // Yikes. We has an error.
- t.printStackTrace();
-
- } finally {
-
- try {
-
- // We are done, so let's cancel the
- // search job. Note that it will otherwise
- // hang around the Sumo Logic service
- // until some session timeout kicks in.
- // Proactively cancelling a search job
- // when we are done with it proves that we
- // are a good citizen.
- sumoClient.cancelSearchJob(searchJobId);
-
- } catch (Throwable t) {
- System.out.printf("Error cancelling search job: '%s'", t.getMessage());
- t.printStackTrace();
- }
- }
- }
-
- /**
- * A simple method to prompt the user for input, and return the entered input.
- *
- * @param prompt The prompt.
- * @return The user input.
- */
- private static String read(String prompt) {
- System.out.print(prompt + ": ");
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- try {
- return br.readLine();
- } catch (IOException ioe) {
- System.out.println("IO error trying to read your name!");
- System.exit(1);
- return null;
- }
- }
-}
-
-
diff --git a/src/main/java/com/sumologic/client/searchjob/SearchJobResultDumper.java b/src/main/java/com/sumologic/client/searchjob/SearchJobResultDumper.java
deleted file mode 100644
index 8bb63e0..0000000
--- a/src/main/java/com/sumologic/client/searchjob/SearchJobResultDumper.java
+++ /dev/null
@@ -1,907 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.searchjob;
-
-import au.com.bytecode.opencsv.CSVWriter;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.sumologic.client.Credentials;
-import com.sumologic.client.SumoLogicClient;
-import com.sumologic.client.model.LogMessage;
-import com.sumologic.client.searchjob.model.GetMessagesForSearchJobResponse;
-import com.sumologic.client.searchjob.model.GetRecordsForSearchJobResponse;
-import com.sumologic.client.searchjob.model.GetSearchJobStatusResponse;
-import com.sumologic.client.searchjob.model.SearchJobRecord;
-import org.apache.commons.cli.*;
-
-import java.io.*;
-import java.net.URL;
-import java.time.OffsetDateTime;
-import java.time.ZoneOffset;
-import java.time.format.DateTimeFormatter;
-import java.time.format.DateTimeFormatterBuilder;
-import java.time.temporal.ChronoField;
-import java.util.*;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * A small but useful tool that executes a search job and dumps the results to
- * the standard output. Based on the commandline arguments, the tool will either
- * dump the messages returned by the search job, or the records ("aggregates").
- * In order to reliably dump results for large time ranges, the tool can also
- * operate in incremental mode, splitting a large time range into multiple
- * queries each covering one or more day.
- */
-public class SearchJobResultDumper {
-
- enum OutputFormat {
- CSV,
- JSON
- }
-
- public static void main(String[] args) throws Exception {
-
- //
- // Get the commandline arguments.
- //
-
- // The URL of the Sumo Logic API endpoint. This will usually be
- // https://api.sumologic.com
- String url = null;
-
- // The credentials of the user for which to execute the query.
- String accessId = null;
- String accessKey = null;
-
- // The start timestamp and end timestamp for the search job.
- // This can either be an ISO8601 timestamp (without timezone),
- // or milliseconds since the epoch.
- String startTimestamp = null;
- String endTimestamp = null;
-
- // The timezone to interpret from and to in if given as ISO8601
- String timezone = null;
-
- String byReceiptTime = null;
-
- // In chunk mode, the number of hours to execute the search query in.
- long chunkIncrementMillis = -1;
-
- // The search query.
- String searchQuery = null;
-
- // The file containing the search query.
- String searchQueryFilename = null;
-
- // The output format.
- OutputFormat outputFormat = OutputFormat.CSV;
-
- // Whether to dump aggregates ("records") or not. By default
- // ("false"), the messages returned by the search job will be
- // dumped. Setting this to "true" will instead dump the records.
- boolean dumpAggregates = false;
-
- // The name of the file to which to write the end timestamp
- // of the last successful run.
- String lastEndFile = null;
-
- // How many times to retry if the query fails.
- int retry = 1;
-
- // Create the command line options.
- Options options = createOptions();
-
- try {
-
- // Parse the command line.
- CommandLineParser parser = new GnuParser();
- CommandLine commandLine = parser.parse(options, args);
-
- url = commandLine.getOptionValue("url");
- accessId = commandLine.getOptionValue("accessid");
- accessKey = commandLine.getOptionValue("accesskey");
-
- if (commandLine.hasOption("catchup")) {
-
- long thisHour =
- ((long) Math.floor(System.currentTimeMillis() / 60 / 60 / 1000d))
- * (60 * 60 * 1000L);
- endTimestamp = Long.toString(thisHour);
- timezone = "UTC";
-
- if (commandLine.hasOption("catchup-file")) {
-
- String catchupFile = commandLine.getOptionValue("catchup-file");
- try {
-
- // Read the timestamp from the file.
- startTimestamp = readTimestampFromFile(catchupFile);
-
- } catch (IOException ioe) {
- if (!commandLine.hasOption("ignore-missing-catchup-file")) {
- throw new ParseException(String.format(
- "Error reading catchup file: '%s' ('%s')", catchupFile, ioe.getMessage()));
- } else {
- System.err.printf(
- "Ignoring missing catchup file: '%s' ('%s')\n", catchupFile, ioe.getMessage());
- }
- }
- }
-
- if (startTimestamp == null) {
-
- // Figure out the catch-up time range.
- Long catchupHours = Long.parseLong(commandLine.getOptionValue("catchup"));
- startTimestamp = Long.toString(thisHour - (catchupHours * 60 * 60 * 1000L));
- }
-
- } else {
-
- if (!commandLine.hasOption("from")) {
- throw new ParseException("-f/--from required if -c/--catchup is omitted");
- }
- startTimestamp = commandLine.getOptionValue("from");
-
- if (!commandLine.hasOption("to")) {
- throw new ParseException("-t/--to required if -c/--catchup is omitted");
- }
- endTimestamp = commandLine.getOptionValue("to");
-
- if (!commandLine.hasOption("tz")) {
- throw new ParseException("-tz/--timezone required if -c/--catchup is omitted");
- }
- timezone = commandLine.getOptionValue("timezone");
- }
-
- if (commandLine.hasOption("hours") && commandLine.hasOption("minutes")) {
- throw new ParseException("Please specify only one of --hours and --minutes");
- }
-
- if (commandLine.hasOption("hours")) {
- chunkIncrementMillis =
- 1000L * 60 * 60 * Long.parseLong(commandLine.getOptionValue("hours"));
- }
- if (commandLine.hasOption("minutes")) {
- chunkIncrementMillis =
- 1000L * 60 * Long.parseLong(commandLine.getOptionValue("minutes"));
- }
-
- if (commandLine.hasOption("byReceiptTime")) {
- byReceiptTime = commandLine.getOptionValue("byReceiptTime");
- }
-
- searchQuery = commandLine.getOptionValue("query");
- searchQueryFilename = commandLine.getOptionValue("file");
- if (commandLine.hasOption("json")) {
- outputFormat = OutputFormat.JSON;
- }
- if (commandLine.hasOption("aggregates")) {
- dumpAggregates = true;
- }
-
- if (searchQuery == null && searchQueryFilename == null) {
- throw new ParseException("Either -q/--query or --file needs to be specified");
- }
-
- if (commandLine.hasOption("last-end-file")) {
- lastEndFile = commandLine.getOptionValue("last-end-file");
- }
-
- if (commandLine.hasOption("retry")) {
- String retryValue = commandLine.getOptionValue("retry");
- retry = Integer.parseInt(retryValue);
- }
-
- } catch (ParseException exp) {
- System.err.println(exp.getMessage());
-
- HelpFormatter formatter = new HelpFormatter();
- formatter.printHelp("SearchJobResultsDumper", options);
- System.exit(1);
- }
-
-
- // Create the Sumo client.
- Credentials credential = new Credentials(accessId, accessKey);
- SumoLogicClient sumoClient = new SumoLogicClient(credential);
- sumoClient.setURL(url);
-
- // Is the search query a reference to a file?
- if (searchQuery == null && searchQueryFilename != null) {
- searchQuery = readQueryStringFromFile(searchQueryFilename);
- }
-
- // Translate the timestamps, if necessary from ISO8601.
- long startMillis = getMillis(startTimestamp, timezone);
- long endMillis = getMillis(endTimestamp, timezone);
-
- // Figure out whether the time range should be covered in a
- // single search job, or if there's an argument telling us
- // to incrementally query in chunks of as many hours as
- // defined by the argument. This last argument is optional.
- long chunkIncrementMillisToUse = endMillis - startMillis;
- if (chunkIncrementMillis != -1) {
- chunkIncrementMillisToUse = chunkIncrementMillis;
- }
-
- //
- // Main execution.
- //
-
- // When dumping aggregates/records, we need a CSV writer.
- CSVWriter csvWriter = null;
- AtomicBoolean headerWritten = new AtomicBoolean(false);
- csvWriter = new CSVWriter(new OutputStreamWriter(System.out));
-
- // For JSON output, we need an object mapper.
- ObjectMapper objectMapper = new ObjectMapper();
-
- long overallStartTimestamp = System.currentTimeMillis();
- boolean failure = false;
- try {
-
- do {
-
- // Figure out the start and end milliseconds since the epoch
- // for the next incremental chunk. If no chunk size was
- // specified, the first chunk is simply the difference
- // between the end timestamp and the start timestamp.
- long chunkStartMillis = startMillis;
- long chunkEndMillis = startMillis + chunkIncrementMillisToUse;
-
- // The chunk end milliseconds since the epoch should never
- // be further than the actual specified end timestamp.
- chunkEndMillis = Math.min(chunkEndMillis, endMillis);
-
- // Now we are ready to execute the search job.
- long executionStartMillis = System.currentTimeMillis();
- String prefix = String.format("Chunk from: '%s' to: '%s'",
- new Date(chunkStartMillis), new Date(chunkEndMillis));
- System.err.printf("--> %s\n", prefix);
- failure = executeSearchJobWithRetry(
- csvWriter,
- headerWritten,
- objectMapper,
- outputFormat,
- prefix,
- sumoClient,
- searchQuery,
- dumpAggregates,
- "" + chunkStartMillis,
- "" + chunkEndMillis,
- timezone,
- retry,
- lastEndFile,
- byReceiptTime);
- if (failure) {
- break;
- }
-
- long elapsed = System.currentTimeMillis() - executionStartMillis;
- System.err.printf("-----> Done in millis: '%d'\n", elapsed);
-
- // Set the next start milliseconds since the epoch based
- // on the chunk increment.
- startMillis += chunkIncrementMillisToUse;
-
- } while (startMillis < endMillis);
-
- // We are done when the start milliseconds since the epoch
- // has incrementally reached or surpassed the specified
- // end timestamp.
-
- } finally {
-
- try {
-
- // Close the CSV writer, if any.
- csvWriter.close();
-
- } catch (IOException ioe) {
- System.err.printf("Error closing CSV writer: '%s'", ioe.getMessage());
- ioe.printStackTrace(System.err);
- }
- }
-
- // Red Rover Red Rover All Over.
- long overallElapsed = System.currentTimeMillis() - overallStartTimestamp;
- System.err.printf("======> Done overall in millis: '%d'\n", overallElapsed);
- if (failure) {
- System.err.println(
- "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
- System.err.println("Finished with errors");
- System.err.println(
- "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
- System.exit(1);
- }
- }
-
- private static Options createOptions() {
-
- Options options = new Options();
- options.addOption(
- OptionBuilder.withLongOpt("url")
- .withArgName("url")
- .withDescription("URL of the Sumo Logic API endpoint")
- .hasArg()
- .isRequired()
- .create("u"));
- options.addOption(
- OptionBuilder.withLongOpt("accessid")
- .withArgName("accessid")
- .withDescription("Access id of the user to login as")
- .hasArg()
- .isRequired()
- .create("i"));
- options.addOption(
- OptionBuilder.withLongOpt("accesskey")
- .withArgName("accesskey")
- .withDescription("Access key of the user to login as")
- .hasArg()
- .isRequired()
- .create("k"));
- options.addOption(
- OptionBuilder.withLongOpt("from")
- .withArgName("from")
- .withDescription("Start timestamp in ISO8601 format, or in milliseconds since the epoch")
- .hasArg()
- .create("f"));
- options.addOption(
- OptionBuilder.withLongOpt("to")
- .withArgName("to")
- .withDescription("End timestamp in ISO8601 format, or in milliseconds since the epoch")
- .hasArg()
- .create("t"));
- options.addOption(
- OptionBuilder.withLongOpt("timezone")
- .withArgName("timezone")
- .withDescription("The timezone to interpret from and to in")
- .hasArg()
- .create("tz"));
- options.addOption(
- OptionBuilder.withLongOpt("byReceiptTime")
- .withArgName("byReceiptTime")
- .withDescription("Search by receipt time instead of message time")
- .hasArg()
- .create("rt"));
- options.addOption(
- OptionBuilder.withLongOpt("hours")
- .withArgName("hours")
- .withDescription("The number of hours to chunk the search query")
- .hasArg()
- .create("h"));
- options.addOption(
- OptionBuilder.withLongOpt("minutes")
- .withArgName("minutes")
- .withDescription("The number of minutes to chunk the search query")
- .hasArg()
- .create("m"));
- options.addOption(
- OptionBuilder.withLongOpt("catchup")
- .withArgName("catchup")
- .withDescription("The number of hours to catchup")
- .hasArg()
- .create("c"));
- options.addOption(
- OptionBuilder.withLongOpt("catchup-file")
- .withArgName("catchup-file")
- .withDescription("The file containing the timestamp from which to catch up from")
- .hasArg()
- .create("cf"));
- options.addOption(
- OptionBuilder.withLongOpt("ignore-missing-catchup-file")
- .withArgName("ignore-missing-catchup-file")
- .withDescription("If the specified catchup file is missing, ignore and use the --catchup value")
- .create("imcf"));
- options.addOption(
- OptionBuilder.withLongOpt("query")
- .withArgName("query")
- .withDescription("The query to execute")
- .hasArg()
- .create("q"));
- options.addOption(
- OptionBuilder.withLongOpt("file")
- .withArgName("file")
- .withDescription("The file containing the query to execute")
- .hasArg()
- .create());
- options.addOption(
- OptionBuilder.withLongOpt("csv")
- .withArgName("csv")
- .withDescription("Format the output as CSV")
- .create());
- options.addOption(
- OptionBuilder.withLongOpt("aggregates")
- .withArgName("aggregates")
- .withDescription("Output the aggregate results, not the messages")
- .create());
- options.addOption(
- OptionBuilder.withLongOpt("json")
- .withArgName("json")
- .withDescription("Format the output as JSON")
- .create());
- options.addOption(
- OptionBuilder.withLongOpt("last-end-file")
- .withArgName("last-end-file")
- .withDescription("Name of the file to write the end timestamp of the last successful run")
- .hasArg()
- .create("le"));
- options.addOption(
- OptionBuilder.withLongOpt("retry")
- .withArgName("retry")
- .withDescription("Number of times to retry a query in case of an error")
- .hasArg()
- .create("r"));
- return options;
- }
-
- private static String readQueryStringFromFile(String fileName) throws IOException {
-
- InputStream is = null;
- if (fileName.startsWith("http")) {
- is = new URL(fileName).openStream();
- } else {
- is = new FileInputStream(fileName);
- }
- BufferedReader in = new BufferedReader(new InputStreamReader(is));
- String line = null;
- StringBuilder sb = new StringBuilder(1024);
- while ((line = in.readLine()) != null) {
- sb.append(line);
- }
- return sb.toString();
- }
-
- private static String readTimestampFromFile(String filename) throws IOException {
- BufferedReader reader =
- new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
- try {
- return reader.readLine();
- } finally {
- reader.close();
- }
- }
-
- private static boolean executeSearchJobWithRetry(CSVWriter csvWriter,
- AtomicBoolean headerWritten,
- ObjectMapper objectMapper,
- OutputFormat outputFormat,
- String prefix,
- SumoLogicClient sumoClient,
- String searchQuery,
- boolean dumpAggregates,
- String startTimestamp,
- String endTimestamp,
- String timeZone,
- int retry,
- String lastEndFile,
- String byReceiptTime) {
-
- int triesLeft = retry;
- int attempt = 1;
- boolean failure = true;
- while (triesLeft > 0 && failure) {
-
- // One less try...
- triesLeft--;
-
- // Execute the search.
- failure = executeSearch(csvWriter,
- headerWritten,
- objectMapper,
- outputFormat,
- prefix,
- sumoClient,
- searchQuery,
- dumpAggregates,
- startTimestamp,
- endTimestamp,
- timeZone,
- attempt,
- lastEndFile,
- byReceiptTime);
-
- if (failure) {
- System.err.println(String.format(
- "Got an error on attempt: '%d', tries left: '%d'", attempt, triesLeft));
- }
-
- // Increment attempt number...
- attempt++;
- }
-
- return failure;
- }
-
- private static boolean executeSearch(CSVWriter csvWriter,
- AtomicBoolean headerWritten,
- ObjectMapper objectMapper,
- OutputFormat outputFormat,
- String prefix,
- SumoLogicClient sumoClient,
- String searchQuery,
- boolean dumpAggregates,
- String startTimestamp,
- String endTimestamp,
- String timeZone,
- int attempt,
- String lastEndFile,
- String byReceiptTime) {
-
- // Create the search job.
- String searchJobId = sumoClient.createSearchJob(
- searchQuery,
- startTimestamp,
- endTimestamp,
- timeZone,
- byReceiptTime);
-
- System.err.printf("[%s] %s - Search job ID: '%s', attempt: '%d'\n",
- new Date(), prefix, searchJobId, attempt);
-
- try {
-
- int messageCount = 0;
- int recordCount = 0;
- int offset = 0;
- GetSearchJobStatusResponse getSearchJobStatusResponse = null;
- while (getSearchJobStatusResponse == null ||
- (!isDone(getSearchJobStatusResponse) &&
- !isCancelled(getSearchJobStatusResponse))) {
- long startMillis = System.currentTimeMillis();
-
- // Get the job status and the latest counts from the status.
- getSearchJobStatusResponse = sumoClient.getSearchJobStatus(searchJobId);
- if (isCancelled(getSearchJobStatusResponse)) {
- System.err.println("Ugh. Search job was cancelled. Exiting...");
- System.err.flush();
- System.exit(1);
- }
-
- // Get any pending warnings.
- List warnings = getSearchJobStatusResponse.getPendingWarnings();
- if (warnings != null && warnings.size() > 0) {
- System.err.println("WARNINGS:");
- for (String warning : warnings) {
- System.err.println(warning);
- }
- }
-
- // Get any pending errors.
- List errors = getSearchJobStatusResponse.getPendingErrors();
- if (errors != null && errors.size() > 0) {
- System.err.println("ERROR:");
- for (String error : errors) {
- System.err.println(error);
- }
- System.err.flush();
- return true;
- }
-
- messageCount = getSearchJobStatusResponse.getMessageCount();
- recordCount = getSearchJobStatusResponse.getRecordCount();
- System.err.printf(
- "[%s] %s - Search job ID: '%s', attempt: '%d', messages: '%d', records: '%d'\n",
- new Date(), prefix, searchJobId, attempt, messageCount, recordCount);
-
- // Catch up with the raw messages, unless we should just dump aggregates.
- if (!dumpAggregates) {
- offset = getMessages(
- csvWriter,
- headerWritten,
- objectMapper,
- outputFormat,
- prefix,
- sumoClient,
- searchJobId,
- offset,
- messageCount);
- }
-
- // Wait if necessary.
- long endMillis = System.currentTimeMillis();
- if (!isDone(getSearchJobStatusResponse)) {
- gracePeriod(prefix, searchJobId, startMillis, endMillis);
- }
- }
-
- // If we should dump the aggregate results rather than the raw messages,
- // we will do this here, after the search job has finished computing.
- if (dumpAggregates) {
- getRecords(
- csvWriter,
- headerWritten,
- objectMapper,
- outputFormat,
- prefix,
- sumoClient,
- searchJobId,
- 0,
- recordCount);
- }
-
- if (lastEndFile != null) {
-
- try {
-
- BufferedWriter writer =
- new BufferedWriter(new OutputStreamWriter(new FileOutputStream(lastEndFile)));
- writer.write(endTimestamp);
- writer.close();
-
- } catch (IOException ioe) {
-
- // Yikes. We has an error.
- System.err.printf("Uncaught exception: '%s'", ioe.getMessage());
- ioe.printStackTrace(System.err);
- System.err.flush();
- }
- }
-
- // No error.
- return false;
-
- } catch (Throwable t) {
-
- // Yikes. We has an error.
- System.err.printf("Uncaught exception: '%s'", t.getMessage());
- t.printStackTrace(System.err);
- System.err.flush();
-
- // Exit with error.
- return true;
-
- } finally {
-
- try {
- sumoClient.cancelSearchJob(searchJobId);
- } catch (Throwable t) {
- System.err.printf("Error cancelling search job: '%s'", t.getMessage());
- t.printStackTrace(System.err);
- System.err.flush();
- }
- }
- }
-
- private static int getMessages(CSVWriter csvWriter,
- AtomicBoolean headerWritten,
- ObjectMapper objectMapper,
- OutputFormat outputFormat,
- String prefix,
- SumoLogicClient sumoClient,
- String searchJobId,
- int messageOffset,
- int messageCount) {
-
- int messageLength = 0;
- while ((messageLength = messageCount - messageOffset) > 0) {
-
- // Did we print the headers already?
- if (outputFormat == OutputFormat.CSV) {
- if (!headerWritten.get()) {
-
- // Get the first record so we get the schema.
- GetMessagesForSearchJobResponse getMessagesForSearchJobResponse =
- sumoClient.getMessagesForSearchJob(searchJobId, 0, 1);
- List messages = getMessagesForSearchJobResponse.getMessages();
- List fieldNames = new ArrayList(messages.get(0).getFieldNames());
- Collections.sort(fieldNames);
- String[] headers = new String[fieldNames.size()];
- for (int i = 0; i < fieldNames.size(); i++) {
- String fieldName = fieldNames.get(i);
- headers[i] = fieldName;
- }
- csvWriter.writeNext(headers);
- headerWritten.set(true);
- }
- }
-
- messageLength = Math.min(messageLength, 1000);
- if (messageLength > 0) {
- System.err.printf(
- "[%s] %s - Search job ID: '%s', messages: '%s', getting offset: '%d', length: '%d'\n",
- new Date(), prefix, searchJobId, messageCount, messageOffset, messageLength);
- System.err.flush();
- GetMessagesForSearchJobResponse getMessagesForSearchJobResponse =
- sumoClient.getMessagesForSearchJob(
- searchJobId, messageOffset, messageLength);
- messageOffset += messageLength;
-
- try {
- List messages = getMessagesForSearchJobResponse.getMessages();
- for (LogMessage message : messages) {
- Map fields = message.getMap();
- List fieldNames = new ArrayList(message.getFieldNames());
- Collections.sort(fieldNames);
-
- // Write as CSV.
- if (outputFormat == OutputFormat.CSV) {
- String[] csv = new String[fields.size()];
- for (int i = 0; i < fieldNames.size(); i++) {
- String fieldName = fieldNames.get(i);
- String fieldValue = fields.get(fieldName);
- csv[i] = fieldValue;
- }
- csvWriter.writeNext(csv);
- }
-
- // Write as JSON.
- if (outputFormat == OutputFormat.JSON) {
- String json = objectMapper.writeValueAsString(fields);
- System.out.println(json);
- }
- }
- } catch (IOException ioe) {
- System.err.printf("Error writing JSON: '%s'", ioe.getMessage());
- ioe.printStackTrace(System.err);
- }
- }
- }
- return messageOffset;
- }
-
- private static int getRecords(CSVWriter csvWriter,
- AtomicBoolean headerWritten,
- ObjectMapper objectMapper,
- OutputFormat outputFormat,
- String prefix,
- SumoLogicClient sumoClient,
- String searchJobId,
- int recordOffset,
- int recordCount) {
-
- // Did we print the headers already?
- if (outputFormat == OutputFormat.CSV) {
- if (!headerWritten.get()) {
-
- // Get the first record so we get the schema.
- GetRecordsForSearchJobResponse getRecordsForSearchJobResponse =
- sumoClient.getRecordsForSearchJob(searchJobId, 0, 1);
- List records = getRecordsForSearchJobResponse.getRecords();
- List fieldNames = new ArrayList(records.get(0).getFieldNames());
- Collections.sort(fieldNames);
- String[] headers = new String[fieldNames.size()];
- for (int i = 0; i < fieldNames.size(); i++) {
- String fieldName = fieldNames.get(i);
- headers[i] = fieldName;
- }
- csvWriter.writeNext(headers);
- headerWritten.set(true);
- }
- }
-
- int recordLength = 0;
- while ((recordLength = recordCount - recordOffset) > 0) {
- recordLength = Math.min(recordLength, 1000);
- if (recordLength > 0) {
- System.err.printf(
- "[%s] %s - Search job ID: '%s', records: '%s', getting offset: '%d', length: '%d'\n",
- new Date(), prefix, searchJobId, recordCount, recordOffset, recordLength);
- System.err.flush();
- GetRecordsForSearchJobResponse getRecordsForSearchJobResponse =
- sumoClient.getRecordsForSearchJob(
- searchJobId, recordOffset, recordLength);
- recordOffset += recordLength;
- try {
- List records = getRecordsForSearchJobResponse.getRecords();
- for (SearchJobRecord record : records) {
- Map fields = record.getMap();
- List fieldNames = new ArrayList(record.getFieldNames());
- Collections.sort(fieldNames);
-
- // Write as CSV.
- if (outputFormat == OutputFormat.CSV) {
- String[] csv = new String[fields.size()];
- for (int i = 0; i < fieldNames.size(); i++) {
- String fieldName = fieldNames.get(i);
- String fieldValue = fields.get(fieldName);
- csv[i] = fieldValue;
- }
- csvWriter.writeNext(csv);
- }
-
- // Write as JSON.
- if (outputFormat == OutputFormat.JSON) {
- String json = objectMapper.writeValueAsString(fields);
- System.out.println(json);
- }
- }
-
- } catch (IOException ioe) {
- System.err.printf("Error writing JSON: '%s'", ioe.getMessage());
- ioe.printStackTrace(System.err);
- }
- }
- }
-
- // Flush the CSV writer.
- if (outputFormat == OutputFormat.CSV) {
- try {
- csvWriter.flush();
- } catch (IOException ioe) {
- System.err.printf("Error flushing CSV writer: '%s'", ioe.getMessage());
- ioe.printStackTrace(System.err);
- }
- }
-
- return recordOffset;
- }
-
- private static long getMillis(String timestamp, String timezone) {
- if (isLong(timestamp)) {
- return Long.parseLong(timestamp);
- } else {
- return iso8601toMillis(timestamp, timezone);
- }
- }
-
- private static boolean isLong(String s) {
- try {
- long dummy = Long.parseLong(s);
- return true;
- } catch (Throwable t) {
- return false;
- }
- }
-
- private static long iso8601toMillis(String timestamp, String timezone) {
- DateTimeFormatter formatter = new DateTimeFormatterBuilder()
- .parseCaseInsensitive()
- .append(DateTimeFormatter.ISO_LOCAL_DATE)
- .optionalStart()
- .appendLiteral('T')
- .append(DateTimeFormatter.ISO_TIME)
- .toFormatter();
-
- TimeZone tz = TimeZone.getTimeZone(timezone);
- int offset = tz.getRawOffset();
- if (tz.inDaylightTime(new Date())) {
- offset = offset + tz.getDSTSavings();
- }
- int offsetHours = offset / 1000 / 60 / 60;
- int offsetMinutes = offset / 1000 / 60 % 60;
- String timestampWithTimezone =
- String.format("%s%+03d:%02d", timestamp, offsetHours, offsetMinutes);
- return OffsetDateTime.parse(timestampWithTimezone, formatter).toInstant().toEpochMilli();
- }
-
- private static boolean isCancelled(GetSearchJobStatusResponse getSearchJobStatusResponse) {
- return getSearchJobStatusResponse.getState().equals("CANCELLED");
- }
-
- private static boolean isDone(GetSearchJobStatusResponse getSearchJobStatusResponse) {
- return getSearchJobStatusResponse.getState().equals("DONE GATHERING RESULTS");
- }
-
- private static void gracePeriod(String prefix,
- String searchJobId,
- long startMillis,
- long endMillis)
- throws InterruptedException {
- long maxWaitMillis = 5000;
- long delta = endMillis - startMillis;
- long waitMillis = Math.max(0, Math.min(maxWaitMillis - delta, maxWaitMillis));
- System.err.printf(
- "[%s] %s - Search job ID: '%s', sleeping for: '%d' milliseconds\n",
- new Date(), prefix, searchJobId, waitMillis);
- System.err.flush();
- Thread.sleep(waitMillis);
- }
-}
-
-
diff --git a/src/main/java/com/sumologic/client/searchjob/model/CancelSearchJobRequest.java b/src/main/java/com/sumologic/client/searchjob/model/CancelSearchJobRequest.java
deleted file mode 100644
index 726c287..0000000
--- a/src/main/java/com/sumologic/client/searchjob/model/CancelSearchJobRequest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.searchjob.model;
-
-import com.sumologic.client.model.HttpDeleteRequest;
-
-public final class CancelSearchJobRequest implements HttpDeleteRequest {
-
- private String id;
-
- /**
- * Creates a get search job status request.
- *
- * @param id The id of the search job.
- */
- public CancelSearchJobRequest(String id) {
- this.id = id;
- }
-
- /**
- * Returns the ID of the search job.
- *
- * @return The ID of the search job.
- */
- public String getId() {
- return id;
- }
-
- /**
- * Sets the ID of the search job.
- *
- * @param id The ID of the search job.
- */
- public void setId(String id) {
- this.id = id;
- }
-}
diff --git a/src/main/java/com/sumologic/client/searchjob/model/CancelSearchJobResponse.java b/src/main/java/com/sumologic/client/searchjob/model/CancelSearchJobResponse.java
deleted file mode 100644
index 7072d6e..0000000
--- a/src/main/java/com/sumologic/client/searchjob/model/CancelSearchJobResponse.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.searchjob.model;
-
-
-public final class CancelSearchJobResponse {
-
-}
diff --git a/src/main/java/com/sumologic/client/searchjob/model/CreateSearchJobRequest.java b/src/main/java/com/sumologic/client/searchjob/model/CreateSearchJobRequest.java
deleted file mode 100644
index 54f04f1..0000000
--- a/src/main/java/com/sumologic/client/searchjob/model/CreateSearchJobRequest.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.searchjob.model;
-
-import com.sumologic.client.model.HttpPostRequest;
-
-public final class CreateSearchJobRequest implements HttpPostRequest {
-
- private String query;
- private String from;
- private String to;
- private String timeZone;
- private String byReceiptTime;
-
- /**
- * Creates a search job request.
- *
- * @param query The query.
- * @param from The start of the time range.
- * @param to The end of the time range.
- * @param timeZone The time zone.
- */
- public CreateSearchJobRequest(String query,
- String from,
- String to,
- String timeZone,
- String byReceiptTime) {
- this.query = query;
- this.from = from;
- this.to = to;
- this.timeZone = timeZone;
- this.byReceiptTime = byReceiptTime;
- }
-
- /**
- * Returns the query.
- *
- * @return The query.
- */
- public String getQuery() {
- return query;
- }
-
- /**
- * Sets the query.
- */
- public void setQuery(String query) {
- this.query = query;
- }
-
- /**
- * Sets the query.
- *
- * @return This object.
- */
- public CreateSearchJobRequest withQuery(String query) {
- setQuery(query);
- return this;
- }
-
- /**
- * Returns the start of the time range.
- *
- * @return The start of the time range.
- */
- public String getFrom() {
- return from;
- }
-
- /**
- * Sets the start of the time range.
- */
- public void setFrom(String from) {
- this.from = from;
- }
-
- /**
- * Sets the start of the time range.
- *
- * @param from The start of the time range.
- * @return This object.
- */
- public CreateSearchJobRequest withFrom(String from) {
- setFrom(from);
- return this;
- }
-
- /**
- * Returns the end of the time range.
- *
- * @return The end of the time range.
- */
- public String getTo() {
- return to;
- }
-
- /**
- * Sets the end of the time range.
- */
- public void setTo(String to) {
- this.to = to;
- }
-
- /**
- * Sets the end of the time range.
- *
- * @param to The end of the time range.
- * @return This object.
- */
- public CreateSearchJobRequest withTo(String to) {
- setTo(to);
- return this;
- }
-
- /**
- * Returns the time zone.
- *
- * @return The time zone.
- */
- public String getTimeZone() {
- return timeZone;
- }
-
- /**
- * Sets the time zone.
- */
- public void setTimeZone(String timeZone) {
- this.timeZone = timeZone;
- }
-
- /**
- * Sets the time zone.
- *
- * @return This object.
- */
- public CreateSearchJobRequest withTimeZone(String timeZone) {
- setTimeZone(timeZone);
- return this;
- }
-
- /**
- * Returns the by receipt time flag.
- *
- * @return The by receipt time flag.
- */
- public String getByReceiptTime() {
- return byReceiptTime;
- }
-
- /**
- * Sets the by receipt time flag.
- */
- public void setByReceiptTime(String byReceiptTime) {
- this.byReceiptTime = byReceiptTime;
- }
-
- /**
- * Sets the by receipt time flag.
- *
- * @return This object.
- */
-
- public CreateSearchJobRequest withByReceiptTime(String byReceiptTime) {
- setByReceiptTime(byReceiptTime);
- return this;
- }
-}
diff --git a/src/main/java/com/sumologic/client/searchjob/model/CreateSearchJobResponse.java b/src/main/java/com/sumologic/client/searchjob/model/CreateSearchJobResponse.java
deleted file mode 100644
index 65946fb..0000000
--- a/src/main/java/com/sumologic/client/searchjob/model/CreateSearchJobResponse.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.searchjob.model;
-
-public final class CreateSearchJobResponse {
-
- private String id;
-
- /**
- * Returns the ID of the search job.
- *
- * @return The ID of the search job.
- */
- public String getId() {
- return id;
- }
-
- /**
- * Sets the ID of the search job.
- *
- * @param id The ID of the search job.
- */
- public void setId(String id) {
- this.id = id;
- }
-}
diff --git a/src/main/java/com/sumologic/client/searchjob/model/GetMessagesForSearchJobRequest.java b/src/main/java/com/sumologic/client/searchjob/model/GetMessagesForSearchJobRequest.java
deleted file mode 100644
index f13c3b0..0000000
--- a/src/main/java/com/sumologic/client/searchjob/model/GetMessagesForSearchJobRequest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.searchjob.model;
-
-import com.sumologic.client.model.HttpGetRequest;
-import org.apache.http.NameValuePair;
-import org.apache.http.message.BasicNameValuePair;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public final class GetMessagesForSearchJobRequest implements HttpGetRequest {
-
- private String id;
- private int offset;
- private int limit;
-
- /**
- * Creates a new messages for search job request.
- *
- * @param id The search job ID.
- * @param offset The offset.
- * @param limit The limit.
- */
- public GetMessagesForSearchJobRequest(String id, int offset, int limit) {
- this.id = id;
- this.offset = offset;
- this.limit = limit;
- }
-
- /**
- * Return the search job ID.
- *
- * @return The search job ID.
- */
- public String getId() {
- return id;
- }
-
- /**
- * Sets the search job ID.
- *
- * @param id The search job ID.
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * Returns the offset.
- *
- * @return The offset.
- */
- public int getOffset() {
- return offset;
- }
-
- /**
- * Sets the offset.
- *
- * @param offset The offset.
- */
- public void setOffset(int offset) {
- this.offset = offset;
- }
-
- /**
- * Returns the limit.
- *
- * @return The limit.
- */
- public int getLimit() {
- return limit;
- }
-
- /**
- * Sets the limit.
- *
- * @param limit The limit.
- */
- public void setLimit(int limit) {
- this.limit = limit;
- }
-
- // HttpGetRequest implementation.
-
- @Override
- public List toUrlParams() {
- List result = new ArrayList(2);
- result.add(new BasicNameValuePair("offset", Integer.toString(offset)));
- result.add(new BasicNameValuePair("limit", Integer.toString(limit)));
- return result;
- }
-}
diff --git a/src/main/java/com/sumologic/client/searchjob/model/GetMessagesForSearchJobResponse.java b/src/main/java/com/sumologic/client/searchjob/model/GetMessagesForSearchJobResponse.java
deleted file mode 100644
index dbaee8d..0000000
--- a/src/main/java/com/sumologic/client/searchjob/model/GetMessagesForSearchJobResponse.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.searchjob.model;
-
-import com.sumologic.client.model.LogMessage;
-
-import java.util.List;
-
-public class GetMessagesForSearchJobResponse {
-
- private List fields;
- private List messages;
-
- /**
- * Returns the fields.
- *
- * @return The fields.
- */
- public List getFields() {
- return fields;
- }
-
- /**
- * Sets the fields.
- *
- * @param fields The fields.
- */
- public void setFields(List fields) {
- this.fields = fields;
- }
-
- /**
- * Sets the fields.
- *
- * @param fields The fields.
- * @return This object.
- */
- public GetMessagesForSearchJobResponse withFields(List fields) {
- setFields(fields);
- return this;
- }
-
- /**
- * Get the messages.
- *
- * @return The messages.
- */
- public List getMessages() {
- return messages;
- }
-
- /**
- * Sets the messages.
- *
- * @param messages The messages.
- */
- public void setMessages(List messages) {
- this.messages = messages;
- }
-
- /**
- * Sets the messages
- *
- * @param messages The messages.
- * @return This object.
- */
- public GetMessagesForSearchJobResponse withMessages(List messages) {
- setMessages(messages);
- return this;
- }
-
- // Object implementation.
-
- @Override
- public String toString() {
- StringBuilder result = new StringBuilder(128);
- result.append("fields: ");
- result.append(fields);
- result.append(", message count: '");
- result.append(messages.size());
- result.append("'");
- return result.toString();
- }
-}
diff --git a/src/main/java/com/sumologic/client/searchjob/model/GetRecordsForSearchJobRequest.java b/src/main/java/com/sumologic/client/searchjob/model/GetRecordsForSearchJobRequest.java
deleted file mode 100644
index e74de8e..0000000
--- a/src/main/java/com/sumologic/client/searchjob/model/GetRecordsForSearchJobRequest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.searchjob.model;
-
-import com.sumologic.client.model.HttpGetRequest;
-import org.apache.http.NameValuePair;
-import org.apache.http.message.BasicNameValuePair;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public final class GetRecordsForSearchJobRequest implements HttpGetRequest {
-
- private String id;
- private int offset;
- private int limit;
-
- /**
- * Creates a new messages for search job request.
- *
- * @param id The search job ID.
- * @param offset The offset.
- * @param limit The limit.
- */
- public GetRecordsForSearchJobRequest(String id, int offset, int limit) {
- this.id = id;
- this.offset = offset;
- this.limit = limit;
- }
-
- /**
- * Return the search job ID.
- *
- * @return The search job ID.
- */
- public String getId() {
- return id;
- }
-
- /**
- * Sets the search job ID.
- *
- * @param id The search job ID.
- */
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * Returns the offset.
- *
- * @return The offset.
- */
- public int getOffset() {
- return offset;
- }
-
- /**
- * Sets the offset.
- *
- * @param offset The offset.
- */
- public void setOffset(int offset) {
- this.offset = offset;
- }
-
- /**
- * Returns the limit.
- *
- * @return The limit.
- */
- public int getLimit() {
- return limit;
- }
-
- /**
- * Sets the limit.
- *
- * @param limit The limit.
- */
- public void setLimit(int limit) {
- this.limit = limit;
- }
-
- // HttpGetRequest implementation.
-
- @Override
- public List toUrlParams() {
- List result = new ArrayList(2);
- result.add(new BasicNameValuePair("offset", Integer.toString(offset)));
- result.add(new BasicNameValuePair("limit", Integer.toString(limit)));
- return result;
- }
-}
diff --git a/src/main/java/com/sumologic/client/searchjob/model/GetRecordsForSearchJobResponse.java b/src/main/java/com/sumologic/client/searchjob/model/GetRecordsForSearchJobResponse.java
deleted file mode 100644
index f430681..0000000
--- a/src/main/java/com/sumologic/client/searchjob/model/GetRecordsForSearchJobResponse.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.searchjob.model;
-
-
-import java.util.List;
-
-public class GetRecordsForSearchJobResponse {
-
- private List fields;
- private List records;
-
- /**
- * Returns the fields.
- *
- * @return The fields.
- */
- public List getFields() {
- return fields;
- }
-
- /**
- * Sets the fields.
- *
- * @param fields The fields.
- */
- public void setFields(List fields) {
- this.fields = fields;
- }
-
- /**
- * Sets the fields.
- *
- * @param fields The fields.
- * @return This object.
- */
- public GetRecordsForSearchJobResponse withFields(List fields) {
- setFields(fields);
- return this;
- }
-
- /**
- * Get the records.
- *
- * @return The records.
- */
- public List getRecords() {
- return records;
- }
-
- /**
- * Sets the records.
- *
- * @param records The records.
- */
- public void setRecords(List records) {
- this.records = records;
- }
-
- /**
- * Sets the records.
- *
- * @param messages The records.
- * @return This object.
- */
- public GetRecordsForSearchJobResponse withMessages(List messages) {
- setRecords(messages);
- return this;
- }
-
- // Object implementation.
-
- @Override
- public String toString() {
- StringBuffer result = new StringBuffer(128);
- result.append("fields: ");
- result.append(fields);
- result.append(", records count: '");
- result.append(records.size());
- result.append("'");
- return result.toString();
- }
-}
diff --git a/src/main/java/com/sumologic/client/searchjob/model/GetSearchJobStatusRequest.java b/src/main/java/com/sumologic/client/searchjob/model/GetSearchJobStatusRequest.java
deleted file mode 100644
index cb54553..0000000
--- a/src/main/java/com/sumologic/client/searchjob/model/GetSearchJobStatusRequest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.searchjob.model;
-
-import com.sumologic.client.model.HttpGetRequest;
-import org.apache.http.NameValuePair;
-
-import java.util.Collections;
-import java.util.List;
-
-public final class GetSearchJobStatusRequest implements HttpGetRequest {
-
- private String id;
-
- /**
- * Creates a get search job status request.
- *
- * @param id The id of the search job.
- */
- public GetSearchJobStatusRequest(String id) {
- this.id = id;
- }
-
- /**
- * Returns the ID of the search job.
- *
- * @return The ID of the search job.
- */
- public String getId() {
- return id;
- }
-
- /**
- * Sets the ID of the search job.
- *
- * @param id The ID of the search job.
- */
- public void setId(String id) {
- this.id = id;
- }
-
- // HttpGetRequest implementation.
-
- @Override
- public List toUrlParams() {
- return Collections.emptyList();
- }
-}
diff --git a/src/main/java/com/sumologic/client/searchjob/model/GetSearchJobStatusResponse.java b/src/main/java/com/sumologic/client/searchjob/model/GetSearchJobStatusResponse.java
deleted file mode 100644
index fd97126..0000000
--- a/src/main/java/com/sumologic/client/searchjob/model/GetSearchJobStatusResponse.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.searchjob.model;
-
-import java.util.List;
-
-public final class GetSearchJobStatusResponse {
-
- private String state;
- private List histogramBuckets;
- private int messageCount;
- private int recordCount;
- private List pendingWarnings;
- private List pendingErrors;
-
- /**
- * Returns the state.
- *
- * @return The state.
- */
- public String getState() {
- return state;
- }
-
- /**
- * Sets the state.
- *
- * @param state The state.
- */
- public void setState(String state) {
- this.state = state;
- }
-
- /**
- * Returns the histogram buckets.
- *
- * @return The histogram buckets.
- */
- public List getHistogramBuckets() {
- return histogramBuckets;
- }
-
- /**
- * Sets the histogram buckets.
- *
- * @param histogramBuckets The histogram buckets.
- */
- public void setHistogramBuckets(List histogramBuckets) {
- this.histogramBuckets = histogramBuckets;
- }
-
- /**
- * Sets the state.
- *
- * @param state The state.
- * @return This object.
- */
- public GetSearchJobStatusResponse withState(String state) {
- setState(state);
- return this;
- }
-
- /**
- * Returns the number of messages.
- *
- * @return The number of messages.
- */
- public int getMessageCount() {
- return messageCount;
- }
-
- /**
- * Sets the number of messages.
- *
- * @param messageCount The number of messages.
- */
- public void setMessageCount(int messageCount) {
- this.messageCount = messageCount;
- }
-
- /**
- * Sets the number of messages.
- *
- * @param messageCount The number of messages.
- * @return This object.
- */
- public GetSearchJobStatusResponse withMessageCount(int messageCount) {
- setMessageCount(messageCount);
- return this;
- }
-
- /**
- * Returns the number of records.
- *
- * @return The number of records.
- */
- public int getRecordCount() {
- return recordCount;
- }
-
- /**
- * Sets the number of records.
- *
- * @param recordCount The number of records.
- */
- public void setRecordCount(int recordCount) {
- this.recordCount = recordCount;
- }
-
- /**
- * Sets the number of records.
- *
- * @param recordCount The number of records.
- * @return This object.
- */
- public GetSearchJobStatusResponse withRecordCount(int recordCount) {
- setRecordCount(recordCount);
- return this;
- }
-
- /**
- * Returns the pending warnings.
- *
- * @return The pending warnings.
- */
- public List getPendingWarnings() {
- return pendingWarnings;
- }
-
- /**
- * Sets the pending warnings.
- *
- * @param pendingWarnings The pending warnings.
- */
- public void setPendingWarnings(List pendingWarnings) {
- this.pendingWarnings = pendingWarnings;
- }
-
- /**
- * Sets the pending warnings.
- *
- * @param pendingWarnings The pending warnings.
- * @return This object.
- */
- public GetSearchJobStatusResponse withPendingWarnings(List pendingWarnings) {
- setPendingWarnings(pendingWarnings);
- return this;
- }
-
- /**
- * Returns the pending errors.
- *
- * @return The pending errors.
- */
- public List getPendingErrors() {
- return pendingErrors;
- }
-
- /**
- * Sets the pending errors.
- *
- * @param pendingErrors The pending errors.
- */
- public void setPendingErrors(List pendingErrors) {
- this.pendingErrors = pendingErrors;
- }
-
- /**
- * Sets the pending errors.
- *
- * @param pendingErrors The pending errors.
- * @return This object.
- */
- public GetSearchJobStatusResponse withPendingErrors(List pendingErrors) {
- setPendingErrors(pendingErrors);
- return this;
- }
-
- // Object implementation.
-
- @Override
- public String toString() {
- StringBuffer result = new StringBuffer(128);
- result.append("state: '");
- result.append(state);
- result.append("', histogram buckets: ");
- result.append(histogramBuckets);
- result.append(", message count: '");
- result.append(messageCount);
- result.append("', record count: '");
- result.append(recordCount);
- result.append("', pending warnings: ");
- result.append(pendingWarnings);
- result.append(", pending errors: ");
- result.append(pendingErrors);
- return result.toString();
- }
-}
diff --git a/src/main/java/com/sumologic/client/searchjob/model/SearchJobField.java b/src/main/java/com/sumologic/client/searchjob/model/SearchJobField.java
deleted file mode 100644
index da6ac65..0000000
--- a/src/main/java/com/sumologic/client/searchjob/model/SearchJobField.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.searchjob.model;
-
-public class SearchJobField {
-
- private String name;
- private String fieldType;
- private boolean keyField;
-
- /**
- * Returns the name.
- *
- * @return The name.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Sets the name.
- *
- * @param name The name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Sets the name.
- *
- * @param name The name.
- * @return The name.
- */
- public SearchJobField withName(String name) {
- setName(name);
- return this;
- }
-
- /**
- * Returns the fieldType.
- *
- * @return The fieldType.
- */
- public String getFieldType() {
- return fieldType;
- }
-
- /**
- * Sets the fieldType.
- *
- * @param fieldType The fieldType.
- */
- public void setFieldType(String fieldType) {
- this.fieldType = fieldType;
- }
-
- /**
- * Sets the field type.
- *
- * @param fieldType The field type.
- * @return This object.
- */
- public SearchJobField withFieldType(String fieldType) {
- setFieldType(fieldType);
- return this;
- }
-
- /**
- * Returns whether this is a key field.
- *
- * @return Whether this is a key field.
- */
- public boolean isKeyField() {
- return keyField;
- }
-
- /**
- * Sets whether this is a key field.
- *
- * @param isKeyField Whether this is a key field.
- */
- public void setKeyField(boolean isKeyField) {
- this.keyField = isKeyField;
- }
-
- /**
- * Sets whether this is a key field.
- *
- * @param isKeyField Whether this is a key field.
- * @return This object.
- */
- public SearchJobField withKeyField(boolean isKeyField) {
- setKeyField(isKeyField);
- return this;
- }
-
- // Object implementation.
-
- @Override
- public String toString() {
- StringBuffer result = new StringBuffer(128);
- result.append("name: '");
- result.append(name);
- result.append("', fieldType: '");
- result.append(fieldType);
- result.append("', keyField: '");
- result.append(keyField);
- result.append("'");
- return result.toString();
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/sumologic/client/searchjob/model/SearchJobHistogramBucket.java b/src/main/java/com/sumologic/client/searchjob/model/SearchJobHistogramBucket.java
deleted file mode 100644
index 0e575a6..0000000
--- a/src/main/java/com/sumologic/client/searchjob/model/SearchJobHistogramBucket.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.searchjob.model;
-
-import java.util.Date;
-
-public class SearchJobHistogramBucket {
-
- private long startTimestamp;
- private long length;
- private int count;
-
- /**
- * Returns the start timestamp.
- *
- * @return The start timestamp.
- */
- public long getStartTimestamp() {
- return startTimestamp;
- }
-
- /**
- * Sets the start timestamp.
- *
- * @param startTimestamp The start timestamp.
- */
- public void setStartTimestamp(long startTimestamp) {
- this.startTimestamp = startTimestamp;
- }
-
- /**
- * Sets the start timestamp.
- *
- * @param startTimestamp The start timestamp.
- * @return This object.
- */
- public SearchJobHistogramBucket withStartTimestamp(long startTimestamp) {
- setStartTimestamp(startTimestamp);
- return this;
- }
-
- /**
- * Returns the length.
- *
- * @return The length.
- */
- public long getLength() {
- return length;
- }
-
- /**
- * Sets the length.
- *
- * @param length
- */
- public void setLength(long length) {
- this.length = length;
- }
-
- /**
- * Sets the length.
- *
- * @param length The length.
- * @return This object.
- */
- public SearchJobHistogramBucket withLength(long length) {
- setLength(length);
- return this;
- }
-
- /**
- * Returns the count.
- *
- * @return The count.
- */
- public int getCount() {
- return count;
- }
-
- /**
- * Sets the count.
- *
- * @param count The count.
- */
- public void setCount(int count) {
- this.count = count;
- }
-
- /**
- * Sets the count.
- *
- * @param count The count.
- * @return This object.
- */
- public SearchJobHistogramBucket withCount(int count) {
- setCount(count);
- return this;
- }
-
- // Object implementation.
-
- @Override
- public String toString() {
- StringBuffer result = new StringBuffer(128);
- result.append("startTimestamp: '");
- result.append(new Date(startTimestamp));
- result.append("', length '");
- result.append(length);
- result.append("', count: '");
- result.append(count);
- result.append("'");
- return result.toString();
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/sumologic/client/searchjob/model/SearchJobMessage.java b/src/main/java/com/sumologic/client/searchjob/model/SearchJobMessage.java
deleted file mode 100644
index ed32193..0000000
--- a/src/main/java/com/sumologic/client/searchjob/model/SearchJobMessage.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.searchjob.model;
-
-import com.sumologic.client.model.LogMessage;
-
-public class SearchJobMessage extends LogMessage {
-
-}
diff --git a/src/main/java/com/sumologic/client/searchjob/model/SearchJobRecord.java b/src/main/java/com/sumologic/client/searchjob/model/SearchJobRecord.java
deleted file mode 100644
index 70e9783..0000000
--- a/src/main/java/com/sumologic/client/searchjob/model/SearchJobRecord.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.searchjob.model;
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.Set;
-
-public class SearchJobRecord {
-
- private Map map;
-
- /**
- * Returns the names of the fields.
- *
- * @return A set of field names.
- */
- public final Set getFieldNames() {
- return Collections.unmodifiableSet(map.keySet());
- }
-
- /**
- * Returns whether the specified field exists.
- *
- * @param fieldName The field name.
- * @return Whether the specified field exists.
- */
- public boolean hasField(String fieldName) {
- return map.containsKey(fieldName);
- }
-
- /**
- * Returns the value for the specified field, or null.
- *
- * @param fieldName The field name.
- * @return The value of the field, or null.
- */
- public String stringField(String fieldName) {
- return map.get(fieldName);
- }
-
- /**
- * Returns the value for the specified as an integer.
- *
- * @param fieldName The field name.
- * @return The value for the specified field as an integer.
- */
- public long intField(String fieldName) {
- return Integer.parseInt(stringField(fieldName));
- }
-
- /**
- * Returns the value for the specified as a long.
- *
- * @param fieldName The field name.
- * @return The value for the specified field as a long.
- */
- public long longField(String fieldName) {
- return Long.parseLong(stringField(fieldName));
- }
-
- /**
- * Returns the value for the specified as a double.
- *
- * @param fieldName The field name.
- * @return The value for the specified field as a double.
- */
- public double doubleField(String fieldName) {
- return Double.parseDouble(stringField(fieldName));
- }
-
- /**
- * Returns the key-value map.
- *
- * @return The map.
- */
- public Map getMap() {
- return map;
- }
-
- /**
- * Sets the key-value map.
- *
- * @param map The key-value map.
- */
- public void setMap(Map map) {
- this.map = map;
- }
-
- /**
- * Sets the key-value map.
- *
- * @param map The key-value map.
- * @return This object.
- */
- public SearchJobRecord withMap(Map map) {
- setMap(map);
- return this;
- }
-}
diff --git a/src/main/java/com/sumologic/client/util/DeserializingResponseHandler.java b/src/main/java/com/sumologic/client/util/DeserializingResponseHandler.java
deleted file mode 100644
index ee98302..0000000
--- a/src/main/java/com/sumologic/client/util/DeserializingResponseHandler.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.util;
-
-import org.apache.http.HttpResponse;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-public class DeserializingResponseHandler
- implements ResponseHandler {
-
- private Class clazz;
-
- public DeserializingResponseHandler(Class clazz) {
- this.clazz = clazz;
- }
-
- @Override
- public Response handle(HttpResponse httpResponse, InputStream httpStream, Request request)
- throws IOException {
-
- return JacksonUtils.MAPPER.readValue(httpStream, clazz);
- }
-}
diff --git a/src/main/java/com/sumologic/client/util/HttpUtils.java b/src/main/java/com/sumologic/client/util/HttpUtils.java
deleted file mode 100644
index 933493e..0000000
--- a/src/main/java/com/sumologic/client/util/HttpUtils.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.util;
-
-import com.fasterxml.jackson.core.JsonGenerationException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.sumologic.client.*;
-import com.sumologic.client.model.HttpDeleteRequest;
-import com.sumologic.client.model.HttpGetRequest;
-import com.sumologic.client.model.HttpPostRequest;
-import com.sumologic.client.model.HttpPutRequest;
-import org.apache.http.HttpEntity;
-import org.apache.http.client.CookieStore;
-import org.apache.http.client.CredentialsProvider;
-import org.apache.http.client.config.CookieSpecs;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.methods.*;
-import org.apache.http.client.utils.URIBuilder;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.BasicCookieStore;
-import org.apache.http.impl.client.BasicCredentialsProvider;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.impl.client.HttpClients;
-
-import java.io.*;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.nio.charset.StandardCharsets;
-import java.util.HashMap;
-import java.util.Map;
-
-public class HttpUtils {
-
- public static final int API_VERSION = 1;
-
- private static final String JSON_CONTENT_TYPE = "application/json";
-
- private final CookieStore cookieStore = new BasicCookieStore();
-
- // Public HTTP request methods
-
- public Response
- get(ConnectionConfig config, String endpoint,
- Request request, Map requestHeaders,
- ResponseHandler handler, int expectedStatusCode) {
- return get(config, endpoint, request, Defaults.DEFAULT_HTTP_TIMEOUT, requestHeaders, handler, expectedStatusCode);
- }
-
- public Response
- get(ConnectionConfig config, String endpoint,
- Request request, int timeout, Map requestHeaders,
- ResponseHandler handler, int expectedStatusCode) {
-
- try {
- URI uri = new URIBuilder()
- .setScheme(config.getProtocol())
- .setHost(config.getHostname())
- .setPort(config.getPort())
- .setPath(getEndpointURI(endpoint))
- .setParameters(request.toUrlParams())
- .setCharset(StandardCharsets.UTF_8)
- .build();
- HttpGet get = new HttpGet(uri);
- configureRequest(config, get, timeout);
-
- return doRequest(config, timeout, get, requestHeaders, request, handler, expectedStatusCode);
- } catch (URISyntaxException e) {
- throw new SumoClientException("URI cannot be generated", e);
- }
- }
-
- public Response
- post(ConnectionConfig config, String endpoint,
- Request request, Map requestHeaders,
- ResponseHandler handler, int expectedStatusCode) {
-
- try {
- URI uri = new URIBuilder()
- .setScheme(config.getProtocol())
- .setHost(config.getHostname())
- .setPort(config.getPort())
- .setPath(getEndpointURI(endpoint))
- .setCharset(StandardCharsets.UTF_8)
- .build();
- HttpPost post = new HttpPost(uri);
- configureRequest(config, post, Defaults.DEFAULT_HTTP_TIMEOUT);
-
- String body = JacksonUtils.MAPPER.writeValueAsString(request);
- StringEntity entity = new StringEntity(body, StandardCharsets.UTF_8);
- entity.setContentType(JSON_CONTENT_TYPE);
- post.setEntity(entity);
-
- return doRequest(
- config, post, requestHeaders, request, handler, expectedStatusCode);
- } catch (URISyntaxException e) {
- throw new SumoClientException("URI cannot be generated", e);
- } catch (JsonMappingException | JsonGenerationException e) {
- throw new SumoClientException("Error generating JSON", e);
- } catch (IOException e) {
- throw new SumoClientException("Error generating JSON", e);
- }
- }
-
- public Response
- put(ConnectionConfig config, String endpoint,
- Request request, ResponseHandler handler, int expectedStatusCode) {
-
- try {
- URI uri = new URIBuilder()
- .setScheme(config.getProtocol())
- .setHost(config.getHostname())
- .setPort(config.getPort())
- .setPath(getEndpointURI(endpoint))
- .build();
-
- HttpPut put = new HttpPut(uri);
-
- Map requestHeaders = new HashMap();
- if (request.getETag() != null) {
- requestHeaders.put("If-Match", request.getETag());
- }
-
- String body = JacksonUtils.MAPPER.writeValueAsString(request);
- StringEntity entity = new StringEntity(body, StandardCharsets.UTF_8);
- entity.setContentType(JSON_CONTENT_TYPE);
- put.setEntity(entity);
- configureRequest(config, put, Defaults.DEFAULT_HTTP_TIMEOUT);
-
- return doRequest(
- config, put, requestHeaders, request, handler, expectedStatusCode);
- } catch (URISyntaxException ex) {
- throw new SumoClientException("URI cannot be generated", ex);
- } catch (JsonMappingException | JsonGenerationException e) {
- throw new SumoClientException("Error generating JSON", e);
- } catch (IOException e) {
- throw new SumoClientException("Error generating JSON", e);
- }
- }
-
- public Response
- delete(ConnectionConfig config, String endpoint,
- Request request, ResponseHandler handler, int expectedStatusCode) {
-
- try {
- URI uri = new URIBuilder()
- .setScheme(config.getProtocol())
- .setHost(config.getHostname())
- .setPort(config.getPort())
- .setPath(getEndpointURI(endpoint))
- .build();
- HttpDelete delete = new HttpDelete(uri);
- configureRequest(config, delete, Defaults.DEFAULT_HTTP_TIMEOUT);
-
- Map requestHeaders = HttpUtils.toRequestHeaders();
-
- return doRequest(
- config, delete, requestHeaders, request, handler, expectedStatusCode);
- } catch (URISyntaxException ex) {
- throw new SumoClientException("URI cannot be generated", ex);
- }
- }
-
- public static Map toRequestHeaders(String... parts) {
- Map result = new HashMap();
- for (int i = 0; i < parts.length; i++) {
- result.put(parts[i], parts[++i]);
- }
- return result;
- }
-
- // Private methods
-
- private CloseableHttpClient getHttpClient(ConnectionConfig config) {
- CredentialsProvider provider = new BasicCredentialsProvider();
- provider.setCredentials(config.getAuthScope(), config.getUsernamePasswordCredentials());
- return HttpClients.custom().setDefaultCookieStore(cookieStore)
- .setDefaultCredentialsProvider(provider)
- .build();
- }
-
- private static String getEndpointURI(String endpoint) {
- return "/" + UrlParameters.API_SERVICE +
- "/" + UrlParameters.VERSION_PREFIX + API_VERSION +
- "/" + endpoint;
- }
-
- private Response
- doRequest(ConnectionConfig config, HttpUriRequest method, Map requestHeaders,
- Request request, ResponseHandler handler, int expectedStatusCode) {
- return doRequest(config, Defaults.DEFAULT_HTTP_TIMEOUT, method, requestHeaders, request, handler, expectedStatusCode);
- }
-
- private Response
- doRequest(ConnectionConfig config, int timeout, HttpUriRequest method, Map requestHeaders,
- Request request, ResponseHandler handler, int expectedStatusCode) {
-
- // Set headers
- for (Map.Entry header : requestHeaders.entrySet()) {
- method.setHeader(header.getKey(), header.getValue());
- }
-
- CloseableHttpClient httpClient = getHttpClient(config);
-
- InputStream httpStream = null;
- CloseableHttpResponse httpResponse = null;
- try {
- httpResponse = httpClient.execute(method);
- HttpEntity entity = httpResponse.getEntity();
- httpStream = entity.getContent();
-
- // Request was ok? yes -> handle http response
- if (httpResponse.getStatusLine().getStatusCode() == expectedStatusCode) {
- return handler.handle(httpResponse, httpStream, request);
- }
-
- // no -> get json error and throw exception
- else {
- StringWriter writer = new StringWriter();
- BufferedReader reader = new BufferedReader(new InputStreamReader(httpStream));
-
- // Convert response to JSON string
- for (String s; (s = reader.readLine()) != null; ) {
- writer.write(s + "\n");
- }
-
- String json = writer.toString();
- if (JacksonUtils.isValidJson(json))
- throw new SumoServerException(method.getURI().toString(), writer.toString());
- else
- throw new SumoServerException(
- method.getURI().toString(),
- httpResponse.getStatusLine().getStatusCode());
- }
- }
-
- // Handle IO exceptions
- catch (IOException ex) {
- throw new SumoClientException("Error reading server response", ex);
- }
-
- // Handle runtime exceptions
- catch (RuntimeException ex) {
- if (ex instanceof SumoServerException) {
- throw ex;
- } else {
- throw new SumoClientException("Runtime error reading server response", ex);
- }
- }
-
- // Clean-up
- finally {
- if (httpStream != null) {
- try {
- httpStream.close();
- } catch (Exception ex) {
- }
- }
-
- if (method != null) {
- try {
- method.abort();
- } catch (Exception ex) {
- }
- }
-
- try {
- httpResponse.close();
- } catch (Exception ex) {
- }
-
- try {
- httpClient.close();
- } catch (Exception ex) {
- }
- }
- }
-
- private void configureRequest(ConnectionConfig config, HttpRequestBase request, int timeout) {
- RequestConfig.Builder builder = RequestConfig.custom().setConnectTimeout(timeout).setSocketTimeout(timeout);
- builder.setCookieSpec(CookieSpecs.STANDARD);
- if (config.getProxy() != null) {
- builder.setProxy(config.getProxy()).build();
- }
- request.setConfig(builder.build());
-
- }
-}
diff --git a/src/main/java/com/sumologic/client/util/JacksonUtils.java b/src/main/java/com/sumologic/client/util/JacksonUtils.java
deleted file mode 100644
index 84ee35f..0000000
--- a/src/main/java/com/sumologic/client/util/JacksonUtils.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.util;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import java.io.IOException;
-
-public class JacksonUtils {
-
- // This is a safe and recommended way to use the ObjectMapper.
- public static final ObjectMapper MAPPER = new ObjectMapper();
-
- static {
- // Don't want old client libraries to break if we add fields.
- MAPPER.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-
- // Only serialize non-null values.
- MAPPER.setSerializationInclusion(JsonInclude.Include.NON_NULL);
- }
-
- public static Long asLong(Object value) {
- if (value == null) {
- return null;
- }
- return ((Number) value).longValue();
- }
-
- public static Double asDouble(Object value) {
- if (value == null) {
- return null;
- }
- return ((Number) value).doubleValue();
- }
-
- public static boolean isValidJson(String json) {
- try {
- MAPPER.readValue(json, JsonNode.class);
- return true;
- } catch (IOException e) {
- return false;
- }
- }
-
-}
diff --git a/src/main/java/com/sumologic/client/util/PassingResponseHandler.java b/src/main/java/com/sumologic/client/util/PassingResponseHandler.java
deleted file mode 100644
index 3a5d8ac..0000000
--- a/src/main/java/com/sumologic/client/util/PassingResponseHandler.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.util;
-
-import org.apache.http.HttpResponse;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-public class PassingResponseHandler
- implements ResponseHandler {
-
- private Response response;
-
- public PassingResponseHandler(Response response) {
- this.response = response;
- }
-
- @Override
- public Response handle(HttpResponse httpResponse, InputStream httpStream, Request request)
- throws IOException {
-
- return response;
- }
-}
diff --git a/src/main/java/com/sumologic/client/util/ResponseHandler.java b/src/main/java/com/sumologic/client/util/ResponseHandler.java
deleted file mode 100644
index 1d8c012..0000000
--- a/src/main/java/com/sumologic/client/util/ResponseHandler.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.util;
-
-import org.apache.http.HttpResponse;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-public interface ResponseHandler {
-
- public Response handle(HttpResponse httpResponse, InputStream httpStream, Request request)
- throws IOException;
-}
diff --git a/src/main/java/com/sumologic/client/util/SourceDeserializer.java b/src/main/java/com/sumologic/client/util/SourceDeserializer.java
deleted file mode 100644
index 0349f84..0000000
--- a/src/main/java/com/sumologic/client/util/SourceDeserializer.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.util;
-
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
-import com.sumologic.client.collectors.model.Source;
-import com.sumologic.client.collectors.model.SourceType;
-
-import java.io.IOException;
-
-public class SourceDeserializer extends StdDeserializer {
-
- public SourceDeserializer() {
- super(Source.class);
- }
-
- @Override
- public Source deserialize(JsonParser jsonParser, DeserializationContext context)
- throws IOException {
-
- Source source = JacksonUtils.MAPPER.readValue(jsonParser, Source.class);
- Class extends Source> sourceClass = SourceType.getSourceClass(source.getSourceType());
-
- if (sourceClass != null) {
- String sourceJson = JacksonUtils.MAPPER.writeValueAsString(source);
- return JacksonUtils.MAPPER.readValue(sourceJson, sourceClass);
- }
- return source;
- }
-}
diff --git a/src/main/java/com/sumologic/client/util/SumoEntityResponseHandler.java b/src/main/java/com/sumologic/client/util/SumoEntityResponseHandler.java
deleted file mode 100644
index 13c7ac6..0000000
--- a/src/main/java/com/sumologic/client/util/SumoEntityResponseHandler.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package com.sumologic.client.util;
-
-import com.sumologic.client.model.SumoEntityResponse;
-import org.apache.http.HttpResponse;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-public class SumoEntityResponseHandler
- implements ResponseHandler {
-
- private static String ETAG_HEADER = "ETag";
-
- private Class clazz;
-
- public SumoEntityResponseHandler(Class clazz) {
- this.clazz = clazz;
- }
-
- @Override
- public Response handle(HttpResponse httpResponse, InputStream httpStream, Request request)
- throws IOException {
-
- Response response = JacksonUtils.MAPPER.readValue(httpStream, clazz);
- if (httpResponse.containsHeader(ETAG_HEADER)) {
- response.setETag(httpResponse.getFirstHeader(ETAG_HEADER).getValue());
- }
- return response;
- }
-}