Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/main/java/org/opensearch/sdk/ExtensionSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/
package org.opensearch.sdk;

import java.util.List;

/**
* This class encapsulates the settings for an Extension.
*/
Expand All @@ -15,6 +17,7 @@ public class ExtensionSettings {
private String extensionName;
private String hostAddress;
private String hostPort;
private List<String> api;

/**
* Placeholder field. Change the location to extension.yml file of the extension.
Expand All @@ -40,9 +43,20 @@ public String getHostPort() {
return hostPort;
}

public List<String> getApi() {
return api;
}

@Override
public String toString() {
return "\nnodename: " + extensionName + "\nhostaddress: " + hostAddress + "\nhostPort: " + hostPort + "\n";
return "ExtensionSettings {extensionName="
+ extensionName
+ ", hostAddress="
+ hostAddress
+ ", hostPort="
+ hostPort
+ ", api="
+ api
+ "}";
}

}
4 changes: 2 additions & 2 deletions src/main/java/org/opensearch/sdk/ExtensionsRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@ public DiscoveryNode getOpensearchNode() {
* Handles a plugin request from OpenSearch. This is the first request for the transport communication and will initialize the extension and will be a part of OpenSearch bootstrap.
*
* @param pluginRequest The request to handle.
* @return A response to OpenSearch validating that this is an extension.
* @return A response to OpenSearch with the extension name and API.
*/
PluginResponse handlePluginsRequest(PluginRequest pluginRequest) {
logger.info("Registering Plugin Request received from OpenSearch");
PluginResponse pluginResponse = new PluginResponse(extensionSettings.getExtensionName());
PluginResponse pluginResponse = new PluginResponse(extensionSettings.getExtensionName(), extensionSettings.getApi());
opensearchNode = pluginRequest.getSourceNode();
setOpensearchNode(opensearchNode);
return pluginResponse;
Expand Down
4 changes: 4 additions & 0 deletions src/test/resources/extension.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
extensionName: extension
hostAddress: 127.0.0.1
hostPort: 4532
api:
- API1
- API2
- API3