-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Labels
enhancementEnhancement or improvement to existing feature or requestEnhancement or improvement to existing feature or requestextensions
Description
Is your feature request related to a problem? Please describe.
One of the goals of extensibility is the ability to add/update/remove an extension without restarting the OpenSearch node.
What would the customer like to see/use:
c. Install/Update/Remove an extension without restarting OpenSearch.
Extensions provide their own REST API for methods/paths that they handle. Presently, the RestController only allows registering paths. There is no mechanism to:
- Test whether a method+path exists. The method for checking paths (
handleNoHandlerFound()) isprivateand the lower-levelgetAllHandlers()method it uses is package private.- This impacts the ability to unit test code which adds these methods as it can only be tested via IT of the resulting API
- Unregister a path. One can overwrite an implementation with a new one, but not remove it.
- This gets more complicated with different results when the path is handled but the method is not.
Describe the solution you'd like
- Provide a wrapper method that internally calls
handleNoHandlerFound()and exposes information via a Java method rather than simply failing a rest request. - Provide a means to remove a registered/handled rest path.
TLDR:
registerHandler(…)exists- I want
isHandlerRegistered(…)andunregisterHandler(…)methods
Describe alternatives you've considered
-
Test existence:
- Create a method to query the path via the REST API (
dispatchRequest()is the first public method that accesses this result) and parse theRestResponse. This would work but seems very inefficient compared to calling an existing (private) method. - Change the visibility of
handleNoHandlerFound()topublic, or at least package private with the calling method in the same package. This method isn't named very well for a public API method, though. - Create a new class in the same package to call the lower level
getAllHandlers()method. This is essentially duplicating the code ofhandleNoHandlerFound().
- Create a method to query the path via the REST API (
-
Unregister a path:
- Create an action which emulates the response of the "no handler found" code and "overwrite" the rest path to use this handler. Not unlike a custom 404 page saying "This page used to exist but it doesn't any more." This could provide misleading results to
OPTIONSqueries that indicated a method exists for a path, when it doesn't really.
- Create an action which emulates the response of the "no handler found" code and "overwrite" the rest path to use this handler. Not unlike a custom 404 page saying "This page used to exist but it doesn't any more." This could provide misleading results to
Additional context
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementEnhancement or improvement to existing feature or requestEnhancement or improvement to existing feature or requestextensions