Skip to content

Commit 3d5d854

Browse files
authored
Undeprecate /_watcher endpoints (#36269)
We deprecated these awhile ago in favor of /_xpack/watcher endpoints. Yet, this is no longer the direction that we want to go in, instead we want to remove the /_xpack namespace. This commit undeprecates the /_watcher endpoint.
1 parent b7ab4d0 commit 3d5d854

File tree

8 files changed

+45
-46
lines changed

8 files changed

+45
-46
lines changed

x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ public class RestAckWatchAction extends WatcherRestHandler {
3737

3838
public RestAckWatchAction(Settings settings, RestController controller) {
3939
super(settings);
40-
// @deprecated Remove deprecations in 6.0
41-
controller.registerWithDeprecatedHandler(POST, URI_BASE + "/watch/{id}/_ack", this,
42-
POST, "/_watcher/watch/{id}/_ack", deprecationLogger);
43-
controller.registerWithDeprecatedHandler(PUT, URI_BASE + "/watch/{id}/_ack", this,
44-
PUT, "/_watcher/watch/{id}/_ack", deprecationLogger);
45-
controller.registerWithDeprecatedHandler(POST, URI_BASE + "/watch/{id}/_ack/{actions}", this,
46-
POST, "/_watcher/watch/{id}/_ack/{actions}", deprecationLogger);
47-
controller.registerWithDeprecatedHandler(PUT, URI_BASE + "/watch/{id}/_ack/{actions}", this,
48-
PUT, "/_watcher/watch/{id}/_ack/{actions}", deprecationLogger);
40+
41+
controller.registerHandler(POST, URI_BASE + "/watch/{id}/_ack", this);
42+
controller.registerHandler(POST, "/_watcher/watch/{id}/_ack", this);
43+
controller.registerHandler(PUT, URI_BASE + "/watch/{id}/_ack", this);
44+
controller.registerHandler(PUT, "/_watcher/watch/{id}/_ack", this);
45+
controller.registerHandler(POST, URI_BASE + "/watch/{id}/_ack/{actions}", this);
46+
controller.registerHandler(POST, "/_watcher/watch/{id}/_ack/{actions}", this);
47+
controller.registerHandler(PUT, URI_BASE + "/watch/{id}/_ack/{actions}", this);
48+
controller.registerHandler(PUT, "/_watcher/watch/{id}/_ack/{actions}", this);
4949

5050
// @deprecated The following can be totally dropped in 6.0
5151
// Note: we deprecated "/{actions}/_ack" totally; so we don't replace it with a matching _xpack variant

x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,14 @@ public RestActivateWatchAction(Settings settings, RestController controller) {
4040

4141
final DeactivateRestHandler deactivateRestHandler = new DeactivateRestHandler(settings);
4242

43-
// @deprecated Remove deprecations in 6.0
44-
controller.registerWithDeprecatedHandler(POST, URI_BASE + "/watch/{id}/_activate", this,
45-
POST, "/_watcher/watch/{id}/_activate", deprecationLogger);
46-
controller.registerWithDeprecatedHandler(PUT, URI_BASE + "/watch/{id}/_activate", this,
47-
PUT, "/_watcher/watch/{id}/_activate", deprecationLogger);
48-
controller.registerWithDeprecatedHandler(POST, URI_BASE + "/watch/{id}/_deactivate", deactivateRestHandler,
49-
POST, "/_watcher/watch/{id}/_deactivate", deprecationLogger);
50-
controller.registerWithDeprecatedHandler(PUT, URI_BASE + "/watch/{id}/_deactivate", deactivateRestHandler,
51-
PUT, "/_watcher/watch/{id}/_deactivate", deprecationLogger);
43+
controller.registerHandler(POST, URI_BASE + "/watch/{id}/_activate", this);
44+
controller.registerHandler(POST, "/_watcher/watch/{id}/_activate", this);
45+
controller.registerHandler(PUT, URI_BASE + "/watch/{id}/_activate", this);
46+
controller.registerHandler(PUT, "/_watcher/watch/{id}/_activate", this);
47+
controller.registerHandler(POST, URI_BASE + "/watch/{id}/_deactivate", deactivateRestHandler);
48+
controller.registerHandler(POST, "/_watcher/watch/{id}/_deactivate", deactivateRestHandler);
49+
controller.registerHandler(PUT, URI_BASE + "/watch/{id}/_deactivate", deactivateRestHandler);
50+
controller.registerHandler(PUT, "/_watcher/watch/{id}/_deactivate", deactivateRestHandler);
5251
}
5352

5453
@Override

x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ public class RestDeleteWatchAction extends WatcherRestHandler {
3333

3434
public RestDeleteWatchAction(Settings settings, RestController controller) {
3535
super(settings);
36-
// @deprecated Remove deprecations in 6.0
37-
controller.registerWithDeprecatedHandler(DELETE, URI_BASE + "/watch/{id}", this,
38-
DELETE, "/_watcher/watch/{id}", deprecationLogger);
36+
37+
controller.registerHandler(DELETE, URI_BASE + "/watch/{id}", this);
38+
controller.registerHandler(DELETE, "/_watcher/watch/{id}", this);
3939
}
4040

4141
@Override

x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,14 @@ public class RestExecuteWatchAction extends WatcherRestHandler implements RestRe
5656
public RestExecuteWatchAction(Settings settings, RestController controller) {
5757
super(settings);
5858

59-
// @deprecated Remove deprecations in 6.0
60-
controller.registerWithDeprecatedHandler(POST, URI_BASE + "/watch/{id}/_execute", this,
61-
POST, "/_watcher/watch/{id}/_execute", deprecationLogger);
62-
controller.registerWithDeprecatedHandler(PUT, URI_BASE + "/watch/{id}/_execute", this,
63-
PUT, "/_watcher/watch/{id}/_execute", deprecationLogger);
64-
controller.registerWithDeprecatedHandler(POST, URI_BASE + "/watch/_execute", this,
65-
POST, "/_watcher/watch/_execute", deprecationLogger);
66-
controller.registerWithDeprecatedHandler(PUT, URI_BASE + "/watch/_execute", this,
67-
PUT, "/_watcher/watch/_execute", deprecationLogger);
59+
controller.registerHandler(POST, URI_BASE + "/watch/{id}/_execute", this);
60+
controller.registerHandler(POST, "/_watcher/watch/{id}/_execute", this);
61+
controller.registerHandler(PUT, URI_BASE + "/watch/{id}/_execute", this);
62+
controller.registerHandler(PUT, "/_watcher/watch/{id}/_execute", this);
63+
controller.registerHandler(POST, URI_BASE + "/watch/_execute", this);
64+
controller.registerHandler(POST, "/_watcher/watch/_execute", this);
65+
controller.registerHandler(PUT, URI_BASE + "/watch/_execute", this);
66+
controller.registerHandler(PUT, "/_watcher/watch/_execute", this);
6867
}
6968

7069
@Override

x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ public class RestGetWatchAction extends WatcherRestHandler {
3434
public RestGetWatchAction(Settings settings, RestController controller) {
3535
super(settings);
3636

37-
// @deprecated Remove deprecations in 6.0
38-
controller.registerWithDeprecatedHandler(GET, URI_BASE + "/watch/{id}", this,
39-
GET, "/_watcher/watch/{id}", deprecationLogger);
37+
controller.registerHandler(GET, URI_BASE + "/watch/{id}", this);
38+
controller.registerHandler(GET, "/_watcher/watch/{id}", this);
4039
}
4140

4241
@Override

x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,10 @@ public class RestPutWatchAction extends WatcherRestHandler implements RestReques
4040
public RestPutWatchAction(Settings settings, RestController controller) {
4141
super(settings);
4242

43-
// @deprecated Remove deprecations in 6.0
44-
controller.registerWithDeprecatedHandler(POST, URI_BASE + "/watch/{id}", this,
45-
POST, "/_watcher/watch/{id}", deprecationLogger);
46-
controller.registerWithDeprecatedHandler(PUT, URI_BASE + "/watch/{id}", this,
47-
PUT, "/_watcher/watch/{id}", deprecationLogger);
43+
controller.registerHandler(POST, URI_BASE + "/watch/{id}", this);
44+
controller.registerHandler(POST, "/_watcher/watch/{id}", this);
45+
controller.registerHandler(PUT, URI_BASE + "/watch/{id}", this);
46+
controller.registerHandler(PUT, "/_watcher/watch/{id}", this);
4847
}
4948

5049
@Override

x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,18 @@ public class RestWatchServiceAction extends WatcherRestHandler {
2828
public RestWatchServiceAction(Settings settings, RestController controller) {
2929
super(settings);
3030

31-
// @deprecated Remove in 6.0
3231
// NOTE: we switched from PUT in 2.x to POST in 5.x
32+
// NOTE: We added back the old URL with the new VERB (POST) since we are deprecating _xpack/* URIs in 7.0
3333
controller.registerWithDeprecatedHandler(POST, URI_BASE + "/_restart", this,
3434
PUT, "/_watcher/_restart", deprecationLogger);
35+
StartRestHandler startRestHandler = new StartRestHandler(settings);
3536
controller.registerWithDeprecatedHandler(POST, URI_BASE + "/_start",
36-
new StartRestHandler(settings), PUT, "/_watcher/_start", deprecationLogger);
37+
startRestHandler, PUT, "/_watcher/_start", deprecationLogger);
38+
controller.registerHandler(POST, "/_watcher/_start", startRestHandler);
39+
StopRestHandler stopRestHandler = new StopRestHandler(settings);
3740
controller.registerWithDeprecatedHandler(POST, URI_BASE + "/_stop",
38-
new StopRestHandler(settings), PUT, "/_watcher/_stop", deprecationLogger);
41+
stopRestHandler, PUT, "/_watcher/_stop", deprecationLogger);
42+
controller.registerHandler(POST, "/_watcher/_stop", stopRestHandler);
3943
}
4044

4145
@Override

x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@ public class RestWatcherStatsAction extends WatcherRestHandler {
3030
public RestWatcherStatsAction(Settings settings, RestController controller) {
3131
super(settings);
3232

33-
// @deprecated Remove deprecations in 6.0
34-
controller.registerWithDeprecatedHandler(GET, URI_BASE + "/stats", this,
35-
GET, "/_watcher/stats", deprecationLogger);
36-
controller.registerWithDeprecatedHandler(GET, URI_BASE + "/stats/{metric}", this,
37-
GET, "/_watcher/stats/{metric}", deprecationLogger);
33+
controller.registerHandler(GET, URI_BASE + "/stats", this);
34+
controller.registerHandler(GET, "/_watcher/stats", this);
35+
controller.registerHandler(GET, URI_BASE + "/stats/{metric}", this);
36+
controller.registerHandler(GET, "/_watcher/stats/{metric}", this);
3837
}
3938

4039
@Override

0 commit comments

Comments
 (0)