Deprecate X-Pack centric watcher endpoints (#36218)
This commit is part of our plan to deprecate and ultimately remove the use of _xpack in the REST APIs. Relates #35958
This commit is contained in:
parent
9f86e996fe
commit
b5b6e37a60
|
@ -46,8 +46,7 @@ final class WatcherRequestConverters {
|
|||
|
||||
static Request startWatchService(StartWatchServiceRequest startWatchServiceRequest) {
|
||||
String endpoint = new RequestConverters.EndpointBuilder()
|
||||
.addPathPartAsIs("_xpack")
|
||||
.addPathPartAsIs("watcher")
|
||||
.addPathPartAsIs("_watcher")
|
||||
.addPathPartAsIs("_start")
|
||||
.build();
|
||||
|
||||
|
@ -56,8 +55,7 @@ final class WatcherRequestConverters {
|
|||
|
||||
static Request stopWatchService(StopWatchServiceRequest stopWatchServiceRequest) {
|
||||
String endpoint = new RequestConverters.EndpointBuilder()
|
||||
.addPathPartAsIs("_xpack")
|
||||
.addPathPartAsIs("watcher")
|
||||
.addPathPartAsIs("_watcher")
|
||||
.addPathPartAsIs("_stop")
|
||||
.build();
|
||||
|
||||
|
@ -66,7 +64,7 @@ final class WatcherRequestConverters {
|
|||
|
||||
static Request putWatch(PutWatchRequest putWatchRequest) {
|
||||
String endpoint = new RequestConverters.EndpointBuilder()
|
||||
.addPathPartAsIs("_xpack", "watcher", "watch")
|
||||
.addPathPartAsIs("_watcher", "watch")
|
||||
.addPathPart(putWatchRequest.getId())
|
||||
.build();
|
||||
|
||||
|
@ -84,7 +82,7 @@ final class WatcherRequestConverters {
|
|||
|
||||
static Request getWatch(GetWatchRequest getWatchRequest) {
|
||||
String endpoint = new RequestConverters.EndpointBuilder()
|
||||
.addPathPartAsIs("_xpack", "watcher", "watch")
|
||||
.addPathPartAsIs("_watcher", "watch")
|
||||
.addPathPart(getWatchRequest.getId())
|
||||
.build();
|
||||
|
||||
|
@ -93,8 +91,7 @@ final class WatcherRequestConverters {
|
|||
|
||||
static Request deactivateWatch(DeactivateWatchRequest deactivateWatchRequest) {
|
||||
String endpoint = new RequestConverters.EndpointBuilder()
|
||||
.addPathPartAsIs("_xpack")
|
||||
.addPathPartAsIs("watcher")
|
||||
.addPathPartAsIs("_watcher")
|
||||
.addPathPartAsIs("watch")
|
||||
.addPathPart(deactivateWatchRequest.getWatchId())
|
||||
.addPathPartAsIs("_deactivate")
|
||||
|
@ -104,7 +101,7 @@ final class WatcherRequestConverters {
|
|||
|
||||
static Request deleteWatch(DeleteWatchRequest deleteWatchRequest) {
|
||||
String endpoint = new RequestConverters.EndpointBuilder()
|
||||
.addPathPartAsIs("_xpack", "watcher", "watch")
|
||||
.addPathPartAsIs("_watcher", "watch")
|
||||
.addPathPart(deleteWatchRequest.getId())
|
||||
.build();
|
||||
|
||||
|
@ -114,7 +111,7 @@ final class WatcherRequestConverters {
|
|||
|
||||
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();
|
||||
|
||||
|
@ -136,7 +133,7 @@ final class WatcherRequestConverters {
|
|||
|
||||
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())
|
||||
|
@ -147,7 +144,7 @@ final class WatcherRequestConverters {
|
|||
|
||||
static Request activateWatch(ActivateWatchRequest activateWatchRequest) {
|
||||
String endpoint = new RequestConverters.EndpointBuilder()
|
||||
.addPathPartAsIs("_xpack", "watcher", "watch")
|
||||
.addPathPartAsIs("_watcher", "watch")
|
||||
.addPathPart(activateWatchRequest.getWatchId())
|
||||
.addPathPartAsIs("_activate")
|
||||
.build();
|
||||
|
@ -156,7 +153,7 @@ final class WatcherRequestConverters {
|
|||
}
|
||||
|
||||
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);
|
||||
|
|
|
@ -151,7 +151,7 @@ public class WatcherIT extends ESRestHighLevelClientTestCase {
|
|||
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());
|
||||
|
|
|
@ -67,13 +67,13 @@ public class WatcherRequestConvertersTests extends ESTestCase {
|
|||
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 {
|
||||
|
@ -95,7 +95,7 @@ public class WatcherRequestConvertersTests extends ESTestCase {
|
|||
|
||||
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();
|
||||
|
@ -109,7 +109,7 @@ public class WatcherRequestConvertersTests extends ESTestCase {
|
|||
|
||||
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());
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ public class WatcherRequestConvertersTests extends ESTestCase {
|
|||
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() {
|
||||
|
@ -128,7 +128,7 @@ public class WatcherRequestConvertersTests extends ESTestCase {
|
|||
|
||||
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());
|
||||
}
|
||||
|
||||
|
@ -142,7 +142,7 @@ public class WatcherRequestConvertersTests extends ESTestCase {
|
|||
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);
|
||||
|
@ -158,7 +158,7 @@ public class WatcherRequestConvertersTests extends ESTestCase {
|
|||
|
||||
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());
|
||||
}
|
||||
|
||||
|
@ -169,7 +169,7 @@ public class WatcherRequestConvertersTests extends ESTestCase {
|
|||
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"));
|
||||
|
@ -218,7 +218,7 @@ public class WatcherRequestConvertersTests extends ESTestCase {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
@ -293,7 +293,7 @@ public class WatcherRequestConvertersTests extends ESTestCase {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
|
@ -407,7 +407,7 @@ public class WatcherDocumentationIT extends ESRestHighLevelClientTestCase {
|
|||
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());
|
||||
|
|
|
@ -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
|
||||
|
@ -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": {
|
||||
|
@ -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
|
||||
|
||||
|
@ -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]
|
||||
|
@ -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]
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
@ -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]
|
||||
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
@ -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]
|
||||
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
@ -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]
|
||||
|
|
|
@ -9,9 +9,9 @@ watch execution for debugging purposes.
|
|||
[float]
|
||||
==== Request
|
||||
|
||||
`POST _xpack/watcher/watch/<watch_id>/_execute` +
|
||||
`POST _watcher/watch/<watch_id>/_execute` +
|
||||
|
||||
`POST _xpack/watcher/watch/_execute`
|
||||
`POST _watcher/watch/_execute`
|
||||
|
||||
[float]
|
||||
==== Description
|
||||
|
@ -137,7 +137,7 @@ The following example executes the `my_watch` watch:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
POST _xpack/watcher/watch/my_watch/_execute
|
||||
POST _watcher/watch/my_watch/_execute
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[setup:my_active_watch]
|
||||
|
@ -146,7 +146,7 @@ The following example shows a comprehensive example of executing the `my-watch`
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
POST _xpack/watcher/watch/my_watch/_execute
|
||||
POST _watcher/watch/my_watch/_execute
|
||||
{
|
||||
"trigger_data" : { <1>
|
||||
"triggered_time" : "now",
|
||||
|
@ -289,7 +289,7 @@ name with the action id:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
POST _xpack/watcher/watch/my_watch/_execute
|
||||
POST _watcher/watch/my_watch/_execute
|
||||
{
|
||||
"action_modes" : {
|
||||
"action1" : "force_simulate",
|
||||
|
@ -305,7 +305,7 @@ using `_all` as the action id:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
POST _xpack/watcher/watch/my_watch/_execute
|
||||
POST _watcher/watch/my_watch/_execute
|
||||
{
|
||||
"action_modes" : {
|
||||
"_all" : "force_execute"
|
||||
|
@ -319,7 +319,7 @@ The following example shows how to execute a watch inline:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
POST _xpack/watcher/watch/_execute
|
||||
POST _watcher/watch/_execute
|
||||
{
|
||||
"watch" : {
|
||||
"trigger" : { "schedule" : { "interval" : "10s" } },
|
||||
|
@ -356,7 +356,7 @@ during the execution this condition will be ignored:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
POST _xpack/watcher/watch/_execute
|
||||
POST _watcher/watch/_execute
|
||||
{
|
||||
"ignore_condition" : true,
|
||||
"watch" : {
|
||||
|
|
|
@ -7,7 +7,7 @@ This API retrieves a watch by its ID.
|
|||
[float]
|
||||
==== Request
|
||||
|
||||
`GET _xpack/watcher/watch/<watch_id>`
|
||||
`GET _watcher/watch/<watch_id>`
|
||||
|
||||
[float]
|
||||
==== Path Parameters
|
||||
|
@ -29,7 +29,7 @@ The following example gets a watch with `my-watch` id:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET _xpack/watcher/watch/my_watch
|
||||
GET _watcher/watch/my_watch
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[setup:my_active_watch]
|
||||
|
|
|
@ -8,7 +8,7 @@ existing one.
|
|||
[float]
|
||||
==== Request
|
||||
|
||||
`PUT _xpack/watcher/watch/<watch_id>`
|
||||
`PUT _watcher/watch/<watch_id>`
|
||||
|
||||
[float]
|
||||
==== Description
|
||||
|
@ -96,7 +96,7 @@ characteristics:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
PUT _xpack/watcher/watch/my-watch
|
||||
PUT _watcher/watch/my-watch
|
||||
{
|
||||
"trigger" : {
|
||||
"schedule" : { "cron" : "0 0/1 * * * ?" }
|
||||
|
@ -151,7 +151,7 @@ it to be inactive by default:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
PUT _xpack/watcher/watch/my-watch?active=false
|
||||
PUT _watcher/watch/my-watch?active=false
|
||||
--------------------------------------------------
|
||||
|
||||
NOTE: If you omit the `active` parameter, the watch is active by default.
|
||||
|
|
|
@ -8,7 +8,7 @@ running.
|
|||
[float]
|
||||
==== Request
|
||||
|
||||
`POST _xpack/watcher/_start`
|
||||
`POST _watcher/_start`
|
||||
|
||||
==== Authorization
|
||||
|
||||
|
@ -20,7 +20,7 @@ information, see {xpack-ref}/security-privileges.html[Security Privileges].
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
POST _xpack/watcher/_start
|
||||
POST _watcher/_start
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@ The `stats` API returns the current {watcher} metrics.
|
|||
[float]
|
||||
==== Request
|
||||
|
||||
`GET _xpack/watcher/stats` +
|
||||
`GET _watcher/stats` +
|
||||
|
||||
`GET _xpack/watcher/stats/<metric>`
|
||||
`GET _watcher/stats/<metric>`
|
||||
|
||||
[float]
|
||||
==== Description
|
||||
|
@ -69,7 +69,7 @@ The following example calls the `stats` API to retrieve basic metrics:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET _xpack/watcher/stats
|
||||
GET _watcher/stats
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
|
@ -98,7 +98,7 @@ and will include the basic metrics and metrics about the current executing watch
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET _xpack/watcher/stats?metric=current_watches
|
||||
GET _watcher/stats?metric=current_watches
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
|
@ -106,7 +106,7 @@ The following example specifies the `metric` option as part of the url path:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET _xpack/watcher/stats/current_watches
|
||||
GET _watcher/stats/current_watches
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
|
@ -151,7 +151,7 @@ both the basic metrics and the queued watches:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
GET _xpack/watcher/stats/queued_watches
|
||||
GET _watcher/stats/queued_watches
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ The `stop` API stops the {watcher} service if the service is running.
|
|||
[float]
|
||||
==== Request
|
||||
|
||||
`POST _xpack/watcher/_stop`
|
||||
`POST _watcher/_stop`
|
||||
|
||||
[float]
|
||||
==== Authorization
|
||||
|
@ -20,7 +20,7 @@ information, see {xpack-ref}/security-privileges.html[Security Privileges].
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
POST _xpack/watcher/_stop
|
||||
POST _watcher/_stop
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ a throttle period with the `email_administrator` action:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
PUT _xpack/watcher/watch/error_logs_alert
|
||||
PUT _watcher/watch/error_logs_alert
|
||||
{
|
||||
"metadata" : {
|
||||
"color" : "red"
|
||||
|
@ -101,7 +101,7 @@ defined in the watch:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
PUT _xpack/watcher/watch/log_event_watch
|
||||
PUT _watcher/watch/log_event_watch
|
||||
{
|
||||
"trigger" : {
|
||||
"schedule" : { "interval" : "5m" }
|
||||
|
@ -177,7 +177,7 @@ To acknowledge an action, you use the
|
|||
|
||||
[source,js]
|
||||
----------------------------------------------------------------------
|
||||
POST _xpack/watcher/watch/<id>/_ack/<action_ids>
|
||||
POST _watcher/watch/<id>/_ack/<action_ids>
|
||||
----------------------------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[skip:https://github.com/elastic/x-plugins/issues/2513]
|
||||
|
@ -204,7 +204,7 @@ there are more than 5 hits in the search result.
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
PUT _xpack/watcher/watch/log_event_watch
|
||||
PUT _watcher/watch/log_event_watch
|
||||
{
|
||||
"trigger" : {
|
||||
"schedule" : { "interval" : "5m" }
|
||||
|
|
|
@ -24,7 +24,7 @@ the following schedule runs every 10 seconds:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
PUT _xpack/watcher/watch/cluster_health_watch
|
||||
PUT _watcher/watch/cluster_health_watch
|
||||
{
|
||||
"trigger" : {
|
||||
"schedule" : { "interval" : "10s" } <1>
|
||||
|
@ -52,7 +52,7 @@ To load the health status into your watch, you simply add an
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
PUT _xpack/watcher/watch/cluster_health_watch
|
||||
PUT _watcher/watch/cluster_health_watch
|
||||
{
|
||||
"trigger" : {
|
||||
"schedule" : { "interval" : "10s" }
|
||||
|
@ -74,7 +74,7 @@ If you're using Security, then you'll also need to supply some authentication cr
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
PUT _xpack/watcher/watch/cluster_health_watch
|
||||
PUT _watcher/watch/cluster_health_watch
|
||||
{
|
||||
"trigger" : {
|
||||
"schedule" : { "interval" : "10s" }
|
||||
|
@ -134,7 +134,7 @@ For example, you could add a condition to check to see if the status is RED.
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
PUT _xpack/watcher/watch/cluster_health_watch
|
||||
PUT _watcher/watch/cluster_health_watch
|
||||
{
|
||||
"trigger" : {
|
||||
"schedule" : { "interval" : "10s" } <1>
|
||||
|
@ -191,7 +191,7 @@ when the status is RED.
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
PUT _xpack/watcher/watch/cluster_health_watch
|
||||
PUT _watcher/watch/cluster_health_watch
|
||||
{
|
||||
"trigger" : {
|
||||
"schedule" : { "interval" : "10s" }
|
||||
|
@ -280,7 +280,7 @@ To remove the watch, use the {ref}/watcher-api-delete-watch.html[DELETE watch AP
|
|||
|
||||
[source,js]
|
||||
-------------------------------------------------------
|
||||
DELETE _xpack/watcher/watch/cluster_health_watch
|
||||
DELETE _watcher/watch/cluster_health_watch
|
||||
-------------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[continued]
|
||||
|
|
|
@ -194,7 +194,7 @@ NOTE: To enable Watcher to send emails, you must configure an email account in `
|
|||
The complete watch looks like this:
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
PUT _xpack/watcher/watch/meetup
|
||||
PUT _watcher/watch/meetup
|
||||
{
|
||||
"trigger": {
|
||||
"schedule": {
|
||||
|
@ -300,7 +300,7 @@ Now that you've created your watch, you can use the
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
POST _xpack/watcher/watch/meetup/_execute
|
||||
POST _watcher/watch/meetup/_execute
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[continued]
|
||||
|
|
|
@ -157,7 +157,7 @@ The complete watch looks like this:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
PUT _xpack/watcher/watch/rss_watch
|
||||
PUT _watcher/watch/rss_watch
|
||||
{
|
||||
"trigger" : {
|
||||
"schedule" : {
|
||||
|
@ -215,7 +215,7 @@ use the {ref}/watcher-api-execute-watch.html[`_execute` API]:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
POST _xpack/watcher/watch/rss_watch/_execute
|
||||
POST _watcher/watch/rss_watch/_execute
|
||||
{
|
||||
"ignore_condition" : true,
|
||||
"action_modes" : {
|
||||
|
|
|
@ -28,7 +28,7 @@ the `logs` index for errors every 10 seconds:
|
|||
|
||||
[source,js]
|
||||
------------------------------------------------------------
|
||||
PUT _xpack/watcher/watch/log_error_watch
|
||||
PUT _watcher/watch/log_error_watch
|
||||
{
|
||||
"trigger" : {
|
||||
"schedule" : { "interval" : "10s" } <1>
|
||||
|
@ -86,7 +86,7 @@ search input returned any hits.
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
PUT _xpack/watcher/watch/log_error_watch
|
||||
PUT _watcher/watch/log_error_watch
|
||||
{
|
||||
"trigger" : { "schedule" : { "interval" : "10s" }},
|
||||
"input" : {
|
||||
|
@ -165,7 +165,7 @@ log when an error is detected.
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
PUT _xpack/watcher/watch/log_error_watch
|
||||
PUT _watcher/watch/log_error_watch
|
||||
{
|
||||
"trigger" : { "schedule" : { "interval" : "10s" }},
|
||||
"input" : {
|
||||
|
@ -207,7 +207,7 @@ To remove the watch, use the {ref}/watcher-api-delete-watch.html[DELETE watch AP
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
DELETE _xpack/watcher/watch/log_error_watch
|
||||
DELETE _watcher/watch/log_error_watch
|
||||
--------------------------------------------------
|
||||
// CONSOLE
|
||||
// TEST[continued]
|
||||
|
|
|
@ -48,7 +48,7 @@ looks for log error events:
|
|||
|
||||
[source,js]
|
||||
--------------------------------------------------
|
||||
PUT _xpack/watcher/watch/log_errors
|
||||
PUT _watcher/watch/log_errors
|
||||
{
|
||||
"metadata" : { <1>
|
||||
"color" : "red"
|
||||
|
|
|
@ -87,13 +87,13 @@ public class ClusterAlertHttpResource extends PublishableHttpResource {
|
|||
(response) -> shouldReplaceClusterAlert(response, XContentType.JSON.xContent(), LAST_UPDATED_VERSION);
|
||||
|
||||
checkForResource(client, listener, logger,
|
||||
"/_xpack/watcher/watch", watchId.get(), "monitoring cluster alert",
|
||||
"/_watcher/watch", watchId.get(), "monitoring cluster alert",
|
||||
resourceOwnerName, "monitoring cluster",
|
||||
GET_EXISTS, GET_DOES_NOT_EXIST,
|
||||
watchChecker, this::alwaysReplaceResource);
|
||||
} else {
|
||||
// if we should be deleting, then just try to delete it (same level of effort as checking)
|
||||
deleteResource(client, listener, logger, "/_xpack/watcher/watch", watchId.get(),
|
||||
deleteResource(client, listener, logger, "/_watcher/watch", watchId.get(),
|
||||
"monitoring cluster alert",
|
||||
resourceOwnerName, "monitoring cluster");
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class ClusterAlertHttpResource extends PublishableHttpResource {
|
|||
@Override
|
||||
protected void doPublish(final RestClient client, final ActionListener<Boolean> listener) {
|
||||
putResource(client, listener, logger,
|
||||
"/_xpack/watcher/watch", watchId.get(), this::watchToHttpEntity, "monitoring cluster alert",
|
||||
"/_watcher/watch", watchId.get(), this::watchToHttpEntity, "monitoring cluster alert",
|
||||
resourceOwnerName, "monitoring cluster");
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ public class ClusterAlertHttpResourceTests extends AbstractPublishableHttpResour
|
|||
|
||||
final HttpEntity entity = entityForClusterAlert(true, minimumVersion);
|
||||
|
||||
doCheckWithStatusCode(resource, "/_xpack/watcher/watch", watchId, successfulCheckStatus(), true, entity);
|
||||
doCheckWithStatusCode(resource, "/_watcher/watch", watchId, successfulCheckStatus(), true, entity);
|
||||
}
|
||||
|
||||
public void testDoCheckGetWatchDoesNotExist() throws IOException {
|
||||
|
@ -71,12 +71,12 @@ public class ClusterAlertHttpResourceTests extends AbstractPublishableHttpResour
|
|||
|
||||
if (randomBoolean()) {
|
||||
// it does not exist because it's literally not there
|
||||
assertCheckDoesNotExist(resource, "/_xpack/watcher/watch", watchId);
|
||||
assertCheckDoesNotExist(resource, "/_watcher/watch", watchId);
|
||||
} else {
|
||||
// it does not exist because we need to replace it
|
||||
final HttpEntity entity = entityForClusterAlert(false, minimumVersion);
|
||||
|
||||
doCheckWithStatusCode(resource, "/_xpack/watcher/watch", watchId, successfulCheckStatus(), false, entity);
|
||||
doCheckWithStatusCode(resource, "/_watcher/watch", watchId, successfulCheckStatus(), false, entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,12 +85,12 @@ public class ClusterAlertHttpResourceTests extends AbstractPublishableHttpResour
|
|||
|
||||
if (randomBoolean()) {
|
||||
// error because of a server error
|
||||
assertCheckWithException(resource, "/_xpack/watcher/watch", watchId);
|
||||
assertCheckWithException(resource, "/_watcher/watch", watchId);
|
||||
} else {
|
||||
// error because of a malformed response
|
||||
final HttpEntity entity = entityForClusterAlert(null, minimumVersion);
|
||||
|
||||
doCheckWithStatusCode(resource, "/_xpack/watcher/watch", watchId, successfulCheckStatus(), null, entity);
|
||||
doCheckWithStatusCode(resource, "/_watcher/watch", watchId, successfulCheckStatus(), null, entity);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class ClusterAlertHttpResourceTests extends AbstractPublishableHttpResour
|
|||
// should not matter
|
||||
when(licenseState.isMonitoringClusterAlertsAllowed()).thenReturn(clusterAlertsAllowed);
|
||||
|
||||
assertCheckAsDeleteExists(noWatchResource, "/_xpack/watcher/watch", watchId);
|
||||
assertCheckAsDeleteExists(noWatchResource, "/_watcher/watch", watchId);
|
||||
}
|
||||
|
||||
public void testDoCheckWithExceptionAsDeleteWatchErrorWhenNoWatchIsSpecified() throws IOException {
|
||||
|
@ -111,27 +111,27 @@ public class ClusterAlertHttpResourceTests extends AbstractPublishableHttpResour
|
|||
// should not matter
|
||||
when(licenseState.isMonitoringClusterAlertsAllowed()).thenReturn(clusterAlertsAllowed);
|
||||
|
||||
assertCheckAsDeleteWithException(noWatchResource, "/_xpack/watcher/watch", watchId);
|
||||
assertCheckAsDeleteWithException(noWatchResource, "/_watcher/watch", watchId);
|
||||
}
|
||||
|
||||
public void testDoCheckAsDeleteWatchExists() throws IOException {
|
||||
when(licenseState.isMonitoringClusterAlertsAllowed()).thenReturn(false);
|
||||
|
||||
assertCheckAsDeleteExists(resource, "/_xpack/watcher/watch", watchId);
|
||||
assertCheckAsDeleteExists(resource, "/_watcher/watch", watchId);
|
||||
}
|
||||
|
||||
public void testDoCheckWithExceptionAsDeleteWatchError() throws IOException {
|
||||
when(licenseState.isMonitoringClusterAlertsAllowed()).thenReturn(false);
|
||||
|
||||
assertCheckAsDeleteWithException(resource, "/_xpack/watcher/watch", watchId);
|
||||
assertCheckAsDeleteWithException(resource, "/_watcher/watch", watchId);
|
||||
}
|
||||
|
||||
public void testDoPublishTrue() throws IOException {
|
||||
assertPublishSucceeds(resource, "/_xpack/watcher/watch", watchId, StringEntity.class);
|
||||
assertPublishSucceeds(resource, "/_watcher/watch", watchId, StringEntity.class);
|
||||
}
|
||||
|
||||
public void testDoPublishFalseWithException() throws IOException {
|
||||
assertPublishWithException(resource, "/_xpack/watcher/watch", watchId, StringEntity.class);
|
||||
assertPublishWithException(resource, "/_watcher/watch", watchId, StringEntity.class);
|
||||
}
|
||||
|
||||
public void testShouldReplaceClusterAlertRethrowsIOException() throws IOException {
|
||||
|
|
|
@ -497,7 +497,7 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
|
|||
// GET / PUT if we are allowed to use it
|
||||
if (currentLicenseAllowsWatcher && clusterAlertBlacklist.contains(watch.v1()) == false) {
|
||||
assertThat(request.getMethod(), equalTo("GET"));
|
||||
assertThat(request.getUri().getPath(), equalTo(pathPrefix + "/_xpack/watcher/watch/" + uniqueWatchId));
|
||||
assertThat(request.getUri().getPath(), equalTo(pathPrefix + "/_watcher/watch/" + uniqueWatchId));
|
||||
assertThat(request.getUri().getQuery(), equalTo(resourceClusterAlertQueryString()));
|
||||
assertHeaders(request, customHeaders);
|
||||
|
||||
|
@ -505,7 +505,7 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
|
|||
request = webServer.takeRequest();
|
||||
|
||||
assertThat(request.getMethod(), equalTo("PUT"));
|
||||
assertThat(request.getUri().getPath(), equalTo(pathPrefix + "/_xpack/watcher/watch/" + uniqueWatchId));
|
||||
assertThat(request.getUri().getPath(), equalTo(pathPrefix + "/_watcher/watch/" + uniqueWatchId));
|
||||
assertThat(request.getUri().getQuery(), equalTo(resourceClusterAlertQueryString()));
|
||||
assertThat(request.getBody(), equalTo(watch.v2()));
|
||||
assertHeaders(request, customHeaders);
|
||||
|
@ -513,7 +513,7 @@ public class HttpExporterIT extends MonitoringIntegTestCase {
|
|||
// DELETE if we're not allowed to use it
|
||||
} else {
|
||||
assertThat(request.getMethod(), equalTo("DELETE"));
|
||||
assertThat(request.getUri().getPath(), equalTo(pathPrefix + "/_xpack/watcher/watch/" + uniqueWatchId));
|
||||
assertThat(request.getUri().getPath(), equalTo(pathPrefix + "/_watcher/watch/" + uniqueWatchId));
|
||||
assertThat(request.getUri().getQuery(), equalTo(resourceClusterAlertQueryString()));
|
||||
assertHeaders(request, customHeaders);
|
||||
}
|
||||
|
|
|
@ -376,7 +376,7 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
|
|||
final List<Response> otherResponses = getWatcherResponses(1, successful, unsuccessful);
|
||||
|
||||
// last check fails implies that N - 2 publishes succeeded!
|
||||
whenPerformRequestAsyncWith(client, new RequestMatcher(is("GET"), startsWith("/_xpack/watcher/watch/")),
|
||||
whenPerformRequestAsyncWith(client, new RequestMatcher(is("GET"), startsWith("/_watcher/watch/")),
|
||||
first, otherResponses, exception);
|
||||
whenSuccessfulPutWatches(otherResponses.size() + 1);
|
||||
|
||||
|
@ -391,7 +391,7 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
|
|||
// there is no form of an unsuccessful delete; only success or error
|
||||
final List<Response> responses = successfulDeleteResponses(successful);
|
||||
|
||||
whenPerformRequestAsyncWith(client, new RequestMatcher(is("DELETE"), startsWith("/_xpack/watcher/watch/")),
|
||||
whenPerformRequestAsyncWith(client, new RequestMatcher(is("DELETE"), startsWith("/_watcher/watch/")),
|
||||
responses.get(0), responses.subList(1, responses.size()), exception);
|
||||
|
||||
expectedGets += successful;
|
||||
|
@ -399,7 +399,7 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
|
|||
} else {
|
||||
final String method = validLicense ? "GET" : "DELETE";
|
||||
|
||||
whenPerformRequestAsyncWith(client, new RequestMatcher(is(method), startsWith("/_xpack/watcher/watch/")), exception);
|
||||
whenPerformRequestAsyncWith(client, new RequestMatcher(is(method), startsWith("/_watcher/watch/")), exception);
|
||||
}
|
||||
|
||||
assertTrue(resources.isDirty());
|
||||
|
@ -454,7 +454,7 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
|
|||
whenGetWatches(successful, unsuccessful + 2);
|
||||
|
||||
// previous publishes must have succeeded
|
||||
whenPerformRequestAsyncWith(client, new RequestMatcher(is("PUT"), startsWith("/_xpack/watcher/watch/")),
|
||||
whenPerformRequestAsyncWith(client, new RequestMatcher(is("PUT"), startsWith("/_watcher/watch/")),
|
||||
firstSuccess, otherResponses, exception);
|
||||
|
||||
// GETs required for each PUT attempt (first is guaranteed "unsuccessful")
|
||||
|
@ -465,7 +465,7 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
|
|||
// fail the check so that it has to attempt the PUT
|
||||
whenGetWatches(0, 1);
|
||||
|
||||
whenPerformRequestAsyncWith(client, new RequestMatcher(is("PUT"), startsWith("/_xpack/watcher/watch/")), exception);
|
||||
whenPerformRequestAsyncWith(client, new RequestMatcher(is("PUT"), startsWith("/_watcher/watch/")), exception);
|
||||
}
|
||||
|
||||
assertTrue(resources.isDirty());
|
||||
|
@ -595,13 +595,13 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
|
|||
private Response successfulGetWatchResponse(final String watchId) {
|
||||
final HttpEntity goodEntity = entityForClusterAlert(true, ClusterAlertsUtil.LAST_UPDATED_VERSION);
|
||||
|
||||
return response("GET", "/_xpack/watcher/watch/" + watchId, successfulCheckStatus(), goodEntity);
|
||||
return response("GET", "/_watcher/watch/" + watchId, successfulCheckStatus(), goodEntity);
|
||||
}
|
||||
private Response unsuccessfulGetWatchResponse(final String watchId) {
|
||||
if (randomBoolean()) {
|
||||
final HttpEntity badEntity = entityForClusterAlert(false, ClusterAlertsUtil.LAST_UPDATED_VERSION);
|
||||
|
||||
return response("GET", "/_xpack/watcher/watch/" + watchId, successfulCheckStatus(), badEntity);
|
||||
return response("GET", "/_watcher/watch/" + watchId, successfulCheckStatus(), badEntity);
|
||||
}
|
||||
|
||||
return unsuccessfulGetResponse();
|
||||
|
@ -764,21 +764,21 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
|
|||
private void whenGetWatches(final int successful, final int unsuccessful) {
|
||||
final List<Response> gets = getWatcherResponses(0, successful, unsuccessful);
|
||||
|
||||
whenPerformRequestAsyncWith(client, new RequestMatcher(is("GET"), startsWith("/_xpack/watcher/watch/")), gets);
|
||||
whenPerformRequestAsyncWith(client, new RequestMatcher(is("GET"), startsWith("/_watcher/watch/")), gets);
|
||||
}
|
||||
|
||||
private void whenSuccessfulPutWatches(final int successful) {
|
||||
final List<Response> successfulPuts = successfulPutResponses(successful);
|
||||
|
||||
// empty is possible if they all exist
|
||||
whenPerformRequestAsyncWith(client, new RequestMatcher(is("PUT"), startsWith("/_xpack/watcher/watch/")), successfulPuts);
|
||||
whenPerformRequestAsyncWith(client, new RequestMatcher(is("PUT"), startsWith("/_watcher/watch/")), successfulPuts);
|
||||
}
|
||||
|
||||
private void whenSuccessfulDeleteWatches(final int successful) {
|
||||
final List<Response> successfulDeletes = successfulDeleteResponses(successful);
|
||||
|
||||
// empty is possible if they all exist
|
||||
whenPerformRequestAsyncWith(client, new RequestMatcher(is("DELETE"), startsWith("/_xpack/watcher/watch/")), successfulDeletes);
|
||||
whenPerformRequestAsyncWith(client, new RequestMatcher(is("DELETE"), startsWith("/_watcher/watch/")), successfulDeletes);
|
||||
}
|
||||
|
||||
private void verifyVersionCheck() {
|
||||
|
@ -811,18 +811,18 @@ public class HttpExporterResourceTests extends AbstractPublishableHttpResourceTe
|
|||
|
||||
private void verifyDeleteWatches(final int called) {
|
||||
verify(client, times(called))
|
||||
.performRequestAsync(argThat(new RequestMatcher(is("DELETE"), startsWith("/_xpack/watcher/watch/"))),
|
||||
.performRequestAsync(argThat(new RequestMatcher(is("DELETE"), startsWith("/_watcher/watch/"))),
|
||||
any(ResponseListener.class));
|
||||
}
|
||||
|
||||
private void verifyGetWatches(final int called) {
|
||||
verify(client, times(called))
|
||||
.performRequestAsync(argThat(new RequestMatcher(is("GET"), startsWith("/_xpack/watcher/watch/"))), any(ResponseListener.class));
|
||||
.performRequestAsync(argThat(new RequestMatcher(is("GET"), startsWith("/_watcher/watch/"))), any(ResponseListener.class));
|
||||
}
|
||||
|
||||
private void verifyPutWatches(final int called) {
|
||||
verify(client, times(called))
|
||||
.performRequestAsync(argThat(new RequestMatcher(is("PUT"), startsWith("/_xpack/watcher/watch/"))), any(ResponseListener.class));
|
||||
.performRequestAsync(argThat(new RequestMatcher(is("PUT"), startsWith("/_watcher/watch/"))), any(ResponseListener.class));
|
||||
}
|
||||
|
||||
private ClusterService mockClusterService(final ClusterState state) {
|
||||
|
|
|
@ -147,7 +147,7 @@ public class XPackRestIT extends ESClientYamlSuiteTestCase {
|
|||
List<Map<String, Object>> hits = objectPathResponse.evaluate("hits.hits");
|
||||
for (Map<String, Object> hit : hits) {
|
||||
String id = (String) hit.get("_id");
|
||||
adminClient().performRequest(new Request("DELETE", "_xpack/watcher/watch/" + id));
|
||||
adminClient().performRequest(new Request("DELETE", "_watcher/watch/" + id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-ack-watch.html",
|
||||
"methods": [ "PUT", "POST" ],
|
||||
"url": {
|
||||
"path": "/_xpack/watcher/watch/{watch_id}/_ack",
|
||||
"paths": [ "/_xpack/watcher/watch/{watch_id}/_ack", "/_xpack/watcher/watch/{watch_id}/_ack/{action_id}"],
|
||||
"path": "/_watcher/watch/{watch_id}/_ack",
|
||||
"paths": [ "/_watcher/watch/{watch_id}/_ack", "/_watcher/watch/{watch_id}/_ack/{action_id}"],
|
||||
"parts": {
|
||||
"watch_id": {
|
||||
"type" : "string",
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-activate-watch.html",
|
||||
"methods": [ "PUT", "POST" ],
|
||||
"url": {
|
||||
"path": "/_xpack/watcher/watch/{watch_id}/_activate",
|
||||
"paths": [ "/_xpack/watcher/watch/{watch_id}/_activate" ],
|
||||
"path": "/_watcher/watch/{watch_id}/_activate",
|
||||
"paths": [ "/_watcher/watch/{watch_id}/_activate" ],
|
||||
"parts": {
|
||||
"watch_id": {
|
||||
"type" : "string",
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
"documentation": "https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-deactivate-watch.html",
|
||||
"methods": [ "PUT", "POST" ],
|
||||
"url": {
|
||||
"path": "/_xpack/watcher/watch/{watch_id}/_deactivate",
|
||||
"paths": [ "/_xpack/watcher/watch/{watch_id}/_deactivate" ],
|
||||
"path": "/_watcher/watch/{watch_id}/_deactivate",
|
||||
"paths": [ "/_watcher/watch/{watch_id}/_deactivate" ],
|
||||
"parts": {
|
||||
"watch_id": {
|
||||
"type" : "string",
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
"methods": [ "DELETE" ],
|
||||
"url": {
|
||||
"path": "/_xpack/watcher/watch/{id}",
|
||||
"paths": [ "/_xpack/watcher/watch/{id}" ],
|
||||
"path": "/_watcher/watch/{id}",
|
||||
"paths": [ "/_watcher/watch/{id}" ],
|
||||
"parts": {
|
||||
"id": {
|
||||
"type" : "string",
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-execute-watch.html",
|
||||
"methods": [ "PUT", "POST" ],
|
||||
"url": {
|
||||
"path": "/_xpack/watcher/watch/{id}/_execute",
|
||||
"paths": [ "/_xpack/watcher/watch/{id}/_execute", "/_xpack/watcher/watch/_execute" ],
|
||||
"path": "/_watcher/watch/{id}/_execute",
|
||||
"paths": [ "/_watcher/watch/{id}/_execute", "/_watcher/watch/_execute" ],
|
||||
"parts": {
|
||||
"id": {
|
||||
"type" : "string",
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-get-watch.html",
|
||||
"methods": [ "GET" ],
|
||||
"url": {
|
||||
"path": "/_xpack/watcher/watch/{id}",
|
||||
"paths": [ "/_xpack/watcher/watch/{id}" ],
|
||||
"path": "/_watcher/watch/{id}",
|
||||
"paths": [ "/_watcher/watch/{id}" ],
|
||||
"parts": {
|
||||
"id": {
|
||||
"type" : "string",
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html",
|
||||
"methods": [ "PUT", "POST" ],
|
||||
"url": {
|
||||
"path": "/_xpack/watcher/watch/{id}",
|
||||
"paths": [ "/_xpack/watcher/watch/{id}" ],
|
||||
"path": "/_watcher/watch/{id}",
|
||||
"paths": [ "/_watcher/watch/{id}" ],
|
||||
"parts": {
|
||||
"id": {
|
||||
"type" : "string",
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-start.html",
|
||||
"methods": [ "POST" ],
|
||||
"url": {
|
||||
"path": "/_xpack/watcher/_start",
|
||||
"paths": [ "/_xpack/watcher/_start" ],
|
||||
"path": "/_watcher/_start",
|
||||
"paths": [ "/_watcher/_start" ],
|
||||
"parts": {
|
||||
},
|
||||
"params": {
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stats.html",
|
||||
"methods": [ "GET" ],
|
||||
"url": {
|
||||
"path": "/_xpack/watcher/stats",
|
||||
"paths": [ "/_xpack/watcher/stats", "/_xpack/watcher/stats/{metric}" ],
|
||||
"path": "/_watcher/stats",
|
||||
"paths": [ "/_watcher/stats", "/_watcher/stats/{metric}" ],
|
||||
"parts": {
|
||||
"metric": {
|
||||
"type" : "enum",
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
"documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-stop.html",
|
||||
"methods": [ "POST" ],
|
||||
"url": {
|
||||
"path": "/_xpack/watcher/_stop",
|
||||
"paths": [ "/_xpack/watcher/_stop" ],
|
||||
"path": "/_watcher/_stop",
|
||||
"paths": [ "/_watcher/_stop" ],
|
||||
"parts": {
|
||||
},
|
||||
"params": {
|
||||
|
|
|
@ -15,7 +15,7 @@ import java.io.IOException;
|
|||
|
||||
public abstract class WatcherRestHandler extends BaseRestHandler {
|
||||
|
||||
protected static String URI_BASE = "_xpack/watcher";
|
||||
protected static String URI_BASE = "/_xpack";
|
||||
|
||||
public WatcherRestHandler(Settings settings) {
|
||||
super(settings);
|
||||
|
|
|
@ -3,8 +3,11 @@
|
|||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.xpack.watcher.rest.action;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.elasticsearch.common.logging.DeprecationLogger;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BytesRestResponse;
|
||||
|
@ -30,17 +33,28 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
|||
*/
|
||||
public class RestAckWatchAction extends WatcherRestHandler {
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestAckWatchAction.class));
|
||||
|
||||
public RestAckWatchAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, URI_BASE + "/watch/{id}/_ack", this);
|
||||
controller.registerHandler(PUT, URI_BASE + "/watch/{id}/_ack", this);
|
||||
controller.registerHandler(POST, URI_BASE + "/watch/{id}/_ack/{actions}", this);
|
||||
controller.registerHandler(PUT, URI_BASE + "/watch/{id}/_ack/{actions}", this);
|
||||
// TODO: remove deprecated endpoint in 8.0.0
|
||||
controller.registerWithDeprecatedHandler(
|
||||
POST, "/_watcher/watch/{id}/_ack", this,
|
||||
POST, URI_BASE + "/watcher/watch/{id}/_ack", deprecationLogger);
|
||||
controller.registerWithDeprecatedHandler(
|
||||
PUT, "/_watcher/watch/{id}/_ack", this,
|
||||
PUT, URI_BASE + "/watcher/watch/{id}/_ack", deprecationLogger);
|
||||
controller.registerWithDeprecatedHandler(
|
||||
POST, "/_watcher/watch/{id}/_ack/{actions}", this,
|
||||
POST, URI_BASE + "/watcher/watch/{id}/_ack/{actions}", deprecationLogger);
|
||||
controller.registerWithDeprecatedHandler(
|
||||
PUT, "/_watcher/watch/{id}/_ack/{actions}", this,
|
||||
PUT, URI_BASE + "/watcher/watch/{id}/_ack/{actions}", deprecationLogger);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "xpack_watcher_ack_watch_action";
|
||||
return "watcher_ack_watch";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,8 +3,11 @@
|
|||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.xpack.watcher.rest.action;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.elasticsearch.common.logging.DeprecationLogger;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BytesRestResponse;
|
||||
|
@ -29,18 +32,31 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
|||
* The rest action to de/activate a watch
|
||||
*/
|
||||
public class RestActivateWatchAction extends WatcherRestHandler {
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestActivateWatchAction.class));
|
||||
|
||||
public RestActivateWatchAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, URI_BASE + "/watch/{id}/_activate", this);
|
||||
controller.registerHandler(PUT, URI_BASE + "/watch/{id}/_activate", this);
|
||||
// TODO: remove deprecated endpoint in 8.0.0
|
||||
controller.registerWithDeprecatedHandler(
|
||||
POST, "/_watcher/watch/{id}/_activate", this,
|
||||
POST, URI_BASE + "/watcher/watch/{id}/_activate", deprecationLogger);
|
||||
controller.registerWithDeprecatedHandler(
|
||||
PUT, "/_watcher/watch/{id}/_activate", this,
|
||||
PUT, URI_BASE + "/watcher/watch/{id}/_activate", deprecationLogger);
|
||||
|
||||
final DeactivateRestHandler deactivateRestHandler = new DeactivateRestHandler(settings);
|
||||
controller.registerHandler(POST, URI_BASE + "/watch/{id}/_deactivate", deactivateRestHandler);
|
||||
controller.registerHandler(PUT, URI_BASE + "/watch/{id}/_deactivate", deactivateRestHandler);
|
||||
controller.registerWithDeprecatedHandler(
|
||||
POST, "/_watcher/watch/{id}/_deactivate", deactivateRestHandler,
|
||||
POST, URI_BASE + "/watcher/watch/{id}/_deactivate", deprecationLogger);
|
||||
controller.registerWithDeprecatedHandler(
|
||||
PUT, "/_watcher/watch/{id}/_deactivate", deactivateRestHandler,
|
||||
PUT, URI_BASE + "/watcher/watch/{id}/_deactivate", deprecationLogger);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "xpack_watcher_activate_watch_action";
|
||||
return "watcher_activate_watch";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -65,7 +81,7 @@ public class RestActivateWatchAction extends WatcherRestHandler {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "xpack_watcher_deactivate_watch_action";
|
||||
return "watcher_deactivate_watch";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,8 +3,11 @@
|
|||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.xpack.watcher.rest.action;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.elasticsearch.common.logging.DeprecationLogger;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.rest.BytesRestResponse;
|
||||
|
@ -25,14 +28,20 @@ import static org.elasticsearch.rest.RestStatus.NOT_FOUND;
|
|||
import static org.elasticsearch.rest.RestStatus.OK;
|
||||
|
||||
public class RestDeleteWatchAction extends WatcherRestHandler {
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestDeleteWatchAction.class));
|
||||
|
||||
public RestDeleteWatchAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(DELETE, URI_BASE + "/watch/{id}", this);
|
||||
// TODO: remove deprecated endpoint in 8.0.0
|
||||
controller.registerWithDeprecatedHandler(
|
||||
DELETE, "/_watcher/watch/{id}", this,
|
||||
DELETE, URI_BASE + "/watcher/watch/{id}", deprecationLogger);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "xpack_watcher_delete_watch_action";
|
||||
return "watcher_delete_watch";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,11 +3,14 @@
|
|||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.xpack.watcher.rest.action;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.elasticsearch.ElasticsearchParseException;
|
||||
import org.elasticsearch.common.ParseField;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.elasticsearch.common.logging.DeprecationLogger;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.set.Sets;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
@ -41,6 +44,8 @@ import static org.elasticsearch.xpack.watcher.rest.action.RestExecuteWatchAction
|
|||
|
||||
public class RestExecuteWatchAction extends WatcherRestHandler implements RestRequestFilter {
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestExecuteWatchAction.class));
|
||||
|
||||
private static final List<String> RESERVED_FIELD_NAMES = Arrays.asList(WatchField.TRIGGER.getPreferredName(),
|
||||
WatchField.INPUT.getPreferredName(), WatchField.CONDITION.getPreferredName(),
|
||||
WatchField.ACTIONS.getPreferredName(), WatchField.TRANSFORM.getPreferredName(),
|
||||
|
@ -50,15 +55,24 @@ public class RestExecuteWatchAction extends WatcherRestHandler implements RestRe
|
|||
|
||||
public RestExecuteWatchAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, URI_BASE + "/watch/{id}/_execute", this);
|
||||
controller.registerHandler(PUT, URI_BASE + "/watch/{id}/_execute", this);
|
||||
controller.registerHandler(POST, URI_BASE + "/watch/_execute", this);
|
||||
controller.registerHandler(PUT, URI_BASE + "/watch/_execute", this);
|
||||
// TODO: remove deprecated endpoint in 8.0.0
|
||||
controller.registerWithDeprecatedHandler(
|
||||
POST, "/_watcher/watch/{id}/_execute", this,
|
||||
POST, URI_BASE + "/watcher/watch/{id}/_execute", deprecationLogger);
|
||||
controller.registerWithDeprecatedHandler(
|
||||
PUT, "/_watcher/watch/{id}/_execute", this,
|
||||
PUT, URI_BASE + "/watcher/watch/{id}/_execute", deprecationLogger);
|
||||
controller.registerWithDeprecatedHandler(
|
||||
POST, "/_watcher/watch/_execute", this,
|
||||
POST, URI_BASE + "/watcher/watch/_execute", deprecationLogger);
|
||||
controller.registerWithDeprecatedHandler(
|
||||
PUT, "/_watcher/watch/_execute", this,
|
||||
PUT, URI_BASE + "/watcher/watch/_execute", deprecationLogger);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "xpack_watcher_execute_watch_action";
|
||||
return "watcher_execute_watch";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,8 +3,11 @@
|
|||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.xpack.watcher.rest.action;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.elasticsearch.common.logging.DeprecationLogger;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.ToXContent;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
|
@ -25,14 +28,20 @@ import static org.elasticsearch.rest.RestStatus.NOT_FOUND;
|
|||
import static org.elasticsearch.rest.RestStatus.OK;
|
||||
|
||||
public class RestGetWatchAction extends WatcherRestHandler {
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetWatchAction.class));
|
||||
|
||||
public RestGetWatchAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, URI_BASE + "/watch/{id}", this);
|
||||
// TODO: remove deprecated endpoint in 8.0.0
|
||||
controller.registerWithDeprecatedHandler(
|
||||
GET, "/_watcher/watch/{id}", this,
|
||||
GET, URI_BASE + "/watcher/watch/{id}", deprecationLogger);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "xpack_watcher_get_watch_action";
|
||||
return "watcher_get_watch";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,8 +3,11 @@
|
|||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.xpack.watcher.rest.action;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.elasticsearch.common.logging.DeprecationLogger;
|
||||
import org.elasticsearch.common.lucene.uid.Versions;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.util.set.Sets;
|
||||
|
@ -32,15 +35,22 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
|||
|
||||
public class RestPutWatchAction extends WatcherRestHandler implements RestRequestFilter {
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestPutWatchAction.class));
|
||||
|
||||
public RestPutWatchAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, URI_BASE + "/watch/{id}", this);
|
||||
controller.registerHandler(PUT, URI_BASE + "/watch/{id}", this);
|
||||
// TODO: remove deprecated endpoint in 8.0.0
|
||||
controller.registerWithDeprecatedHandler(
|
||||
POST, "/_watcher/watch/{id}", this,
|
||||
POST, URI_BASE + "/watcher/watch/{id}", deprecationLogger);
|
||||
controller.registerWithDeprecatedHandler(
|
||||
PUT, "/_watcher/watch/{id}", this,
|
||||
PUT, URI_BASE + "/watcher/watch/{id}", deprecationLogger);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "xpack_watcher_put_watch_action";
|
||||
return "watcher_put_watch";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,8 +3,11 @@
|
|||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.xpack.watcher.rest.action;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.elasticsearch.common.logging.DeprecationLogger;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.rest.RestController;
|
||||
import org.elasticsearch.rest.RestRequest;
|
||||
|
@ -17,15 +20,22 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
|
|||
|
||||
public class RestWatchServiceAction extends WatcherRestHandler {
|
||||
|
||||
private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestWatchServiceAction.class));
|
||||
|
||||
public RestWatchServiceAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(POST, URI_BASE + "/_start", this);
|
||||
controller.registerHandler(POST, URI_BASE + "/_stop", new StopRestHandler(settings));
|
||||
// TODO: remove deprecated endpoint in 8.0.0
|
||||
controller.registerWithDeprecatedHandler(
|
||||
POST, "/_watcher/_start", this,
|
||||
POST, URI_BASE + "/watcher/_start", deprecationLogger);
|
||||
controller.registerWithDeprecatedHandler(
|
||||
POST, "/_watcher/_stop", new StopRestHandler(settings),
|
||||
POST, URI_BASE + "/watcher/_stop", deprecationLogger);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "xpack_watcher_start_service_action";
|
||||
return "watcher_start_service";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,7 +51,7 @@ public class RestWatchServiceAction extends WatcherRestHandler {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "xpack_watcher_stop_service_action";
|
||||
return "watcher_stop_service";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
* or more contributor license agreements. Licensed under the Elastic License;
|
||||
* you may not use this file except in compliance with the Elastic License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.xpack.watcher.rest.action;
|
||||
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
@ -29,13 +30,18 @@ public class RestWatcherStatsAction extends WatcherRestHandler {
|
|||
|
||||
public RestWatcherStatsAction(Settings settings, RestController controller) {
|
||||
super(settings);
|
||||
controller.registerHandler(GET, URI_BASE + "/stats", this);
|
||||
controller.registerHandler(GET, URI_BASE + "/stats/{metric}", this);
|
||||
// TODO: remove deprecated endpoint in 8.0.0
|
||||
controller.registerWithDeprecatedHandler(
|
||||
GET, "/_watcher/stats", this,
|
||||
GET, URI_BASE + "/watcher/stats", deprecationLogger);
|
||||
controller.registerWithDeprecatedHandler(
|
||||
GET, "/_watcher/stats/{metric}", this,
|
||||
GET, URI_BASE + "/watcher/stats/{metric}", deprecationLogger);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "xpack_watcher_stats_action";
|
||||
return "watcher_stats";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -154,7 +154,7 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
|
|||
public void testWatcher() throws Exception {
|
||||
if (isRunningAgainstOldCluster()) {
|
||||
logger.info("Adding a watch on old cluster {}", getOldClusterVersion());
|
||||
Request createBwcWatch = new Request("PUT", "_xpack/watcher/watch/bwc_watch");
|
||||
Request createBwcWatch = new Request("PUT", "/_xpack/watcher/watch/bwc_watch");
|
||||
createBwcWatch.setJsonEntity(loadWatch("simple-watch.json"));
|
||||
client().performRequest(createBwcWatch);
|
||||
|
||||
|
@ -208,10 +208,10 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
|
|||
}
|
||||
|
||||
// Wait for watcher to actually start....
|
||||
Map<String, Object> startWatchResponse = entityAsMap(client().performRequest(new Request("POST", "_xpack/watcher/_start")));
|
||||
Map<String, Object> startWatchResponse = entityAsMap(client().performRequest(new Request("POST", "_watcher/_start")));
|
||||
assertThat(startWatchResponse.get("acknowledged"), equalTo(Boolean.TRUE));
|
||||
assertBusy(() -> {
|
||||
Map<String, Object> statsWatchResponse = entityAsMap(client().performRequest(new Request("GET", "_xpack/watcher/stats")));
|
||||
Map<String, Object> statsWatchResponse = entityAsMap(client().performRequest(new Request("GET", "_watcher/stats")));
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Object> states = ((List<Object>) statsWatchResponse.get("stats"))
|
||||
.stream().map(o -> ((Map<String, Object>) o).get("watcher_state")).collect(Collectors.toList());
|
||||
|
@ -226,11 +226,11 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
|
|||
/* Shut down watcher after every test because watcher can be a bit finicky about shutting down when the node shuts
|
||||
* down. This makes super sure it shuts down *and* causes the test to fail in a sensible spot if it doesn't shut down.
|
||||
*/
|
||||
Map<String, Object> stopWatchResponse = entityAsMap(client().performRequest(new Request("POST", "_xpack/watcher/_stop")));
|
||||
Map<String, Object> stopWatchResponse = entityAsMap(client().performRequest(new Request("POST", "_watcher/_stop")));
|
||||
assertThat(stopWatchResponse.get("acknowledged"), equalTo(Boolean.TRUE));
|
||||
assertBusy(() -> {
|
||||
Map<String, Object> statsStoppedWatchResponse = entityAsMap(client().performRequest(
|
||||
new Request("GET", "_xpack/watcher/stats")));
|
||||
new Request("GET", "_watcher/stats")));
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Object> states = ((List<Object>) statsStoppedWatchResponse.get("stats"))
|
||||
.stream().map(o -> ((Map<String, Object>) o).get("watcher_state")).collect(Collectors.toList());
|
||||
|
@ -462,7 +462,7 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
|
|||
@SuppressWarnings("unchecked")
|
||||
private void assertWatchIndexContentsWork() throws Exception {
|
||||
// Fetch a basic watch
|
||||
Map<String, Object> bwcWatch = entityAsMap(client().performRequest(new Request("GET", "_xpack/watcher/watch/bwc_watch")));
|
||||
Map<String, Object> bwcWatch = entityAsMap(client().performRequest(new Request("GET", "_watcher/watch/bwc_watch")));
|
||||
|
||||
logger.error("-----> {}", bwcWatch);
|
||||
|
||||
|
@ -477,7 +477,7 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
|
|||
assertThat(ObjectPath.eval("actions.index_payload.index.timeout_in_millis", source), equalTo(timeout));
|
||||
|
||||
// Fetch a watch with "fun" throttle periods
|
||||
bwcWatch = entityAsMap(client().performRequest(new Request("GET", "_xpack/watcher/watch/bwc_throttle_period")));
|
||||
bwcWatch = entityAsMap(client().performRequest(new Request("GET", "_watcher/watch/bwc_throttle_period")));
|
||||
assertThat(bwcWatch.get("found"), equalTo(true));
|
||||
source = (Map<String, Object>) bwcWatch.get("watch");
|
||||
assertEquals(timeout, source.get("throttle_period_in_millis"));
|
||||
|
@ -487,7 +487,7 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
|
|||
* Fetch a watch with a funny timeout to verify loading fractional time
|
||||
* values.
|
||||
*/
|
||||
bwcWatch = entityAsMap(client().performRequest(new Request("GET", "_xpack/watcher/watch/bwc_funny_timeout")));
|
||||
bwcWatch = entityAsMap(client().performRequest(new Request("GET", "_watcher/watch/bwc_funny_timeout")));
|
||||
assertThat(bwcWatch.get("found"), equalTo(true));
|
||||
source = (Map<String, Object>) bwcWatch.get("watch");
|
||||
|
||||
|
@ -519,7 +519,7 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
|
|||
.condition(InternalAlwaysCondition.INSTANCE)
|
||||
.trigger(ScheduleTrigger.builder(new IntervalSchedule(IntervalSchedule.Interval.seconds(1))))
|
||||
.addAction("awesome", LoggingAction.builder(new TextTemplate("test"))).buildAsBytes(XContentType.JSON).utf8ToString();
|
||||
Request createWatchRequest = new Request("PUT", "_xpack/watcher/watch/new_watch");
|
||||
Request createWatchRequest = new Request("PUT", "_watcher/watch/new_watch");
|
||||
createWatchRequest.setJsonEntity(watch);
|
||||
Map<String, Object> createWatch = entityAsMap(client().performRequest(createWatchRequest));
|
||||
|
||||
|
@ -532,7 +532,7 @@ public class FullClusterRestartIT extends AbstractFullClusterRestartTestCase {
|
|||
assertThat(updateWatch.get("created"), equalTo(false));
|
||||
assertThat(updateWatch.get("_version"), equalTo(2));
|
||||
|
||||
Map<String, Object> get = entityAsMap(client().performRequest(new Request("GET", "_xpack/watcher/watch/new_watch")));
|
||||
Map<String, Object> get = entityAsMap(client().performRequest(new Request("GET", "_watcher/watch/new_watch")));
|
||||
assertThat(get.get("found"), equalTo(true));
|
||||
@SuppressWarnings("unchecked") Map<?, ?> source = (Map<String, Object>) get.get("watch");
|
||||
Map<String, Object> logging = ObjectPath.eval("actions.awesome.logging", source);
|
||||
|
|
|
@ -17,16 +17,16 @@ import static org.hamcrest.Matchers.not;
|
|||
public class WatcherRestartIT extends AbstractUpgradeTestCase {
|
||||
|
||||
public void testWatcherRestart() throws Exception {
|
||||
client().performRequest(new Request("POST", "/_xpack/watcher/_stop"));
|
||||
client().performRequest(new Request("POST", "/_watcher/_stop"));
|
||||
ensureWatcherStopped();
|
||||
|
||||
client().performRequest(new Request("POST", "/_xpack/watcher/_start"));
|
||||
client().performRequest(new Request("POST", "/_watcher/_start"));
|
||||
ensureWatcherStarted();
|
||||
}
|
||||
|
||||
private void ensureWatcherStopped() throws Exception {
|
||||
assertBusy(() -> {
|
||||
Response stats = client().performRequest(new Request("GET", "_xpack/watcher/stats"));
|
||||
Response stats = client().performRequest(new Request("GET", "_watcher/stats"));
|
||||
String responseBody = EntityUtils.toString(stats.getEntity(), StandardCharsets.UTF_8);
|
||||
assertThat(responseBody, containsString("\"watcher_state\":\"stopped\""));
|
||||
assertThat(responseBody, not(containsString("\"watcher_state\":\"starting\"")));
|
||||
|
@ -37,7 +37,7 @@ public class WatcherRestartIT extends AbstractUpgradeTestCase {
|
|||
|
||||
private void ensureWatcherStarted() throws Exception {
|
||||
assertBusy(() -> {
|
||||
Response response = client().performRequest(new Request("GET", "_xpack/watcher/stats"));
|
||||
Response response = client().performRequest(new Request("GET", "_watcher/stats"));
|
||||
String responseBody = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
|
||||
assertThat(responseBody, containsString("\"watcher_state\":\"started\""));
|
||||
assertThat(responseBody, not(containsString("\"watcher_state\":\"starting\"")));
|
||||
|
|
|
@ -77,7 +77,7 @@ public class MonitoringWithWatcherRestIT extends ESRestTestCase {
|
|||
}
|
||||
|
||||
private void assertMonitoringWatchHasBeenOverWritten(String watchId) throws Exception {
|
||||
ObjectPath path = ObjectPath.createFromResponse(client().performRequest(new Request("GET", "/_xpack/watcher/watch/" + watchId)));
|
||||
ObjectPath path = ObjectPath.createFromResponse(client().performRequest(new Request("GET", "/_watcher/watch/" + watchId)));
|
||||
String interval = path.evaluate("watch.trigger.schedule.interval");
|
||||
assertThat(interval, is("1m"));
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public class MonitoringWithWatcherRestIT extends ESRestTestCase {
|
|||
private String createMonitoringWatch() throws Exception {
|
||||
String clusterUUID = getClusterUUID();
|
||||
String watchId = clusterUUID + "_kibana_version_mismatch";
|
||||
Request request = new Request("PUT", "/_xpack/watcher/watch/" + watchId);
|
||||
Request request = new Request("PUT", "/_watcher/watch/" + watchId);
|
||||
request.setJsonEntity(WatchSourceBuilders.watchBuilder()
|
||||
.trigger(TriggerBuilders.schedule(new IntervalSchedule(new IntervalSchedule.Interval(1000, MINUTES))))
|
||||
.input(simpleInput())
|
||||
|
|
|
@ -57,13 +57,13 @@ public class SmokeTestWatcherWithSecurityIT extends ESRestTestCase {
|
|||
|
||||
assertBusy(() -> {
|
||||
try {
|
||||
Response statsResponse = adminClient().performRequest(new Request("GET", "/_xpack/watcher/stats"));
|
||||
Response statsResponse = adminClient().performRequest(new Request("GET", "/_watcher/stats"));
|
||||
ObjectPath objectPath = ObjectPath.createFromResponse(statsResponse);
|
||||
String state = objectPath.evaluate("stats.0.watcher_state");
|
||||
|
||||
switch (state) {
|
||||
case "stopped":
|
||||
Response startResponse = adminClient().performRequest(new Request("POST", "/_xpack/watcher/_start"));
|
||||
Response startResponse = adminClient().performRequest(new Request("POST", "/_watcher/_start"));
|
||||
Map<String, Object> responseMap = entityAsMap(startResponse);
|
||||
assertThat(responseMap, hasEntry("acknowledged", true));
|
||||
throw new AssertionError("waiting until stopped state reached started state");
|
||||
|
@ -95,7 +95,7 @@ public class SmokeTestWatcherWithSecurityIT extends ESRestTestCase {
|
|||
|
||||
assertBusy(() -> {
|
||||
try {
|
||||
Response statsResponse = adminClient().performRequest(new Request("GET", "/_xpack/watcher/stats"));
|
||||
Response statsResponse = adminClient().performRequest(new Request("GET", "/_watcher/stats"));
|
||||
ObjectPath objectPath = ObjectPath.createFromResponse(statsResponse);
|
||||
String state = objectPath.evaluate("stats.0.watcher_state");
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class SmokeTestWatcherWithSecurityIT extends ESRestTestCase {
|
|||
case "starting":
|
||||
throw new AssertionError("waiting until starting state reached started state to stop");
|
||||
case "started":
|
||||
Response stopResponse = adminClient().performRequest(new Request("POST", "/_xpack/watcher/_stop"));
|
||||
Response stopResponse = adminClient().performRequest(new Request("POST", "/_watcher/_stop"));
|
||||
String body = EntityUtils.toString(stopResponse.getEntity());
|
||||
assertThat(body, containsString("\"acknowledged\":true"));
|
||||
throw new AssertionError("waiting until started state reached stopped state");
|
||||
|
@ -291,7 +291,7 @@ public class SmokeTestWatcherWithSecurityIT extends ESRestTestCase {
|
|||
}
|
||||
|
||||
private void indexWatch(String watchId, XContentBuilder builder) throws Exception {
|
||||
Request request = new Request("PUT", "/_xpack/watcher/watch/" + watchId);
|
||||
Request request = new Request("PUT", "/_watcher/watch/" + watchId);
|
||||
request.setJsonEntity(Strings.toString(builder));
|
||||
Response response = client().performRequest(request);
|
||||
Map<String, Object> responseMap = entityAsMap(response);
|
||||
|
|
|
@ -41,12 +41,12 @@ public class SmokeTestWatcherTestSuiteIT extends ESRestTestCase {
|
|||
assertOK(adminClient().performRequest(new Request("DELETE", "/.watcher-history-*")));
|
||||
|
||||
assertBusy(() -> {
|
||||
Response response = adminClient().performRequest(new Request("GET", "/_xpack/watcher/stats"));
|
||||
Response response = adminClient().performRequest(new Request("GET", "/_watcher/stats"));
|
||||
String state = ObjectPath.createFromResponse(response).evaluate("stats.0.watcher_state");
|
||||
|
||||
switch (state) {
|
||||
case "stopped":
|
||||
Response startResponse = adminClient().performRequest(new Request("POST", "/_xpack/watcher/_start"));
|
||||
Response startResponse = adminClient().performRequest(new Request("POST", "/_watcher/_start"));
|
||||
boolean isAcknowledged = ObjectPath.createFromResponse(startResponse).evaluate("acknowledged");
|
||||
assertThat(isAcknowledged, is(true));
|
||||
throw new AssertionError("waiting until stopped state reached started state");
|
||||
|
@ -73,7 +73,7 @@ public class SmokeTestWatcherTestSuiteIT extends ESRestTestCase {
|
|||
@After
|
||||
public void stopWatcher() throws Exception {
|
||||
assertBusy(() -> {
|
||||
Response response = adminClient().performRequest(new Request("GET", "/_xpack/watcher/stats"));
|
||||
Response response = adminClient().performRequest(new Request("GET", "/_watcher/stats"));
|
||||
String state = ObjectPath.createFromResponse(response).evaluate("stats.0.watcher_state");
|
||||
|
||||
switch (state) {
|
||||
|
@ -85,7 +85,7 @@ public class SmokeTestWatcherTestSuiteIT extends ESRestTestCase {
|
|||
case "starting":
|
||||
throw new AssertionError("waiting until starting state reached started state to stop");
|
||||
case "started":
|
||||
Response stopResponse = adminClient().performRequest(new Request("POST", "/_xpack/watcher/_stop"));
|
||||
Response stopResponse = adminClient().performRequest(new Request("POST", "/_watcher/_stop"));
|
||||
boolean isAcknowledged = ObjectPath.createFromResponse(stopResponse).evaluate("acknowledged");
|
||||
assertThat(isAcknowledged, is(true));
|
||||
throw new AssertionError("waiting until started state reached stopped state");
|
||||
|
@ -163,7 +163,7 @@ public class SmokeTestWatcherTestSuiteIT extends ESRestTestCase {
|
|||
}
|
||||
|
||||
private void indexWatch(String watchId, XContentBuilder builder) throws Exception {
|
||||
Request request = new Request("PUT", "/_xpack/watcher/watch/" + watchId);
|
||||
Request request = new Request("PUT", "/_watcher/watch/" + watchId);
|
||||
request.setJsonEntity(Strings.toString(builder));
|
||||
Response response = client().performRequest(request);
|
||||
Map<String, Object> responseMap = entityAsMap(response);
|
||||
|
@ -171,7 +171,7 @@ public class SmokeTestWatcherTestSuiteIT extends ESRestTestCase {
|
|||
}
|
||||
|
||||
private void deleteWatch(String watchId) throws IOException {
|
||||
Response response = client().performRequest(new Request("DELETE", "/_xpack/watcher/watch/" + watchId));
|
||||
Response response = client().performRequest(new Request("DELETE", "/_watcher/watch/" + watchId));
|
||||
assertOK(response);
|
||||
ObjectPath path = ObjectPath.createFromResponse(response);
|
||||
boolean found = path.evaluate("found");
|
||||
|
@ -209,7 +209,7 @@ public class SmokeTestWatcherTestSuiteIT extends ESRestTestCase {
|
|||
}
|
||||
|
||||
private void assertWatchCount(int expectedWatches) throws IOException {
|
||||
Response watcherStatsResponse = adminClient().performRequest(new Request("GET", "/_xpack/watcher/stats"));
|
||||
Response watcherStatsResponse = adminClient().performRequest(new Request("GET", "/_watcher/stats"));
|
||||
ObjectPath objectPath = ObjectPath.createFromResponse(watcherStatsResponse);
|
||||
int watchCount = objectPath.evaluate("stats.0.watch_count");
|
||||
assertThat(watchCount, is(expectedWatches));
|
||||
|
|
Loading…
Reference in New Issue