Skip to content

Commit 66d864b

Browse files
Akhil JonnalagaddaAkhil Jonnalagadda
Akhil Jonnalagadda
authored and
Akhil Jonnalagadda
committed
feat: add support for application list filters
added support for filters such as start time interval which supports beginning and current keywords
1 parent 9f0acf2 commit 66d864b

File tree

10 files changed

+145
-28
lines changed

10 files changed

+145
-28
lines changed

modules/examples/src/main/java/com/ibm/cloud/iaesdk/ibm_analytics_engine_api/v3/IbmAnalyticsEngineApiExamples.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ public static void main(String[] args) throws Exception {
249249
// begin-replace_instance_default_runtime
250250
ReplaceInstanceDefaultRuntimeOptions replaceInstanceDefaultRuntimeOptions = new ReplaceInstanceDefaultRuntimeOptions.Builder()
251251
.instanceId("e64c907a-e82f-46fd-addc-ccfafbd28b09")
252-
.sparkVersion("3.3")
252+
.sparkVersion("3.4")
253253
.build();
254254

255255
Response<Runtime> response = ibmAnalyticsEngineApiService.replaceInstanceDefaultRuntime(replaceInstanceDefaultRuntimeOptions).execute();
@@ -266,7 +266,7 @@ public static void main(String[] args) throws Exception {
266266
System.out.println("createApplication() result:");
267267
// begin-create_application
268268
Runtime runtimeModel = new Runtime.Builder()
269-
.sparkVersion("3.3")
269+
.sparkVersion("3.4")
270270
.build();
271271
ApplicationRequestApplicationDetails applicationRequestApplicationDetailsModel = new ApplicationRequestApplicationDetails.Builder()
272272
.application("/opt/ibm/spark/examples/src/main/python/wordcount.py")

modules/ibm-analytics-engine-api/src/main/java/com/ibm/cloud/iaesdk/ibm_analytics_engine_api/v3/IbmAnalyticsEngineApi.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,15 @@ public ServiceCall<ApplicationCollection> listApplications(ListApplicationsOptio
452452
if (listApplicationsOptions.state() != null) {
453453
builder.query("state", RequestUtils.join(listApplicationsOptions.state(), ","));
454454
}
455+
if (listApplicationsOptions.startTimeInterval() != null) {
456+
builder.query("start_time_interval", String.valueOf(listApplicationsOptions.startTimeInterval()));
457+
}
458+
if (listApplicationsOptions.submissionTimeInterval() != null) {
459+
builder.query("submission_time_interval", String.valueOf(listApplicationsOptions.submissionTimeInterval()));
460+
}
461+
if (listApplicationsOptions.endTimeInterval() != null) {
462+
builder.query("end_time_interval", String.valueOf(listApplicationsOptions.endTimeInterval()));
463+
}
455464
if (listApplicationsOptions.limit() != null) {
456465
builder.query("limit", String.valueOf(listApplicationsOptions.limit()));
457466
}

modules/ibm-analytics-engine-api/src/main/java/com/ibm/cloud/iaesdk/ibm_analytics_engine_api/v3/model/ListApplicationsOptions.java

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public interface State {
4444

4545
protected String instanceId;
4646
protected List<String> state;
47+
protected String startTimeInterval;
48+
protected String submissionTimeInterval;
49+
protected String endTimeInterval;
4750
protected Long limit;
4851
protected String start;
4952

@@ -53,6 +56,9 @@ public interface State {
5356
public static class Builder {
5457
private String instanceId;
5558
private List<String> state;
59+
private String startTimeInterval;
60+
private String submissionTimeInterval;
61+
private String endTimeInterval;
5662
private Long limit;
5763
private String start;
5864

@@ -64,6 +70,9 @@ public static class Builder {
6470
private Builder(ListApplicationsOptions listApplicationsOptions) {
6571
this.instanceId = listApplicationsOptions.instanceId;
6672
this.state = listApplicationsOptions.state;
73+
this.startTimeInterval = listApplicationsOptions.startTimeInterval;
74+
this.submissionTimeInterval = listApplicationsOptions.submissionTimeInterval;
75+
this.endTimeInterval = listApplicationsOptions.endTimeInterval;
6776
this.limit = listApplicationsOptions.limit;
6877
this.start = listApplicationsOptions.start;
6978
}
@@ -131,6 +140,39 @@ public Builder state(List<String> state) {
131140
return this;
132141
}
133142

143+
/**
144+
* Set the startTimeInterval.
145+
*
146+
* @param startTimeInterval the startTimeInterval
147+
* @return the ListApplicationsOptions builder
148+
*/
149+
public Builder startTimeInterval(String startTimeInterval) {
150+
this.startTimeInterval = startTimeInterval;
151+
return this;
152+
}
153+
154+
/**
155+
* Set the submissionTimeInterval.
156+
*
157+
* @param submissionTimeInterval the submissionTimeInterval
158+
* @return the ListApplicationsOptions builder
159+
*/
160+
public Builder submissionTimeInterval(String submissionTimeInterval) {
161+
this.submissionTimeInterval = submissionTimeInterval;
162+
return this;
163+
}
164+
165+
/**
166+
* Set the endTimeInterval.
167+
*
168+
* @param endTimeInterval the endTimeInterval
169+
* @return the ListApplicationsOptions builder
170+
*/
171+
public Builder endTimeInterval(String endTimeInterval) {
172+
this.endTimeInterval = endTimeInterval;
173+
return this;
174+
}
175+
134176
/**
135177
* Set the limit.
136178
*
@@ -161,6 +203,9 @@ protected ListApplicationsOptions(Builder builder) {
161203
"instanceId cannot be empty");
162204
instanceId = builder.instanceId;
163205
state = builder.state;
206+
startTimeInterval = builder.startTimeInterval;
207+
submissionTimeInterval = builder.submissionTimeInterval;
208+
endTimeInterval = builder.endTimeInterval;
164209
limit = builder.limit;
165210
start = builder.start;
166211
}
@@ -196,6 +241,51 @@ public List<String> state() {
196241
return state;
197242
}
198243

244+
/**
245+
* Gets the startTimeInterval.
246+
*
247+
* Time interval to use for filtering applications by their start time. Interval is specified in the format `&lt;lower
248+
* timestamp limit&gt;,&lt;upper timestamp limit&gt;`. Each timestamp value must be ISO 8601 compliant. You may also
249+
* use keywords `BEGINNING` as a placeholder value for lower timestamp limit and `CURRENT` as a placeholder value for
250+
* upper timestamp limit. Note: The lower timestamp limit is inclusive, whereas the upper timestamp limit is
251+
* exclusive.
252+
*
253+
* @return the startTimeInterval
254+
*/
255+
public String startTimeInterval() {
256+
return startTimeInterval;
257+
}
258+
259+
/**
260+
* Gets the submissionTimeInterval.
261+
*
262+
* Time interval to use for filtering applications by their submission time. Interval is specified in the format
263+
* `&lt;lower timestamp limit&gt;,&lt;upper timestamp limit&gt;`. Each timestamp value must be ISO 8601 compliant. You
264+
* may also use keywords `BEGINNING` as a placeholder value for lower timestamp limit and `CURRENT` as a placeholder
265+
* value for upper timestamp limit. Note: The lower timestamp limit is inclusive, whereas the upper timestamp limit is
266+
* exclusive.
267+
*
268+
* @return the submissionTimeInterval
269+
*/
270+
public String submissionTimeInterval() {
271+
return submissionTimeInterval;
272+
}
273+
274+
/**
275+
* Gets the endTimeInterval.
276+
*
277+
* Time interval to use for filtering applications by their end time. Interval is specified in the format `&lt;lower
278+
* timestamp limit&gt;,&lt;upper timestamp limit&gt;`. Each timestamp value must be ISO 8601 compliant. You may also
279+
* use keywords `BEGINNING` as a placeholder value for lower timestamp limit and `CURRENT` as a placeholder value for
280+
* upper timestamp limit. Note: The lower timestamp limit is inclusive, whereas the upper timestamp limit is
281+
* exclusive.
282+
*
283+
* @return the endTimeInterval
284+
*/
285+
public String endTimeInterval() {
286+
return endTimeInterval;
287+
}
288+
199289
/**
200290
* Gets the limit.
201291
*

modules/ibm-analytics-engine-api/src/test/java/com/ibm/cloud/iaesdk/ibm_analytics_engine_api/v3/IbmAnalyticsEngineApiIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ public void testReplaceInstanceDefaultRuntime() throws Exception {
327327
try {
328328
ReplaceInstanceDefaultRuntimeOptions replaceInstanceDefaultRuntimeOptions = new ReplaceInstanceDefaultRuntimeOptions.Builder()
329329
.instanceId(instanceId)
330-
.sparkVersion("3.1")
330+
.sparkVersion("3.3")
331331
.build();
332332

333333
// Invoke operation
@@ -349,7 +349,7 @@ public void testReplaceInstanceDefaultRuntime() throws Exception {
349349
public void testCreateApplication() throws Exception {
350350
try {
351351
Runtime runtimeModel = new Runtime.Builder()
352-
.sparkVersion("3.3")
352+
.sparkVersion("3.4")
353353
.build();
354354

355355
ApplicationRequestApplicationDetails applicationRequestApplicationDetailsModel = new ApplicationRequestApplicationDetails.Builder()

0 commit comments

Comments
 (0)