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

[ML] Remove deprecated _xpack endpoints #59870

Merged
merged 1 commit into from
Jul 20, 2020
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 @@ -360,7 +360,6 @@ public class MachineLearning extends Plugin implements SystemIndexPlugin,
SearchPlugin {
public static final String NAME = "ml";
public static final String BASE_PATH = "/_ml/";
public static final String PRE_V7_BASE_PATH = "/_xpack/ml/";
public static final String DATAFEED_THREAD_POOL_NAME = NAME + "_datafeed";
public static final String JOB_COMMS_THREAD_POOL_NAME = NAME + "_job_comms";
public static final String UTILITY_THREAD_POOL_NAME = NAME + "_utility";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import org.elasticsearch.xpack.ml.MachineLearning;

import java.io.IOException;
import java.util.Collections;
import java.util.List;

import static org.elasticsearch.rest.RestRequest.Method.DELETE;
Expand All @@ -23,16 +22,9 @@ public class RestDeleteExpiredDataAction extends BaseRestHandler {

@Override
public List<Route> routes() {
return Collections.singletonList(
new Route(DELETE, MachineLearning.BASE_PATH + "_delete_expired_data/{" + Job.ID.getPreferredName() + "}"));
}

@Override
public List<ReplacedRoute> replacedRoutes() {
// TODO: remove deprecated endpoint in 8.0.0
return Collections.singletonList(
new ReplacedRoute(DELETE, MachineLearning.BASE_PATH + "_delete_expired_data",
DELETE, MachineLearning.PRE_V7_BASE_PATH + "_delete_expired_data")
return List.of(
new Route(DELETE, MachineLearning.BASE_PATH + "_delete_expired_data/{" + Job.ID.getPreferredName() + "}"),
new Route(DELETE, MachineLearning.BASE_PATH + "_delete_expired_data")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,8 @@ public class RestFindFileStructureAction extends BaseRestHandler {

@Override
public List<Route> routes() {
return Collections.emptyList();
}

@Override
public List<ReplacedRoute> replacedRoutes() {
// TODO: remove deprecated endpoint in 8.0.0
return Collections.singletonList(
new ReplacedRoute(POST, MachineLearning.BASE_PATH + "find_file_structure",
POST, MachineLearning.PRE_V7_BASE_PATH + "find_file_structure")
new Route(POST, MachineLearning.BASE_PATH + "find_file_structure")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,8 @@ public class RestMlInfoAction extends BaseRestHandler {

@Override
public List<Route> routes() {
return Collections.emptyList();
}

@Override
public List<ReplacedRoute> replacedRoutes() {
// TODO: remove deprecated endpoint in 8.0.0
return Collections.singletonList(
new ReplacedRoute(GET, MachineLearning.BASE_PATH + "info",
GET, MachineLearning.PRE_V7_BASE_PATH + "info")
new Route(GET, MachineLearning.BASE_PATH + "info")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,8 @@ public class RestSetUpgradeModeAction extends BaseRestHandler {

@Override
public List<Route> routes() {
return Collections.emptyList();
}

@Override
public List<ReplacedRoute> replacedRoutes() {
// TODO: remove deprecated endpoint in 8.0.0
return Collections.singletonList(
new ReplacedRoute(POST, MachineLearning.BASE_PATH + "set_upgrade_mode",
POST, MachineLearning.PRE_V7_BASE_PATH + "set_upgrade_mode")
new Route(POST, MachineLearning.BASE_PATH + "set_upgrade_mode")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,8 @@ public class RestDeleteCalendarAction extends BaseRestHandler {

@Override
public List<Route> routes() {
return Collections.emptyList();
}

@Override
public List<ReplacedRoute> replacedRoutes() {
// TODO: remove deprecated endpoint in 8.0.0
return Collections.singletonList(
new ReplacedRoute(DELETE, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}",
DELETE, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}")
new Route(DELETE, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,11 @@

public class RestDeleteCalendarEventAction extends BaseRestHandler {

@Override
public List<Route> routes() {
return Collections.emptyList();
}

@Override
public List<ReplacedRoute> replacedRoutes() {
// TODO: remove deprecated endpoint in 8.0.0
public List<Route> routes() {
return Collections.singletonList(
new ReplacedRoute(DELETE, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events/{" +
ScheduledEvent.EVENT_ID.getPreferredName() + "}",
DELETE, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events/{" +
new Route(DELETE, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events/{" +
ScheduledEvent.EVENT_ID.getPreferredName() + "}")
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,8 @@ public class RestDeleteCalendarJobAction extends BaseRestHandler {

@Override
public List<Route> routes() {
return Collections.emptyList();
}

@Override
public List<ReplacedRoute> replacedRoutes() {
// TODO: remove deprecated endpoint in 8.0.0
return Collections.singletonList(
new ReplacedRoute(DELETE, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" +
Job.ID.getPreferredName() + "}",
DELETE, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" +
new Route(DELETE, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" +
Job.ID.getPreferredName() + "}")
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,8 @@ public class RestGetCalendarEventsAction extends BaseRestHandler {

@Override
public List<Route> routes() {
return Collections.emptyList();
}

@Override
public List<ReplacedRoute> replacedRoutes() {
// TODO: remove deprecated endpoint in 8.0.0
return Collections.singletonList(
new ReplacedRoute(GET, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events",
GET, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events")
new Route(GET, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.elasticsearch.xpack.ml.MachineLearning;

import java.io.IOException;
import java.util.Collections;
import java.util.List;

import static org.elasticsearch.rest.RestRequest.Method.GET;
Expand All @@ -27,21 +26,11 @@ public class RestGetCalendarsAction extends BaseRestHandler {

@Override
public List<Route> routes() {
return Collections.emptyList();
}

@Override
public List<ReplacedRoute> replacedRoutes() {
// TODO: remove deprecated endpoint in 8.0.0
return List.of(
new ReplacedRoute(GET, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}",
GET, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}"),
new ReplacedRoute(GET, MachineLearning.BASE_PATH + "calendars/",
GET, MachineLearning.PRE_V7_BASE_PATH + "calendars/"),
new ReplacedRoute(POST, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}",
POST, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}"),
new ReplacedRoute(POST, MachineLearning.BASE_PATH + "calendars/",
POST, MachineLearning.PRE_V7_BASE_PATH + "calendars/")
new Route(GET, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}"),
new Route(GET, MachineLearning.BASE_PATH + "calendars/"),
new Route(POST, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}"),
new Route(POST, MachineLearning.BASE_PATH + "calendars/")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,8 @@ public class RestPostCalendarEventAction extends BaseRestHandler {

@Override
public List<Route> routes() {
return Collections.emptyList();
}

@Override
public List<ReplacedRoute> replacedRoutes() {
// TODO: remove deprecated endpoint in 8.0.0
return Collections.singletonList(
new ReplacedRoute(POST, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events",
POST, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events")
new Route(POST, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/events")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,8 @@ public class RestPutCalendarAction extends BaseRestHandler {

@Override
public List<Route> routes() {
return Collections.emptyList();
}

@Override
public List<ReplacedRoute> replacedRoutes() {
// TODO: remove deprecated endpoint in 8.0.0
return Collections.singletonList(
new ReplacedRoute(PUT, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}",
PUT, MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}")
new Route(PUT, MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,10 @@ public class RestPutCalendarJobAction extends BaseRestHandler {

@Override
public List<Route> routes() {
return Collections.emptyList();
}

@Override
public List<ReplacedRoute> replacedRoutes() {
// TODO: remove deprecated endpoint in 8.0.0
return Collections.singletonList(
new ReplacedRoute(PUT,
MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" + Job.ID.getPreferredName() + "}",
PUT,
MachineLearning.PRE_V7_BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" +
Job.ID.getPreferredName() + "}")
new Route(PUT,
MachineLearning.BASE_PATH + "calendars/{" + Calendar.ID.getPreferredName() + "}/jobs/{" + Job.ID.getPreferredName() +
"}")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,8 @@ public class RestDeleteDatafeedAction extends BaseRestHandler {

@Override
public List<Route> routes() {
return Collections.emptyList();
}

@Override
public List<ReplacedRoute> replacedRoutes() {
// TODO: remove deprecated endpoint in 8.0.0
return Collections.singletonList(
new ReplacedRoute(DELETE, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}",
DELETE, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}")
new Route(DELETE, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,17 @@
import org.elasticsearch.xpack.ml.MachineLearning;

import java.io.IOException;
import java.util.Collections;
import java.util.List;

import static org.elasticsearch.rest.RestRequest.Method.GET;

public class RestGetDatafeedStatsAction extends BaseRestHandler {

@Override
@Override
public List<Route> routes() {
return Collections.emptyList();
}

@Override
public List<ReplacedRoute> replacedRoutes() {
// TODO: remove deprecated endpoint in 8.0.0
return List.of(
new ReplacedRoute(GET, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stats",
GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stats"),
new ReplacedRoute(GET, MachineLearning.BASE_PATH + "datafeeds/_stats",
GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/_stats")
new Route(GET, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stats"),
new Route(GET, MachineLearning.BASE_PATH + "datafeeds/_stats")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,17 @@
import org.elasticsearch.xpack.ml.MachineLearning;

import java.io.IOException;
import java.util.Collections;
import java.util.List;

import static org.elasticsearch.rest.RestRequest.Method.GET;

public class RestGetDatafeedsAction extends BaseRestHandler {

@Override
@Override
public List<Route> routes() {
return Collections.emptyList();
}

@Override
public List<ReplacedRoute> replacedRoutes() {
// TODO: remove deprecated endpoint in 8.0.0
return List.of(
new ReplacedRoute(GET, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}",
GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}"),
new ReplacedRoute(GET, MachineLearning.BASE_PATH + "datafeeds",
GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds")
new Route(GET, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}"),
new Route(GET, MachineLearning.BASE_PATH + "datafeeds")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,8 @@ public class RestPreviewDatafeedAction extends BaseRestHandler {

@Override
public List<Route> routes() {
return Collections.emptyList();
}

@Override
public List<ReplacedRoute> replacedRoutes() {
// TODO: remove deprecated endpoint in 8.0.0
return Collections.singletonList(
new ReplacedRoute(GET, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_preview",
GET, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_preview")
new Route(GET, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_preview")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,8 @@ public class RestPutDatafeedAction extends BaseRestHandler {

@Override
public List<Route> routes() {
return Collections.emptyList();
}

@Override
public List<ReplacedRoute> replacedRoutes() {
// TODO: remove deprecated endpoint in 8.0.0
return Collections.singletonList(
new ReplacedRoute(PUT, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}",
PUT, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}")
new Route(PUT, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,8 @@ public class RestStartDatafeedAction extends BaseRestHandler {

@Override
public List<Route> routes() {
return Collections.emptyList();
}

@Override
public List<ReplacedRoute> replacedRoutes() {
// TODO: remove deprecated endpoint in 8.0.0
return Collections.singletonList(
new ReplacedRoute(POST, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_start",
POST, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_start")
new Route(POST, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_start")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,8 @@ public class RestStopDatafeedAction extends BaseRestHandler {

@Override
public List<Route> routes() {
return Collections.emptyList();
}

@Override
public List<ReplacedRoute> replacedRoutes() {
// TODO: remove deprecated endpoint in 8.0.0
return Collections.singletonList(
new ReplacedRoute(POST, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stop",
POST, MachineLearning.PRE_V7_BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stop")
new Route(POST, MachineLearning.BASE_PATH + "datafeeds/{" + DatafeedConfig.ID.getPreferredName() + "}/_stop")
);
}

Expand Down
Loading