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

Created SDK Client to interact with OpenSearch #67

Merged
merged 12 commits into from
Aug 23, 2022

Conversation

owaiskazi19
Copy link
Member

@owaiskazi19 owaiskazi19 commented Jul 29, 2022

Description

Created SDK Client to interact with OpenSearch for request calls required by the extensions. Once #20 is done, the next step would be to integrate SDK with the feature/extensions branch of AD to convert the AD plugin to extension. This client will help us to make the API calls from AD extension to OpenSearch.

Build will fail as opensearch-project/OpenSearch#4197 should be merged first

Issues Resolved

Closes #66

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.

@owaiskazi19 owaiskazi19 requested a review from a team July 29, 2022 20:40
Copy link
Member

@dbwiddis dbwiddis left a comment

Choose a reason for hiding this comment

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

Need to decide what connection and authentication protocols we want to use so we can build this securely from the start.

src/main/java/org/opensearch/sdk/SDKClient.java Outdated Show resolved Hide resolved
src/main/java/org/opensearch/sdk/SDKClient.java Outdated Show resolved Hide resolved
src/main/java/org/opensearch/sdk/SDKClient.java Outdated Show resolved Hide resolved
src/main/java/org/opensearch/sdk/SDKClient.java Outdated Show resolved Hide resolved
src/test/java/org/opensearch/sdk/TestSDKClient.java Outdated Show resolved Hide resolved
src/test/java/org/opensearch/sdk/FailingTransport.java Outdated Show resolved Hide resolved
build.gradle Show resolved Hide resolved
src/main/java/org/opensearch/sdk/SDKClient.java Outdated Show resolved Hide resolved
src/main/java/org/opensearch/sdk/SDKClient.java Outdated Show resolved Hide resolved
src/main/java/org/opensearch/sdk/SDKClient.java Outdated Show resolved Hide resolved
src/test/java/org/opensearch/sdk/FailingTransport.java Outdated Show resolved Hide resolved
src/main/java/org/opensearch/sdk/SDKClient.java Outdated Show resolved Hide resolved
*/
public OpenSearchClient createClient(String hostAddress, int port) throws IOException {
RestClientBuilder builder = RestClient.builder(new HttpHost(hostAddress, port));
builder.setStrictDeprecationMode(true);
Copy link
Member

Choose a reason for hiding this comment

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

Curious, what does this do?
Side note: I could only find elasticsearch documentation[1].
@VachaShah

[1] https://javadoc.io/static/org.elasticsearch.client/elasticsearch-rest-client/6.8.3/org/elasticsearch/client/RestClientBuilder.html

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
src/main/java/org/opensearch/sdk/ExtensionsRunner.java Outdated Show resolved Hide resolved
src/main/java/org/opensearch/sdk/ExtensionsRunner.java Outdated Show resolved Hide resolved
src/main/java/org/opensearch/sdk/SDKClient.java Outdated Show resolved Hide resolved
src/main/java/org/opensearch/sdk/SDKClient.java Outdated Show resolved Hide resolved
src/main/java/org/opensearch/sdk/SDKClient.java Outdated Show resolved Hide resolved
src/main/java/org/opensearch/sdk/SDKClient.java Outdated Show resolved Hide resolved
src/main/java/org/opensearch/sdk/SDKClient.java Outdated Show resolved Hide resolved
src/test/java/org/opensearch/sdk/FailingTransport.java Outdated Show resolved Hide resolved
src/test/java/org/opensearch/sdk/TestSDKClient.java Outdated Show resolved Hide resolved
Signed-off-by: Owais Kazi <[email protected]>
Signed-off-by: Owais Kazi <[email protected]>
@owaiskazi19 owaiskazi19 requested a review from dbwiddis August 22, 2022 20:11
dbwiddis
dbwiddis previously approved these changes Aug 22, 2022
Copy link
Member

@dbwiddis dbwiddis left a comment

Choose a reason for hiding this comment

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

LGTM. I'm still a bit confused on the client naming stuff, but that can be clarified in later PRs.

src/main/java/org/opensearch/sdk/SDKClient.java Outdated Show resolved Hide resolved
src/main/java/org/opensearch/sdk/SDKClient.java Outdated Show resolved Hide resolved
Signed-off-by: Owais Kazi <[email protected]>
@joshpalis joshpalis self-requested a review August 23, 2022 17:10
@owaiskazi19 owaiskazi19 merged commit 7af4f07 into opensearch-project:main Aug 23, 2022
@dblock
Copy link
Member

dblock commented Oct 5, 2022

Is it strange that the SDK depends on the Java client? 🤔 Would the Java client itself ever want to use the SDK?

@saratvemulapalli
Copy link
Member

@dblock thats a good question.
SDK uses RestAPIs to talk to OpenSearch instead of using traditional internal client built by OpenSearch and handed over to plugins[1].

Do you think the java client would ever need to use the SDK?

[1] https://github.com/opensearch-project/OpenSearch/blob/main/server/src/main/java/org/opensearch/plugins/Plugin.java#L141

@dblock
Copy link
Member

dblock commented Oct 6, 2022

I can't come up with an example, I came from an angle of wanting the SDK to have its dependencies to a minimum, but I suppose until I have a good reason things should remain as is ;)

kokibas pushed a commit to kokibas/opensearch-sdk-java that referenced this pull request Mar 17, 2023
* Integrated SDK Client to make request to OpenSearch

Signed-off-by: Owais Kazi <[email protected]>

* Added test and restructure SDK

Signed-off-by: Owais Kazi <[email protected]>

* Added license

Signed-off-by: Owais Kazi <[email protected]>

* Send config from initial request

Signed-off-by: Owais Kazi <[email protected]>

* Utilized the hostaddress and port from extension initialize request

Signed-off-by: Owais Kazi <[email protected]>

* Integrated SDK Client to make request to OpenSearch

Signed-off-by: Owais Kazi <[email protected]>

* Added test and restructure SDK

Signed-off-by: Owais Kazi <[email protected]>

* Removed security related attributes

Signed-off-by: Owais Kazi <[email protected]>

* Updated branch

Signed-off-by: Owais Kazi <[email protected]>

* PR comments

Signed-off-by: Owais Kazi <[email protected]>

* Changed the method name

Signed-off-by: Owais Kazi <[email protected]>

* Small changes

Signed-off-by: Owais Kazi <[email protected]>

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

Successfully merging this pull request may close these issues.

[FEATURE] Create SDKClient to interact with OpenSearch
6 participants