diff --git a/src/Nest/Cluster/ClusterStats/ClusterNodesStats.cs b/src/Nest/Cluster/ClusterStats/ClusterNodesStats.cs index b8cda13c4e8..1b2406baecc 100644 --- a/src/Nest/Cluster/ClusterStats/ClusterNodesStats.cs +++ b/src/Nest/Cluster/ClusterStats/ClusterNodesStats.cs @@ -15,6 +15,9 @@ public class ClusterNodesStats [JsonProperty("jvm")] public ClusterJvm Jvm { get; internal set; } + [JsonProperty("network_types")] + public ClusterNetworkTypes NetworkTypes { get; internal set; } + [JsonProperty("os")] public ClusterOperatingSystemStats OperatingSystem { get; internal set; } @@ -28,6 +31,16 @@ public class ClusterNodesStats public IReadOnlyCollection Versions { get; internal set; } } + [JsonObject] + public class ClusterNetworkTypes + { + [JsonProperty("http_types")] + public IReadOnlyDictionary HttpTypes { get; internal set; } + + [JsonProperty("transport_types")] + public IReadOnlyDictionary TransportTypes { get; internal set; } + } + [JsonObject] public class ClusterFileSystem { @@ -143,8 +156,33 @@ public class ClusterOperatingSystemStats [JsonProperty("available_processors")] public int AvailableProcessors { get; internal set; } + [JsonProperty("mem")] + public OperatingSystemMemoryInfo Memory { get; internal set; } + [JsonProperty("names")] public IReadOnlyCollection Names { get; internal set; } + + [JsonProperty("pretty_names")] + public IReadOnlyCollection PrettyNames { get; internal set; } + } + + [JsonObject] + public class OperatingSystemMemoryInfo + { + [JsonProperty("free_in_bytes")] + public long FreeBytes { get; internal set; } + + [JsonProperty("free_percent")] + public int FreePercent { get; internal set; } + + [JsonProperty("total_in_bytes")] + public long TotalBytes { get; internal set; } + + [JsonProperty("used_in_bytes")] + public long UsedBytes { get; internal set; } + + [JsonProperty("used_percent")] + public int UsedPercent { get; internal set; } } [JsonObject] diff --git a/src/Nest/Cluster/ClusterStats/ClusterStatsResponse.cs b/src/Nest/Cluster/ClusterStats/ClusterStatsResponse.cs index 671e7eb05d5..0fe24492a0f 100644 --- a/src/Nest/Cluster/ClusterStats/ClusterStatsResponse.cs +++ b/src/Nest/Cluster/ClusterStats/ClusterStatsResponse.cs @@ -7,6 +7,9 @@ public interface IClusterStatsResponse : INodesResponse [JsonProperty("cluster_name")] string ClusterName { get; } + [JsonProperty("cluster_uuid")] + string ClusterUUID { get; } + [JsonProperty("indices")] ClusterIndicesStats Indices { get; } @@ -24,6 +27,8 @@ public class ClusterStatsResponse : NodesResponseBase, IClusterStatsResponse { public string ClusterName { get; internal set; } + public string ClusterUUID { get; internal set; } + public ClusterIndicesStats Indices { get; internal set; } public ClusterNodesStats Nodes { get; internal set; } diff --git a/src/Nest/Cluster/NodesInfo/NodeInfo.cs b/src/Nest/Cluster/NodesInfo/NodeInfo.cs index d9ae3c7ae5b..c4b24bd3825 100644 --- a/src/Nest/Cluster/NodesInfo/NodeInfo.cs +++ b/src/Nest/Cluster/NodesInfo/NodeInfo.cs @@ -81,6 +81,9 @@ public class NodeOperatingSystemInfo [JsonProperty("name")] public string Name { get; internal set; } + [JsonProperty("pretty_name")] + public string PrettyName { get; internal set; } + [JsonProperty("refresh_interval_in_millis")] public int RefreshInterval { get; internal set; } @@ -91,6 +94,16 @@ public class NodeOperatingSystemInfo public string Version { get; internal set; } } + [JsonObject] + public class ClusterOperatingSystemPrettyNane + { + [JsonProperty("pretty_name")] + public string PrettyName { get; internal set; } + + [JsonProperty("count")] + public int Count { get; internal set; } + } + [JsonObject] public class NodeInfoOSCPU { diff --git a/src/Nest/CommonOptions/Stats/PluginStats.cs b/src/Nest/CommonOptions/Stats/PluginStats.cs index 388a47890d1..aad9327a20f 100644 --- a/src/Nest/CommonOptions/Stats/PluginStats.cs +++ b/src/Nest/CommonOptions/Stats/PluginStats.cs @@ -11,6 +11,9 @@ public class PluginStats [JsonProperty("description")] public string Description { get; set; } + [JsonProperty("elasticsearch_version")] + public string ElasticsearchVersion { get; set; } + [JsonProperty("isolated")] public bool Isolated { get; set; } @@ -23,6 +26,12 @@ public class PluginStats [JsonProperty("site")] public bool Site { get; set; } + [JsonProperty("java_version")] + public string JavaVersion { get; set; } + + [JsonProperty("has_native_controller")] + public bool? HasNativeController { get; set; } + [JsonProperty("version")] public string Version { get; set; } } diff --git a/src/Nest/CommonOptions/Stats/SegmentsStats.cs b/src/Nest/CommonOptions/Stats/SegmentsStats.cs index 6c954401e62..f4a6c727abb 100644 --- a/src/Nest/CommonOptions/Stats/SegmentsStats.cs +++ b/src/Nest/CommonOptions/Stats/SegmentsStats.cs @@ -32,6 +32,9 @@ public class SegmentsStats [JsonProperty("index_writer_memory_in_bytes")] public long IndexWriterMemoryInBytes { get; set; } + [JsonProperty("max_unsafe_auto_id_timestamp")] + public string MaximumUnsafeAutoIdTimestamp { get; set; } + [JsonProperty("memory")] public string Memory { get; set; } diff --git a/src/Nest/Document/Multiple/MultiGet/Response/MultiGetHit.cs b/src/Nest/Document/Multiple/MultiGet/Response/MultiGetHit.cs index 55623859abf..d48e78c81af 100644 --- a/src/Nest/Document/Multiple/MultiGet/Response/MultiGetHit.cs +++ b/src/Nest/Document/Multiple/MultiGet/Response/MultiGetHit.cs @@ -23,6 +23,10 @@ public interface IMultiGetHit where TDocument : class string Type { get; } long Version { get; } + + long PrimaryTerm { get; } + + long SequenceNumber { get; } } [JsonObject] @@ -58,5 +62,11 @@ public class MultiGetHit : IMultiGetHit [JsonProperty("_version")] public long Version { get; internal set; } + + [JsonProperty("_primary_term")] + public long PrimaryTerm { get; internal set; } + + [JsonProperty("_seq_no")] + public long SequenceNumber { get; internal set; } } } diff --git a/src/Nest/Document/Single/Get/GetResponse.cs b/src/Nest/Document/Single/Get/GetResponse.cs index 20adebe37d1..a41925a5290 100644 --- a/src/Nest/Document/Single/Get/GetResponse.cs +++ b/src/Nest/Document/Single/Get/GetResponse.cs @@ -33,6 +33,12 @@ public interface IGetResponse : IResponse where TDocument : class [JsonProperty("_version")] long Version { get; } + + [JsonProperty("_primary_term")] + long? PrimaryTerm { get; } + + [JsonProperty("_seq_no")] + long? SequenceNumber { get; } } [JsonObject(MemberSerialization.OptIn)] @@ -47,5 +53,7 @@ public class GetResponse : ResponseBase, IGetResponse wher public TDocument Source { get; internal set; } public string Type { get; internal set; } public long Version { get; internal set; } + public long? PrimaryTerm { get; internal set; } + public long? SequenceNumber { get; internal set; } } } diff --git a/src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeProperty.cs b/src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeProperty.cs index 9170ce6dbb3..192d31757e9 100644 --- a/src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeProperty.cs +++ b/src/Nest/Mapping/Types/Geo/GeoShape/GeoShapeProperty.cs @@ -1,3 +1,4 @@ +using System; using System.Diagnostics; using Newtonsoft.Json; @@ -23,6 +24,7 @@ public interface IGeoShapeProperty : IDocValuesProperty /// noting that large shapes will have greater false positives. /// [JsonProperty("distance_error_pct")] + [Obsolete("Removed in Elasticsearch 6.6")] double? DistanceErrorPercentage { get; set; } /// @@ -63,6 +65,7 @@ public interface IGeoShapeProperty : IDocValuesProperty /// so that geo_shape queries are optimal on a point only field. /// [JsonProperty("points_only")] + [Obsolete("Removed in Elasticsearch 6.6")] bool? PointsOnly { get; set; } /// @@ -71,6 +74,7 @@ public interface IGeoShapeProperty : IDocValuesProperty /// the best tree_levels value to honor this precision. /// [JsonProperty("precision")] + [Obsolete("Removed in Elasticsearch 6.6")] Distance Precision { get; set; } /// @@ -85,6 +89,7 @@ public interface IGeoShapeProperty : IDocValuesProperty /// Name of the PrefixTree implementation to be used. /// Defaults to /// + [Obsolete("Removed in Elasticsearch 6.6")] [JsonProperty("tree")] GeoTree? Tree { get; set; } @@ -96,6 +101,7 @@ public interface IGeoShapeProperty : IDocValuesProperty /// parameter instead. /// [JsonProperty("tree_levels")] + [Obsolete("Removed in Elasticsearch 6.6")] int? TreeLevels { get; set; } /// @@ -112,6 +118,7 @@ public class GeoShapeProperty : DocValuesPropertyBase, IGeoShapeProperty public GeoShapeProperty() : base(FieldType.GeoShape) { } /// + [Obsolete("Removed in Elasticsearch 6.6")] public double? DistanceErrorPercentage { get; set; } /// @@ -124,18 +131,22 @@ public GeoShapeProperty() : base(FieldType.GeoShape) { } public GeoOrientation? Orientation { get; set; } /// + [Obsolete("Removed in Elasticsearch 6.6")] public bool? PointsOnly { get; set; } /// + [Obsolete("Removed in Elasticsearch 6.6")] public Distance Precision { get; set; } /// public GeoStrategy? Strategy { get; set; } /// + [Obsolete("Removed in Elasticsearch 6.6")] public GeoTree? Tree { get; set; } /// + [Obsolete("Removed in Elasticsearch 6.6")] public int? TreeLevels { get; set; } /// @@ -150,28 +161,42 @@ public class GeoShapePropertyDescriptor { public GeoShapePropertyDescriptor() : base(FieldType.GeoShape) { } + + [Obsolete("Removed in Elasticsearch 6.6")] double? IGeoShapeProperty.DistanceErrorPercentage { get; set; } bool? IGeoShapeProperty.IgnoreMalformed { get; set; } bool? IGeoShapeProperty.IgnoreZValue { get; set; } GeoOrientation? IGeoShapeProperty.Orientation { get; set; } + + [Obsolete("Removed in Elasticsearch 6.6")] bool? IGeoShapeProperty.PointsOnly { get; set; } + + [Obsolete("Removed in Elasticsearch 6.6")] Distance IGeoShapeProperty.Precision { get; set; } GeoStrategy? IGeoShapeProperty.Strategy { get; set; } + + [Obsolete("Removed in Elasticsearch 6.6")] GeoTree? IGeoShapeProperty.Tree { get; set; } + + [Obsolete("Removed in Elasticsearch 6.6")] int? IGeoShapeProperty.TreeLevels { get; set; } bool? IGeoShapeProperty.Coerce { get; set; } /// + + [Obsolete("Removed in Elasticsearch 6.6")] public GeoShapePropertyDescriptor Tree(GeoTree? tree) => Assign(tree, (a, v) => a.Tree = v); /// + [Obsolete("Removed in Elasticsearch 6.6")] public GeoShapePropertyDescriptor TreeLevels(int? treeLevels) => Assign(treeLevels, (a, v) => a.TreeLevels = v); /// public GeoShapePropertyDescriptor Strategy(GeoStrategy? strategy) => Assign(strategy, (a, v) => a.Strategy = v); /// + [Obsolete("Removed in Elasticsearch 6.6")] public GeoShapePropertyDescriptor Precision(double precision, DistanceUnit unit) => Assign(new Distance(precision, unit), (a, v) => a.Precision = v); @@ -179,10 +204,12 @@ public GeoShapePropertyDescriptor Precision(double precision, DistanceUnit un public GeoShapePropertyDescriptor Orientation(GeoOrientation? orientation) => Assign(orientation, (a, v) => a.Orientation = v); /// + [Obsolete("Removed in Elasticsearch 6.6")] public GeoShapePropertyDescriptor DistanceErrorPercentage(double? distanceErrorPercentage) => Assign(distanceErrorPercentage, (a, v) => a.DistanceErrorPercentage = v); /// + [Obsolete("Removed in Elasticsearch 6.6")] public GeoShapePropertyDescriptor PointsOnly(bool? pointsOnly = true) => Assign(pointsOnly, (a, v) => a.PointsOnly = v); /// diff --git a/src/Nest/XPack/Info/XPackInfo/XPackInfoResponse.cs b/src/Nest/XPack/Info/XPackInfo/XPackInfoResponse.cs index 8f63e8b811e..a8b3904abee 100644 --- a/src/Nest/XPack/Info/XPackInfo/XPackInfoResponse.cs +++ b/src/Nest/XPack/Info/XPackInfo/XPackInfoResponse.cs @@ -55,18 +55,33 @@ public class MinimalLicenseInformation public class XPackFeatures { + [JsonProperty("ccr")] + public XPackFeature Ccr { get; internal set; } + [JsonProperty("graph")] public XPackFeature Graph { get; internal set; } + [JsonProperty("ilm")] + public XPackFeature Ilm { get; internal set; } + + [JsonProperty("logstash")] + public XPackFeature Logstash { get; internal set; } + [JsonProperty("ml")] public XPackFeature MachineLearning { get; internal set; } [JsonProperty("monitoring")] public XPackFeature Monitoring { get; internal set; } + [JsonProperty("rollup")] + public XPackFeature Rollup { get; internal set; } + [JsonProperty("security")] public XPackFeature Security { get; internal set; } + [JsonProperty("sql")] + public XPackFeature Sql { get; internal set; } + [JsonProperty("watcher")] public XPackFeature Watcher { get; internal set; } } diff --git a/src/Nest/XPack/Info/XPackUsage/XPackUsageResponse.cs b/src/Nest/XPack/Info/XPackUsage/XPackUsageResponse.cs index 5e01c002f67..e216b0da554 100644 --- a/src/Nest/XPack/Info/XPackUsage/XPackUsageResponse.cs +++ b/src/Nest/XPack/Info/XPackUsage/XPackUsageResponse.cs @@ -5,30 +5,87 @@ namespace Nest { public interface IXPackUsageResponse : IResponse { - [JsonProperty("watcher")] - AlertingUsage Alerting { get; } + [JsonProperty("ccr")] + CcrUsage Ccr { get; } [JsonProperty("graph")] XPackUsage Graph { get; } + [JsonProperty("logstash")] + XPackUsage Logstash { get; } + [JsonProperty("ml")] MachineLearningUsage MachineLearning { get; } [JsonProperty("monitoring")] MonitoringUsage Monitoring { get; } + [JsonProperty("rollup")] + XPackUsage Rollup { get; } + [JsonProperty("security")] SecurityUsage Security { get; } + + [JsonProperty("sql")] + SqlUsage Sql { get; } + + [JsonProperty("watcher")] + AlertingUsage Alerting { get; } + } + + public class SqlUsage : XPackUsage + { + [JsonProperty("features")] + public IReadOnlyDictionary Features { get; set; } = EmptyReadOnly.Dictionary; + + [JsonProperty("queries")] + public IReadOnlyDictionary Queries { get; set; } = EmptyReadOnly.Dictionary; + } + + public class QueryUsage + { + [JsonProperty("total")] + public int Total { get; internal set; } + + [JsonProperty("paging")] + public int Paging { get; internal set; } + + [JsonProperty("failed")] + public int Failed { get; internal set; } + + [JsonProperty("count")] + public int? Count { get; internal set; } + } + + public class CcrUsage : XPackUsage + { + [JsonProperty("auto_follow_patterns_count")] + public int AutoFollowPatternsCount { get; internal set; } + + [JsonProperty("follower_indices_count")] + public int FollowerIndicesCount { get; internal set; } } public class XPackUsageResponse : ResponseBase, IXPackUsageResponse { + [JsonProperty("sql")] + public SqlUsage Sql { get; internal set; } + + [JsonProperty("rollup")] + public XPackUsage Rollup { get; internal set; } + + [JsonProperty("ccr")] + public CcrUsage Ccr { get; internal set; } + [JsonProperty("watcher")] public AlertingUsage Alerting { get; internal set; } [JsonProperty("graph")] public XPackUsage Graph { get; internal set; } + [JsonProperty("logstash")] + public XPackUsage Logstash { get; internal set; } + [JsonProperty("ml")] public MachineLearningUsage MachineLearning { get; internal set; } @@ -41,7 +98,10 @@ public class XPackUsageResponse : ResponseBase, IXPackUsageResponse public class XPackUsage { + [JsonProperty("available")] public bool Available { get; internal set; } + + [JsonProperty("enabled")] public bool Enabled { get; internal set; } } @@ -59,6 +119,9 @@ public class SecurityUsage : XPackUsage [JsonProperty("realms")] public IReadOnlyDictionary Realms { get; internal set; } = EmptyReadOnly.Dictionary; + [JsonProperty("role_mapping")] + public IReadOnlyDictionary RoleMapping { get; internal set; } = EmptyReadOnly.Dictionary; + [JsonProperty("roles")] public IReadOnlyDictionary Roles { get; internal set; } = EmptyReadOnly.Dictionary; @@ -68,6 +131,15 @@ public class SecurityUsage : XPackUsage [JsonProperty("system_key")] public SecurityFeatureToggle SystemKey { get; internal set; } + public class RoleMappingUsage + { + [JsonProperty("enabled")] + public int Enabled { get; internal set; } + + [JsonProperty("size")] + public int Size { get; internal set; } + } + public class AuditUsage : SecurityFeatureToggle { [JsonProperty("outputs")] @@ -131,12 +203,24 @@ public class AlertingUsage : XPackUsage [JsonProperty("execution")] public AlertingExecution Execution { get; internal set; } + [JsonProperty("watch")] + public AlertingInput Watch { get; internal set; } + public class AlertingExecution { [JsonProperty("actions")] public IReadOnlyDictionary Actions { get; internal set; } = EmptyReadOnly.Dictionary; } + public class AlertingInput + { + [JsonProperty("input")] + public IReadOnlyDictionary Input { get; internal set; } = EmptyReadOnly.Dictionary; + + [JsonProperty("trigger")] + public IReadOnlyDictionary Trigger { get; internal set; } = EmptyReadOnly.Dictionary; + } + public class ExecutionAction { [JsonProperty("total")] @@ -158,6 +242,9 @@ public class AlertingCount public class MonitoringUsage : XPackUsage { + [JsonProperty("collection_enabled")] + public bool CollectionEnabled { get; internal set; } + [JsonProperty("enabled_exporters")] public IReadOnlyDictionary EnabledExporters { get; set; } = EmptyReadOnly.Dictionary; } diff --git a/src/Nest/XPack/RollUp/GetRollupJob/RollupJobStats.cs b/src/Nest/XPack/RollUp/GetRollupJob/RollupJobStats.cs index 547f5b1a8c0..8092dfee630 100644 --- a/src/Nest/XPack/RollUp/GetRollupJob/RollupJobStats.cs +++ b/src/Nest/XPack/RollUp/GetRollupJob/RollupJobStats.cs @@ -15,5 +15,23 @@ public class RollupJobStats [JsonProperty("trigger_count")] public long TriggerCount { get; internal set; } + + [JsonProperty("search_failures")] + public long? SearchFailures { get; internal set; } + + [JsonProperty("index_failures")] + public long? IndexFailures { get; internal set; } + + [JsonProperty("index_time_in_ms")] + public long? IndexTimeInMilliseconds { get; internal set; } + + [JsonProperty("index_total")] + public long? IndexTotal { get; internal set; } + + [JsonProperty("search_time_in_ms")] + public long? SearchTimeInMilliseconds { get; internal set; } + + [JsonProperty("search_total")] + public long? SearchTotal { get; internal set; } } } diff --git a/src/Tests/Tests/Cluster/ClusterStats/ClusterStatsApiTests.cs b/src/Tests/Tests/Cluster/ClusterStats/ClusterStatsApiTests.cs index 583e5281276..1ce8bed8817 100644 --- a/src/Tests/Tests/Cluster/ClusterStats/ClusterStatsApiTests.cs +++ b/src/Tests/Tests/Cluster/ClusterStats/ClusterStatsApiTests.cs @@ -28,6 +28,10 @@ protected override LazyResponses ClientUsage() => Calls( protected override void ExpectResponse(IClusterStatsResponse response) { response.ClusterName.Should().NotBeNullOrWhiteSpace(); + + if (base.Cluster.ClusterConfiguration.Version >= "6.8.0") + response.ClusterUUID.Should().NotBeNullOrWhiteSpace(); + response.NodeStatistics.Should().NotBeNull(); response.Status.Should().NotBe(ClusterStatus.Red); response.Timestamp.Should().BeGreaterThan(0); @@ -67,6 +71,12 @@ protected void Assert(ClusterNodesStats nodes) nodes.OperatingSystem.Names.Should().NotBeEmpty(); + if (base.Cluster.ClusterConfiguration.Version >= "6.8.0") + { + nodes.OperatingSystem.Memory.Should().NotBeNull(); + nodes.OperatingSystem.PrettyNames.Should().NotBeNull(); + } + var plugins = nodes.Plugins; plugins.Should().NotBeEmpty(); diff --git a/src/Tests/Tests/Document/Multiple/MultiGet/MultiGetApiTests.cs b/src/Tests/Tests/Document/Multiple/MultiGet/MultiGetApiTests.cs index b394db1af24..917d7bac62f 100644 --- a/src/Tests/Tests/Document/Multiple/MultiGet/MultiGetApiTests.cs +++ b/src/Tests/Tests/Document/Multiple/MultiGet/MultiGetApiTests.cs @@ -170,6 +170,11 @@ protected override void ExpectResponse(IMultiGetResponse response) hit.Id.Should().NotBeNullOrWhiteSpace(); hit.Found.Should().BeTrue(); hit.Version.Should().Be(1); + if (base.Cluster.ClusterConfiguration.Version >= "6.8.0") + { + hit.PrimaryTerm.Should().BeGreaterOrEqualTo(1); + hit.SequenceNumber.Should().BeGreaterOrEqualTo(0); + } hit.Source.ShouldAdhereToSourceSerializerWhenSet(); } } diff --git a/src/Tests/Tests/Document/Single/DocumentCrudTests.cs b/src/Tests/Tests/Document/Single/DocumentCrudTests.cs index b9f49d5c67b..4f3fc70a68a 100644 --- a/src/Tests/Tests/Document/Single/DocumentCrudTests.cs +++ b/src/Tests/Tests/Document/Single/DocumentCrudTests.cs @@ -78,6 +78,11 @@ [I] protected async Task DocumentIsUpdated() => await AssertOnGetAfterUpdate(r = { r.Source.Should().NotBeNull(); r.Version.Should().BeGreaterThan(1); + if (base.Cluster.ClusterConfiguration.Version >= "6.8.0") + { + r.SequenceNumber.Should().BeGreaterOrEqualTo(1); + r.PrimaryTerm.Should().BeGreaterThan(0); + } r.Source.Description.Should().EndWith("updated"); }); diff --git a/src/Tests/Tests/Document/Single/Get/GetApiTests.cs b/src/Tests/Tests/Document/Single/Get/GetApiTests.cs index f7f79aec331..92978ec4969 100644 --- a/src/Tests/Tests/Document/Single/Get/GetApiTests.cs +++ b/src/Tests/Tests/Document/Single/Get/GetApiTests.cs @@ -45,6 +45,12 @@ protected override void ExpectResponse(IGetResponse response) response.Source.Should().NotBeNull(); response.Source.Name.Should().Be(ProjectId); response.Source.ShouldAdhereToSourceSerializerWhenSet(); + + if (base.Cluster.ClusterConfiguration.Version >= "6.8.0") + { + response.SequenceNumber.Should().BeGreaterOrEqualTo(0); + response.PrimaryTerm.Should().BeGreaterOrEqualTo(1); + } } } diff --git a/src/Tests/Tests/XPack/Info/XPackInfoApiTests.cs b/src/Tests/Tests/XPack/Info/XPackInfoApiTests.cs new file mode 100644 index 00000000000..3a1503016f0 --- /dev/null +++ b/src/Tests/Tests/XPack/Info/XPackInfoApiTests.cs @@ -0,0 +1,90 @@ +using System.Threading.Tasks; +using Elastic.Xunit.XunitPlumbing; +using FluentAssertions; +using Nest; +using Tests.Core.ManagedElasticsearch.Clusters; +using Tests.Framework; +using Tests.Framework.EndpointTests.TestState; +using Tests.Framework.Integration; + +namespace Tests.XPack.Info +{ + [SkipVersion("<6.8.0", "All APIs exist in Elasticsearch 6.8.0")] + public class XPackInfoApiTests : CoordinatedIntegrationTestBase + { + private const string XPackInfoStep = nameof(XPackInfoStep); + private const string XPackUsageStep = nameof(XPackUsageStep); + + public XPackInfoApiTests(XPackCluster cluster, EndpointUsage usage) : base(new CoordinatedUsage(cluster, usage) + { + { + XPackInfoStep, u => u.Calls( + v => new XPackInfoRequest(), + (v, d) => d, + (v, c, f) => c.XPackInfo(f), + (v, c, f) => c.XPackInfoAsync(f), + (v, c, r) => c.XPackInfo(r), + (v, c, r) => c.XPackInfoAsync(r) + ) + }, + { + XPackUsageStep, u => u.Calls( + v => new XPackUsageRequest(), + (v, d) => d, + (v, c, f) => c.XPackUsage(f), + (v, c, f) => c.XPackUsageAsync(f), + (v, c, r) => c.XPackUsage(r), + (v, c, r) => c.XPackUsageAsync(r) + ) + } + }) { } + + [I] public async Task XPackInfoResponse() => await Assert(XPackInfoStep, (v, r) => + { + r.IsValid.Should().BeTrue(); + r.ApiCall.HttpStatusCode.Should().Be(200); + + r.Build.Should().NotBeNull(); + r.Features.Should().NotBeNull(); + r.Features.Ccr.Should().NotBeNull(); + r.Features.Graph.Should().NotBeNull(); + r.Features.Ilm.Should().NotBeNull(); + r.Features.Logstash.Should().NotBeNull(); + r.Features.MachineLearning.Should().NotBeNull(); + r.Features.MachineLearning.NativeCodeInformation.Should().NotBeNull(); + r.Features.Monitoring.Should().NotBeNull(); + r.Features.Rollup.Should().NotBeNull(); + r.Features.Security.Should().NotBeNull(); + r.Features.Sql.Should().NotBeNull(); + r.Features.Watcher.Should().NotBeNull(); + r.License.Should().NotBeNull(); + }); + + [I] public async Task XPackUsageResponse() => await Assert(XPackUsageStep, (v, r) => + { + r.IsValid.Should().BeTrue(); + r.ApiCall.HttpStatusCode.Should().Be(200); + + r.Ccr.Should().NotBeNull(); + r.Graph.Should().NotBeNull(); + r.Logstash.Should().NotBeNull(); + r.MachineLearning.Should().NotBeNull(); + r.MachineLearning.Datafeeds.Should().NotBeNull(); + r.MachineLearning.Jobs.Should().NotBeNull(); + r.Monitoring.Should().NotBeNull(); + r.Monitoring.EnabledExporters.Should().NotBeNull(); + r.Rollup.Should().NotBeNull(); + r.Security.Should().NotBeNull(); + r.Security.Roles.Should().NotBeNull(); + r.Security.Realms.Should().NotBeNull(); + r.Security.RoleMapping.Should().NotBeNull(); + r.Sql.Should().NotBeNull(); + r.Sql.Features.Should().NotBeNull(); + r.Sql.Queries.Should().NotBeNull(); + r.Alerting.Should().NotBeNull(); + r.Alerting.Count.Should().NotBeNull(); + r.Alerting.Execution.Should().NotBeNull(); + r.Alerting.Watch.Should().NotBeNull(); + }); + } +} diff --git a/src/Tests/Tests/XPack/Info/XPackInfoUrlTests.cs b/src/Tests/Tests/XPack/Info/XPackInfoUrlTests.cs new file mode 100644 index 00000000000..296d3c36930 --- /dev/null +++ b/src/Tests/Tests/XPack/Info/XPackInfoUrlTests.cs @@ -0,0 +1,28 @@ +using System.Threading.Tasks; +using Elastic.Xunit.XunitPlumbing; +using Nest; +using Tests.Framework; +using static Tests.Framework.UrlTester; + +namespace Tests.XPack.Info +{ + public class XPackInfoUrlTests : UrlTestsBase + { + [U] public override async Task Urls() + { + await GET("/_xpack") + .Fluent(c => c.XPackInfo()) + .Request(c => c.XPackInfo()) + .FluentAsync(c => c.XPackInfoAsync()) + .RequestAsync(c => c.XPackInfoAsync()) + ; + + await GET("/_xpack/usage") + .Fluent(c => c.XPackUsage()) + .Request(c => c.XPackUsage()) + .FluentAsync(c => c.XPackUsageAsync()) + .RequestAsync(c => c.XPackUsageAsync()) + ; + } + } +}