From bea149c3f4cf3e36c0652096dc6efa99511e11ea Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Thu, 21 Sep 2023 17:14:42 +1200 Subject: [PATCH] Re-generate `cat.pending_tasks` Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 1 + src/OpenSearch.Client/ApiUrlsLookup.cs | 1 - src/OpenSearch.Client/Descriptors.Cat.cs | 26 ------ src/OpenSearch.Client/OpenSearchClient.Cat.cs | 24 ------ src/OpenSearch.Client/Requests.Cat.cs | 75 ----------------- .../_Generated/ApiUrlsLookup.cs | 2 + .../_Generated/Descriptors.Cat.cs | 45 +++++++++++ .../_Generated/OpenSearchClient.Cat.cs | 44 ++++++++++ .../_Generated/Requests.Cat.cs | 80 +++++++++++++++++++ .../RequestParameters.Cat.cs | 68 ---------------- .../OpenSearchLowLevelClient.Cat.cs | 9 --- .../RequestParameters.Cat.cs | 72 +++++++++++++++++ .../OpenSearchLowLevelClient.Cat.cs | 24 ++++++ 13 files changed, 268 insertions(+), 203 deletions(-) diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index 6042681126..7be3540059 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -53,6 +53,7 @@ public static class CodeConfiguration new("cat.master"), new("cat.nodeattrs"), new("cat.nodes"), + new("cat.pending_tasks"), new("cluster.*"), new("dangling_indices.*"), diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index ffd770820e..dba4eda9d9 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 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}"}); internal static ApiUrls CatRepositories = new ApiUrls(new[]{"_cat/repositories"}); diff --git a/src/OpenSearch.Client/Descriptors.Cat.cs b/src/OpenSearch.Client/Descriptors.Cat.cs index 228e15b154..94a072c8b9 100644 --- a/src/OpenSearch.Client/Descriptors.Cat.cs +++ b/src/OpenSearch.Client/Descriptors.Cat.cs @@ -57,32 +57,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - ///Descriptor for PendingTasks https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-pending-tasks/ - public partial class CatPendingTasksDescriptor : RequestDescriptorBase, ICatPendingTasksRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.CatPendingTasks; - // values part of the url path - // Request parameters - ///a short version of the Accept header, e.g. json, yaml - public CatPendingTasksDescriptor Format(string format) => Qs("format", format); - ///Comma-separated list of column names to display - public CatPendingTasksDescriptor Headers(params string[] headers) => Qs("h", headers); - ///Return help information - public CatPendingTasksDescriptor Help(bool? help = true) => Qs("help", help); - ///Return local information, do not retrieve the state from cluster_manager node (default: false) - public CatPendingTasksDescriptor Local(bool? local = true) => Qs("local", local); - ///Explicit operation timeout for connection to master node - ///Deprecated as of OpenSearch 2.0, use instead - public CatPendingTasksDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); - ///Explicit operation timeout for connection to cluster_manager node - ///Introduced in OpenSearch 2.0 instead of - public CatPendingTasksDescriptor ClusterManagerTimeout(Time timeout) => Qs("cluster_manager_timeout", timeout); - ///Comma-separated list of column names or column aliases to sort by - public CatPendingTasksDescriptor SortByColumns(params string[] sortbycolumns) => Qs("s", sortbycolumns); - ///Verbose mode. Display column headers - public CatPendingTasksDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); - } - ///Descriptor for Plugins https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-plugins/ public partial class CatPluginsDescriptor : RequestDescriptorBase, ICatPluginsRequest { diff --git a/src/OpenSearch.Client/OpenSearchClient.Cat.cs b/src/OpenSearch.Client/OpenSearchClient.Cat.cs index 674598ad1a..e34740a232 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.pending_tasks API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-pending-tasks/ - /// - public CatResponse PendingTasks(Func selector = null) => PendingTasks(selector.InvokeOrDefault(new CatPendingTasksDescriptor())); - /// - /// GET request to the cat.pending_tasks API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-pending-tasks/ - /// - public Task> PendingTasksAsync(Func selector = null, CancellationToken ct = default) => PendingTasksAsync(selector.InvokeOrDefault(new CatPendingTasksDescriptor()), ct); - /// - /// GET request to the cat.pending_tasks API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-pending-tasks/ - /// - public CatResponse PendingTasks(ICatPendingTasksRequest request) => DoCat(request); - /// - /// GET request to the cat.pending_tasks API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-pending-tasks/ - /// - public Task> PendingTasksAsync(ICatPendingTasksRequest request, CancellationToken ct = default) => DoCatAsync(request, ct); /// /// GET request to the cat.plugins API, read more about this API online: /// diff --git a/src/OpenSearch.Client/Requests.Cat.cs b/src/OpenSearch.Client/Requests.Cat.cs index 05a12ac777..58769013d6 100644 --- a/src/OpenSearch.Client/Requests.Cat.cs +++ b/src/OpenSearch.Client/Requests.Cat.cs @@ -58,81 +58,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - [InterfaceDataContract] - public partial interface ICatPendingTasksRequest : IRequest - { - } - - ///Request for PendingTasks https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-pending-tasks/ - public partial class CatPendingTasksRequest : PlainRequestBase, ICatPendingTasksRequest - { - protected ICatPendingTasksRequest Self => this; - internal override ApiUrls ApiUrls => ApiUrlsLookups.CatPendingTasks; - // values part of the url path - // Request parameters - ///a short version of the Accept header, e.g. json, yaml - public string Format - { - get => Q("format"); - set - { - Q("format", value); - SetAcceptHeader(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 (default: false) - public bool? Local - { - get => Q("local"); - set => Q("local", 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/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) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, "_cat/pending_tasks", 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. - [MapsApi("cat.pending_tasks", "")] - public Task PendingTasksAsync(CatPendingTasksRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, "_cat/pending_tasks", ctx, null, RequestParams(requestParameters)); ///GET on /_cat/plugins https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-plugins/ ///Request specific configuration such as querystring parameters & request specific connection settings. public TResponse Plugins(CatPluginsRequestParameters 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 feb5c3207a..138cdec9fa 100644 --- a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs @@ -782,4 +782,76 @@ public bool? Verbose set => Q("v", value); } } + + /// Request options for PendingTasks https://opensearch.org/docs/latest/api-reference/cat/cat-pending-tasks/ + public partial class CatPendingTasksRequestParameters + : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + public override bool SupportsBody => false; + + /// 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); + } + } + + /// 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. + 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 4a9c1d94d7..283fc2ba5c 100644 --- a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs @@ -492,5 +492,29 @@ public Task NodesAsync( null, RequestParams(requestParameters) ); + + /// GET on /_cat/pending_tasks https://opensearch.org/docs/latest/api-reference/cat/cat-pending-tasks/ + /// Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse PendingTasks( + CatPendingTasksRequestParameters requestParameters = null + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest(GET, "_cat/pending_tasks", null, RequestParams(requestParameters)); + + /// GET on /_cat/pending_tasks https://opensearch.org/docs/latest/api-reference/cat/cat-pending-tasks/ + /// Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cat.pending_tasks", "")] + public Task PendingTasksAsync( + CatPendingTasksRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + "_cat/pending_tasks", + ctx, + null, + RequestParams(requestParameters) + ); } }