Skip to content

feat: add support for application list filters #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public static void main(String[] args) throws Exception {
// begin-replace_instance_default_runtime
ReplaceInstanceDefaultRuntimeOptions replaceInstanceDefaultRuntimeOptions = new ReplaceInstanceDefaultRuntimeOptions.Builder()
.instanceId("e64c907a-e82f-46fd-addc-ccfafbd28b09")
.sparkVersion("3.3")
.sparkVersion("3.4")
.build();

Response<Runtime> response = ibmAnalyticsEngineApiService.replaceInstanceDefaultRuntime(replaceInstanceDefaultRuntimeOptions).execute();
Expand All @@ -266,7 +266,7 @@ public static void main(String[] args) throws Exception {
System.out.println("createApplication() result:");
// begin-create_application
Runtime runtimeModel = new Runtime.Builder()
.sparkVersion("3.3")
.sparkVersion("3.4")
.build();
ApplicationRequestApplicationDetails applicationRequestApplicationDetailsModel = new ApplicationRequestApplicationDetails.Builder()
.application("/opt/ibm/spark/examples/src/main/python/wordcount.py")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,15 @@ public ServiceCall<ApplicationCollection> listApplications(ListApplicationsOptio
if (listApplicationsOptions.state() != null) {
builder.query("state", RequestUtils.join(listApplicationsOptions.state(), ","));
}
if (listApplicationsOptions.startTimeInterval() != null) {
builder.query("start_time_interval", String.valueOf(listApplicationsOptions.startTimeInterval()));
}
if (listApplicationsOptions.submissionTimeInterval() != null) {
builder.query("submission_time_interval", String.valueOf(listApplicationsOptions.submissionTimeInterval()));
}
if (listApplicationsOptions.endTimeInterval() != null) {
builder.query("end_time_interval", String.valueOf(listApplicationsOptions.endTimeInterval()));
}
if (listApplicationsOptions.limit() != null) {
builder.query("limit", String.valueOf(listApplicationsOptions.limit()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public interface State {

protected String instanceId;
protected List<String> state;
protected String startTimeInterval;
protected String submissionTimeInterval;
protected String endTimeInterval;
protected Long limit;
protected String start;

Expand All @@ -53,6 +56,9 @@ public interface State {
public static class Builder {
private String instanceId;
private List<String> state;
private String startTimeInterval;
private String submissionTimeInterval;
private String endTimeInterval;
private Long limit;
private String start;

Expand All @@ -64,6 +70,9 @@ public static class Builder {
private Builder(ListApplicationsOptions listApplicationsOptions) {
this.instanceId = listApplicationsOptions.instanceId;
this.state = listApplicationsOptions.state;
this.startTimeInterval = listApplicationsOptions.startTimeInterval;
this.submissionTimeInterval = listApplicationsOptions.submissionTimeInterval;
this.endTimeInterval = listApplicationsOptions.endTimeInterval;
this.limit = listApplicationsOptions.limit;
this.start = listApplicationsOptions.start;
}
Expand Down Expand Up @@ -131,6 +140,39 @@ public Builder state(List<String> state) {
return this;
}

/**
* Set the startTimeInterval.
*
* @param startTimeInterval the startTimeInterval
* @return the ListApplicationsOptions builder
*/
public Builder startTimeInterval(String startTimeInterval) {
this.startTimeInterval = startTimeInterval;
return this;
}

/**
* Set the submissionTimeInterval.
*
* @param submissionTimeInterval the submissionTimeInterval
* @return the ListApplicationsOptions builder
*/
public Builder submissionTimeInterval(String submissionTimeInterval) {
this.submissionTimeInterval = submissionTimeInterval;
return this;
}

/**
* Set the endTimeInterval.
*
* @param endTimeInterval the endTimeInterval
* @return the ListApplicationsOptions builder
*/
public Builder endTimeInterval(String endTimeInterval) {
this.endTimeInterval = endTimeInterval;
return this;
}

/**
* Set the limit.
*
Expand Down Expand Up @@ -161,6 +203,9 @@ protected ListApplicationsOptions(Builder builder) {
"instanceId cannot be empty");
instanceId = builder.instanceId;
state = builder.state;
startTimeInterval = builder.startTimeInterval;
submissionTimeInterval = builder.submissionTimeInterval;
endTimeInterval = builder.endTimeInterval;
limit = builder.limit;
start = builder.start;
}
Expand Down Expand Up @@ -196,6 +241,51 @@ public List<String> state() {
return state;
}

/**
* Gets the startTimeInterval.
*
* Time interval to use for filtering applications by their start time. Interval is specified in the format `&lt;lower
* timestamp limit&gt;,&lt;upper timestamp limit&gt;`. Each timestamp value must be ISO 8601 compliant. You may also
* use keywords `BEGINNING` as a placeholder value for lower timestamp limit and `CURRENT` as a placeholder value for
* upper timestamp limit. Note: The lower timestamp limit is inclusive, whereas the upper timestamp limit is
* exclusive.
*
* @return the startTimeInterval
*/
public String startTimeInterval() {
return startTimeInterval;
}

/**
* Gets the submissionTimeInterval.
*
* Time interval to use for filtering applications by their submission time. Interval is specified in the format
* `&lt;lower timestamp limit&gt;,&lt;upper timestamp limit&gt;`. Each timestamp value must be ISO 8601 compliant. You
* may also use keywords `BEGINNING` as a placeholder value for lower timestamp limit and `CURRENT` as a placeholder
* value for upper timestamp limit. Note: The lower timestamp limit is inclusive, whereas the upper timestamp limit is
* exclusive.
*
* @return the submissionTimeInterval
*/
public String submissionTimeInterval() {
return submissionTimeInterval;
}

/**
* Gets the endTimeInterval.
*
* Time interval to use for filtering applications by their end time. Interval is specified in the format `&lt;lower
* timestamp limit&gt;,&lt;upper timestamp limit&gt;`. Each timestamp value must be ISO 8601 compliant. You may also
* use keywords `BEGINNING` as a placeholder value for lower timestamp limit and `CURRENT` as a placeholder value for
* upper timestamp limit. Note: The lower timestamp limit is inclusive, whereas the upper timestamp limit is
* exclusive.
*
* @return the endTimeInterval
*/
public String endTimeInterval() {
return endTimeInterval;
}

/**
* Gets the limit.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public void testReplaceInstanceDefaultRuntime() throws Exception {
try {
ReplaceInstanceDefaultRuntimeOptions replaceInstanceDefaultRuntimeOptions = new ReplaceInstanceDefaultRuntimeOptions.Builder()
.instanceId(instanceId)
.sparkVersion("3.1")
.sparkVersion("3.3")
.build();

// Invoke operation
Expand All @@ -349,7 +349,7 @@ public void testReplaceInstanceDefaultRuntime() throws Exception {
public void testCreateApplication() throws Exception {
try {
Runtime runtimeModel = new Runtime.Builder()
.sparkVersion("3.3")
.sparkVersion("3.4")
.build();

ApplicationRequestApplicationDetails applicationRequestApplicationDetailsModel = new ApplicationRequestApplicationDetails.Builder()
Expand Down
Loading