Skip to content

Commit

Permalink
Added unmapped endpoints (#2894)
Browse files Browse the repository at this point in the history
* Implementation of: GrokProcessorPatterns, NodesUsage and DeprecationInfo
  • Loading branch information
Stuart Cam authored Nov 14, 2017
1 parent 128cc04 commit 498c0c3
Show file tree
Hide file tree
Showing 26 changed files with 762 additions and 130 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4441,28 +4441,28 @@ public class GetPipelineRequestParameters : FluentRequestParameters<GetPipelineR
///https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html
///</pre>
///</summary>
public class IngestProcessorGrokRequestParameters : FluentRequestParameters<IngestProcessorGrokRequestParameters>
public class GrokProcessorPatternsRequestParameters : FluentRequestParameters<GrokProcessorPatternsRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;

///<summary>Pretty format the returned JSON response.</summary>
public IngestProcessorGrokRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty);
public GrokProcessorPatternsRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty);


///<summary>Return human readable values for statistics.</summary>
public IngestProcessorGrokRequestParameters Human(bool human) => this.AddQueryString("human", human);
public GrokProcessorPatternsRequestParameters Human(bool human) => this.AddQueryString("human", human);


///<summary>Include the stack trace of returned errors.</summary>
public IngestProcessorGrokRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace);
public GrokProcessorPatternsRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace);


///<summary>The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.</summary>
public IngestProcessorGrokRequestParameters Source(string source) => this.AddQueryString("source", source);
public GrokProcessorPatternsRequestParameters Source(string source) => this.AddQueryString("source", source);


///<summary>A comma-separated list of filters used to reduce the respone.</summary>
public IngestProcessorGrokRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path);
public GrokProcessorPatternsRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path);

}

Expand Down Expand Up @@ -6295,28 +6295,28 @@ public class GraphExploreRequestParameters : FluentRequestParameters<GraphExplor
///http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html
///</pre>
///</summary>
public class XpackDeprecationInfoRequestParameters : FluentRequestParameters<XpackDeprecationInfoRequestParameters>
public class DeprecationInfoRequestParameters : FluentRequestParameters<DeprecationInfoRequestParameters>
{
public override HttpMethod DefaultHttpMethod => HttpMethod.GET;

///<summary>Pretty format the returned JSON response.</summary>
public XpackDeprecationInfoRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty);
public DeprecationInfoRequestParameters Pretty(bool pretty) => this.AddQueryString("pretty", pretty);


///<summary>Return human readable values for statistics.</summary>
public XpackDeprecationInfoRequestParameters Human(bool human) => this.AddQueryString("human", human);
public DeprecationInfoRequestParameters Human(bool human) => this.AddQueryString("human", human);


///<summary>Include the stack trace of returned errors.</summary>
public XpackDeprecationInfoRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace);
public DeprecationInfoRequestParameters ErrorTrace(bool error_trace) => this.AddQueryString("error_trace", error_trace);


///<summary>The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests.</summary>
public XpackDeprecationInfoRequestParameters Source(string source) => this.AddQueryString("source", source);
public DeprecationInfoRequestParameters Source(string source) => this.AddQueryString("source", source);


///<summary>A comma-separated list of filters used to reduce the respone.</summary>
public XpackDeprecationInfoRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path);
public DeprecationInfoRequestParameters FilterPath(params string[] filter_path) => this.AddQueryString("filter_path", filter_path);

}

