Skip to content
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

Create SDKRestClient wrapper class around RestHighLevelClient #367

Merged
merged 3 commits into from
Jan 30, 2023

Conversation

dbwiddis
Copy link
Member

Signed-off-by: Daniel Widdis [email protected]

Description

Creates a wrapper class translating the Client class method signatures to RestHighLevelClient methods. Existing code making the various REST calls does not need to change (mostly) except for:

  • Imports may change
  • Occasional minor differences in response class parsing (e.g., List vs. Set, Iterables vs. Map entrySet, etc.)

Massively speeds the process of migrating existing plugins.

Notes:

  • Committed deprecated, so nobody should use it for new code.
    • Intentionally only partially implementing Client interface, to minimize the (deprecated) footprint to what is necessary
    • We can add new wrapper methods as we come across them
  • Cluster client is a placeholder, need to actually implement cluster-level features

Issues Resolved

Part of #353

By 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.

@codecov-commenter
Copy link

codecov-commenter commented Jan 25, 2023

Codecov Report

Merging #367 (7546ee6) into main (c62c90e) will increase coverage by 1.53%.
The diff coverage is 87.09%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@             Coverage Diff              @@
##               main     #367      +/-   ##
============================================
+ Coverage     69.35%   70.89%   +1.53%     
- Complexity      126      128       +2     
============================================
  Files            27       27              
  Lines           558      584      +26     
  Branches         15       15              
============================================
+ Hits            387      414      +27     
  Misses          162      162              
+ Partials          9        8       -1     
Impacted Files Coverage Δ
src/main/java/org/opensearch/sdk/SDKClient.java 89.39% <87.09%> (+9.39%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Signed-off-by: Daniel Widdis <[email protected]>
owaiskazi19
owaiskazi19 previously approved these changes Jan 28, 2023
Copy link
Member

@owaiskazi19 owaiskazi19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nits. This wrapper class would definitely ease the migration for a plugin to an extension. Thanks @dbwiddis for this!

src/test/java/org/opensearch/sdk/TestSDKClient.java Outdated Show resolved Hide resolved
src/main/java/org/opensearch/sdk/SDKClient.java Outdated Show resolved Hide resolved
Signed-off-by: Daniel Widdis <[email protected]>
@saratvemulapalli saratvemulapalli merged commit 6f26cae into opensearch-project:main Jan 30, 2023
@dbwiddis dbwiddis deleted the rest-client branch January 30, 2023 18:58
opensearch-trigger-bot bot pushed a commit that referenced this pull request Feb 3, 2023
* RestHighLevelClient Wrapper

Signed-off-by: Daniel Widdis <[email protected]>

* Address code review comments

Signed-off-by: Daniel Widdis <[email protected]>

* Add admin method returning the underlying SDKClient

Signed-off-by: Daniel Widdis <[email protected]>

---------

Signed-off-by: Daniel Widdis <[email protected]>
(cherry picked from commit 6f26cae)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
ryanbogan pushed a commit that referenced this pull request Feb 3, 2023
…408)

* RestHighLevelClient Wrapper



* Address code review comments



* Add admin method returning the underlying SDKClient



---------


(cherry picked from commit 6f26cae)

Signed-off-by: Daniel Widdis <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
kokibas pushed a commit to kokibas/opensearch-sdk-java that referenced this pull request Mar 17, 2023
…arch-project#367)

* RestHighLevelClient Wrapper

Signed-off-by: Daniel Widdis <[email protected]>

* Address code review comments

Signed-off-by: Daniel Widdis <[email protected]>

* Add admin method returning the underlying SDKClient

Signed-off-by: Daniel Widdis <[email protected]>

---------

Signed-off-by: Daniel Widdis <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants