Skip to content

Commit 04e5668

Browse files
committed
updated version checks for v2 Search APIs
1 parent e7a921b commit 04e5668

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

splunk/src/main/java/com/splunk/Job.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ private InputStream getEventsMethod(String methodPath, Map args) {
372372
// v1(GET), v2(POST)
373373
String fullPath;
374374
ResponseMessage response;
375-
if (service.versionIsEarlierThan("9.0")) {
375+
if (service.versionIsEarlierThan("9.0.2")) {
376376
fullPath = path.replace(JobCollection.REST_PATH_V2, JobCollection.REST_PATH) + methodPath;
377377
response = service.get(fullPath, args);
378378
}

splunk/src/main/java/com/splunk/JobCollection.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class JobCollection extends EntityCollection<Job> {
3434
* @param service The connected {@code Service} instance.
3535
*/
3636
JobCollection(Service service) {
37-
super(service, service.versionIsAtLeast("9.0") ? REST_PATH_V2 : REST_PATH, Job.class);
37+
super(service, service.versionIsAtLeast("9.0.2") ? REST_PATH_V2 : REST_PATH, Job.class);
3838
this.refreshArgs.put("count", "0");
3939
}
4040

@@ -46,7 +46,7 @@ public class JobCollection extends EntityCollection<Job> {
4646
* return and how to sort them (see {@link CollectionArgs}).
4747
*/
4848
JobCollection(Service service, Args args) {
49-
super(service, service.versionIsAtLeast("9.0") ? REST_PATH_V2 : REST_PATH, Job.class, args);
49+
super(service, service.versionIsAtLeast("9.0.2") ? REST_PATH_V2 : REST_PATH, Job.class, args);
5050
this.refreshArgs.put("count", "0");
5151
}
5252

@@ -87,7 +87,7 @@ public Job create(String query, Map args) {
8787
.item(0)
8888
.getTextContent();
8989

90-
String path = service.versionIsAtLeast("9.0") ? REST_PATH_V2 : REST_PATH;
90+
String path = service.versionIsAtLeast("9.0.2") ? REST_PATH_V2 : REST_PATH;
9191
Job job = new Job(service, path + "/" + sid);
9292
job.refresh();
9393

splunk/src/main/java/com/splunk/Service.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public InputStream export(String search, Map args) {
225225
}
226226
ResponseMessage response;
227227

228-
if (versionIsAtLeast("9.0"))
228+
if (versionIsAtLeast("9.0.2"))
229229
response = post(JobCollection.REST_PATH_V2 + "/export", args);
230230
else {
231231
response = post(JobCollection.REST_PATH + "/export", args);
@@ -1258,7 +1258,7 @@ public ResponseMessage parse(String query) {
12581258
public ResponseMessage parse(String query, Map args) {
12591259
args = Args.create(args).add("q", query);
12601260

1261-
if (versionIsAtLeast("9.0"))
1261+
if (versionIsAtLeast("9.0.2"))
12621262
return post("search/v2/parser", args);
12631263
else
12641264
return get("search/parser", args);
@@ -1311,6 +1311,7 @@ public Job search(String query, Map<String, Object> args) {
13111311
* @return The HTTP response.
13121312
*/
13131313
@Override public ResponseMessage send(String path, RequestMessage request) {
1314+
System.out.println("Path: "+path);
13141315
// cookieStore is a protected member of HttpService
13151316
if (token != null && cookieStore.isEmpty()) {
13161317
request.getHeader().put("Authorization", token);

0 commit comments

Comments
 (0)