-
Notifications
You must be signed in to change notification settings - Fork 24.7k
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
HLRC: Add get rollup job #33921
Merged
Merged
HLRC: Add get rollup job #33921
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5f394ff
HLRC: Add get rollup job
nik9000 08fa5ef
Add test for missing and converter
nik9000 81015df
Merge branch 'master' into hlrc_rollup_get
nik9000 0418a81
Move toXContent to tests
nik9000 baef527
Merge branch 'master' into hlrc_rollup_get
nik9000 d542da4
Fix
nik9000 eb90d8a
Merge branch 'master' into hlrc_rollup_get
nik9000 a92d354
Fixup
nik9000 fdfa4c4
Merge branch 'master' into hlrc_rollup_get
nik9000 55bfb19
No _all
nik9000 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
...nt/rest-high-level/src/main/java/org/elasticsearch/client/rollup/GetRollupJobRequest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* Licensed to Elasticsearch under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch 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 org.elasticsearch.client.rollup; | ||
|
||
import org.elasticsearch.client.Validatable; | ||
import org.elasticsearch.client.ValidationException; | ||
|
||
import java.util.Objects; | ||
import java.util.Optional; | ||
|
||
/** | ||
* Request to fetch rollup jobs. | ||
*/ | ||
public class GetRollupJobRequest implements Validatable { | ||
private final String jobId; | ||
|
||
/** | ||
* Create a requets . | ||
* @param jobId id of the job to return or {@code _all} to return all jobs | ||
*/ | ||
public GetRollupJobRequest(final String jobId) { | ||
this.jobId = Objects.requireNonNull(jobId, "jobId is required"); | ||
} | ||
|
||
/** | ||
* Create a request to load all rollup jobs. | ||
*/ | ||
public GetRollupJobRequest() { | ||
this("_all"); | ||
} | ||
|
||
/** | ||
* ID of the job to return. | ||
*/ | ||
public String getJobId() { | ||
return jobId; | ||
} | ||
|
||
@Override | ||
public Optional<ValidationException> validate() { | ||
return Optional.empty(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
final GetRollupJobRequest that = (GetRollupJobRequest) o; | ||
return jobId.equals(that.jobId); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(jobId); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<3 validation here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The server-side request (and REST endpoint) converts null, empty or
*
into_all
. So we should probably do the same here, or remove that from the server-side request and add the logic to the transport action.Otherwise an asterisk from the HLRC will go unconverted and the server will try to look for a job literally named
*
:)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like REST doesn't support null but the transport client does. Or maybe I'm reading it wrong. I'm not sure we need all of that because we have a "normal" way to query for all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could totally do a default constructor that sets it to
_all
and ensure this one does not do that behavior w the null check