Expand Down
12 changes: 6 additions & 6 deletions src/Elasticsearch.Net/ElasticLowLevelClient.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4826,7 +4826,7 @@ public ElasticsearchResponse<T> IngestGetPipeline<T>(string id, Func<GetPipeline
///<para>See also: https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html </para>
///</summary>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public ElasticsearchResponse<T> IngestProcessorGrok<T>(Func<IngestProcessorGrokRequestParameters, IngestProcessorGrokRequestParameters> requestParameters = null)
public ElasticsearchResponse<T> IngestProcessorGrok<T>(Func<GrokProcessorPatternsRequestParameters, GrokProcessorPatternsRequestParameters> requestParameters = null)
where T : class => this.DoRequest<T>(GET, Url($"_ingest/processor/grok"), null, _params(requestParameters));

///<summary>Represents a GET on /_ingest/processor/grok
Expand All @@ -4839,7 +4839,7 @@ public ElasticsearchResponse<T> IngestProcessorGrok<T>(Func<IngestProcessorGrokR
///<para>See also: https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html </para>
///</summary>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public Task<ElasticsearchResponse<T>> IngestProcessorGrokAsync<T>(Func<IngestProcessorGrokRequestParameters, IngestProcessorGrokRequestParameters> requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
public Task<ElasticsearchResponse<T>> IngestProcessorGrokAsync<T>(Func<GrokProcessorPatternsRequestParameters, GrokProcessorPatternsRequestParameters> requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
where T : class => this.DoRequestAsync<T>(GET, Url($"_ingest/processor/grok"), cancellationToken, null, _params(requestParameters));

///<summary>Represents a PUT on /_ingest/pipeline/{id}
Expand Down Expand Up @@ -7794,7 +7794,7 @@ public ElasticsearchResponse<T> XpackGraphExplore<T>(string index, string type,
///<para>See also: http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html </para>
///</summary>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public ElasticsearchResponse<T> XpackDeprecationInfo<T>(Func<XpackDeprecationInfoRequestParameters, XpackDeprecationInfoRequestParameters> requestParameters = null)
public ElasticsearchResponse<T> XpackDeprecationInfo<T>(Func<DeprecationInfoRequestParameters, DeprecationInfoRequestParameters> requestParameters = null)
where T : class => this.DoRequest<T>(GET, Url($"_xpack/migration/deprecations"), null, _params(requestParameters));

///<summary>Represents a GET on /_xpack/migration/deprecations
Expand All @@ -7807,7 +7807,7 @@ public ElasticsearchResponse<T> XpackDeprecationInfo<T>(Func<XpackDeprecationInf
///<para>See also: http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html </para>
///</summary>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public Task<ElasticsearchResponse<T>> XpackDeprecationInfoAsync<T>(Func<XpackDeprecationInfoRequestParameters, XpackDeprecationInfoRequestParameters> requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
public Task<ElasticsearchResponse<T>> XpackDeprecationInfoAsync<T>(Func<DeprecationInfoRequestParameters, DeprecationInfoRequestParameters> requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
where T : class => this.DoRequestAsync<T>(GET, Url($"_xpack/migration/deprecations"), cancellationToken, null, _params(requestParameters));

///<summary>Represents a GET on /{index}/_xpack/migration/deprecations
Expand All @@ -7821,7 +7821,7 @@ public ElasticsearchResponse<T> XpackDeprecationInfo<T>(Func<XpackDeprecationInf
///</summary>
///<param name="index">Index pattern</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public ElasticsearchResponse<T> XpackDeprecationInfo<T>(string index, Func<XpackDeprecationInfoRequestParameters, XpackDeprecationInfoRequestParameters> requestParameters = null)
public ElasticsearchResponse<T> XpackDeprecationInfo<T>(string index, Func<DeprecationInfoRequestParameters, DeprecationInfoRequestParameters> requestParameters = null)
where T : class => this.DoRequest<T>(GET, Url($"{index.NotNull("index")}/_xpack/migration/deprecations"), null, _params(requestParameters));

///<summary>Represents a GET on /{index}/_xpack/migration/deprecations
Expand All @@ -7835,7 +7835,7 @@ public ElasticsearchResponse<T> XpackDeprecationInfo<T>(string index, Func<Xpack
///</summary>
///<param name="index">Index pattern</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
public Task<ElasticsearchResponse<T>> XpackDeprecationInfoAsync<T>(string index, Func<XpackDeprecationInfoRequestParameters, XpackDeprecationInfoRequestParameters> requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
public Task<ElasticsearchResponse<T>> XpackDeprecationInfoAsync<T>(string index, Func<DeprecationInfoRequestParameters, DeprecationInfoRequestParameters> requestParameters = null, CancellationToken cancellationToken = default(CancellationToken))
where T : class => this.DoRequestAsync<T>(GET, Url($"{index.NotNull("index")}/_xpack/migration/deprecations"), cancellationToken, null, _params(requestParameters));

///<summary>Represents a GET on /_xpack
Expand Down
12 changes: 6 additions & 6 deletions src/Elasticsearch.Net/IElasticLowLevelClient.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4495,7 +4495,7 @@ public partial interface IElasticLowLevelClient
///<para>See also: https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html </para>
///</summary>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
ElasticsearchResponse<T> IngestProcessorGrok<T>(Func<IngestProcessorGrokRequestParameters, IngestProcessorGrokRequestParameters> requestParameters = null) where T : class;
ElasticsearchResponse<T> IngestProcessorGrok<T>(Func<GrokProcessorPatternsRequestParameters, GrokProcessorPatternsRequestParameters> requestParameters = null) where T : class;

///<summary>Represents a GET on /_ingest/processor/grok
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
Expand All @@ -4507,7 +4507,7 @@ public partial interface IElasticLowLevelClient
///<para>See also: https://www.elastic.co/guide/en/elasticsearch/plugins/master/ingest.html </para>
///</summary>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
Task<ElasticsearchResponse<T>> IngestProcessorGrokAsync<T>(Func<IngestProcessorGrokRequestParameters, IngestProcessorGrokRequestParameters> requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
Task<ElasticsearchResponse<T>> IngestProcessorGrokAsync<T>(Func<GrokProcessorPatternsRequestParameters, GrokProcessorPatternsRequestParameters> requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;

///<summary>Represents a PUT on /_ingest/pipeline/{id}
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
Expand Down Expand Up @@ -7257,7 +7257,7 @@ public partial interface IElasticLowLevelClient
///<para>See also: http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html </para>
///</summary>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
ElasticsearchResponse<T> XpackDeprecationInfo<T>(Func<XpackDeprecationInfoRequestParameters, XpackDeprecationInfoRequestParameters> requestParameters = null) where T : class;
ElasticsearchResponse<T> XpackDeprecationInfo<T>(Func<DeprecationInfoRequestParameters, DeprecationInfoRequestParameters> requestParameters = null) where T : class;

///<summary>Represents a GET on /_xpack/migration/deprecations
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
Expand All @@ -7269,7 +7269,7 @@ public partial interface IElasticLowLevelClient
///<para>See also: http://www.elastic.co/guide/en/migration/current/migration-api-deprecation.html </para>
///</summary>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
Task<ElasticsearchResponse<T>> XpackDeprecationInfoAsync<T>(Func<XpackDeprecationInfoRequestParameters, XpackDeprecationInfoRequestParameters> requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
Task<ElasticsearchResponse<T>> XpackDeprecationInfoAsync<T>(Func<DeprecationInfoRequestParameters, DeprecationInfoRequestParameters> requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;

///<summary>Represents a GET on /{index}/_xpack/migration/deprecations
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
Expand All @@ -7282,7 +7282,7 @@ public partial interface IElasticLowLevelClient
///</summary>
///<param name="index">Index pattern</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
ElasticsearchResponse<T> XpackDeprecationInfo<T>(string index, Func<XpackDeprecationInfoRequestParameters, XpackDeprecationInfoRequestParameters> requestParameters = null) where T : class;
ElasticsearchResponse<T> XpackDeprecationInfo<T>(string index, Func<DeprecationInfoRequestParameters, DeprecationInfoRequestParameters> requestParameters = null) where T : class;

///<summary>Represents a GET on /{index}/_xpack/migration/deprecations
///<para></para>Returns: A task of ElasticsearchResponse&lt;T&gt; where the behaviour depends on the type of T:
Expand All @@ -7295,7 +7295,7 @@ public partial interface IElasticLowLevelClient
///</summary>
///<param name="index">Index pattern</param>
///<param name="requestParameters">A func that allows you to describe the querystring parameters &amp; request specific connection settings.</param>
Task<ElasticsearchResponse<T>> XpackDeprecationInfoAsync<T>(string index, Func<XpackDeprecationInfoRequestParameters, XpackDeprecationInfoRequestParameters> requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;
Task<ElasticsearchResponse<T>> XpackDeprecationInfoAsync<T>(string index, Func<DeprecationInfoRequestParameters, DeprecationInfoRequestParameters> requestParameters = null, CancellationToken cancellationToken = default(CancellationToken)) where T : class;

///<summary>Represents a GET on /_xpack
///<para></para>Returns: ElasticsearchResponse&lt;T&gt; where the behavior depends on the type of T:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Elasticsearch.Net;
using System.Threading;

namespace Nest
{
using System.Threading;
using NodesHotThreadConverter = Func<IApiCallDetails, Stream, NodesHotThreadsResponse>;

public partial interface IElasticClient
Expand Down
55 changes: 55 additions & 0 deletions src/Nest/Cluster/NodesUsage/ElasticClient-NodesUsage.cs
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)
);
}
}
53 changes: 53 additions & 0 deletions src/Nest/Cluster/NodesUsage/NodeUsageResponse.cs
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; }
}
}
9 changes: 9 additions & 0 deletions src/Nest/Cluster/NodesUsage/NodesUsageRequest.cs
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 { }
}
Loading

0 comments on commit 498c0c3

Please sign in to comment.