-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Added rest layer changes for List all PITs and PIT segments #4388
Merged
Bukhtawar
merged 18 commits into
opensearch-project:main
from
bharath-techie:listsegmentsfinal
Sep 25, 2022
Merged
Changes from 11 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
18c5be0
Changes for list all and pit segments
bharath-techie 8c97d73
Adding rest tests
bharath-techie 5167a2c
Fixes for security
bharath-techie 13b5f4c
Fixing build and addressing comment
bharath-techie 660b3d5
Addressing comment
bharath-techie 2f65bf6
Merge branch 'main' of https://github.com/opensearch-project/OpenSear…
bharath-techie bf4c52d
Fixes for cross cluster
bharath-techie ba70d3e
Security model changes
bharath-techie cc67e75
Security model changes
bharath-techie 85b89fd
Merge branch 'main' of https://github.com/opensearch-project/OpenSear…
bharath-techie 46f9382
modifying action name
bharath-techie 090ccff
Addressing comments
bharath-techie c227b9b
Merge branch 'main' of https://github.com/opensearch-project/OpenSear…
bharath-techie fc48cfb
Merge branch 'main' of https://github.com/opensearch-project/OpenSear…
bharath-techie bb950d3
changes as per new security model
bharath-techie aa3b57a
Addressing comments
bharath-techie 261d78a
Merge branch 'main' of https://github.com/opensearch-project/OpenSear…
bharath-techie 2898976
Merge branch 'main' of https://github.com/opensearch-project/OpenSear…
bharath-techie 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
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
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
19 changes: 19 additions & 0 deletions
19
rest-api-spec/src/main/resources/rest-api-spec/api/get_all_pits.json
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,19 @@ | ||
{ | ||
"get_all_pits":{ | ||
"documentation":{ | ||
"url":"https://opensearch.org/docs/latest/opensearch/rest-api/point_in_time/", | ||
"description":"Lists all active point in time searches." | ||
}, | ||
"stability":"stable", | ||
"url":{ | ||
"paths":[ | ||
{ | ||
"path":"/_search/point_in_time/_all", | ||
"methods":[ | ||
"GET" | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} |
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
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 | ||||
---|---|---|---|---|---|---|
|
@@ -13,6 +13,7 @@ | |||||
import org.opensearch.common.Strings; | ||||||
import org.opensearch.common.io.stream.StreamInput; | ||||||
import org.opensearch.common.io.stream.StreamOutput; | ||||||
import org.opensearch.common.xcontent.XContentParser; | ||||||
|
||||||
import java.io.IOException; | ||||||
import java.util.ArrayList; | ||||||
|
@@ -84,4 +85,37 @@ public ActionRequestValidationException validate() { | |||||
} | ||||||
return validationException; | ||||||
} | ||||||
|
||||||
public void fromXContent(XContentParser parser) throws IOException { | ||||||
pitIds.clear(); | ||||||
if (parser.nextToken() != XContentParser.Token.START_OBJECT) { | ||||||
throw new IllegalArgumentException("Malformed content, must start with an object"); | ||||||
} else { | ||||||
XContentParser.Token token; | ||||||
String currentFieldName = null; | ||||||
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) { | ||||||
if (token == XContentParser.Token.FIELD_NAME) { | ||||||
currentFieldName = parser.currentName(); | ||||||
} else if ("pit_id".equals(currentFieldName)) { | ||||||
if (token == XContentParser.Token.START_ARRAY) { | ||||||
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) { | ||||||
if (token.isValue() == false) { | ||||||
throw new IllegalArgumentException("pit_id array element should only contain pit_id"); | ||||||
} | ||||||
pitIds.add(parser.text()); | ||||||
} | ||||||
} else { | ||||||
if (token.isValue() == false) { | ||||||
throw new IllegalArgumentException("pit_id element should only contain pit_id"); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} | ||||||
pitIds.add(parser.text()); | ||||||
} | ||||||
} else { | ||||||
throw new IllegalArgumentException( | ||||||
"Unknown parameter [" + currentFieldName + "] in request body or parameter is of the wrong type[" + token + "] " | ||||||
); | ||||||
} | ||||||
} | ||||||
} | ||||||
} | ||||||
} |
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
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.