-
Notifications
You must be signed in to change notification settings - Fork 114
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
Enhances index, get, and delete snapshot management apis #369
Enhances index, get, and delete snapshot management apis #369
Conversation
Signed-off-by: Clay Downs <[email protected]>
Signed-off-by: Clay Downs <[email protected]>
src/main/kotlin/org/opensearch/indexmanagement/opensearchapi/OpenSearchExtensions.kt
Outdated
Show resolved
Hide resolved
...pensearch/indexmanagement/snapshotmanagement/api/transport/get/TransportGetSMPolicyAction.kt
Outdated
Show resolved
Hide resolved
...earch/indexmanagement/snapshotmanagement/api/transport/index/TransportIndexSMPolicyAction.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/org/opensearch/indexmanagement/snapshotmanagement/SMUtils.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/org/opensearch/indexmanagement/snapshotmanagement/SMUtils.kt
Outdated
Show resolved
Hide resolved
...earch/indexmanagement/snapshotmanagement/api/transport/index/TransportIndexSMPolicyAction.kt
Outdated
Show resolved
Hide resolved
...t/kotlin/org/opensearch/indexmanagement/snapshotmanagement/SnapshotManagementRestTestCase.kt
Outdated
Show resolved
Hide resolved
...t/kotlin/org/opensearch/indexmanagement/snapshotmanagement/SnapshotManagementRestTestCase.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/org/opensearch/indexmanagement/snapshotmanagement/model/SMPolicy.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/org/opensearch/indexmanagement/snapshotmanagement/model/SMPolicy.kt
Outdated
Show resolved
Hide resolved
Signed-off-by: Clay Downs <[email protected]>
Signed-off-by: Clay Downs <[email protected]>
src/main/kotlin/org/opensearch/indexmanagement/snapshotmanagement/SMUtils.kt
Outdated
Show resolved
Hide resolved
val smDoc = try { | ||
parser(getResponse) | ||
} catch (e: IllegalArgumentException) { | ||
throw OpenSearchStatusException("Snapshot management doc could not be parsed", RestStatus.NOT_FOUND) |
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.
Not sure if 404 is the correct response code for a parsing exception?
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.
Thanks, changed to INTERNAL_SERVER_ERROR. Do you think there is a better choice?
src/main/kotlin/org/opensearch/indexmanagement/snapshotmanagement/SMUtils.kt
Outdated
Show resolved
Hide resolved
return smMetadata | ||
} | ||
|
||
suspend fun <T> Client.getSMDoc(docID: String, parser: (GetResponse) -> T): T { |
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.
Is this used in multiple places or plan to be used in future for other things? Otherwise kind of seems like an over abstraction if it's just for the two above.. you might have ended up w/ even more lines of code than just explicitly implementing each above.
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.
I removed the abstraction, it is a bit more code now but I don't think getSMDoc would have been used again, and now the exception messages can be more precise.
Signed-off-by: Clay Downs <[email protected]>
Signed-off-by: Clay Downs [email protected]
Issue #, if available:
#280
Description of changes:
Fills out the index, get, and delete apis and adds in unit and integration tests.
Index
POST _plugins/_sm/policies/test-policyIn this pull request, get only may be used with a single policy. It will be expanded to include wildcards and lists of policies in a future PR.
Get
GET _plugins/_sm/policies/test-policyDelete
DELETE _plugins/_sm/policies/test-policyBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.