Remove description from xpack feature sets (#43065)
The description field of xpack featuresets is optionally part of the xpack info api, when using the verbose flag. However, this information is unnecessary, as it is better left for documentation (and the existing descriptions describe anything meaningful). This commit removes the description field from feature sets.
This commit is contained in:
parent
6108899a2d
commit
172cd4dbfa
|
@ -318,11 +318,6 @@ public class XPackInfoResponse {
|
|||
return name;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String description() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public boolean available() {
|
||||
return available;
|
||||
}
|
||||
|
|
|
@ -71,17 +71,14 @@ public class PingAndInfoIT extends ESRestHighLevelClientTestCase {
|
|||
assertEquals(LicenseStatus.ACTIVE, info.getLicenseInfo().getStatus());
|
||||
|
||||
FeatureSet graph = info.getFeatureSetsInfo().getFeatureSets().get("graph");
|
||||
assertNotNull(graph.description());
|
||||
assertTrue(graph.available());
|
||||
assertTrue(graph.enabled());
|
||||
assertNull(graph.nativeCodeInfo());
|
||||
FeatureSet monitoring = info.getFeatureSetsInfo().getFeatureSets().get("monitoring");
|
||||
assertNotNull(monitoring.description());
|
||||
assertTrue(monitoring.available());
|
||||
assertTrue(monitoring.enabled());
|
||||
assertNull(monitoring.nativeCodeInfo());
|
||||
FeatureSet ml = info.getFeatureSetsInfo().getFeatureSets().get("ml");
|
||||
assertNotNull(ml.description());
|
||||
assertTrue(ml.available());
|
||||
assertTrue(ml.enabled());
|
||||
assertEquals(mainResponse.getVersion().getNumber(), ml.nativeCodeInfo().get("version").toString());
|
||||
|
|
|
@ -70,8 +70,7 @@ public class XPackInfoResponseTests extends
|
|||
private FeatureSetsInfo convertHlrcToInternal(org.elasticsearch.client.xpack.XPackInfoResponse.FeatureSetsInfo featureSetsInfo) {
|
||||
return featureSetsInfo != null
|
||||
? new FeatureSetsInfo(featureSetsInfo.getFeatureSets().values().stream()
|
||||
.map(fs -> new FeatureSet(fs.name(), fs.description(), fs.available(), fs.enabled(),
|
||||
fs.nativeCodeInfo()))
|
||||
.map(fs -> new FeatureSet(fs.name(), fs.available(), fs.enabled(), fs.nativeCodeInfo()))
|
||||
.collect(Collectors.toSet()))
|
||||
: null;
|
||||
}
|
||||
|
@ -169,7 +168,6 @@ public class XPackInfoResponseTests extends
|
|||
private FeatureSet randomFeatureSet() {
|
||||
return new FeatureSet(
|
||||
randomAlphaOfLength(5),
|
||||
randomBoolean() ? null : randomAlphaOfLength(20),
|
||||
randomBoolean(),
|
||||
randomBoolean(),
|
||||
randomNativeCodeInfo());
|
||||
|
|
|
@ -64,32 +64,26 @@ Example response:
|
|||
},
|
||||
"features" : {
|
||||
"ccr" : {
|
||||
"description" : "Cross Cluster Replication",
|
||||
"available" : true,
|
||||
"enabled" : true
|
||||
},
|
||||
"data_frame" : {
|
||||
"description" : "Data Frame for the Elastic Stack",
|
||||
"available" : true,
|
||||
"enabled" : true
|
||||
},
|
||||
"graph" : {
|
||||
"description" : "Graph Data Exploration for the Elastic Stack",
|
||||
"available" : true,
|
||||
"enabled" : true
|
||||
},
|
||||
"ilm" : {
|
||||
"description" : "Index lifecycle management for the Elastic Stack",
|
||||
"available" : true,
|
||||
"enabled" : true
|
||||
},
|
||||
"logstash" : {
|
||||
"description" : "Logstash management component for X-Pack",
|
||||
"available" : true,
|
||||
"enabled" : true
|
||||
},
|
||||
"ml" : {
|
||||
"description" : "Machine Learning for the Elastic Stack",
|
||||
"available" : true,
|
||||
"enabled" : true,
|
||||
"native_code_info" : {
|
||||
|
@ -98,27 +92,22 @@ Example response:
|
|||
}
|
||||
},
|
||||
"monitoring" : {
|
||||
"description" : "Monitoring for the Elastic Stack",
|
||||
"available" : true,
|
||||
"enabled" : true
|
||||
},
|
||||
"rollup": {
|
||||
"description": "Time series pre-aggregation and rollup",
|
||||
"available": true,
|
||||
"enabled": true
|
||||
},
|
||||
"security" : {
|
||||
"description" : "Security for the Elastic Stack",
|
||||
"available" : true,
|
||||
"enabled" : false
|
||||
},
|
||||
"sql" : {
|
||||
"description" : "SQL access to Elasticsearch",
|
||||
"available" : true,
|
||||
"enabled" : true
|
||||
},
|
||||
"watcher" : {
|
||||
"description" : "Alerting, Notification and Automation for the Elastic Stack",
|
||||
"available" : true,
|
||||
"enabled" : true
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
package org.elasticsearch.protocol.xpack;
|
||||
|
||||
import org.elasticsearch.Version;
|
||||
import org.elasticsearch.action.ActionResponse;
|
||||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.ParseField;
|
||||
|
@ -331,28 +332,37 @@ public class XPackInfoResponse extends ActionResponse implements ToXContentObjec
|
|||
|
||||
public static class FeatureSet implements ToXContentObject, Writeable {
|
||||
private final String name;
|
||||
@Nullable private final String description;
|
||||
private final boolean available;
|
||||
private final boolean enabled;
|
||||
@Nullable private final Map<String, Object> nativeCodeInfo;
|
||||
|
||||
public FeatureSet(String name, @Nullable String description, boolean available, boolean enabled,
|
||||
public FeatureSet(String name, boolean available, boolean enabled,
|
||||
@Nullable Map<String, Object> nativeCodeInfo) {
|
||||
this.name = name;
|
||||
this.description = description;
|
||||
this.available = available;
|
||||
this.enabled = enabled;
|
||||
this.nativeCodeInfo = nativeCodeInfo;
|
||||
}
|
||||
|
||||
public FeatureSet(StreamInput in) throws IOException {
|
||||
this(in.readString(), in.readOptionalString(), in.readBoolean(), in.readBoolean(), in.readMap());
|
||||
this(in.readString(), readAvailable(in), in.readBoolean(), in.readMap());
|
||||
}
|
||||
|
||||
// this is separated out so that the removed description can be read from the stream on construction
|
||||
// TODO: remove this for 8.0
|
||||
private static boolean readAvailable(StreamInput in) throws IOException {
|
||||
if (in.getVersion().before(Version.V_7_3_0)) {
|
||||
in.readOptionalString();
|
||||
}
|
||||
return in.readBoolean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeTo(StreamOutput out) throws IOException {
|
||||
out.writeString(name);
|
||||
out.writeOptionalString(description);
|
||||
if (out.getVersion().before(Version.V_7_3_0)) {
|
||||
out.writeOptionalString(null);
|
||||
}
|
||||
out.writeBoolean(available);
|
||||
out.writeBoolean(enabled);
|
||||
out.writeMap(nativeCodeInfo);
|
||||
|
@ -362,11 +372,6 @@ public class XPackInfoResponse extends ActionResponse implements ToXContentObjec
|
|||
return name;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String description() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public boolean available() {
|
||||
return available;
|
||||
}
|
||||
|
@ -386,7 +391,6 @@ public class XPackInfoResponse extends ActionResponse implements ToXContentObjec
|
|||
if (this == other) return true;
|
||||
FeatureSet rhs = (FeatureSet) other;
|
||||
return Objects.equals(name, rhs.name)
|
||||
&& Objects.equals(description, rhs.description)
|
||||
&& available == rhs.available
|
||||
&& enabled == rhs.enabled
|
||||
&& Objects.equals(nativeCodeInfo, rhs.nativeCodeInfo);
|
||||
|
@ -394,15 +398,12 @@ public class XPackInfoResponse extends ActionResponse implements ToXContentObjec
|
|||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(name, description, available, enabled, nativeCodeInfo);
|
||||
return Objects.hash(name, available, enabled, nativeCodeInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
|
||||
builder.startObject();
|
||||
if (description != null) {
|
||||
builder.field("description", description);
|
||||
}
|
||||
builder.field("available", available);
|
||||
builder.field("enabled", enabled);
|
||||
if (nativeCodeInfo != null) {
|
||||
|
|
|
@ -16,11 +16,6 @@ public class EmptyXPackFeatureSet implements XPackFeatureSet {
|
|||
return "Empty XPackFeatureSet";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Core will not function without this empty featureset compliments of the way the TransportXPackInfoAction Guice works";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean available() {
|
||||
return false;
|
||||
|
|
|
@ -19,8 +19,6 @@ public interface XPackFeatureSet {
|
|||
|
||||
String name();
|
||||
|
||||
String description();
|
||||
|
||||
boolean available();
|
||||
|
||||
boolean enabled();
|
||||
|
|
|
@ -58,7 +58,7 @@ public class TransportXPackInfoAction extends HandledTransportAction<XPackInfoRe
|
|||
XPackInfoResponse.FeatureSetsInfo featureSetsInfo = null;
|
||||
if (request.getCategories().contains(XPackInfoRequest.Category.FEATURES)) {
|
||||
Set<FeatureSet> featureSets = this.featureSets.stream().map(fs ->
|
||||
new FeatureSet(fs.name(), request.isVerbose() ? fs.description() : null, fs.available(), fs.enabled(),
|
||||
new FeatureSet(fs.name(), fs.available(), fs.enabled(),
|
||||
request.isVerbose() ? fs.nativeCodeInfo() : null))
|
||||
.collect(Collectors.toSet());
|
||||
featureSetsInfo = new XPackInfoResponse.FeatureSetsInfo(featureSets);
|
||||
|
|
|
@ -43,11 +43,6 @@ public class CCRFeatureSet implements XPackFeatureSet {
|
|||
return XPackField.CCR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Cross Cluster Replication";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean available() {
|
||||
return licenseState != null && licenseState.isCcrAllowed();
|
||||
|
|
|
@ -49,7 +49,6 @@ public class TransportXPackInfoActionTests extends ESTestCase {
|
|||
for (int i = 0; i < featureSetCount; i++) {
|
||||
XPackFeatureSet fs = mock(XPackFeatureSet.class);
|
||||
when(fs.name()).thenReturn(randomAlphaOfLength(5));
|
||||
when(fs.description()).thenReturn(randomAlphaOfLength(10));
|
||||
when(fs.available()).thenReturn(randomBoolean());
|
||||
when(fs.enabled()).thenReturn(randomBoolean());
|
||||
featureSets.add(fs);
|
||||
|
@ -131,11 +130,6 @@ public class TransportXPackInfoActionTests extends ESTestCase {
|
|||
for (XPackFeatureSet fs : featureSets) {
|
||||
assertThat(features, hasKey(fs.name()));
|
||||
assertThat(features.get(fs.name()).name(), equalTo(fs.name()));
|
||||
if (!request.isVerbose()) {
|
||||
assertThat(features.get(fs.name()).description(), is(nullValue()));
|
||||
} else {
|
||||
assertThat(features.get(fs.name()).description(), is(fs.description()));
|
||||
}
|
||||
assertThat(features.get(fs.name()).available(), equalTo(fs.available()));
|
||||
assertThat(features.get(fs.name()).enabled(), equalTo(fs.enabled()));
|
||||
}
|
||||
|
|
|
@ -84,11 +84,6 @@ public class DataFrameFeatureSet implements XPackFeatureSet {
|
|||
return XPackField.DATA_FRAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Data Frame for the Elastic Stack";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean available() {
|
||||
return licenseState != null && licenseState.isDataFrameAllowed();
|
||||
|
|
|
@ -33,11 +33,6 @@ public class GraphFeatureSet implements XPackFeatureSet {
|
|||
return XPackField.GRAPH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Graph Data Exploration for the Elastic Stack";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean available() {
|
||||
return licenseState != null && licenseState.isGraphAllowed();
|
||||
|
|
|
@ -45,11 +45,6 @@ public class IndexLifecycleFeatureSet implements XPackFeatureSet {
|
|||
return XPackField.INDEX_LIFECYCLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Index lifecycle management for the Elastic Stack";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean available() {
|
||||
return licenseState != null && licenseState.isIndexLifecycleAllowed();
|
||||
|
|
|
@ -34,11 +34,6 @@ public class LogstashFeatureSet implements XPackFeatureSet {
|
|||
return XPackField.LOGSTASH;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Logstash management component for X-Pack";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean available() {
|
||||
return licenseState != null && licenseState.isLogstashAllowed();
|
||||
|
|
|
@ -114,11 +114,6 @@ public class MachineLearningFeatureSet implements XPackFeatureSet {
|
|||
return XPackField.MACHINE_LEARNING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Machine Learning for the Elastic Stack";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean available() {
|
||||
return licenseState != null && licenseState.isMachineLearningAllowed();
|
||||
|
|
|
@ -43,11 +43,6 @@ public class MonitoringFeatureSet implements XPackFeatureSet {
|
|||
return XPackField.MONITORING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Monitoring for the Elastic Stack";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean available() {
|
||||
return licenseState != null && licenseState.isMonitoringAllowed();
|
||||
|
|
|
@ -33,11 +33,6 @@ public class RollupFeatureSet implements XPackFeatureSet {
|
|||
return XPackField.ROLLUP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Time series pre-aggregation and rollup";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean available() {
|
||||
return licenseState != null && licenseState.isRollupAllowed();
|
||||
|
|
|
@ -68,11 +68,6 @@ public class SecurityFeatureSet implements XPackFeatureSet {
|
|||
return XPackField.SECURITY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Security for the Elastic Stack";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean available() {
|
||||
return licenseState != null && licenseState.isSecurityAvailable();
|
||||
|
|
|
@ -236,8 +236,8 @@ public class SetupPasswordToolTests extends CommandTestCase {
|
|||
URL xpackSecurityPluginQueryURL = queryXPackSecurityFeatureConfigURL(url);
|
||||
|
||||
Set<FeatureSet> featureSets = new HashSet<>();
|
||||
featureSets.add(new FeatureSet("logstash", null, true, true, null));
|
||||
featureSets.add(new FeatureSet("security", null, true, true, null));
|
||||
featureSets.add(new FeatureSet("logstash", true, true, null));
|
||||
featureSets.add(new FeatureSet("security", true, true, null));
|
||||
FeatureSetsInfo featureInfos = new FeatureSetsInfo(featureSets);
|
||||
XPackInfoResponse xpackInfo = new XPackInfoResponse(null, null, featureInfos);
|
||||
String securityPluginQueryResponseBody = null;
|
||||
|
@ -267,8 +267,8 @@ public class SetupPasswordToolTests extends CommandTestCase {
|
|||
any(CheckedFunction.class))).thenReturn(httpResponse);
|
||||
|
||||
Set<FeatureSet> featureSets = new HashSet<>();
|
||||
featureSets.add(new FeatureSet("logstash", null, true, true, null));
|
||||
featureSets.add(new FeatureSet("security", null, false, false, null));
|
||||
featureSets.add(new FeatureSet("logstash", true, true, null));
|
||||
featureSets.add(new FeatureSet("security", false, false, null));
|
||||
FeatureSetsInfo featureInfos = new FeatureSetsInfo(featureSets);
|
||||
XPackInfoResponse xpackInfo = new XPackInfoResponse(null, null, featureInfos);
|
||||
String securityPluginQueryResponseBody = null;
|
||||
|
@ -298,8 +298,8 @@ public class SetupPasswordToolTests extends CommandTestCase {
|
|||
any(CheckedFunction.class))).thenReturn(httpResponse);
|
||||
|
||||
Set<FeatureSet> featureSets = new HashSet<>();
|
||||
featureSets.add(new FeatureSet("logstash", null, true, true, null));
|
||||
featureSets.add(new FeatureSet("security", null, true, false, null));
|
||||
featureSets.add(new FeatureSet("logstash", true, true, null));
|
||||
featureSets.add(new FeatureSet("security", true, false, null));
|
||||
FeatureSetsInfo featureInfos = new FeatureSetsInfo(featureSets);
|
||||
XPackInfoResponse xpackInfo = new XPackInfoResponse(null, null, featureInfos);
|
||||
String securityPluginQueryResponseBody = null;
|
||||
|
|
|
@ -45,11 +45,6 @@ public class SqlFeatureSet implements XPackFeatureSet {
|
|||
return XPackField.SQL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "SQL access to Elasticsearch";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean available() {
|
||||
return licenseState != null && licenseState.isSqlAllowed();
|
||||
|
|
|
@ -68,19 +68,15 @@
|
|||
- is_true: features.watcher
|
||||
- is_true: features.watcher.enabled
|
||||
- is_true: features.watcher.available
|
||||
- is_true: features.watcher.description
|
||||
- is_true: features.security
|
||||
- is_true: features.security.enabled
|
||||
- is_true: features.security.available
|
||||
- is_true: features.security.description
|
||||
- is_true: features.graph
|
||||
- is_true: features.graph.enabled
|
||||
- is_true: features.graph.available
|
||||
- is_true: features.graph.description
|
||||
- is_true: features.monitoring
|
||||
- is_true: features.monitoring.enabled
|
||||
- is_true: features.monitoring.available
|
||||
- is_true: features.monitoring.description
|
||||
- is_true: tagline
|
||||
|
||||
- do:
|
||||
|
@ -152,19 +148,15 @@
|
|||
- is_true: features.watcher
|
||||
- is_true: features.watcher.enabled
|
||||
- is_true: features.watcher.available
|
||||
- is_false: features.watcher.description
|
||||
- is_true: features.security
|
||||
- is_true: features.security.enabled
|
||||
- is_true: features.security.available
|
||||
- is_false: features.security.description
|
||||
- is_true: features.graph
|
||||
- is_true: features.graph.enabled
|
||||
- is_true: features.graph.available
|
||||
- is_false: features.graph.description
|
||||
- is_true: features.monitoring
|
||||
- is_true: features.monitoring.enabled
|
||||
- is_true: features.monitoring.available
|
||||
- is_false: features.monitoring.description
|
||||
- is_false: tagline
|
||||
|
||||
|
||||
|
|
|
@ -47,11 +47,6 @@ public class WatcherFeatureSet implements XPackFeatureSet {
|
|||
return XPackField.WATCHER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String description() {
|
||||
return "Alerting, Notification and Automation for the Elastic Stack";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean available() {
|
||||
return licenseState != null && licenseState.isWatcherAllowed();
|
||||
|
|
Loading…
Reference in New Issue