Skip to content

Conversation

@colings86
Copy link
Contributor

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:

  1. 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
  2. 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.

In either case I'm not sure its a good idea to expose the current PutOperationModeRequest class 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 OperationMode enum itself is not particular user friendly since its values are RUNNING, STOPPING and STOPPED which relate to the state ILM is in not what you want to do as a user and also because PutOperationModeRequest rejects STOPPED because you can't go from RUNNING straight to STOPPED and this is an implementation detail the user should not need to be concerned with when they use this API

Open to thoughts.

@colings86 colings86 added the :Data Management/ILM+SLM Index and Snapshot lifecycle management label Aug 3, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@colings86
Copy link
Contributor Author

Any thoughts on my suggestions above?

@talevy
Copy link
Contributor

talevy commented Aug 8, 2018

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.

Copy link
Member

@dakrone dakrone left a 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:

  1. 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
  2. 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.

Copy link
Member

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

@colings86
Copy link
Contributor Author

@dakrone @talevy I've pushed a commit which adds StartILMAction and StopILMAction and all the relevant classes to support it on the REST layer and in the REST client. Could you take a look?

@colings86 colings86 changed the title Adds REST client support for PutOperationMode in ILM Adds REST client support for starting and stopping ILM Aug 9, 2018
Copy link
Member

@dakrone dakrone left a 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

Copy link
Member

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)

Copy link
Member

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

Copy link
Member

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)

Copy link
Contributor Author

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

Copy link
Member

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)

Copy link
Member

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?

Copy link
Member

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

Copy link
Member

Choose a reason for hiding this comment

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

Another to remove

@colings86
Copy link
Contributor Author

@dakrone I pushed a commit that should address your comments

Copy link
Member

@dakrone dakrone left a comment

Choose a reason for hiding this comment

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

LGTM, thanks Colin!

@colings86 colings86 merged commit 8750d62 into elastic:index-lifecycle Aug 9, 2018
@colings86 colings86 deleted the ilm/rest-operation-mode branch August 9, 2018 19:39
jasontedor pushed a commit that referenced this pull request Aug 17, 2018
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Data Management/ILM+SLM Index and Snapshot lifecycle management

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants