Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ private WatcherRequestConverters() {}

static Request startWatchService(StartWatchServiceRequest startWatchServiceRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack")
.addPathPartAsIs("watcher")
.addPathPartAsIs("_watcher")
.addPathPartAsIs("_start")
.build();

Expand All @@ -56,8 +55,7 @@ static Request startWatchService(StartWatchServiceRequest startWatchServiceReque

static Request stopWatchService(StopWatchServiceRequest stopWatchServiceRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack")
.addPathPartAsIs("watcher")
.addPathPartAsIs("_watcher")
.addPathPartAsIs("_stop")
.build();

Expand All @@ -66,7 +64,7 @@ static Request stopWatchService(StopWatchServiceRequest stopWatchServiceRequest)

static Request putWatch(PutWatchRequest putWatchRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack", "watcher", "watch")
.addPathPartAsIs("_watcher", "watch")
.addPathPart(putWatchRequest.getId())
.build();

Expand All @@ -84,7 +82,7 @@ static Request putWatch(PutWatchRequest putWatchRequest) {

static Request getWatch(GetWatchRequest getWatchRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack", "watcher", "watch")
.addPathPartAsIs("_watcher", "watch")
.addPathPart(getWatchRequest.getId())
.build();

Expand All @@ -93,8 +91,7 @@ static Request getWatch(GetWatchRequest getWatchRequest) {

static Request deactivateWatch(DeactivateWatchRequest deactivateWatchRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack")
.addPathPartAsIs("watcher")
.addPathPartAsIs("_watcher")
.addPathPartAsIs("watch")
.addPathPart(deactivateWatchRequest.getWatchId())
.addPathPartAsIs("_deactivate")
Expand All @@ -104,7 +101,7 @@ static Request deactivateWatch(DeactivateWatchRequest deactivateWatchRequest) {

static Request deleteWatch(DeleteWatchRequest deleteWatchRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack", "watcher", "watch")
.addPathPartAsIs("_watcher", "watch")
.addPathPart(deleteWatchRequest.getId())
.build();

Expand All @@ -114,7 +111,7 @@ static Request deleteWatch(DeleteWatchRequest deleteWatchRequest) {

static Request executeWatch(ExecuteWatchRequest executeWatchRequest) throws IOException {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack", "watcher", "watch")
.addPathPartAsIs("_watcher", "watch")
.addPathPart(executeWatchRequest.getId()) // will ignore if ID is null
.addPathPartAsIs("_execute").build();

Expand All @@ -136,7 +133,7 @@ static Request executeWatch(ExecuteWatchRequest executeWatchRequest) throws IOEx

public static Request ackWatch(AckWatchRequest ackWatchRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack", "watcher", "watch")
.addPathPartAsIs("_watcher", "watch")
.addPathPart(ackWatchRequest.getWatchId())
.addPathPartAsIs("_ack")
.addCommaSeparatedPathParts(ackWatchRequest.getActionIds())
Expand All @@ -147,7 +144,7 @@ public static Request ackWatch(AckWatchRequest ackWatchRequest) {

static Request activateWatch(ActivateWatchRequest activateWatchRequest) {
String endpoint = new RequestConverters.EndpointBuilder()
.addPathPartAsIs("_xpack", "watcher", "watch")
.addPathPartAsIs("_watcher", "watch")
.addPathPart(activateWatchRequest.getWatchId())
.addPathPartAsIs("_activate")
.build();
Expand All @@ -156,7 +153,7 @@ static Request activateWatch(ActivateWatchRequest activateWatchRequest) {
}

static Request watcherStats(WatcherStatsRequest watcherStatsRequest) {
RequestConverters.EndpointBuilder builder = new RequestConverters.EndpointBuilder().addPathPartAsIs("_xpack", "watcher", "stats");
RequestConverters.EndpointBuilder builder = new RequestConverters.EndpointBuilder().addPathPartAsIs("_watcher", "stats");
String endpoint = builder.build();
Request request = new Request(HttpGet.METHOD_NAME, endpoint);
RequestConverters.Params parameters = new RequestConverters.Params(request);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public void testAckWatch() throws Exception {
assertEquals(AckStatus.State.AWAITS_SUCCESSFUL_EXECUTION, actionStatus.ackStatus().state());

// TODO: use the high-level REST client here once it supports 'execute watch'.
Request executeWatchRequest = new Request("POST", "_xpack/watcher/watch/" + watchId + "/_execute");
Request executeWatchRequest = new Request("POST", "_watcher/watch/" + watchId + "/_execute");
executeWatchRequest.setJsonEntity("{ \"record_execution\": true }");
Response executeResponse = client().performRequest(executeWatchRequest);
assertEquals(RestStatus.OK.getStatus(), executeResponse.getStatusLine().getStatusCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ private static String toString(HttpEntity entity) throws IOException {
public void testStartWatchService() {
Request request = WatcherRequestConverters.startWatchService(new StartWatchServiceRequest());
assertEquals(HttpPost.METHOD_NAME, request.getMethod());
assertEquals("/_xpack/watcher/_start", request.getEndpoint());
assertEquals("/_watcher/_start", request.getEndpoint());
}

public void testStopWatchService() {
Request request = WatcherRequestConverters.stopWatchService(new StopWatchServiceRequest());
assertEquals(HttpPost.METHOD_NAME, request.getMethod());
assertEquals("/_xpack/watcher/_stop", request.getEndpoint());
assertEquals("/_watcher/_stop", request.getEndpoint());
}

public void testPutWatch() throws Exception {
Expand All @@ -95,7 +95,7 @@ public void testPutWatch() throws Exception {

Request request = WatcherRequestConverters.putWatch(putWatchRequest);
assertEquals(HttpPut.METHOD_NAME, request.getMethod());
assertEquals("/_xpack/watcher/watch/" + watchId, request.getEndpoint());
assertEquals("/_watcher/watch/" + watchId, request.getEndpoint());
assertEquals(expectedParams, request.getParameters());
assertThat(request.getEntity().getContentType().getValue(), is(XContentType.JSON.mediaTypeWithoutParameters()));
ByteArrayOutputStream bos = new ByteArrayOutputStream();
Expand All @@ -109,7 +109,7 @@ public void testGetWatch() throws Exception {

Request request = WatcherRequestConverters.getWatch(getWatchRequest);
assertEquals(HttpGet.METHOD_NAME, request.getMethod());
assertEquals("/_xpack/watcher/watch/" + watchId, request.getEndpoint());
assertEquals("/_watcher/watch/" + watchId, request.getEndpoint());
assertThat(request.getEntity(), nullValue());
}

Expand All @@ -119,7 +119,7 @@ public void testDeactivateWatch() {
Request request = WatcherRequestConverters.deactivateWatch(deactivateWatchRequest);

assertEquals(HttpPut.METHOD_NAME, request.getMethod());
assertEquals("/_xpack/watcher/watch/" + watchId + "/_deactivate", request.getEndpoint());
assertEquals("/_watcher/watch/" + watchId + "/_deactivate", request.getEndpoint());
}

public void testDeleteWatch() {
Expand All @@ -128,7 +128,7 @@ public void testDeleteWatch() {

Request request = WatcherRequestConverters.deleteWatch(deleteWatchRequest);
assertEquals(HttpDelete.METHOD_NAME, request.getMethod());
assertEquals("/_xpack/watcher/watch/" + watchId, request.getEndpoint());
assertEquals("/_watcher/watch/" + watchId, request.getEndpoint());
assertThat(request.getEntity(), nullValue());
}

Expand All @@ -142,7 +142,7 @@ public void testAckWatch() {
assertEquals(HttpPut.METHOD_NAME, request.getMethod());

StringJoiner expectedEndpoint = new StringJoiner("/", "/", "")
.add("_xpack").add("watcher").add("watch").add(watchId).add("_ack");
.add("_watcher").add("watch").add(watchId).add("_ack");
if (ackWatchRequest.getActionIds().length > 0) {
String actionsParam = String.join(",", ackWatchRequest.getActionIds());
expectedEndpoint.add(actionsParam);
Expand All @@ -158,7 +158,7 @@ public void testActivateWatchRequestConversion() {

Request request = WatcherRequestConverters.activateWatch(activateWatchRequest);
assertEquals(HttpPut.METHOD_NAME, request.getMethod());
assertEquals("/_xpack/watcher/watch/" + watchId + "/_activate", request.getEndpoint());
assertEquals("/_watcher/watch/" + watchId + "/_activate", request.getEndpoint());
assertThat(request.getEntity(), nullValue());
}

Expand All @@ -169,7 +169,7 @@ public void testWatcherStatsRequest() {
WatcherStatsRequest watcherStatsRequest = new WatcherStatsRequest(includeCurrent, includeQueued);

Request request = WatcherRequestConverters.watcherStats(watcherStatsRequest);
assertThat(request.getEndpoint(), equalTo("/_xpack/watcher/stats"));
assertThat(request.getEndpoint(), equalTo("/_watcher/stats"));
assertThat(request.getMethod(), equalTo(HttpGet.METHOD_NAME));
if (includeCurrent || includeQueued) {
assertThat(request.getParameters(), hasKey("metric"));
Expand Down Expand Up @@ -218,7 +218,7 @@ public void testExecuteWatchByIdRequest() throws IOException {
}

Request req = WatcherRequestConverters.executeWatch(request);
assertThat(req.getEndpoint(), equalTo("/_xpack/watcher/watch/my_id/_execute"));
assertThat(req.getEndpoint(), equalTo("/_watcher/watch/my_id/_execute"));
assertThat(req.getMethod(), equalTo(HttpPost.METHOD_NAME));

if (ignoreCondition) {
Expand Down Expand Up @@ -293,7 +293,7 @@ public void testExecuteInlineWatchRequest() throws IOException {
}

Request req = WatcherRequestConverters.executeWatch(request);
assertThat(req.getEndpoint(), equalTo("/_xpack/watcher/watch/_execute"));
assertThat(req.getEndpoint(), equalTo("/_watcher/watch/_execute"));
assertThat(req.getMethod(), equalTo(HttpPost.METHOD_NAME));

if (ignoreCondition) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ public void testAckWatch() throws Exception {
client.watcher().putWatch(putWatchRequest, RequestOptions.DEFAULT);

// TODO: use the high-level REST client here once it supports 'execute watch'.
Request executeWatchRequest = new Request("POST", "_xpack/watcher/watch/my_watch_id/_execute");
Request executeWatchRequest = new Request("POST", "_watcher/watch/my_watch_id/_execute");
executeWatchRequest.setJsonEntity("{ \"record_execution\": true }");
Response executeResponse = client().performRequest(executeWatchRequest);
assertEquals(RestStatus.OK.getStatus(), executeResponse.getStatusLine().getStatusCode());
Expand Down
22 changes: 11 additions & 11 deletions x-pack/docs/en/rest-api/watcher/ack-watch.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ execution.
[float]
==== Request

`PUT _xpack/watcher/watch/<watch_id>/_ack` +
`PUT _watcher/watch/<watch_id>/_ack` +

`PUT _xpack/watcher/watch/<watch_id>/_ack/<action_id>`
`PUT _watcher/watch/<watch_id>/_ack/<action_id>`

[float]
==== Path Parameters
Expand All @@ -42,7 +42,7 @@ To demonstrate let's create a new watch:

[source,js]
--------------------------------------------------
PUT _xpack/watcher/watch/my_watch
PUT _watcher/watch/my_watch
{
"trigger": {
"schedule": {
Expand Down Expand Up @@ -80,7 +80,7 @@ watch definition when you call the <<watcher-api-get-watch, Get Watch API>>:

[source,js]
--------------------------------------------------
GET _xpack/watcher/watch/my_watch
GET _watcher/watch/my_watch
--------------------------------------------------
// CONSOLE

Expand Down Expand Up @@ -117,12 +117,12 @@ check the status:

[source,js]
--------------------------------------------------
POST _xpack/watcher/watch/my_watch/_execute
POST _watcher/watch/my_watch/_execute
{
"record_execution" : true
}

GET _xpack/watcher/watch/my_watch
GET _watcher/watch/my_watch
--------------------------------------------------
// CONSOLE
// TEST[continued]
Expand Down Expand Up @@ -172,8 +172,8 @@ Now we can acknowledge it:

[source,js]
--------------------------------------------------
PUT _xpack/watcher/watch/my_watch/_ack/test_index
GET _xpack/watcher/watch/my_watch
PUT _watcher/watch/my_watch/_ack/test_index
GET _watcher/watch/my_watch
--------------------------------------------------
// CONSOLE
// TEST[continued]
Expand Down Expand Up @@ -226,7 +226,7 @@ comma-separated list of action ids:

[source,js]
--------------------------------------------------
POST _xpack/watcher/watch/my_watch/_ack/action1,action2
POST _watcher/watch/my_watch/_ack/action1,action2
--------------------------------------------------
// CONSOLE

Expand All @@ -235,9 +235,9 @@ parameter:

[source,js]
--------------------------------------------------
POST _xpack/watcher/watch/my_watch/_ack
POST _watcher/watch/my_watch/_ack
--------------------------------------------------
// TEST[s/^/POST _xpack\/watcher\/watch\/my_watch\/_execute\n{ "record_execution" : true }\n/]
// TEST[s/^/POST _watcher\/watch\/my_watch\/_execute\n{ "record_execution" : true }\n/]
// CONSOLE


Expand Down
6 changes: 3 additions & 3 deletions x-pack/docs/en/rest-api/watcher/activate-watch.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ API enables you to activate a currently inactive watch.
[float]
==== Request

`PUT _xpack/watcher/watch/<watch_id>/_activate`
`PUT _watcher/watch/<watch_id>/_activate`

[float]
==== Path Parameters
Expand All @@ -31,7 +31,7 @@ call the <<watcher-api-get-watch, Get Watch API>>:

[source,js]
--------------------------------------------------
GET _xpack/watcher/watch/my_watch
GET _watcher/watch/my_watch
--------------------------------------------------
// CONSOLE
// TEST[setup:my_inactive_watch]
Expand Down Expand Up @@ -62,7 +62,7 @@ You can activate the watch by executing the following API call:

[source,js]
--------------------------------------------------
PUT _xpack/watcher/watch/my_watch/_activate
PUT _watcher/watch/my_watch/_activate
--------------------------------------------------
// CONSOLE
// TEST[setup:my_inactive_watch]
Expand Down
6 changes: 3 additions & 3 deletions x-pack/docs/en/rest-api/watcher/deactivate-watch.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ API enables you to deactivate a currently active watch.
[float]
==== Request

`PUT _xpack/watcher/watch/<watch_id>/_deactivate`
`PUT _watcher/watch/<watch_id>/_deactivate`

[float]
==== Path Parameters
Expand All @@ -30,7 +30,7 @@ call the <<watcher-api-get-watch, Get Watch API>>:

[source,js]
--------------------------------------------------
GET _xpack/watcher/watch/my_watch
GET _watcher/watch/my_watch
--------------------------------------------------
// CONSOLE
// TEST[setup:my_active_watch]
Expand Down Expand Up @@ -61,7 +61,7 @@ You can deactivate the watch by executing the following API call:

[source,js]
--------------------------------------------------
PUT _xpack/watcher/watch/my_watch/_deactivate
PUT _watcher/watch/my_watch/_deactivate
--------------------------------------------------
// CONSOLE
// TEST[setup:my_active_watch]
Expand Down
4 changes: 2 additions & 2 deletions x-pack/docs/en/rest-api/watcher/delete-watch.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The DELETE watch API removes a watch from {watcher}.
[float]
==== Request

`DELETE _xpack/watcher/watch/<watch_id>`
`DELETE _watcher/watch/<watch_id>`

[float]
==== Description
Expand Down Expand Up @@ -42,7 +42,7 @@ The following example deletes a watch with the `my-watch` id:

[source,js]
--------------------------------------------------
DELETE _xpack/watcher/watch/my_watch
DELETE _watcher/watch/my_watch
--------------------------------------------------
// CONSOLE
// TEST[setup:my_active_watch]
Expand Down
Loading