diff --git a/docs/reference/migration/migrate_8_0.asciidoc b/docs/reference/migration/migrate_8_0.asciidoc index 05b2c6a9123cf..eff10899a2e03 100644 --- a/docs/reference/migration/migrate_8_0.asciidoc +++ b/docs/reference/migration/migrate_8_0.asciidoc @@ -50,6 +50,16 @@ Indices created in Elasticsearch 6.x or before will need to be reindexed with Elasticsearch 7.x in order to be readable by Elasticsearch 8.x. ========================================= + +[float] +==== REST endpoints containing `_xpack` + +In 7.0, we deprecated REST endpoints that contain `_xpack` in their path. These +endpoints are now removed in 8.0. Each endpoint that was deprecated and removed +is replaced with a new endpoint that does not contain `_xpack`. As an example, +`/{index}/_xpack/graph/_explore` is replaced by `/{index}/_graph/explore`. + + // end::notable-breaking-changes[] include::migrate_8_0/analysis.asciidoc[] diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java index cbe2f3827be74..383c31c332e32 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestDeleteLicenseAction.java @@ -6,9 +6,7 @@ package org.elasticsearch.license; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.protocol.xpack.license.DeleteLicenseRequest; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; @@ -21,13 +19,8 @@ public class RestDeleteLicenseAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestDeleteLicenseAction.class)); - RestDeleteLicenseAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - DELETE, "/_license", this, - DELETE, "/_xpack/license", deprecationLogger); + controller.registerHandler(DELETE, "/_license", this); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java index 941be60200b4d..70dbe93bfb0fb 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetBasicStatus.java @@ -6,9 +6,7 @@ package org.elasticsearch.license; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; @@ -18,13 +16,8 @@ public class RestGetBasicStatus extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetBasicStatus.class)); - RestGetBasicStatus(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, "/_license/basic_status", this, - GET, "/_xpack/license/basic_status", deprecationLogger); + controller.registerHandler(GET, "/_license/basic_status", this); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java index dff1262541cc1..1aa3ccb0eab43 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java @@ -6,9 +6,7 @@ package org.elasticsearch.license; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.ToXContent; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.protocol.xpack.license.GetLicenseRequest; @@ -29,13 +27,8 @@ public class RestGetLicenseAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetLicenseAction.class)); - RestGetLicenseAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, "/_license", this, - GET, "/_xpack/license", deprecationLogger); + controller.registerHandler(GET, "/_license", this); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java index 2ce0a50a05b2d..cac4a7d3d6d52 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetTrialStatus.java @@ -6,9 +6,7 @@ package org.elasticsearch.license; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; @@ -18,13 +16,8 @@ public class RestGetTrialStatus extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetTrialStatus.class)); - RestGetTrialStatus(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, "/_license/trial_status", this, - GET, "/_xpack/license/trial_status", deprecationLogger); + controller.registerHandler(GET, "/_license/trial_status", this); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java index 951c1d9e29080..6d3a82cfeadce 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartBasicLicense.java @@ -6,9 +6,7 @@ package org.elasticsearch.license; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; @@ -20,13 +18,8 @@ public class RestPostStartBasicLicense extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestPostStartBasicLicense.class)); - RestPostStartBasicLicense(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_license/start_basic", this, - POST, "/_xpack/license/start_basic", deprecationLogger); + controller.registerHandler(POST, "/_license/start_basic", this); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java index 270770bd0691f..4cdba7845561c 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPostStartTrialLicense.java @@ -6,9 +6,7 @@ package org.elasticsearch.license; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; @@ -24,13 +22,8 @@ public class RestPostStartTrialLicense extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestPostStartTrialLicense.class)); - RestPostStartTrialLicense(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_license/start_trial", this, - POST, "/_xpack/license/start_trial", deprecationLogger); + controller.registerHandler(POST, "/_license/start_trial", this); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java index 4268fc1e52190..ef3a14e37ae64 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestPutLicenseAction.java @@ -6,9 +6,7 @@ package org.elasticsearch.license; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; @@ -21,18 +19,10 @@ public class RestPutLicenseAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestPutLicenseAction.class)); - RestPutLicenseAction(RestController controller) { // TODO: remove POST endpoint? - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_license", this, - POST, "/_xpack/license", deprecationLogger); - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - PUT, "/_license", this, - PUT, "/_xpack/license", deprecationLogger); + controller.registerHandler(POST, "/_license", this); + controller.registerHandler(PUT, "/_license", this); } @Override diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/rest/RestGetCertificateInfoAction.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/rest/RestGetCertificateInfoAction.java index 569a392c0349b..d00bba383e90d 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/rest/RestGetCertificateInfoAction.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ssl/rest/RestGetCertificateInfoAction.java @@ -5,9 +5,7 @@ */ package org.elasticsearch.xpack.core.ssl.rest; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; @@ -27,14 +25,8 @@ */ public class RestGetCertificateInfoAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = - new DeprecationLogger(LogManager.getLogger(RestGetCertificateInfoAction.class)); - public RestGetCertificateInfoAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, "/_ssl/certificates", this, - GET, "/_xpack/ssl/certificates", deprecationLogger); + controller.registerHandler(GET, "/_ssl/certificates", this); } @Override diff --git a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java index 1ffd19c46b4cb..065a40b46e8a5 100644 --- a/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java +++ b/x-pack/plugin/deprecation/src/main/java/org/elasticsearch/xpack/deprecation/RestDeprecationInfoAction.java @@ -9,7 +9,6 @@ import org.apache.logging.log4j.Logger; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; @@ -21,15 +20,10 @@ public class RestDeprecationInfoAction extends BaseRestHandler { private static final Logger logger = LogManager.getLogger(RestDeprecationInfoAction.class); - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger); public RestDeprecationInfoAction(RestController controller) { - controller.registerWithDeprecatedHandler( - RestRequest.Method.GET, "/_migration/deprecations", this, - RestRequest.Method.GET, "/_xpack/migration/deprecations", deprecationLogger); - controller.registerWithDeprecatedHandler( - RestRequest.Method.GET, "/{index}/_migration/deprecations", this, - RestRequest.Method.GET, "/{index}/_xpack/migration/deprecations", deprecationLogger); + controller.registerHandler(RestRequest.Method.GET, "/_migration/deprecations", this); + controller.registerHandler(RestRequest.Method.GET, "/{index}/_migration/deprecations", this); } @Override diff --git a/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java b/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java index 40331f168c2d3..cf0dbfeb0d646 100644 --- a/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java +++ b/x-pack/plugin/graph/src/main/java/org/elasticsearch/xpack/graph/rest/action/RestGraphAction.java @@ -6,13 +6,11 @@ package org.elasticsearch.xpack.graph.rest.action; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.protocol.xpack.graph.GraphExploreRequest; @@ -39,8 +37,6 @@ */ public class RestGraphAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGraphAction.class)); - public static final ParseField TIMEOUT_FIELD = new ParseField("timeout"); public static final ParseField SIGNIFICANCE_FIELD = new ParseField("use_significance"); public static final ParseField RETURN_DETAILED_INFO = new ParseField("return_detailed_stats"); @@ -61,14 +57,8 @@ public class RestGraphAction extends BaseRestHandler { public static final ParseField TERM_FIELD = new ParseField("term"); public RestGraphAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, "/{index}/_graph/explore", this, - GET, "/{index}/_xpack/graph/_explore", deprecationLogger); - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/{index}/_graph/explore", this, - POST, "/{index}/_xpack/graph/_explore", deprecationLogger); + controller.registerHandler(GET, "/{index}/_graph/explore", this); + controller.registerHandler(POST, "/{index}/_graph/explore", this); } @Override diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java index f9a991caccd5f..f72871fb055c1 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/rest/action/RestMonitoringBulkAction.java @@ -5,12 +5,9 @@ */ package org.elasticsearch.xpack.monitoring.rest.action; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; @@ -39,16 +36,11 @@ public class RestMonitoringBulkAction extends BaseRestHandler { public static final String MONITORING_ID = "system_id"; public static final String MONITORING_VERSION = "system_api_version"; public static final String INTERVAL = "interval"; - private static final Logger logger = LogManager.getLogger(RestMonitoringBulkAction.class); - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger); private final Map> supportedApiVersions; public RestMonitoringBulkAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler(POST, "/_monitoring/bulk", this, - POST, "/_xpack/monitoring/_bulk", deprecationLogger); - controller.registerWithDeprecatedHandler(PUT, "/_monitoring/bulk", this, - PUT, "/_xpack/monitoring/_bulk", deprecationLogger); + controller.registerHandler(POST, "/_monitoring/bulk", this); + controller.registerHandler(PUT, "/_monitoring/bulk", this); final List allVersions = Arrays.asList( MonitoringTemplateUtils.TEMPLATE_VERSION, diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestDeleteRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestDeleteRollupJobAction.java index 2ab2af450680a..83e1b53cb1a4b 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestDeleteRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestDeleteRollupJobAction.java @@ -6,10 +6,8 @@ package org.elasticsearch.xpack.rollup.rest; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParseField; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; @@ -21,15 +19,10 @@ public class RestDeleteRollupJobAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestDeleteRollupJobAction.class)); - public static final ParseField ID = new ParseField("id"); public RestDeleteRollupJobAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - DELETE, "/_rollup/job/{id}", this, - DELETE, "/_xpack/rollup/job/{id}/", deprecationLogger); + controller.registerHandler(DELETE, "/_rollup/job/{id}", this); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupCapsAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupCapsAction.java index 9ddd9459425e8..2c30efb5d833e 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupCapsAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupCapsAction.java @@ -6,10 +6,8 @@ package org.elasticsearch.xpack.rollup.rest; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParseField; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; @@ -20,15 +18,10 @@ public class RestGetRollupCapsAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetRollupCapsAction.class)); - public static final ParseField ID = new ParseField("id"); public RestGetRollupCapsAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, "/_rollup/data/{id}", this, - GET, "/_xpack/rollup/data/{id}/", deprecationLogger); + controller.registerHandler(GET, "/_rollup/data/{id}", this); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupIndexCapsAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupIndexCapsAction.java index a5e2e6ea8068e..a4675bfa7f2e4 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupIndexCapsAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupIndexCapsAction.java @@ -6,12 +6,10 @@ package org.elasticsearch.xpack.rollup.rest; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.action.support.IndicesOptions; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.Strings; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; @@ -22,16 +20,10 @@ public class RestGetRollupIndexCapsAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = - new DeprecationLogger(LogManager.getLogger(RestGetRollupIndexCapsAction.class)); - static final ParseField INDEX = new ParseField("index"); public RestGetRollupIndexCapsAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, "/{index}/_rollup/data", this, - GET, "/{index}/_xpack/rollup/data", deprecationLogger); + controller.registerHandler(GET, "/{index}/_rollup/data", this); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupJobsAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupJobsAction.java index 8b1327be55b82..cefa90266ea6b 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupJobsAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestGetRollupJobsAction.java @@ -6,10 +6,8 @@ package org.elasticsearch.xpack.rollup.rest; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParseField; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; @@ -20,15 +18,10 @@ public class RestGetRollupJobsAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetRollupJobsAction.class)); - public static final ParseField ID = new ParseField("id"); public RestGetRollupJobsAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, "/_rollup/job/{id}", this, - GET, "/_xpack/rollup/job/{id}/", deprecationLogger); + controller.registerHandler(GET, "/_rollup/job/{id}", this); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestPutRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestPutRollupJobAction.java index 25612350ddea5..4f1f2a1a4d5dd 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestPutRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestPutRollupJobAction.java @@ -6,9 +6,7 @@ package org.elasticsearch.xpack.rollup.rest; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; @@ -21,13 +19,8 @@ public class RestPutRollupJobAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestPutRollupJobAction.class)); - public RestPutRollupJobAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - PUT, "/_rollup/job/{id}", this, - PUT, "/_xpack/rollup/job/{id}", deprecationLogger); + controller.registerHandler(PUT, "/_rollup/job/{id}", this); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStartRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStartRollupJobAction.java index 3e9e3ad0fc652..8f11802addadf 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStartRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStartRollupJobAction.java @@ -6,9 +6,7 @@ package org.elasticsearch.xpack.rollup.rest; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; @@ -20,13 +18,8 @@ public class RestStartRollupJobAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestStartRollupJobAction.class)); - public RestStartRollupJobAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_rollup/job/{id}/_start", this, - POST, "/_xpack/rollup/job/{id}/_start", deprecationLogger); + controller.registerHandler(POST, "/_rollup/job/{id}/_start", this); } @Override diff --git a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStopRollupJobAction.java b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStopRollupJobAction.java index 107adf941b2ce..0d41893f9d6d2 100644 --- a/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStopRollupJobAction.java +++ b/x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/rest/RestStopRollupJobAction.java @@ -6,9 +6,7 @@ package org.elasticsearch.xpack.rollup.rest; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.unit.TimeValue; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; @@ -21,13 +19,8 @@ public class RestStopRollupJobAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestStopRollupJobAction.class)); - public RestStopRollupJobAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_rollup/job/{id}/_stop", this, - POST, "/_xpack/rollup/job/{id}/_stop", deprecationLogger); + controller.registerHandler(POST, "/_rollup/job/{id}/_stop", this); } @Override diff --git a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/Protocol.java b/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/Protocol.java index 29238bf4064a5..37e20ae4e2c2b 100644 --- a/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/Protocol.java +++ b/x-pack/plugin/sql/sql-proto/src/main/java/org/elasticsearch/xpack/sql/proto/Protocol.java @@ -29,11 +29,7 @@ public final class Protocol { * SQL-related endpoints */ public static final String CLEAR_CURSOR_REST_ENDPOINT = "/_sql/close"; - public static final String CLEAR_CURSOR_DEPRECATED_REST_ENDPOINT = "/_xpack/sql/close"; public static final String SQL_QUERY_REST_ENDPOINT = "/_sql"; - public static final String SQL_QUERY_DEPRECATED_REST_ENDPOINT = "/_xpack/sql"; public static final String SQL_TRANSLATE_REST_ENDPOINT = "/_sql/translate"; - public static final String SQL_TRANSLATE_DEPRECATED_REST_ENDPOINT = "/_xpack/sql/translate"; public static final String SQL_STATS_REST_ENDPOINT = "/_sql/stats"; - public static final String SQL_STATS_DEPRECATED_REST_ENDPOINT = "/_xpack/sql/stats"; } diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java index 5d02e81dda792..88713eb4a8fae 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlClearCursorAction.java @@ -6,9 +6,7 @@ package org.elasticsearch.xpack.sql.plugin; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; @@ -24,13 +22,8 @@ public class RestSqlClearCursorAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestSqlClearCursorAction.class)); - public RestSqlClearCursorAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, Protocol.CLEAR_CURSOR_REST_ENDPOINT, this, - POST, Protocol.CLEAR_CURSOR_DEPRECATED_REST_ENDPOINT, deprecationLogger); + controller.registerHandler(POST, Protocol.CLEAR_CURSOR_REST_ENDPOINT, this); } @Override diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java index e785c2e74cc06..a4dbca091673b 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlQueryAction.java @@ -6,9 +6,7 @@ package org.elasticsearch.xpack.sql.plugin; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType; @@ -32,17 +30,9 @@ public class RestSqlQueryAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestSqlQueryAction.class)); - public RestSqlQueryAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, Protocol.SQL_QUERY_REST_ENDPOINT, this, - GET, Protocol.SQL_QUERY_DEPRECATED_REST_ENDPOINT, deprecationLogger); - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, Protocol.SQL_QUERY_REST_ENDPOINT, this, - POST, Protocol.SQL_QUERY_DEPRECATED_REST_ENDPOINT, deprecationLogger); + controller.registerHandler(GET, Protocol.SQL_QUERY_REST_ENDPOINT, this); + controller.registerHandler(POST, Protocol.SQL_QUERY_REST_ENDPOINT, this); } @Override diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlStatsAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlStatsAction.java index bc6af60d79683..8bb6c3328b382 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlStatsAction.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlStatsAction.java @@ -6,9 +6,7 @@ package org.elasticsearch.xpack.sql.plugin; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; @@ -19,13 +17,8 @@ public class RestSqlStatsAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestSqlStatsAction.class)); - protected RestSqlStatsAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, Protocol.SQL_STATS_REST_ENDPOINT, this, - GET, Protocol.SQL_STATS_DEPRECATED_REST_ENDPOINT, deprecationLogger); + controller.registerHandler(GET, Protocol.SQL_STATS_REST_ENDPOINT, this); } @Override diff --git a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java index 8ac6ef9fc81f8..b445789422e6e 100644 --- a/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java +++ b/x-pack/plugin/sql/src/main/java/org/elasticsearch/xpack/sql/plugin/RestSqlTranslateAction.java @@ -5,9 +5,7 @@ */ package org.elasticsearch.xpack.sql.plugin; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; @@ -27,17 +25,9 @@ */ public class RestSqlTranslateAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestSqlTranslateAction.class)); - public RestSqlTranslateAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, Protocol.SQL_TRANSLATE_REST_ENDPOINT, this, - GET, Protocol.SQL_TRANSLATE_DEPRECATED_REST_ENDPOINT, deprecationLogger); - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, Protocol.SQL_TRANSLATE_REST_ENDPOINT, this, - POST, Protocol.SQL_TRANSLATE_DEPRECATED_REST_ENDPOINT, deprecationLogger); + controller.registerHandler(GET, Protocol.SQL_TRANSLATE_REST_ENDPOINT, this); + controller.registerHandler(POST, Protocol.SQL_TRANSLATE_REST_ENDPOINT, this); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java index 5b11d620faaf8..f016f253583aa 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestAckWatchAction.java @@ -6,9 +6,7 @@ package org.elasticsearch.xpack.watcher.rest.action; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; @@ -31,22 +29,11 @@ */ public class RestAckWatchAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestAckWatchAction.class)); - public RestAckWatchAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_watcher/watch/{id}/_ack", this, - POST, "/_xpack/watcher/watch/{id}/_ack", deprecationLogger); - controller.registerWithDeprecatedHandler( - PUT, "/_watcher/watch/{id}/_ack", this, - PUT, "/_xpack/watcher/watch/{id}/_ack", deprecationLogger); - controller.registerWithDeprecatedHandler( - POST, "/_watcher/watch/{id}/_ack/{actions}", this, - POST, "/_xpack/watcher/watch/{id}/_ack/{actions}", deprecationLogger); - controller.registerWithDeprecatedHandler( - PUT, "/_watcher/watch/{id}/_ack/{actions}", this, - PUT, "/_xpack/watcher/watch/{id}/_ack/{actions}", deprecationLogger); + controller.registerHandler(POST, "/_watcher/watch/{id}/_ack", this); + controller.registerHandler(PUT, "/_watcher/watch/{id}/_ack", this); + controller.registerHandler(POST, "/_watcher/watch/{id}/_ack/{actions}", this); + controller.registerHandler(PUT, "/_watcher/watch/{id}/_ack/{actions}", this); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java index 358d1e88d8e9b..0317854d88b0f 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestActivateWatchAction.java @@ -6,9 +6,7 @@ package org.elasticsearch.xpack.watcher.rest.action; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; @@ -31,24 +29,13 @@ */ public class RestActivateWatchAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestActivateWatchAction.class)); - public RestActivateWatchAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_watcher/watch/{id}/_activate", this, - POST, "/_xpack/watcher/watch/{id}/_activate", deprecationLogger); - controller.registerWithDeprecatedHandler( - PUT, "/_watcher/watch/{id}/_activate", this, - PUT, "/_xpack/watcher/watch/{id}/_activate", deprecationLogger); + controller.registerHandler(POST, "/_watcher/watch/{id}/_activate", this); + controller.registerHandler(PUT, "/_watcher/watch/{id}/_activate", this); final DeactivateRestHandler deactivateRestHandler = new DeactivateRestHandler(); - controller.registerWithDeprecatedHandler( - POST, "/_watcher/watch/{id}/_deactivate", deactivateRestHandler, - POST, "/_xpack/watcher/watch/{id}/_deactivate", deprecationLogger); - controller.registerWithDeprecatedHandler( - PUT, "/_watcher/watch/{id}/_deactivate", deactivateRestHandler, - PUT, "/_xpack/watcher/watch/{id}/_deactivate", deprecationLogger); + controller.registerHandler(POST, "/_watcher/watch/{id}/_deactivate", deactivateRestHandler); + controller.registerHandler(PUT, "/_watcher/watch/{id}/_deactivate", deactivateRestHandler); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java index a56a863ef888c..dd33b79365d49 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestDeleteWatchAction.java @@ -6,9 +6,7 @@ package org.elasticsearch.xpack.watcher.rest.action; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.protocol.xpack.watcher.DeleteWatchRequest; import org.elasticsearch.protocol.xpack.watcher.DeleteWatchResponse; @@ -27,13 +25,8 @@ public class RestDeleteWatchAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestDeleteWatchAction.class)); - public RestDeleteWatchAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - DELETE, "/_watcher/watch/{id}", this, - DELETE, "/_xpack/watcher/watch/{id}", deprecationLogger); + controller.registerHandler(DELETE, "/_watcher/watch/{id}", this); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java index be943d27075f9..a42161aafc301 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestExecuteWatchAction.java @@ -6,12 +6,10 @@ package org.elasticsearch.xpack.watcher.rest.action; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.ElasticsearchParseException; import org.elasticsearch.client.node.NodeClient; import org.elasticsearch.common.ParseField; import org.elasticsearch.common.bytes.BytesReference; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.common.xcontent.XContentParser; @@ -44,8 +42,6 @@ public class RestExecuteWatchAction extends BaseRestHandler implements RestRequestFilter { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestExecuteWatchAction.class)); - private static final List RESERVED_FIELD_NAMES = Arrays.asList(WatchField.TRIGGER.getPreferredName(), WatchField.INPUT.getPreferredName(), WatchField.CONDITION.getPreferredName(), WatchField.ACTIONS.getPreferredName(), WatchField.TRANSFORM.getPreferredName(), @@ -53,19 +49,10 @@ public class RestExecuteWatchAction extends BaseRestHandler implements RestReque WatchField.METADATA.getPreferredName(), WatchField.STATUS.getPreferredName()); public RestExecuteWatchAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_watcher/watch/{id}/_execute", this, - POST, "/_xpack/watcher/watch/{id}/_execute", deprecationLogger); - controller.registerWithDeprecatedHandler( - PUT, "/_watcher/watch/{id}/_execute", this, - PUT, "/_xpack/watcher/watch/{id}/_execute", deprecationLogger); - controller.registerWithDeprecatedHandler( - POST, "/_watcher/watch/_execute", this, - POST, "/_xpack/watcher/watch/_execute", deprecationLogger); - controller.registerWithDeprecatedHandler( - PUT, "/_watcher/watch/_execute", this, - PUT, "/_xpack/watcher/watch/_execute", deprecationLogger); + controller.registerHandler(POST, "/_watcher/watch/{id}/_execute", this); + controller.registerHandler(PUT, "/_watcher/watch/{id}/_execute", this); + controller.registerHandler(POST, "/_watcher/watch/_execute", this); + controller.registerHandler(PUT, "/_watcher/watch/_execute", this); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java index 4c3af1a23c44e..1001c8181467a 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestGetWatchAction.java @@ -6,9 +6,7 @@ package org.elasticsearch.xpack.watcher.rest.action; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.xcontent.XContentBuilder; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.BytesRestResponse; @@ -27,13 +25,8 @@ public class RestGetWatchAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestGetWatchAction.class)); - public RestGetWatchAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, "/_watcher/watch/{id}", this, - GET, "/_xpack/watcher/watch/{id}", deprecationLogger); + controller.registerHandler(GET, "/_watcher/watch/{id}", this); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java index 03696b83e0d0e..2240c789c53f2 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestPutWatchAction.java @@ -6,9 +6,7 @@ package org.elasticsearch.xpack.watcher.rest.action; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.common.lucene.uid.Versions; import org.elasticsearch.common.util.set.Sets; import org.elasticsearch.common.xcontent.XContentBuilder; @@ -34,16 +32,9 @@ public class RestPutWatchAction extends BaseRestHandler implements RestRequestFilter { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestPutWatchAction.class)); - public RestPutWatchAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_watcher/watch/{id}", this, - POST, "/_xpack/watcher/watch/{id}", deprecationLogger); - controller.registerWithDeprecatedHandler( - PUT, "/_watcher/watch/{id}", this, - PUT, "/_xpack/watcher/watch/{id}", deprecationLogger); + controller.registerHandler(POST, "/_watcher/watch/{id}", this); + controller.registerHandler(PUT, "/_watcher/watch/{id}", this); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java index 1b6d050a6061e..c59cdffdcb96c 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatchServiceAction.java @@ -6,9 +6,7 @@ package org.elasticsearch.xpack.watcher.rest.action; -import org.apache.logging.log4j.LogManager; import org.elasticsearch.client.node.NodeClient; -import org.elasticsearch.common.logging.DeprecationLogger; import org.elasticsearch.rest.BaseRestHandler; import org.elasticsearch.rest.RestController; import org.elasticsearch.rest.RestRequest; @@ -20,16 +18,9 @@ public class RestWatchServiceAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = new DeprecationLogger(LogManager.getLogger(RestWatchServiceAction.class)); - public RestWatchServiceAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - POST, "/_watcher/_start", this, - POST, "/_xpack/watcher/_start", deprecationLogger); - controller.registerWithDeprecatedHandler( - POST, "/_watcher/_stop", new StopRestHandler(), - POST, "/_xpack/watcher/_stop", deprecationLogger); + controller.registerHandler(POST, "/_watcher/_start", this); + controller.registerHandler(POST, "/_watcher/_stop", new StopRestHandler()); } @Override diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java index 2d3c5e545bd63..60a0e0fb9fcdd 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/rest/action/RestWatcherStatsAction.java @@ -28,13 +28,8 @@ public class RestWatcherStatsAction extends BaseRestHandler { private static final DeprecationLogger deprecationLogger = new DeprecationLogger(logger); public RestWatcherStatsAction(RestController controller) { - // TODO: remove deprecated endpoint in 8.0.0 - controller.registerWithDeprecatedHandler( - GET, "/_watcher/stats", this, - GET, "/_xpack/watcher/stats", deprecationLogger); - controller.registerWithDeprecatedHandler( - GET, "/_watcher/stats/{metric}", this, - GET, "/_xpack/watcher/stats/{metric}", deprecationLogger); + controller.registerHandler(GET, "/_watcher/stats", this); + controller.registerHandler(GET, "/_watcher/stats/{metric}", this); } @Override diff --git a/x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/FullClusterRestartIT.java b/x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/FullClusterRestartIT.java index 69db9fb9fdb36..facc2eea30c87 100644 --- a/x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/FullClusterRestartIT.java +++ b/x-pack/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/FullClusterRestartIT.java @@ -126,8 +126,8 @@ public void testSecurityNativeRealm() throws Exception { public void testWatcher() throws Exception { if (isRunningAgainstOldCluster()) { logger.info("Adding a watch on old cluster {}", getOldClusterVersion()); - Request createBwcWatch = new Request("PUT", getWatcherEndpoint() + "/watch/bwc_watch"); - Request createBwcThrottlePeriod = new Request("PUT", getWatcherEndpoint() + "/watch/bwc_throttle_period"); + Request createBwcWatch = new Request("PUT", "/_watcher/watch/bwc_watch"); + Request createBwcThrottlePeriod = new Request("PUT", "/_watcher/watch/bwc_throttle_period"); createBwcWatch.setJsonEntity(loadWatch("simple-watch.json")); client().performRequest(createBwcWatch); @@ -137,7 +137,7 @@ public void testWatcher() throws Exception { client().performRequest(createBwcThrottlePeriod); logger.info("Adding a watch with \"fun\" read timeout on old cluster"); - Request createFunnyTimeout = new Request("PUT", getWatcherEndpoint() + "/watch/bwc_funny_timeout"); + Request createFunnyTimeout = new Request("PUT", "/_watcher/watch/bwc_funny_timeout"); createFunnyTimeout.setJsonEntity(loadWatch("funny-timeout-watch.json")); client().performRequest(createFunnyTimeout); @@ -228,7 +228,7 @@ public void testRollupAfterRestart() throws Exception { client().performRequest(bulkRequest); // create the rollup job - final Request createRollupJobRequest = new Request("PUT", getRollupEndpoint() + "/job/rollup-job-test"); + final Request createRollupJobRequest = new Request("PUT", "/_rollup/job/rollup-job-test"); String intervalType; if (getOldClusterVersion().onOrAfter(Version.V_7_2_0)) { @@ -257,7 +257,7 @@ public void testRollupAfterRestart() throws Exception { assertThat(createRollupJobResponse.get("acknowledged"), equalTo(Boolean.TRUE)); // start the rollup job - final Request startRollupJobRequest = new Request("POST", getRollupEndpoint() + "/job/rollup-job-test/_start"); + final Request startRollupJobRequest = new Request("POST", "/_rollup/job/rollup-job-test/_start"); Map startRollupJobResponse = entityAsMap(client().performRequest(startRollupJobRequest)); assertThat(startRollupJobResponse.get("started"), equalTo(Boolean.TRUE)); @@ -445,7 +445,7 @@ static String toStr(Response response) throws IOException { private void createUser(final boolean oldCluster) throws Exception { final String id = oldCluster ? "preupgrade_user" : "postupgrade_user"; - Request request = new Request("PUT", getSecurityEndpoint() + "/user/" + id); + Request request = new Request("PUT", "/_security/user/" + id); request.setJsonEntity( "{\n" + " \"password\" : \"j@rV1s\",\n" + @@ -459,7 +459,7 @@ private void createUser(final boolean oldCluster) throws Exception { private void createRole(final boolean oldCluster) throws Exception { final String id = oldCluster ? "preupgrade_role" : "postupgrade_role"; - Request request = new Request("PUT", getSecurityEndpoint() + "/role/" + id); + Request request = new Request("PUT", "/_security/role/" + id); request.setJsonEntity( "{\n" + " \"run_as\": [ \"abc\" ],\n" + @@ -480,7 +480,7 @@ private void createRole(final boolean oldCluster) throws Exception { private void assertUserInfo(final boolean oldCluster) throws Exception { final String user = oldCluster ? "preupgrade_user" : "postupgrade_user"; - Request request = new Request("GET", getSecurityEndpoint() + "/user/" + user);; + Request request = new Request("GET", "/_security/user/" + user);; Map response = entityAsMap(client().performRequest(request)); @SuppressWarnings("unchecked") Map userInfo = (Map) response.get(user); assertEquals(user + "@example.com", userInfo.get("email")); @@ -488,50 +488,10 @@ private void assertUserInfo(final boolean oldCluster) throws Exception { assertNotNull(userInfo.get("roles")); } - private String getSecurityEndpoint() { - String securityEndpoint; - if (getOldClusterVersion().onOrAfter(Version.V_7_0_0) || isRunningAgainstOldCluster() == false) { - securityEndpoint = "/_security"; - } else { - securityEndpoint = "/_xpack/security"; - } - return securityEndpoint; - } - - private String getSQLEndpoint() { - String securityEndpoint; - if (getOldClusterVersion().onOrAfter(Version.V_7_0_0) || isRunningAgainstOldCluster() == false) { - securityEndpoint = "/_sql"; - } else { - securityEndpoint = "/_xpack/sql"; - } - return securityEndpoint; - } - - private String getRollupEndpoint() { - String securityEndpoint; - if (getOldClusterVersion().onOrAfter(Version.V_7_0_0) || isRunningAgainstOldCluster() == false) { - securityEndpoint = "/_rollup"; - } else { - securityEndpoint = "/_xpack/rollup"; - } - return securityEndpoint; - } - - private String getWatcherEndpoint() { - String securityEndpoint; - if (getOldClusterVersion().onOrAfter(Version.V_7_0_0) || isRunningAgainstOldCluster() == false) { - securityEndpoint = "/_watcher"; - } else { - securityEndpoint = "/_xpack/watcher"; - } - return securityEndpoint; - } - private void assertRoleInfo(final boolean oldCluster) throws Exception { final String role = oldCluster ? "preupgrade_role" : "postupgrade_role"; @SuppressWarnings("unchecked") Map response = (Map) entityAsMap( - client().performRequest(new Request("GET", getSecurityEndpoint() + "/role/" + role)) + client().performRequest(new Request("GET", "/_security/role/" + role)) ).get(role); assertNotNull(response.get("run_as")); assertNotNull(response.get("cluster")); @@ -544,7 +504,7 @@ private void assertRollUpJob(final String rollupJob) throws Exception { waitForRollUpJob(rollupJob, expectedStates); // check that the rollup job is started using the RollUp API - final Request getRollupJobRequest = new Request("GET", getRollupEndpoint() + "/job/" + rollupJob); + final Request getRollupJobRequest = new Request("GET", "_rollup/job/" + rollupJob); Map getRollupJobResponse = entityAsMap(client().performRequest(getRollupJobRequest)); Map job = getJob(getRollupJobResponse, rollupJob); assertNotNull(job); @@ -583,7 +543,7 @@ private void assertRollUpJob(final String rollupJob) throws Exception { private void waitForRollUpJob(final String rollupJob, final Matcher expectedStates) throws Exception { assertBusy(() -> { - final Request getRollupJobRequest = new Request("GET", getRollupEndpoint() + "/job/" + rollupJob); + final Request getRollupJobRequest = new Request("GET", "/_rollup/job/" + rollupJob); Response getRollupJobResponse = client().performRequest(getRollupJobRequest); assertThat(getRollupJobResponse.getStatusLine().getStatusCode(), equalTo(RestStatus.OK.getStatus()));