Skip to content

Commit a3336f2

Browse files
committed
adjust to no longer rely on rest api compatiblity
1 parent f3b7c6d commit a3336f2

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/license/RestGetLicenseAction.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import java.util.List;
2828
import java.util.Map;
2929

30-
import static org.elasticsearch.core.RestApiVersion.V_8;
3130
import static org.elasticsearch.rest.RestRequest.Method.GET;
3231
import static org.elasticsearch.rest.RestStatus.NOT_FOUND;
3332
import static org.elasticsearch.rest.RestStatus.OK;
@@ -62,17 +61,17 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC
6261
overrideParams.put(License.REST_VIEW_MODE, "true");
6362
overrideParams.put(License.LICENSE_VERSION_MODE, String.valueOf(License.VERSION_CURRENT));
6463

65-
// In 7.x, there was an opt-in flag to show "enterprise" licenses. In 8.0 the flag is deprecated and can only be true
66-
if (request.getRestApiVersion() == V_8 && request.hasParam("accept_enterprise")) {
64+
// In 7.x, there was an opt-in flag to show "enterprise" licenses. In 8.0+ the flag is deprecated and can only be true
65+
if (request.hasParam("accept_enterprise")) {
6766
deprecationLogger.warn(
68-
DeprecationCategory.COMPATIBLE_API,
67+
DeprecationCategory.API,
6968
"get_license_accept_enterprise",
7069
"Including [accept_enterprise] in get license requests is deprecated."
7170
+ " The parameter will be removed in the next major version"
7271
);
73-
if (request.paramAsBoolean("accept_enterprise", true) == false) { // consumes the parameter to avoid error
74-
throw new IllegalArgumentException("The [accept_enterprise] parameters may not be false");
75-
}
72+
}
73+
if (request.paramAsBoolean("accept_enterprise", true) == false) { // consumes the parameter to avoid error
74+
throw new IllegalArgumentException("The [accept_enterprise] parameters may not be false");
7675
}
7776

7877
final ToXContent.Params params = new ToXContent.DelegatingMapParams(overrideParams, request);

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/rest/action/RestXPackInfoAction.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import java.util.EnumSet;
2323
import java.util.List;
2424

25-
import static org.elasticsearch.core.RestApiVersion.V_8;
2625
import static org.elasticsearch.rest.RestRequest.Method.GET;
2726
import static org.elasticsearch.rest.RestRequest.Method.HEAD;
2827

@@ -49,16 +48,16 @@ public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client
4948
boolean verbose = request.paramAsBoolean("human", true);
5049

5150
// In 7.x, there was an opt-in flag to show "enterprise" licenses. In 8.0 the flag is deprecated and can only be true
52-
if (request.getRestApiVersion() == V_8 && request.hasParam("accept_enterprise")) {
51+
if (request.hasParam("accept_enterprise")) {
5352
deprecationLogger.warn(
54-
DeprecationCategory.COMPATIBLE_API,
53+
DeprecationCategory.API,
5554
"get_license_accept_enterprise",
5655
"Including [accept_enterprise] in get license requests is deprecated."
5756
+ " The parameter will be removed in the next major version"
5857
);
59-
if (request.paramAsBoolean("accept_enterprise", true) == false) { // consumes the parameter to avoid error
60-
throw new IllegalArgumentException("The [accept_enterprise] parameters may not be false");
61-
}
58+
}
59+
if (request.paramAsBoolean("accept_enterprise", true) == false) { // consumes the parameter to avoid error
60+
throw new IllegalArgumentException("The [accept_enterprise] parameters may not be false");
6261
}
6362

6463
EnumSet<XPackInfoRequest.Category> categories = XPackInfoRequest.Category.toSet(

0 commit comments

Comments
 (0)