diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index 99c8fc76aa..6042681126 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -52,6 +52,7 @@ public static class CodeConfiguration new("cat.indices"), new("cat.master"), new("cat.nodeattrs"), + new("cat.nodes"), new("cluster.*"), new("dangling_indices.*"), diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index 5a98320533..ffd770820e 100644 --- a/src/OpenSearch.Client/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/ApiUrlsLookup.cs @@ -46,7 +46,6 @@ namespace OpenSearch.Client internal static partial class ApiUrlsLookups { internal static ApiUrls NoNamespaceBulk = new ApiUrls(new[]{"_bulk", "{index}/_bulk"}); - internal static ApiUrls CatNodes = new ApiUrls(new[]{"_cat/nodes"}); internal static ApiUrls CatPendingTasks = new ApiUrls(new[]{"_cat/pending_tasks"}); internal static ApiUrls CatPlugins = new ApiUrls(new[]{"_cat/plugins"}); internal static ApiUrls CatRecovery = new ApiUrls(new[]{"_cat/recovery", "_cat/recovery/{index}"}); diff --git a/src/OpenSearch.Client/Descriptors.Cat.cs b/src/OpenSearch.Client/Descriptors.Cat.cs index eab4f10757..228e15b154 100644 --- a/src/OpenSearch.Client/Descriptors.Cat.cs +++ b/src/OpenSearch.Client/Descriptors.Cat.cs @@ -57,34 +57,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - ///Descriptor for Nodes https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-nodes/ - public partial class CatNodesDescriptor : RequestDescriptorBase, ICatNodesRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.CatNodes; - // values part of the url path - // Request parameters - ///The unit in which to display byte values - public CatNodesDescriptor Bytes(Bytes? bytes) => Qs("bytes", bytes); - ///a short version of the Accept header, e.g. json, yaml - public CatNodesDescriptor Format(string format) => Qs("format", format); - ///Return the full node ID instead of the shortened version (default: false) - public CatNodesDescriptor FullId(bool? fullid = true) => Qs("full_id", fullid); - ///Comma-separated list of column names to display - public CatNodesDescriptor Headers(params string[] headers) => Qs("h", headers); - ///Return help information - public CatNodesDescriptor Help(bool? help = true) => Qs("help", help); - ///Explicit operation timeout for connection to master node - ///Deprecated as of OpenSearch 2.0, use instead - public CatNodesDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); - ///Explicit operation timeout for connection to cluster_manager node - ///Introduced in OpenSearch 2.0 instead of - public CatNodesDescriptor ClusterManagerTimeout(Time timeout) => Qs("cluster_manager_timeout", timeout); - ///Comma-separated list of column names or column aliases to sort by - public CatNodesDescriptor SortByColumns(params string[] sortbycolumns) => Qs("s", sortbycolumns); - ///Verbose mode. Display column headers - public CatNodesDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); - } - ///Descriptor for PendingTasks https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-pending-tasks/ public partial class CatPendingTasksDescriptor : RequestDescriptorBase, ICatPendingTasksRequest { diff --git a/src/OpenSearch.Client/OpenSearchClient.Cat.cs b/src/OpenSearch.Client/OpenSearchClient.Cat.cs index 3fdaffc0ba..674598ad1a 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Cat.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Cat.cs @@ -59,30 +59,6 @@ namespace OpenSearch.Client.Specification.CatApi /// public partial class CatNamespace : NamespacedClientProxy { - /// - /// GET request to the cat.nodes API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-nodes/ - /// - public CatResponse Nodes(Func selector = null) => Nodes(selector.InvokeOrDefault(new CatNodesDescriptor())); - /// - /// GET request to the cat.nodes API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-nodes/ - /// - public Task> NodesAsync(Func selector = null, CancellationToken ct = default) => NodesAsync(selector.InvokeOrDefault(new CatNodesDescriptor()), ct); - /// - /// GET request to the cat.nodes API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-nodes/ - /// - public CatResponse Nodes(ICatNodesRequest request) => DoCat(request); - /// - /// GET request to the cat.nodes API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-nodes/ - /// - public Task> NodesAsync(ICatNodesRequest request, CancellationToken ct = default) => DoCatAsync(request, ct); /// /// GET request to the cat.pending_tasks API, read more about this API online: /// diff --git a/src/OpenSearch.Client/Requests.Cat.cs b/src/OpenSearch.Client/Requests.Cat.cs index 75bd1e5ae6..05a12ac777 100644 --- a/src/OpenSearch.Client/Requests.Cat.cs +++ b/src/OpenSearch.Client/Requests.Cat.cs @@ -58,88 +58,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - [InterfaceDataContract] - public partial interface ICatNodesRequest : IRequest - { - } - - ///Request for Nodes https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-nodes/ - public partial class CatNodesRequest : PlainRequestBase, ICatNodesRequest - { - protected ICatNodesRequest Self => this; - internal override ApiUrls ApiUrls => ApiUrlsLookups.CatNodes; - // values part of the url path - // Request parameters - ///The unit in which to display byte values - public Bytes? Bytes - { - get => Q("bytes"); - set => Q("bytes", value); - } - - ///a short version of the Accept header, e.g. json, yaml - public string Format - { - get => Q("format"); - set - { - Q("format", value); - SetAcceptHeader(value); - } - } - - ///Return the full node ID instead of the shortened version (default: false) - public bool? FullId - { - get => Q("full_id"); - set => Q("full_id", value); - } - - ///Comma-separated list of column names to display - public string[] Headers - { - get => Q("h"); - set => Q("h", value); - } - - ///Return help information - public bool? Help - { - get => Q("help"); - set => Q("help", value); - } - - ///Explicit operation timeout for connection to master node - ///Deprecated as of OpenSearch 2.0, use instead - public Time MasterTimeout - { - get => Q public partial class LowLevelCatNamespace : NamespacedClientProxy { - ///GET on /_cat/nodes https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-nodes/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse Nodes(CatNodesRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, "_cat/nodes", null, RequestParams(requestParameters)); - ///GET on /_cat/nodes https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-nodes/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cat.nodes", "")] - public Task NodesAsync(CatNodesRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, "_cat/nodes", ctx, null, RequestParams(requestParameters)); ///GET on /_cat/pending_tasks https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-pending-tasks/ ///Request specific configuration such as querystring parameters & request specific connection settings. public TResponse PendingTasks(CatPendingTasksRequestParameters requestParameters = null) diff --git a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs index ac0ae402fb..feb5c3207a 100644 --- a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs @@ -694,4 +694,92 @@ public bool? Verbose set => Q("v", value); } } + + /// Request options for Nodes https://opensearch.org/docs/latest/api-reference/cat/cat-nodes/ + public partial class CatNodesRequestParameters : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + public override bool SupportsBody => false; + + /// The unit in which to display byte values. + public Bytes? Bytes + { + get => Q("bytes"); + set => Q("bytes", value); + } + + /// Operation timeout for connection to cluster-manager node. + /// Supported by OpenSearch servers of version 2.0.0 or greater. + public TimeSpan ClusterManagerTimeout + { + get => Q("cluster_manager_timeout"); + set => Q("cluster_manager_timeout", value); + } + + /// A short version of the Accept header, e.g. json, yaml. + public string Format + { + get => Q("format"); + set + { + Q("format", value); + SetAcceptHeader(value); + } + } + + /// Return the full node ID instead of the shortened version. + public bool? FullId + { + get => Q("full_id"); + set => Q("full_id", value); + } + + /// Comma-separated list of column names to display. + public string[] Headers + { + get => Q("h"); + set => Q("h", value); + } + + /// Return help information. + public bool? Help + { + get => Q("help"); + set => Q("help", value); + } + + /// Return local information, do not retrieve the state from cluster-manager node. + [Obsolete( + "Deprecated as of: 1.0, reason: This parameter does not cause this API to act locally." + )] + public bool? Local + { + get => Q("local"); + set => Q("local", value); + } + + /// Operation timeout for connection to master node. + [Obsolete( + "Deprecated as of: 2.0.0, reason: To promote inclusive language, use 'cluster_manager_timeout' instead." + )] + public TimeSpan MasterTimeout + { + get => Q("master_timeout"); + set => Q("master_timeout", value); + } + + /// Comma-separated list of column names or column aliases to sort by. + public string[] SortByColumns + { + get => Q("s"); + set => Q("s", value); + } + + /// Verbose mode. Display column headers. + public bool? Verbose + { + get => Q("v"); + set => Q("v", value); + } + } } diff --git a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs index 34359e65e9..4a9c1d94d7 100644 --- a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs @@ -470,5 +470,27 @@ public Task NodeAttributesAsync( null, RequestParams(requestParameters) ); + + /// GET on /_cat/nodes https://opensearch.org/docs/latest/api-reference/cat/cat-nodes/ + /// Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse Nodes(CatNodesRequestParameters requestParameters = null) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest(GET, "_cat/nodes", null, RequestParams(requestParameters)); + + /// GET on /_cat/nodes https://opensearch.org/docs/latest/api-reference/cat/cat-nodes/ + /// Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cat.nodes", "")] + public Task NodesAsync( + CatNodesRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + "_cat/nodes", + ctx, + null, + RequestParams(requestParameters) + ); } }