-
Notifications
You must be signed in to change notification settings - Fork 25.2k
HLRC: execute watch API #35868
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: execute watch API #35868
Conversation
This reverts commit 7a462df.
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.
Small nits, one question.
@@ -97,6 +101,30 @@ static Request deleteWatch(DeleteWatchRequest deleteWatchRequest) { | |||
return request; | |||
} | |||
|
|||
static Request executeWatch(ExecuteWatchRequest executeWatchRequest) throws IOException { | |||
RequestConverters.EndpointBuilder builder = new RequestConverters.EndpointBuilder() | |||
.addPathPart("_xpack", "watcher", "watch"); |
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 can be .addPathPartAsIs
since they are not user supplied.
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.
++
RequestConverters.EndpointBuilder builder = new RequestConverters.EndpointBuilder() | ||
.addPathPart("_xpack", "watcher", "watch"); | ||
if (executeWatchRequest.getId() != null) { | ||
builder.addPathPart(executeWatchRequest.getId()); |
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.
addPathPart wont "build" anything thats null, so u can just call it instead of checking for null.
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.
++
|
||
request.setActionMode("action1", ExecuteWatchRequest.ActionExecutionMode.SIMULATE); | ||
|
||
String triggerData = "{ \"entry1\" : \"blah\", \"entry2\" : \"blah\" }"; |
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.
are these mandatory? if they can be null pls add some random()
here. If they cant be null then pls add them to the constructor as final's if possible :)
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.
++
...core/src/main/java/org/elasticsearch/xpack/core/watcher/support/xcontent/XContentSource.java
Show resolved
Hide resolved
Thanks @hub-cap, I pushed some changes to address your comments. |
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.
one minor nit. Also, something to note is that there is a PR that is conflicting with this that removes _xpack
from the HLRC and tests etc... If it merges first, ill link it to you, otherwise you win and I have to do the work ;)
builder.addPathPart(executeWatchRequest.getId()); | ||
} | ||
.addPathPartAsIs("_xpack", "watcher", "watch"); | ||
builder.addPathPart(executeWatchRequest.getId()); // will ignore if ID is null |
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.
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack", "watcher", "watch")
.addPathPart(...getId())
.addPathPartAsIs("_execute").build()
run the gradle build tests 2 |
This change adds support for the execute watch API in the high level rest client
Relates to #29827