-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
HLRC: Add support for XPack Post Start Basic Licence API #33606
HLRC: Add support for XPack Post Start Basic Licence API #33606
Conversation
Pinging @elastic/es-core-infra |
3ac4964
to
71d6de1
Compare
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, assuming that you will fix the formatting issue and the test pass. Maybe @hub-cap should give it a look as well.
@elasticmachine test this please |
@hub-cap could you please have a look as well ? |
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.
Lets drop the word post from all this, as we want to keep it to just the name of the action. Of course, in the request converters we will know its a POST, but the HL client should be agnostic of this. Also please move the stuff you put back in protocol
back. Sorry about any confusion, the rest client has been in lots of flux.
x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java
Outdated
Show resolved
Hide resolved
...ugin/core/src/main/java/org/elasticsearch/protocol/xpack/license/PostStartBasicResponse.java
Outdated
Show resolved
Hide resolved
as mentioned in #33406 (review), we need to add a |
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.
Great work so far. Some stuff to address below, nothing huge.
import org.elasticsearch.action.support.master.AcknowledgedRequest; | ||
|
||
public class PostStartBasicRequest extends AcknowledgedRequest<PostStartBasicRequest> { | ||
private boolean acknowledge = false; |
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.
pls make this boolean final and remove the setter.
import static org.elasticsearch.common.xcontent.ConstructingObjectParser.optionalConstructorArg; | ||
import static org.elasticsearch.common.xcontent.XContentParserUtils.ensureExpectedToken; | ||
|
||
public class PostStartBasicResponse extends AcknowledgedResponse { |
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.
This class looks like it has a lot of extra stuff that is not needed. In general, we do not need from/to transport serialization. Do we need addCustomFields, as its also toXContent related.
return new PostStartBasicResponse(status, acknowledgements.v2(), acknowledgements.v1()); | ||
}); | ||
|
||
private static final ParseField BASIC_WAS_STARTED = new ParseField("basic_was_started"); |
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.
private Map<String, String[]> acknowledgeMessages; | ||
private String acknowledgeMessage; | ||
|
||
public enum Status { |
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.
is this a more common class that can be used elsewhere? if so, lets break it out to its own class, and put it in the same package.
import java.util.Map; | ||
import java.util.function.Predicate; | ||
|
||
public class PostStartBasicResponseTests extends AbstractStreamableXContentTestCase<PostStartBasicResponse> { |
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.
These will have to change as well, once you remove the ToXContent portion of the response. You will have to manually construct the parser and then pass that in to the fromXContent of the response.
@@ -0,0 +1,55 @@ | |||
[[java-rest-high-post-start-basic]] |
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.
You may want to lift some of the wording from the very similar PR ive linked here, https://github.com/elastic/elasticsearch/blob/07554dda3b4bb2e2871d913f00e3cead0cedeeb4/docs/java-rest/high-level/licensing/start-trial.asciidoc .
Pls also add a LicenseRequestConvertersTests to test your request converter. |
@elasticmachine test this 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.
LGTM, one nit then you can merge
} | ||
|
||
@Override | ||
public ActionRequestValidationException validate() { |
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.
You can leave this out if you are not using it
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.
with ccbc485 StartBasicRequest
extends TimedRequest
, added couple test routines for that
there is a dependency for tests on #33406 - I'd rather wait for start trial license to be merged |
if you want to merge, you can always just stub in some Low level rest calls and then @andyb-elastic can clean them up in his PR ;) |
@hub-cap thanks for the tip: in fact there are several ways (at least 2) on how to solve the problem:
for now I rely on a hard coded trial license approach |
Ahh right it was this issue, and I discussed with @andyb-elastic and he is going to make a new PR with the changes to make a new cluster with the different license test requirements. So it might make sense to merge this and backport it and await his change, so you can also make your change. Your call. |
thanks @hub-cap for comments 👍 |
Right, looks like you got the case where it starts a basic license working by manually setting a trial license. I'm working on a PR to run the license IT in a separate gradle project (we ran into some issues getting it to work with multiple clusters in the same project) |
HLRC: Add support for XPack Post Start Basic Licence API
Relates to #29827