From 547b0ebc1bb4671dd19877a4a5f3962653d5e808 Mon Sep 17 00:00:00 2001 From: Alexander Reelsen Date: Tue, 1 Aug 2017 14:14:51 +0200 Subject: [PATCH] X-Pack: Remove deprecated handlers, remove watcher restart action (elastic/x-pack-elasticsearch#2133) The deprecated handlers should have been removed earlier, but are now going to to away finally. Also the watcher restart action has been removed, mainly because users should not blindly restart, but always make sure, that watcher is stopped correctly before restarting. This had been removed from the transport action previously. Original commit: elastic/x-pack-elasticsearch@78a5ec3c05d656c0a61563d87d1082f97388b4fe --- docs/en/rest-api/watcher.asciidoc | 1 - docs/en/rest-api/watcher/restart.asciidoc | 22 --------- .../license/RestDeleteLicenseAction.java | 10 +--- .../license/RestGetLicenseAction.java | 10 +--- .../license/RestPutLicenseAction.java | 18 ++----- .../rest/action/RestAuthenticateAction.java | 6 --- .../realm/RestClearRealmCacheAction.java | 10 ---- .../role/RestClearRolesCacheAction.java | 6 --- .../action/role/RestDeleteRoleAction.java | 6 --- .../rest/action/role/RestGetRolesAction.java | 10 ---- .../rest/action/role/RestPutRoleAction.java | 10 ---- .../action/user/RestDeleteUserAction.java | 6 --- .../rest/action/user/RestGetUsersAction.java | 10 ---- .../rest/action/user/RestPutUserAction.java | 10 ---- .../rest/action/RestAckWatchAction.java | 24 ++------- .../rest/action/RestActivateWatchAction.java | 15 ++---- .../rest/action/RestDeleteWatchAction.java | 4 +- .../rest/action/RestExecuteWatchAction.java | 14 ++---- .../rest/action/RestGetWatchAction.java | 5 +- .../rest/action/RestPutWatchAction.java | 8 +-- .../rest/action/RestWatchServiceAction.java | 49 ++----------------- .../rest/action/RestWatcherStatsAction.java | 8 +-- .../api/xpack.watcher.restart.json | 15 ------ .../test/watcher/restart_watcher/10_basic.yml | 8 --- 24 files changed, 28 insertions(+), 257 deletions(-) delete mode 100644 docs/en/rest-api/watcher/restart.asciidoc delete mode 100644 plugin/src/test/resources/rest-api-spec/api/xpack.watcher.restart.json delete mode 100644 plugin/src/test/resources/rest-api-spec/test/watcher/restart_watcher/10_basic.yml diff --git a/docs/en/rest-api/watcher.asciidoc b/docs/en/rest-api/watcher.asciidoc index 3c69973c2ec..2fcce5806cc 100644 --- a/docs/en/rest-api/watcher.asciidoc +++ b/docs/en/rest-api/watcher.asciidoc @@ -24,4 +24,3 @@ include::watcher/deactivate-watch.asciidoc[] include::watcher/stats.asciidoc[] include::watcher/stop.asciidoc[] include::watcher/start.asciidoc[] -include::watcher/restart.asciidoc[] diff --git a/docs/en/rest-api/watcher/restart.asciidoc b/docs/en/rest-api/watcher/restart.asciidoc deleted file mode 100644 index 0a41db3ea15..00000000000 --- a/docs/en/rest-api/watcher/restart.asciidoc +++ /dev/null @@ -1,22 +0,0 @@ -[role="xpack"] -[[watcher-api-restart]] -=== Restart API - -The `restart` API stops, then starts the {watcher} service, as in the -following example: - -[source,js] --------------------------------------------------- -POST _xpack/watcher/_restart --------------------------------------------------- -// CONSOLE - -{watcher} returns the following response if the request is successful: - -[source,js] --------------------------------------------------- -{ - "acknowledged": true -} --------------------------------------------------- -// TESTRESPONSE diff --git a/plugin/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java b/plugin/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java index aed273d43b1..b7ee7e89fe8 100644 --- a/plugin/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java +++ b/plugin/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java @@ -19,15 +19,7 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE; public class RestDeleteLicenseAction extends XPackRestHandler { public RestDeleteLicenseAction(Settings settings, RestController controller) { super(settings); - // @deprecated Remove deprecations in 6.0 - controller.registerWithDeprecatedHandler(DELETE, URI_BASE + "/license", this, - DELETE, "/_license", deprecationLogger); - - // Remove _licenses support entirely in 6.0 - controller.registerAsDeprecatedHandler(DELETE, "/_licenses", this, - "[DELETE /_licenses] is deprecated! Use " + - "[DELETE /_xpack/license] instead.", - deprecationLogger); + controller.registerHandler(DELETE, URI_BASE + "/license", this); } @Override diff --git a/plugin/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java b/plugin/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java index 1080074dbe5..8df29c2f938 100644 --- a/plugin/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java +++ b/plugin/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java @@ -30,15 +30,7 @@ public class RestGetLicenseAction extends XPackRestHandler { @Inject public RestGetLicenseAction(Settings settings, RestController controller) { super(settings); - // @deprecated Remove deprecations in 6.0 - controller.registerWithDeprecatedHandler(GET, URI_BASE + "/license", this, - GET, "/_license", deprecationLogger); - - // Remove _licenses support entirely in 6.0 - controller.registerAsDeprecatedHandler(GET, "/_licenses", this, - "[GET /_licenses] is deprecated! Use " + - "[GET /_xpack/license] instead.", - deprecationLogger); + controller.registerHandler(GET, URI_BASE + "/license", this); } @Override diff --git a/plugin/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java b/plugin/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java index f7bb3df0842..96b53486a1f 100644 --- a/plugin/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java +++ b/plugin/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java @@ -23,23 +23,11 @@ import static org.elasticsearch.rest.RestRequest.Method.POST; import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestPutLicenseAction extends XPackRestHandler { + public RestPutLicenseAction(Settings settings, RestController controller) { super(settings); - // @deprecated Remove deprecations in 6.0 - controller.registerWithDeprecatedHandler(POST, URI_BASE + "/license", this, - POST, "/_license", deprecationLogger); - controller.registerWithDeprecatedHandler(PUT, URI_BASE + "/license", this, - PUT, "/_license", deprecationLogger); - - // Remove _licenses support entirely in 6.0 - controller.registerAsDeprecatedHandler(POST, "/_licenses", this, - "[POST /_licenses] is deprecated! Use " + - "[POST /_xpack/license] instead.", - deprecationLogger); - controller.registerAsDeprecatedHandler(PUT, "/_licenses", this, - "[PUT /_licenses] is deprecated! Use " + - "[PUT /_xpack/license] instead.", - deprecationLogger); + controller.registerHandler(POST, URI_BASE + "/license", this); + controller.registerHandler(PUT, URI_BASE + "/license", this); } @Override diff --git a/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/RestAuthenticateAction.java b/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/RestAuthenticateAction.java index 240a0da8e4a..cefc1ab9582 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/RestAuthenticateAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/RestAuthenticateAction.java @@ -35,12 +35,6 @@ public class RestAuthenticateAction extends SecurityBaseRestHandler { super(settings, licenseState); this.securityContext = securityContext; controller.registerHandler(GET, "/_xpack/security/_authenticate", this); - - // @deprecated: Remove in 6.0 - controller.registerAsDeprecatedHandler(GET, "/_shield/authenticate", this, - "[GET /_shield/authenticate] is deprecated! Use " + - "[GET /_xpack/security/_authenticate] instead.", - deprecationLogger); } @Override diff --git a/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/realm/RestClearRealmCacheAction.java b/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/realm/RestClearRealmCacheAction.java index 7ea868e3a41..bf42bb15163 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/realm/RestClearRealmCacheAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/realm/RestClearRealmCacheAction.java @@ -24,16 +24,6 @@ public final class RestClearRealmCacheAction extends SecurityBaseRestHandler { public RestClearRealmCacheAction(Settings settings, RestController controller, XPackLicenseState licenseState) { super(settings, licenseState); controller.registerHandler(POST, "/_xpack/security/realm/{realms}/_clear_cache", this); - - // @deprecated: Remove in 6.0 - controller.registerAsDeprecatedHandler(POST, "/_shield/realm/{realms}/_cache/clear", this, - "[POST /_shield/realm/{realms}/_cache/clear] is deprecated! Use " + - "[POST /_xpack/security/realm/{realms}/_clear_cache] instead.", - deprecationLogger); - controller.registerAsDeprecatedHandler(POST, "/_shield/realm/{realms}/_clear_cache", this, - "[POST /_shield/realm/{realms}/_clear_cache] is deprecated! Use " + - "[POST /_xpack/security/realm/{realms}/_clear_cache] instead.", - deprecationLogger); } @Override diff --git a/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestClearRolesCacheAction.java b/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestClearRolesCacheAction.java index 99368dbe5d8..01c00ac3e72 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestClearRolesCacheAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestClearRolesCacheAction.java @@ -24,12 +24,6 @@ public final class RestClearRolesCacheAction extends SecurityBaseRestHandler { public RestClearRolesCacheAction(Settings settings, RestController controller, XPackLicenseState licenseState) { super(settings, licenseState); controller.registerHandler(POST, "/_xpack/security/role/{name}/_clear_cache", this); - - // @deprecated: Remove in 6.0 - controller.registerAsDeprecatedHandler(POST, "/_shield/role/{name}/_clear_cache", this, - "[POST /_shield/role/{name}/_clear_cache] is deprecated! Use " + - "[POST /_xpack/security/role/{name}/_clear_cache] instead.", - deprecationLogger); } @Override diff --git a/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestDeleteRoleAction.java b/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestDeleteRoleAction.java index c42bd02ebdd..0cbb4fc9f45 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestDeleteRoleAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestDeleteRoleAction.java @@ -31,12 +31,6 @@ public class RestDeleteRoleAction extends SecurityBaseRestHandler { public RestDeleteRoleAction(Settings settings, RestController controller, XPackLicenseState licenseState) { super(settings, licenseState); controller.registerHandler(DELETE, "/_xpack/security/role/{name}", this); - - // @deprecated: Remove in 6.0 - controller.registerAsDeprecatedHandler(DELETE, "/_shield/role/{name}", this, - "[DELETE /_shield/role/{name}] is deprecated! Use " + - "[DELETE /_xpack/security/role/{name}] instead.", - deprecationLogger); } @Override diff --git a/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestGetRolesAction.java b/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestGetRolesAction.java index 1ef5bb0e2d1..0b9190c92e2 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestGetRolesAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestGetRolesAction.java @@ -33,16 +33,6 @@ public class RestGetRolesAction extends SecurityBaseRestHandler { super(settings, licenseState); controller.registerHandler(GET, "/_xpack/security/role/", this); controller.registerHandler(GET, "/_xpack/security/role/{name}", this); - - // @deprecated: Remove in 6.0 - controller.registerAsDeprecatedHandler(GET, "/_shield/role", this, - "[GET /_shield/role] is deprecated! Use " + - "[GET /_xpack/security/role] instead.", - deprecationLogger); - controller.registerAsDeprecatedHandler(GET, "/_shield/role/{name}", this, - "[GET /_shield/role/{name}] is deprecated! Use " + - "[GET /_xpack/security/role/{name}] instead.", - deprecationLogger); } @Override diff --git a/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestPutRoleAction.java b/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestPutRoleAction.java index 544052e1a0e..782bb30122a 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestPutRoleAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/role/RestPutRoleAction.java @@ -34,16 +34,6 @@ public class RestPutRoleAction extends SecurityBaseRestHandler { super(settings, licenseState); controller.registerHandler(POST, "/_xpack/security/role/{name}", this); controller.registerHandler(PUT, "/_xpack/security/role/{name}", this); - - // @deprecated: Remove in 6.0 - controller.registerAsDeprecatedHandler(POST, "/_shield/role/{name}", this, - "[POST /_shield/role/{name}] is deprecated! Use " + - "[POST /_xpack/security/role/{name}] instead.", - deprecationLogger); - controller.registerAsDeprecatedHandler(PUT, "/_shield/role/{name}", this, - "[PUT /_shield/role/{name}] is deprecated! Use " + - "[PUT /_xpack/security/role/{name}] instead.", - deprecationLogger); } @Override diff --git a/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestDeleteUserAction.java b/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestDeleteUserAction.java index 322e14d2466..caecc785883 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestDeleteUserAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestDeleteUserAction.java @@ -31,12 +31,6 @@ public class RestDeleteUserAction extends SecurityBaseRestHandler { public RestDeleteUserAction(Settings settings, RestController controller, XPackLicenseState licenseState) { super(settings, licenseState); controller.registerHandler(DELETE, "/_xpack/security/user/{username}", this); - - // @deprecated: Remove in 6.0 - controller.registerAsDeprecatedHandler(DELETE, "/_shield/user/{username}", this, - "[DELETE /_shield/user/{username}] is deprecated! Use " + - "[DELETE /_xpack/security/user/{username}] instead.", - deprecationLogger); } @Override diff --git a/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUsersAction.java b/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUsersAction.java index 375f4c98e91..d71d334b9dd 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUsersAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestGetUsersAction.java @@ -34,16 +34,6 @@ public class RestGetUsersAction extends SecurityBaseRestHandler { super(settings, licenseState); controller.registerHandler(GET, "/_xpack/security/user/", this); controller.registerHandler(GET, "/_xpack/security/user/{username}", this); - - // @deprecated: Remove in 6.0 - controller.registerAsDeprecatedHandler(GET, "/_shield/user", this, - "[GET /_shield/user] is deprecated! Use " + - "[GET /_xpack/security/user] instead.", - deprecationLogger); - controller.registerAsDeprecatedHandler(GET, "/_shield/user/{username}", this, - "[GET /_shield/user/{username}] is deprecated! Use " + - "[GET /_xpack/security/user/{username}] instead.", - deprecationLogger); } @Override diff --git a/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestPutUserAction.java b/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestPutUserAction.java index 0d52a8e0cc9..f70494e913e 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestPutUserAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/security/rest/action/user/RestPutUserAction.java @@ -38,16 +38,6 @@ public class RestPutUserAction extends SecurityBaseRestHandler implements RestRe super(settings, licenseState); controller.registerHandler(POST, "/_xpack/security/user/{username}", this); controller.registerHandler(PUT, "/_xpack/security/user/{username}", this); - - // @deprecated: Remove in 6.0 - controller.registerAsDeprecatedHandler(POST, "/_shield/user/{username}", this, - "[POST /_shield/user/{username}] is deprecated! Use " + - "[POST /_xpack/security/user/{username}] instead.", - deprecationLogger); - controller.registerAsDeprecatedHandler(PUT, "/_shield/user/{username}", this, - "[PUT /_shield/user/{username}] is deprecated! Use " + - "[PUT /_xpack/security/user/{username}] instead.", - deprecationLogger); } @Override diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java index dcb329ad6a1..b513e9efb1f 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java @@ -31,26 +31,10 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestAckWatchAction extends WatcherRestHandler { public RestAckWatchAction(Settings settings, RestController controller) { super(settings); - // @deprecated Remove deprecations in 6.0 - controller.registerWithDeprecatedHandler(POST, URI_BASE + "/watch/{id}/_ack", this, - POST, "/_watcher/watch/{id}/_ack", deprecationLogger); - controller.registerWithDeprecatedHandler(PUT, URI_BASE + "/watch/{id}/_ack", this, - PUT, "/_watcher/watch/{id}/_ack", deprecationLogger); - controller.registerWithDeprecatedHandler(POST, URI_BASE + "/watch/{id}/_ack/{actions}", this, - POST, "/_watcher/watch/{id}/_ack/{actions}", deprecationLogger); - controller.registerWithDeprecatedHandler(PUT, URI_BASE + "/watch/{id}/_ack/{actions}", this, - PUT, "/_watcher/watch/{id}/_ack/{actions}", deprecationLogger); - - // @deprecated The following can be totally dropped in 6.0 - // Note: we deprecated "/{actions}/_ack" totally; so we don't replace it with a matching _xpack variant - controller.registerAsDeprecatedHandler(POST, "/_watcher/watch/{id}/{actions}/_ack", this, - "[POST /_watcher/watch/{id}/{actions}/_ack] is deprecated! Use " + - "[POST /_xpack/watcher/watch/{id}/_ack/{actions}] instead.", - deprecationLogger); - controller.registerAsDeprecatedHandler(PUT, "/_watcher/watch/{id}/{actions}/_ack", this, - "[PUT /_watcher/watch/{id}/{actions}/_ack] is deprecated! Use " + - "[PUT /_xpack/watcher/watch/{id}/_ack/{actions}] instead.", - deprecationLogger); + 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); } @Override diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java index 101952510a8..afb4941dac4 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java @@ -31,18 +31,11 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestActivateWatchAction extends WatcherRestHandler { 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); final DeactivateRestHandler deactivateRestHandler = new DeactivateRestHandler(settings); - - // @deprecated Remove deprecations in 6.0 - controller.registerWithDeprecatedHandler(POST, URI_BASE + "/watch/{id}/_activate", this, - POST, "/_watcher/watch/{id}/_activate", deprecationLogger); - controller.registerWithDeprecatedHandler(PUT, URI_BASE + "/watch/{id}/_activate", this, - PUT, "/_watcher/watch/{id}/_activate", deprecationLogger); - controller.registerWithDeprecatedHandler(POST, URI_BASE + "/watch/{id}/_deactivate", deactivateRestHandler, - POST, "/_watcher/watch/{id}/_deactivate", deprecationLogger); - controller.registerWithDeprecatedHandler(PUT, URI_BASE + "/watch/{id}/_deactivate", deactivateRestHandler, - PUT, "/_watcher/watch/{id}/_deactivate", deprecationLogger); + controller.registerHandler(POST, URI_BASE + "/watch/{id}/_deactivate", deactivateRestHandler); + controller.registerHandler(PUT, URI_BASE + "/watch/{id}/_deactivate", deactivateRestHandler); } @Override diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java index 075d2e53a57..c30dcdf3d8c 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java @@ -27,9 +27,7 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestDeleteWatchAction extends WatcherRestHandler { public RestDeleteWatchAction(Settings settings, RestController controller) { super(settings); - // @deprecated Remove deprecations in 6.0 - controller.registerWithDeprecatedHandler(DELETE, URI_BASE + "/watch/{id}", this, - DELETE, "/_watcher/watch/{id}", deprecationLogger); + controller.registerHandler(DELETE, URI_BASE + "/watch/{id}", this); } @Override diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java index 463fa30f130..88db5b0e3c8 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java @@ -40,16 +40,10 @@ public class RestExecuteWatchAction extends WatcherRestHandler implements RestRe public RestExecuteWatchAction(Settings settings, RestController controller) { super(settings); - - // @deprecated Remove deprecations in 6.0 - controller.registerWithDeprecatedHandler(POST, URI_BASE + "/watch/{id}/_execute", this, - POST, "/_watcher/watch/{id}/_execute", deprecationLogger); - controller.registerWithDeprecatedHandler(PUT, URI_BASE + "/watch/{id}/_execute", this, - PUT, "/_watcher/watch/{id}/_execute", deprecationLogger); - controller.registerWithDeprecatedHandler(POST, URI_BASE + "/watch/_execute", this, - POST, "/_watcher/watch/_execute", deprecationLogger); - controller.registerWithDeprecatedHandler(PUT, URI_BASE + "/watch/_execute", this, - PUT, "/_watcher/watch/_execute", deprecationLogger); + 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); } @Override diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java index 1e730a16087..d2058943dba 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java @@ -28,10 +28,7 @@ import static org.elasticsearch.rest.RestStatus.OK; public class RestGetWatchAction extends WatcherRestHandler { public RestGetWatchAction(Settings settings, RestController controller) { super(settings); - - // @deprecated Remove deprecations in 6.0 - controller.registerWithDeprecatedHandler(GET, URI_BASE + "/watch/{id}", this, - GET, "/_watcher/watch/{id}", deprecationLogger); + controller.registerHandler(GET, URI_BASE + "/watch/{id}", this); } @Override diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java index 90ba05013dd..8c65f5988fa 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java @@ -33,12 +33,8 @@ public class RestPutWatchAction extends WatcherRestHandler implements RestReques public RestPutWatchAction(Settings settings, RestController controller) { super(settings); - - // @deprecated Remove deprecations in 6.0 - controller.registerWithDeprecatedHandler(POST, URI_BASE + "/watch/{id}", this, - POST, "/_watcher/watch/{id}", deprecationLogger); - controller.registerWithDeprecatedHandler(PUT, URI_BASE + "/watch/{id}", this, - PUT, "/_watcher/watch/{id}", deprecationLogger); + controller.registerHandler(POST, URI_BASE + "/watch/{id}", this); + controller.registerHandler(PUT, URI_BASE + "/watch/{id}", this); } @Override diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java index 16b54e88215..38fa5255b54 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java @@ -5,9 +5,7 @@ */ package org.elasticsearch.xpack.watcher.rest.action; -import org.elasticsearch.action.ActionListener; import org.elasticsearch.common.settings.Settings; -import org.elasticsearch.rest.BytesRestResponse; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; import org.elasticsearch.rest.action.AcknowledgedRestListener; @@ -18,62 +16,25 @@ import org.elasticsearch.xpack.watcher.transport.actions.service.WatcherServiceR import java.io.IOException; import static org.elasticsearch.rest.RestRequest.Method.POST; -import static org.elasticsearch.rest.RestRequest.Method.PUT; public class RestWatchServiceAction extends WatcherRestHandler { public RestWatchServiceAction(Settings settings, RestController controller) { super(settings); - - // @deprecated Remove in 6.0 - // NOTE: we switched from PUT in 2.x to POST in 5.x - controller.registerWithDeprecatedHandler(POST, URI_BASE + "/_restart", this, - PUT, "/_watcher/_restart", deprecationLogger); - controller.registerWithDeprecatedHandler(POST, URI_BASE + "/_start", - new StartRestHandler(settings), PUT, "/_watcher/_start", deprecationLogger); - controller.registerWithDeprecatedHandler(POST, URI_BASE + "/_stop", - new StopRestHandler(settings), PUT, "/_watcher/_stop", deprecationLogger); + controller.registerHandler(POST, URI_BASE + "/_start", this); + controller.registerHandler(POST, URI_BASE + "/_stop", new StopRestHandler(settings)); } @Override public String getName() { - return "xpack_watcher_service_action"; + return "xpack_watcher_start_service_action"; } @Override public RestChannelConsumer doPrepareRequest(RestRequest request, WatcherClient client) throws IOException { - return channel -> client.watcherService(new WatcherServiceRequest().stop(), - ActionListener.wrap( - stopResponse -> client.watcherService(new WatcherServiceRequest().start(), - new AcknowledgedRestListener<>(channel)) - , e -> { - try { - channel.sendResponse(new BytesRestResponse(channel, e)); - } catch (Exception inner) { - inner.addSuppressed(e); - logger.error("failed to send failure response", inner); - } - })); - } - - private static class StartRestHandler extends WatcherRestHandler { - - StartRestHandler(Settings settings) { - super(settings); - } - - @Override - public String getName() { - return "xpack_watcher_start_service_action"; - } - - @Override - public RestChannelConsumer doPrepareRequest(RestRequest request, WatcherClient client) - throws IOException { - return channel -> client.watcherService(new WatcherServiceRequest().start(), - new AcknowledgedRestListener<>(channel)); - } + return channel -> client.watcherService(new WatcherServiceRequest().start(), + new AcknowledgedRestListener<>(channel)); } private static class StopRestHandler extends WatcherRestHandler { diff --git a/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java b/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java index a36c1ac4b1b..d16b2d6ae0b 100644 --- a/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java +++ b/plugin/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java @@ -22,12 +22,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET; public class RestWatcherStatsAction extends WatcherRestHandler { public RestWatcherStatsAction(Settings settings, RestController controller) { super(settings); - - // @deprecated Remove deprecations in 6.0 - controller.registerWithDeprecatedHandler(GET, URI_BASE + "/stats", this, - GET, "/_watcher/stats", deprecationLogger); - controller.registerWithDeprecatedHandler(GET, URI_BASE + "/stats/{metric}", this, - GET, "/_watcher/stats/{metric}", deprecationLogger); + controller.registerHandler(GET, URI_BASE + "/stats", this); + controller.registerHandler(GET, URI_BASE + "/stats/{metric}", this); } @Override diff --git a/plugin/src/test/resources/rest-api-spec/api/xpack.watcher.restart.json b/plugin/src/test/resources/rest-api-spec/api/xpack.watcher.restart.json deleted file mode 100644 index 28eb0d5cffd..00000000000 --- a/plugin/src/test/resources/rest-api-spec/api/xpack.watcher.restart.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "xpack.watcher.restart": { - "documentation": "http://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-restart.html", - "methods": [ "POST" ], - "url": { - "path": "/_xpack/watcher/_restart", - "paths": [ "/_xpack/watcher/_restart" ], - "parts": { - }, - "params": { - } - }, - "body": null - } -} diff --git a/plugin/src/test/resources/rest-api-spec/test/watcher/restart_watcher/10_basic.yml b/plugin/src/test/resources/rest-api-spec/test/watcher/restart_watcher/10_basic.yml deleted file mode 100644 index d6ff96323f6..00000000000 --- a/plugin/src/test/resources/rest-api-spec/test/watcher/restart_watcher/10_basic.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -"Test restart watcher api": - - do: - cluster.health: - wait_for_status: yellow - - - do: {xpack.watcher.restart: {}} - - match: { acknowledged: true }