Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undeprecate /_watcher endpoints #36269

Merged
merged 5 commits into from
Dec 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ 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);

controller.registerHandler(POST, URI_BASE + "/watch/{id}/_ack", this);
controller.registerHandler(POST, "/_watcher/watch/{id}/_ack", this);
controller.registerHandler(PUT, URI_BASE + "/watch/{id}/_ack", this);
controller.registerHandler(PUT, "/_watcher/watch/{id}/_ack", this);
controller.registerHandler(POST, URI_BASE + "/watch/{id}/_ack/{actions}", this);
controller.registerHandler(POST, "/_watcher/watch/{id}/_ack/{actions}", this);
controller.registerHandler(PUT, URI_BASE + "/watch/{id}/_ack/{actions}", this);
controller.registerHandler(PUT, "/_watcher/watch/{id}/_ack/{actions}", this);

// @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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,14 @@ public RestActivateWatchAction(Settings settings, RestController controller) {

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}/_activate", this);
controller.registerHandler(POST, "/_watcher/watch/{id}/_activate", this);
controller.registerHandler(PUT, URI_BASE + "/watch/{id}/_activate", this);
controller.registerHandler(PUT, "/_watcher/watch/{id}/_activate", this);
controller.registerHandler(POST, URI_BASE + "/watch/{id}/_deactivate", deactivateRestHandler);
controller.registerHandler(POST, "/_watcher/watch/{id}/_deactivate", deactivateRestHandler);
controller.registerHandler(PUT, URI_BASE + "/watch/{id}/_deactivate", deactivateRestHandler);
controller.registerHandler(PUT, "/_watcher/watch/{id}/_deactivate", deactivateRestHandler);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ 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);
controller.registerHandler(DELETE, "/_watcher/watch/{id}", this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,14 @@ 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(POST, "/_watcher/watch/{id}/_execute", this);
controller.registerHandler(PUT, URI_BASE + "/watch/{id}/_execute", this);
controller.registerHandler(PUT, "/_watcher/watch/{id}/_execute", this);
controller.registerHandler(POST, URI_BASE + "/watch/_execute", this);
controller.registerHandler(POST, "/_watcher/watch/_execute", this);
controller.registerHandler(PUT, URI_BASE + "/watch/_execute", this);
controller.registerHandler(PUT, "/_watcher/watch/_execute", this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,8 @@ 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);
controller.registerHandler(GET, "/_watcher/watch/{id}", this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,10 @@ 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(POST, "/_watcher/watch/{id}", this);
controller.registerHandler(PUT, URI_BASE + "/watch/{id}", this);
controller.registerHandler(PUT, "/_watcher/watch/{id}", this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,18 @@ 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
// NOTE: We added back the old URL with the new VERB (POST) since we are deprecating _xpack/* URIs in 7.0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im not 100% sure i did this right. Should I instead put both the PUT and POST back to non deprecated? In 7, only POST /_watcher and POST /_xpack/watcher exist, so this is why I did not undeprecate the PUT /_watcher

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that sounds good.

controller.registerWithDeprecatedHandler(POST, URI_BASE + "/_restart", this,
PUT, "/_watcher/_restart", deprecationLogger);
StartRestHandler startRestHandler = new StartRestHandler(settings);
controller.registerWithDeprecatedHandler(POST, URI_BASE + "/_start",
new StartRestHandler(settings), PUT, "/_watcher/_start", deprecationLogger);
startRestHandler, PUT, "/_watcher/_start", deprecationLogger);
controller.registerHandler(POST, "/_watcher/_start", startRestHandler);
StopRestHandler stopRestHandler = new StopRestHandler(settings);
controller.registerWithDeprecatedHandler(POST, URI_BASE + "/_stop",
new StopRestHandler(settings), PUT, "/_watcher/_stop", deprecationLogger);
stopRestHandler, PUT, "/_watcher/_stop", deprecationLogger);
controller.registerHandler(POST, "/_watcher/_stop", stopRestHandler);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ 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, "/_watcher/stats", this);
controller.registerHandler(GET, URI_BASE + "/stats/{metric}", this);
controller.registerHandler(GET, "/_watcher/stats/{metric}", this);
}

@Override
Expand Down