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@78a5ec3c05
This commit is contained in:
parent
681ce6e2aa
commit
547b0ebc1b
|
@ -24,4 +24,3 @@ include::watcher/deactivate-watch.asciidoc[]
|
||||||
include::watcher/stats.asciidoc[]
|
include::watcher/stats.asciidoc[]
|
||||||
include::watcher/stop.asciidoc[]
|
include::watcher/stop.asciidoc[]
|
||||||
include::watcher/start.asciidoc[]
|
include::watcher/start.asciidoc[]
|
||||||
include::watcher/restart.asciidoc[]
|
|
||||||
|
|
|
@ -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
|
|
|
@ -19,15 +19,7 @@ import static org.elasticsearch.rest.RestRequest.Method.DELETE;
|
||||||
public class RestDeleteLicenseAction extends XPackRestHandler {
|
public class RestDeleteLicenseAction extends XPackRestHandler {
|
||||||
public RestDeleteLicenseAction(Settings settings, RestController controller) {
|
public RestDeleteLicenseAction(Settings settings, RestController controller) {
|
||||||
super(settings);
|
super(settings);
|
||||||
// @deprecated Remove deprecations in 6.0
|
controller.registerHandler(DELETE, URI_BASE + "/license", this);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -30,15 +30,7 @@ public class RestGetLicenseAction extends XPackRestHandler {
|
||||||
@Inject
|
@Inject
|
||||||
public RestGetLicenseAction(Settings settings, RestController controller) {
|
public RestGetLicenseAction(Settings settings, RestController controller) {
|
||||||
super(settings);
|
super(settings);
|
||||||
// @deprecated Remove deprecations in 6.0
|
controller.registerHandler(GET, URI_BASE + "/license", this);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -23,23 +23,11 @@ import static org.elasticsearch.rest.RestRequest.Method.POST;
|
||||||
import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
||||||
|
|
||||||
public class RestPutLicenseAction extends XPackRestHandler {
|
public class RestPutLicenseAction extends XPackRestHandler {
|
||||||
|
|
||||||
public RestPutLicenseAction(Settings settings, RestController controller) {
|
public RestPutLicenseAction(Settings settings, RestController controller) {
|
||||||
super(settings);
|
super(settings);
|
||||||
// @deprecated Remove deprecations in 6.0
|
controller.registerHandler(POST, URI_BASE + "/license", this);
|
||||||
controller.registerWithDeprecatedHandler(POST, URI_BASE + "/license", this,
|
controller.registerHandler(PUT, 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -35,12 +35,6 @@ public class RestAuthenticateAction extends SecurityBaseRestHandler {
|
||||||
super(settings, licenseState);
|
super(settings, licenseState);
|
||||||
this.securityContext = securityContext;
|
this.securityContext = securityContext;
|
||||||
controller.registerHandler(GET, "/_xpack/security/_authenticate", this);
|
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
|
@Override
|
||||||
|
|
|
@ -24,16 +24,6 @@ public final class RestClearRealmCacheAction extends SecurityBaseRestHandler {
|
||||||
public RestClearRealmCacheAction(Settings settings, RestController controller, XPackLicenseState licenseState) {
|
public RestClearRealmCacheAction(Settings settings, RestController controller, XPackLicenseState licenseState) {
|
||||||
super(settings, licenseState);
|
super(settings, licenseState);
|
||||||
controller.registerHandler(POST, "/_xpack/security/realm/{realms}/_clear_cache", this);
|
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
|
@Override
|
||||||
|
|
|
@ -24,12 +24,6 @@ public final class RestClearRolesCacheAction extends SecurityBaseRestHandler {
|
||||||
public RestClearRolesCacheAction(Settings settings, RestController controller, XPackLicenseState licenseState) {
|
public RestClearRolesCacheAction(Settings settings, RestController controller, XPackLicenseState licenseState) {
|
||||||
super(settings, licenseState);
|
super(settings, licenseState);
|
||||||
controller.registerHandler(POST, "/_xpack/security/role/{name}/_clear_cache", this);
|
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
|
@Override
|
||||||
|
|
|
@ -31,12 +31,6 @@ public class RestDeleteRoleAction extends SecurityBaseRestHandler {
|
||||||
public RestDeleteRoleAction(Settings settings, RestController controller, XPackLicenseState licenseState) {
|
public RestDeleteRoleAction(Settings settings, RestController controller, XPackLicenseState licenseState) {
|
||||||
super(settings, licenseState);
|
super(settings, licenseState);
|
||||||
controller.registerHandler(DELETE, "/_xpack/security/role/{name}", this);
|
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
|
@Override
|
||||||
|
|
|
@ -33,16 +33,6 @@ public class RestGetRolesAction extends SecurityBaseRestHandler {
|
||||||
super(settings, licenseState);
|
super(settings, licenseState);
|
||||||
controller.registerHandler(GET, "/_xpack/security/role/", this);
|
controller.registerHandler(GET, "/_xpack/security/role/", this);
|
||||||
controller.registerHandler(GET, "/_xpack/security/role/{name}", 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
|
@Override
|
||||||
|
|
|
@ -34,16 +34,6 @@ public class RestPutRoleAction extends SecurityBaseRestHandler {
|
||||||
super(settings, licenseState);
|
super(settings, licenseState);
|
||||||
controller.registerHandler(POST, "/_xpack/security/role/{name}", this);
|
controller.registerHandler(POST, "/_xpack/security/role/{name}", this);
|
||||||
controller.registerHandler(PUT, "/_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
|
@Override
|
||||||
|
|
|
@ -31,12 +31,6 @@ public class RestDeleteUserAction extends SecurityBaseRestHandler {
|
||||||
public RestDeleteUserAction(Settings settings, RestController controller, XPackLicenseState licenseState) {
|
public RestDeleteUserAction(Settings settings, RestController controller, XPackLicenseState licenseState) {
|
||||||
super(settings, licenseState);
|
super(settings, licenseState);
|
||||||
controller.registerHandler(DELETE, "/_xpack/security/user/{username}", this);
|
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
|
@Override
|
||||||
|
|
|
@ -34,16 +34,6 @@ public class RestGetUsersAction extends SecurityBaseRestHandler {
|
||||||
super(settings, licenseState);
|
super(settings, licenseState);
|
||||||
controller.registerHandler(GET, "/_xpack/security/user/", this);
|
controller.registerHandler(GET, "/_xpack/security/user/", this);
|
||||||
controller.registerHandler(GET, "/_xpack/security/user/{username}", 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
|
@Override
|
||||||
|
|
|
@ -38,16 +38,6 @@ public class RestPutUserAction extends SecurityBaseRestHandler implements RestRe
|
||||||
super(settings, licenseState);
|
super(settings, licenseState);
|
||||||
controller.registerHandler(POST, "/_xpack/security/user/{username}", this);
|
controller.registerHandler(POST, "/_xpack/security/user/{username}", this);
|
||||||
controller.registerHandler(PUT, "/_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
|
@Override
|
||||||
|
|
|
@ -31,26 +31,10 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
||||||
public class RestAckWatchAction extends WatcherRestHandler {
|
public class RestAckWatchAction extends WatcherRestHandler {
|
||||||
public RestAckWatchAction(Settings settings, RestController controller) {
|
public RestAckWatchAction(Settings settings, RestController controller) {
|
||||||
super(settings);
|
super(settings);
|
||||||
// @deprecated Remove deprecations in 6.0
|
controller.registerHandler(POST, URI_BASE + "/watch/{id}/_ack", this);
|
||||||
controller.registerWithDeprecatedHandler(POST, URI_BASE + "/watch/{id}/_ack", this,
|
controller.registerHandler(PUT, URI_BASE + "/watch/{id}/_ack", this);
|
||||||
POST, "/_watcher/watch/{id}/_ack", deprecationLogger);
|
controller.registerHandler(POST, URI_BASE + "/watch/{id}/_ack/{actions}", this);
|
||||||
controller.registerWithDeprecatedHandler(PUT, URI_BASE + "/watch/{id}/_ack", this,
|
controller.registerHandler(PUT, URI_BASE + "/watch/{id}/_ack/{actions}", 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -31,18 +31,11 @@ import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
||||||
public class RestActivateWatchAction extends WatcherRestHandler {
|
public class RestActivateWatchAction extends WatcherRestHandler {
|
||||||
public RestActivateWatchAction(Settings settings, RestController controller) {
|
public RestActivateWatchAction(Settings settings, RestController controller) {
|
||||||
super(settings);
|
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);
|
final DeactivateRestHandler deactivateRestHandler = new DeactivateRestHandler(settings);
|
||||||
|
controller.registerHandler(POST, URI_BASE + "/watch/{id}/_deactivate", deactivateRestHandler);
|
||||||
// @deprecated Remove deprecations in 6.0
|
controller.registerHandler(PUT, URI_BASE + "/watch/{id}/_deactivate", deactivateRestHandler);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -27,9 +27,7 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
||||||
public class RestDeleteWatchAction extends WatcherRestHandler {
|
public class RestDeleteWatchAction extends WatcherRestHandler {
|
||||||
public RestDeleteWatchAction(Settings settings, RestController controller) {
|
public RestDeleteWatchAction(Settings settings, RestController controller) {
|
||||||
super(settings);
|
super(settings);
|
||||||
// @deprecated Remove deprecations in 6.0
|
controller.registerHandler(DELETE, URI_BASE + "/watch/{id}", this);
|
||||||
controller.registerWithDeprecatedHandler(DELETE, URI_BASE + "/watch/{id}", this,
|
|
||||||
DELETE, "/_watcher/watch/{id}", deprecationLogger);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -40,16 +40,10 @@ public class RestExecuteWatchAction extends WatcherRestHandler implements RestRe
|
||||||
|
|
||||||
public RestExecuteWatchAction(Settings settings, RestController controller) {
|
public RestExecuteWatchAction(Settings settings, RestController controller) {
|
||||||
super(settings);
|
super(settings);
|
||||||
|
controller.registerHandler(POST, URI_BASE + "/watch/{id}/_execute", this);
|
||||||
// @deprecated Remove deprecations in 6.0
|
controller.registerHandler(PUT, URI_BASE + "/watch/{id}/_execute", this);
|
||||||
controller.registerWithDeprecatedHandler(POST, URI_BASE + "/watch/{id}/_execute", this,
|
controller.registerHandler(POST, URI_BASE + "/watch/_execute", this);
|
||||||
POST, "/_watcher/watch/{id}/_execute", deprecationLogger);
|
controller.registerHandler(PUT, URI_BASE + "/watch/_execute", this);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -28,10 +28,7 @@ import static org.elasticsearch.rest.RestStatus.OK;
|
||||||
public class RestGetWatchAction extends WatcherRestHandler {
|
public class RestGetWatchAction extends WatcherRestHandler {
|
||||||
public RestGetWatchAction(Settings settings, RestController controller) {
|
public RestGetWatchAction(Settings settings, RestController controller) {
|
||||||
super(settings);
|
super(settings);
|
||||||
|
controller.registerHandler(GET, URI_BASE + "/watch/{id}", this);
|
||||||
// @deprecated Remove deprecations in 6.0
|
|
||||||
controller.registerWithDeprecatedHandler(GET, URI_BASE + "/watch/{id}", this,
|
|
||||||
GET, "/_watcher/watch/{id}", deprecationLogger);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -33,12 +33,8 @@ public class RestPutWatchAction extends WatcherRestHandler implements RestReques
|
||||||
|
|
||||||
public RestPutWatchAction(Settings settings, RestController controller) {
|
public RestPutWatchAction(Settings settings, RestController controller) {
|
||||||
super(settings);
|
super(settings);
|
||||||
|
controller.registerHandler(POST, URI_BASE + "/watch/{id}", this);
|
||||||
// @deprecated Remove deprecations in 6.0
|
controller.registerHandler(PUT, URI_BASE + "/watch/{id}", this);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,9 +5,7 @@
|
||||||
*/
|
*/
|
||||||
package org.elasticsearch.xpack.watcher.rest.action;
|
package org.elasticsearch.xpack.watcher.rest.action;
|
||||||
|
|
||||||
import org.elasticsearch.action.ActionListener;
|
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.rest.BytesRestResponse;
|
|
||||||
import org.elasticsearch.rest.RestController;
|
import org.elasticsearch.rest.RestController;
|
||||||
import org.elasticsearch.rest.RestRequest;
|
import org.elasticsearch.rest.RestRequest;
|
||||||
import org.elasticsearch.rest.action.AcknowledgedRestListener;
|
import org.elasticsearch.rest.action.AcknowledgedRestListener;
|
||||||
|
@ -18,62 +16,25 @@ import org.elasticsearch.xpack.watcher.transport.actions.service.WatcherServiceR
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import static org.elasticsearch.rest.RestRequest.Method.POST;
|
import static org.elasticsearch.rest.RestRequest.Method.POST;
|
||||||
import static org.elasticsearch.rest.RestRequest.Method.PUT;
|
|
||||||
|
|
||||||
public class RestWatchServiceAction extends WatcherRestHandler {
|
public class RestWatchServiceAction extends WatcherRestHandler {
|
||||||
|
|
||||||
public RestWatchServiceAction(Settings settings, RestController controller) {
|
public RestWatchServiceAction(Settings settings, RestController controller) {
|
||||||
super(settings);
|
super(settings);
|
||||||
|
controller.registerHandler(POST, URI_BASE + "/_start", this);
|
||||||
// @deprecated Remove in 6.0
|
controller.registerHandler(POST, URI_BASE + "/_stop", new StopRestHandler(settings));
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "xpack_watcher_service_action";
|
return "xpack_watcher_start_service_action";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RestChannelConsumer doPrepareRequest(RestRequest request, WatcherClient client)
|
public RestChannelConsumer doPrepareRequest(RestRequest request, WatcherClient client)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
return channel -> client.watcherService(new WatcherServiceRequest().stop(),
|
return channel -> client.watcherService(new WatcherServiceRequest().start(),
|
||||||
ActionListener.wrap(
|
new AcknowledgedRestListener<>(channel));
|
||||||
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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class StopRestHandler extends WatcherRestHandler {
|
private static class StopRestHandler extends WatcherRestHandler {
|
||||||
|
|
|
@ -22,12 +22,8 @@ import static org.elasticsearch.rest.RestRequest.Method.GET;
|
||||||
public class RestWatcherStatsAction extends WatcherRestHandler {
|
public class RestWatcherStatsAction extends WatcherRestHandler {
|
||||||
public RestWatcherStatsAction(Settings settings, RestController controller) {
|
public RestWatcherStatsAction(Settings settings, RestController controller) {
|
||||||
super(settings);
|
super(settings);
|
||||||
|
controller.registerHandler(GET, URI_BASE + "/stats", this);
|
||||||
// @deprecated Remove deprecations in 6.0
|
controller.registerHandler(GET, URI_BASE + "/stats/{metric}", this);
|
||||||
controller.registerWithDeprecatedHandler(GET, URI_BASE + "/stats", this,
|
|
||||||
GET, "/_watcher/stats", deprecationLogger);
|
|
||||||
controller.registerWithDeprecatedHandler(GET, URI_BASE + "/stats/{metric}", this,
|
|
||||||
GET, "/_watcher/stats/{metric}", deprecationLogger);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -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
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
---
|
|
||||||
"Test restart watcher api":
|
|
||||||
- do:
|
|
||||||
cluster.health:
|
|
||||||
wait_for_status: yellow
|
|
||||||
|
|
||||||
- do: {xpack.watcher.restart: {}}
|
|
||||||
- match: { acknowledged: true }
|
|
Loading…
Reference in New Issue