-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Adds REST client support for starting and stopping ILM #32609
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
Adds REST client support for starting and stopping ILM #32609
Conversation
|
Pinging @elastic/es-core-infra |
|
Any thoughts on my suggestions above? |
|
I prefer (1.) I re-used the same transport request for simplicity under the hood, I do not think this consolidation should be exposed to the user, and users should see specific objects that reflect what they can or cannot do. |
dakrone
left a comment
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 this is the best way to expose this API. I think given the REST api for this API are separate endpoints (_ilm/start and _ilm/stop) that we should either:
- Split this API into two on the transport layer as well and have a StartILMAction and a StopILMAction with their own request and response objects
- Keep the action as is but hide the PutOperationRequest from the user and have the client expose a PutOperationModeResponse startILM(RequestiOptions) method and a PutOperationModeResponse stopILM(RequestOptions) method.
I think I'm more in favor of option 1, even though it will require slightly more code.
I think this helps us not have to expose the PutOperationModeRequest and the Enum that (I agree) is not particularly friendly to a user. So whatever we can do to avoid exposing that would be great.
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.
Think it'd be worth renaming this to putLifecycleOperationMode? I'm worried the name is too generic for a gigantic file that isn't specific to ILM
dakrone
left a comment
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 left some comments, could you remove the new Response classes and use AcknowledgedResponse everywhere please
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.
Indentation is off here and the line below (super minor)
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.
Same here about indentation now
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.
How did we arrive at this? (not critiquing, just curious)
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.
random number so no method to pick it really. The problem is that we need to be able to do equality so it has to have some value. Ideally I would have an INSTANCE constant and make the constructor private but the Streamable serialisation relies on the constructor being public
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.
Can you remove this class entirely in favor of just returning AcknowledgedResponse? (similar to #32722)
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.
Can you also remove this one in favor of AcknowledgedRequest?
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.
Whoops sorry, ignore this, should only change the Response ones
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.
Another to remove
|
@dakrone I pushed a commit that should address your comments |
dakrone
left a comment
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.
LGTM, thanks Colin!
* Adds REST client support for PutOperationMode in ILM * Corrects licence headers * iter * add request converter test * Fixes tests * Creates start and stop actions for controlling ILM operation * Addresses review comments
Not sure if this is the best way to expose this API. I think given the REST api for this API are separate endpoints (
_ilm/startand_ilm/stop) that we should either:StartILMActionand aStopILMActionwith their own request and response objectsPutOperationRequestfrom the user and have the client expose aPutOperationModeResponse startILM(RequestiOptions)method and aPutOperationModeResponse stopILM(RequestOptions)method.In either case I'm not sure its a good idea to expose the current
PutOperationModeRequestclass to the user since its not particularly user friendly because:a. As far as the user is concerned what they want to do is start and stop ILM not put it into an "operation mode"
b. The
OperationModeenum itself is not particular user friendly since its values areRUNNING,STOPPINGandSTOPPEDwhich relate to the state ILM is in not what you want to do as a user and also becausePutOperationModeRequestrejectsSTOPPEDbecause you can't go fromRUNNINGstraight toSTOPPEDand this is an implementation detail the user should not need to be concerned with when they use this APIOpen to thoughts.