-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implementation of: GrokProcessorPatterns, NodesUsage and DeprecationInfo
- Loading branch information
Stuart Cam
authored
Nov 14, 2017
1 parent
128cc04
commit 498c0c3
Showing
26 changed files
with
762 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using System; | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
using Elasticsearch.Net; | ||
|
||
namespace Nest | ||
{ | ||
using System.Threading; | ||
using NodesHotThreadConverter = Func<IApiCallDetails, Stream, NodesHotThreadsResponse>; | ||
|
||
public partial interface IElasticClient | ||
{ | ||
/// <summary> | ||
/// The cluster nodes usage API allows to retrieve information on the usage of features for each node. | ||
/// <para> </para>https://www.elastic.co/guide/en/elasticsearch/reference/master/cluster-nodes-usage.html | ||
/// </summary> | ||
/// <param name="selector">An optional descriptor to further describe the nodes usage operation</param> | ||
INodesUsageResponse NodesUsage(Func<NodesUsageDescriptor, INodesUsageRequest> selector = null); | ||
|
||
/// <inheritdoc/> | ||
INodesUsageResponse NodesUsage(INodesUsageRequest request); | ||
|
||
/// <inheritdoc/> | ||
Task<INodesUsageResponse> NodesUsageAsync(Func<NodesUsageDescriptor, INodesUsageRequest> selector = null, CancellationToken cancellationToken = default(CancellationToken)); | ||
|
||
/// <inheritdoc/> | ||
Task<INodesUsageResponse> NodesUsageAsync(INodesUsageRequest request, CancellationToken cancellationToken = default(CancellationToken)); | ||
} | ||
|
||
public partial class ElasticClient | ||
{ | ||
/// <inheritdoc/> | ||
public INodesUsageResponse NodesUsage(Func<NodesUsageDescriptor, INodesUsageRequest> selector = null) => | ||
this.NodesUsage(selector.InvokeOrDefault(new NodesUsageDescriptor())); | ||
|
||
/// <inheritdoc/> | ||
public INodesUsageResponse NodesUsage(INodesUsageRequest request) => | ||
this.Dispatcher.Dispatch<INodesUsageRequest, NodesUsageRequestParameters, NodesUsageResponse>( | ||
request, | ||
(p, d) => this.LowLevelDispatch.NodesUsageDispatch<NodesUsageResponse>(p) | ||
); | ||
|
||
/// <inheritdoc/> | ||
public Task<INodesUsageResponse> NodesUsageAsync(Func<NodesUsageDescriptor, INodesUsageRequest> selector = null, CancellationToken cancellationToken = default(CancellationToken)) => | ||
this.NodesUsageAsync(selector.InvokeOrDefault(new NodesUsageDescriptor()), cancellationToken); | ||
|
||
/// <inheritdoc/> | ||
public Task<INodesUsageResponse> NodesUsageAsync(INodesUsageRequest request, CancellationToken cancellationToken = default(CancellationToken)) => | ||
this.Dispatcher.DispatchAsync<INodesUsageRequest, NodesUsageRequestParameters, NodesUsageResponse, INodesUsageResponse>( | ||
request, | ||
cancellationToken, | ||
(p, d, c) => this.LowLevelDispatch.NodesUsageDispatchAsync<NodesUsageResponse>(p, c) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
|
||
namespace Nest | ||
{ | ||
public class NodesMetaData | ||
{ | ||
[JsonProperty("total")] | ||
public int Total { get; internal set; } | ||
|
||
[JsonProperty("successful")] | ||
public int Successful { get; internal set; } | ||
|
||
[JsonProperty("failed")] | ||
public int Failed { get; internal set; } | ||
} | ||
|
||
public class NodeUsageInformation | ||
{ | ||
[JsonProperty("timestamp")] | ||
[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))] | ||
public DateTimeOffset Timestamp { get; internal set; } | ||
|
||
[JsonProperty("since")] | ||
[JsonConverter(typeof(EpochMillisecondsDateTimeJsonConverter))] | ||
public DateTimeOffset Since { get; internal set; } | ||
|
||
[JsonProperty("rest_actions")] | ||
public IReadOnlyDictionary<string, int> RestActions { get; internal set; } | ||
} | ||
|
||
public interface INodesUsageResponse : IResponse | ||
{ | ||
string ClusterName { get; } | ||
|
||
IReadOnlyDictionary<string, NodeUsageInformation> Nodes { get; } | ||
|
||
NodesMetaData NodesMetaData { get; } | ||
} | ||
|
||
public class NodesUsageResponse : ResponseBase, INodesUsageResponse | ||
{ | ||
[JsonProperty("cluster_name")] | ||
public string ClusterName { get; internal set; } | ||
|
||
[JsonProperty("nodes")] | ||
public IReadOnlyDictionary<string, NodeUsageInformation> Nodes { get; internal set; } = EmptyReadOnly<string, NodeUsageInformation>.Dictionary; | ||
|
||
[JsonProperty("_nodes")] | ||
public NodesMetaData NodesMetaData { get; internal set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace Nest | ||
{ | ||
public partial interface INodesUsageRequest { } | ||
|
||
public partial class NodesUsageRequest { } | ||
|
||
[DescriptorFor("NodesUsage")] | ||
public partial class NodesUsageDescriptor { } | ||
} |
Oops, something went wrong.