From 7d7fc7ae0b9a4e5f99212d2476a7a54030263c04 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Thu, 7 Sep 2023 16:41:48 +1200 Subject: [PATCH 1/7] Re-generate `cluster.post_voting_config_exclusions` Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 1 + src/OpenSearch.Client/ApiUrlsLookup.cs | 1 - src/OpenSearch.Client/Descriptors.Cluster.cs | 14 ----- .../OpenSearchClient.Cluster.cs | 24 -------- src/OpenSearch.Client/Requests.Cluster.cs | 40 ------------- .../_Generated/ApiUrlsLookup.cs | 3 + .../_Generated/Descriptors.Cluster.cs | 25 ++++++++ .../_Generated/OpenSearchClient.Cluster.cs | 60 +++++++++++++++++++ .../_Generated/Requests.Cluster.cs | 40 +++++++++++++ .../RequestParameters.Cluster.cs | 33 ---------- .../OpenSearchLowLevelClient.Cluster.cs | 9 --- .../RequestParameters.Cluster.cs | 32 ++++++++++ .../OpenSearchLowLevelClient.Cluster.cs | 29 +++++++++ 13 files changed, 190 insertions(+), 121 deletions(-) diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index 758473e7b7..9b429dcd18 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -47,6 +47,7 @@ public static class CodeConfiguration new("cluster.get_settings"), new("cluster.health"), new("cluster.pending_tasks"), + new("cluster.post_voting_config_exclusions"), new("cluster.*_component_template"), diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index 4bb7d9d61a..e671760fd4 100644 --- a/src/OpenSearch.Client/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/ApiUrlsLookup.cs @@ -70,7 +70,6 @@ internal static partial class ApiUrlsLookups internal static ApiUrls CatTemplates = new ApiUrls(new[]{"_cat/templates", "_cat/templates/{name}"}); internal static ApiUrls CatThreadPool = new ApiUrls(new[]{"_cat/thread_pool", "_cat/thread_pool/{thread_pool_patterns}"}); internal static ApiUrls NoNamespaceClearScroll = new ApiUrls(new[]{"_search/scroll"}); - internal static ApiUrls ClusterPostVotingConfigExclusions = new ApiUrls(new[]{"_cluster/voting_config_exclusions"}); internal static ApiUrls ClusterPutSettings = new ApiUrls(new[]{"_cluster/settings"}); internal static ApiUrls ClusterRemoteInfo = new ApiUrls(new[]{"_remote/info"}); internal static ApiUrls ClusterReroute = new ApiUrls(new[]{"_cluster/reroute"}); diff --git a/src/OpenSearch.Client/Descriptors.Cluster.cs b/src/OpenSearch.Client/Descriptors.Cluster.cs index 68f33d2819..07807e790a 100644 --- a/src/OpenSearch.Client/Descriptors.Cluster.cs +++ b/src/OpenSearch.Client/Descriptors.Cluster.cs @@ -57,20 +57,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - ///Descriptor for PostVotingConfigExclusions - public partial class PostVotingConfigExclusionsDescriptor : RequestDescriptorBase, IPostVotingConfigExclusionsRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterPostVotingConfigExclusions; - // values part of the url path - // Request parameters - ///A comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_names. - public PostVotingConfigExclusionsDescriptor NodeIds(string nodeids) => Qs("node_ids", nodeids); - ///A comma-separated list of the names of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_ids. - public PostVotingConfigExclusionsDescriptor NodeNames(string nodenames) => Qs("node_names", nodenames); - ///Explicit operation timeout - public PostVotingConfigExclusionsDescriptor Timeout(Time timeout) => Qs("timeout", timeout); - } - ///Descriptor for PutSettings https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/ public partial class ClusterPutSettingsDescriptor : RequestDescriptorBase, IClusterPutSettingsRequest { diff --git a/src/OpenSearch.Client/OpenSearchClient.Cluster.cs b/src/OpenSearch.Client/OpenSearchClient.Cluster.cs index 22d773b053..4a415c9b0c 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Cluster.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Cluster.cs @@ -59,30 +59,6 @@ namespace OpenSearch.Client.Specification.ClusterApi /// public partial class ClusterNamespace : NamespacedClientProxy { - /// - /// POST request to the cluster.post_voting_config_exclusions API, read more about this API online: - /// - /// - /// - public PostVotingConfigExclusionsResponse PostVotingConfigExclusions(Func selector = null) => PostVotingConfigExclusions(selector.InvokeOrDefault(new PostVotingConfigExclusionsDescriptor())); - /// - /// POST request to the cluster.post_voting_config_exclusions API, read more about this API online: - /// - /// - /// - public Task PostVotingConfigExclusionsAsync(Func selector = null, CancellationToken ct = default) => PostVotingConfigExclusionsAsync(selector.InvokeOrDefault(new PostVotingConfigExclusionsDescriptor()), ct); - /// - /// POST request to the cluster.post_voting_config_exclusions API, read more about this API online: - /// - /// - /// - public PostVotingConfigExclusionsResponse PostVotingConfigExclusions(IPostVotingConfigExclusionsRequest request) => DoRequest(request, request.RequestParameters); - /// - /// POST request to the cluster.post_voting_config_exclusions API, read more about this API online: - /// - /// - /// - public Task PostVotingConfigExclusionsAsync(IPostVotingConfigExclusionsRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct); /// /// PUT request to the cluster.put_settings API, read more about this API online: /// diff --git a/src/OpenSearch.Client/Requests.Cluster.cs b/src/OpenSearch.Client/Requests.Cluster.cs index 4a88cad6af..e754bc367a 100644 --- a/src/OpenSearch.Client/Requests.Cluster.cs +++ b/src/OpenSearch.Client/Requests.Cluster.cs @@ -58,46 +58,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - [InterfaceDataContract] - public partial interface IPostVotingConfigExclusionsRequest : IRequest - { - } - - ///Request for PostVotingConfigExclusions - public partial class PostVotingConfigExclusionsRequest : PlainRequestBase, IPostVotingConfigExclusionsRequest - { - protected IPostVotingConfigExclusionsRequest Self => this; - internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterPostVotingConfigExclusions; - // values part of the url path - // Request parameters - /// - /// A comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not also specify - /// ?node_names. - /// - public string NodeIds - { - get => Q("node_ids"); - set => Q("node_ids", value); - } - - /// - /// A comma-separated list of the names of the nodes to exclude from the voting configuration. If specified, you may not also specify - /// ?node_ids. - /// - public string NodeNames - { - get => Q("node_names"); - set => Q("node_names", value); - } - - ///Explicit operation timeout - public Time Timeout - { - get => Q public partial class ClusterNamespace : NamespacedClientProxy { - /// - /// PUT request to the cluster.put_settings API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/ - /// - public ClusterPutSettingsResponse PutSettings(Func selector) => PutSettings(selector.InvokeOrDefault(new ClusterPutSettingsDescriptor())); - /// - /// PUT request to the cluster.put_settings API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/ - /// - public Task PutSettingsAsync(Func selector, CancellationToken ct = default) => PutSettingsAsync(selector.InvokeOrDefault(new ClusterPutSettingsDescriptor()), ct); - /// - /// PUT request to the cluster.put_settings API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/ - /// - public ClusterPutSettingsResponse PutSettings(IClusterPutSettingsRequest request) => DoRequest(request, request.RequestParameters); - /// - /// PUT request to the cluster.put_settings API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/ - /// - public Task PutSettingsAsync(IClusterPutSettingsRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct); /// /// GET request to the cluster.remote_info API, read more about this API online: /// diff --git a/src/OpenSearch.Client/Requests.Cluster.cs b/src/OpenSearch.Client/Requests.Cluster.cs index e754bc367a..3913f5cda1 100644 --- a/src/OpenSearch.Client/Requests.Cluster.cs +++ b/src/OpenSearch.Client/Requests.Cluster.cs @@ -58,49 +58,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - [InterfaceDataContract] - public partial interface IClusterPutSettingsRequest : IRequest - { - } - - ///Request for PutSettings https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/ - public partial class ClusterPutSettingsRequest : PlainRequestBase, IClusterPutSettingsRequest - { - protected IClusterPutSettingsRequest Self => this; - internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterPutSettings; - // values part of the url path - // Request parameters - ///Return settings in flat format (default: false) - public bool? FlatSettings - { - get => Q("flat_settings"); - set => Q("flat_settings", 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 LowLevelClusterNamespace : NamespacedClientProxy { - ///PUT on /_cluster/settings https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/ - ///The settings to be updated. Can be either `transient` or `persistent` (survives cluster restart). - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse PutSettings(PostData body, ClusterPutSettingsRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(PUT, "_cluster/settings", body, RequestParams(requestParameters)); - ///PUT on /_cluster/settings https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/ - ///The settings to be updated. Can be either `transient` or `persistent` (survives cluster restart). - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cluster.put_settings", "body")] - public Task PutSettingsAsync(PostData body, ClusterPutSettingsRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(PUT, "_cluster/settings", ctx, body, RequestParams(requestParameters)); ///GET on /_remote/info https://opensearch.org/docs/latest/opensearch/rest-api/remote-info/ ///Request specific configuration such as querystring parameters & request specific connection settings. public TResponse RemoteInfo(RemoteInfoRequestParameters requestParameters = null) diff --git a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs index 6e4ce2ebad..3a60a7cf51 100644 --- a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs @@ -442,4 +442,44 @@ public TimeSpan Timeout set => Q("timeout", value); } } + + /// Request options for PutSettings https://opensearch.org/docs/latest/api-reference/cluster-settings/ + public partial class ClusterPutSettingsRequestParameters + : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.PUT; + public override bool SupportsBody => true; + + /// 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); + } + + /// Return settings in flat format. + public bool? FlatSettings + { + get => Q("flat_settings"); + set => Q("flat_settings", 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); + } + + /// Operation timeout. + public TimeSpan Timeout + { + get => Q("timeout"); + set => Q("timeout", value); + } + } } diff --git a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs index b5d4c8c0c3..a72dc00646 100644 --- a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs @@ -432,5 +432,33 @@ public Task PutComponentTemplateAsync( body, RequestParams(requestParameters) ); + + /// PUT on /_cluster/settings https://opensearch.org/docs/latest/api-reference/cluster-settings/ + /// The settings to be updated. Can be either `transient` or `persistent` (survives cluster restart). + /// Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse PutSettings( + PostData body, + ClusterPutSettingsRequestParameters requestParameters = null + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest(PUT, "_cluster/settings", body, RequestParams(requestParameters)); + + /// PUT on /_cluster/settings https://opensearch.org/docs/latest/api-reference/cluster-settings/ + /// The settings to be updated. Can be either `transient` or `persistent` (survives cluster restart). + /// Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cluster.put_settings", "body")] + public Task PutSettingsAsync( + PostData body, + ClusterPutSettingsRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + PUT, + "_cluster/settings", + ctx, + body, + RequestParams(requestParameters) + ); } } From c24dfee6cec3beda1e826e561023805d4a286edd Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Fri, 8 Sep 2023 16:44:15 +1200 Subject: [PATCH 3/7] Re-generate `cluster.remote_info` Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 1 + src/OpenSearch.Client/ApiUrlsLookup.cs | 1 - src/OpenSearch.Client/Descriptors.Cluster.cs | 8 ---- .../OpenSearchClient.Cluster.cs | 24 ----------- src/OpenSearch.Client/Requests.Cluster.cs | 14 ------- .../_Generated/ApiUrlsLookup.cs | 2 + .../_Generated/Descriptors.Cluster.cs | 14 +++++++ .../_Generated/OpenSearchClient.Cluster.cs | 42 +++++++++++++++++++ .../_Generated/Requests.Cluster.cs | 15 +++++++ .../RequestParameters.Cluster.cs | 7 ---- .../OpenSearchLowLevelClient.Cluster.cs | 9 ---- .../RequestParameters.Cluster.cs | 8 ++++ .../OpenSearchLowLevelClient.Cluster.cs | 22 ++++++++++ 13 files changed, 104 insertions(+), 63 deletions(-) diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index 5b322e3665..de9e3961af 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -49,6 +49,7 @@ public static class CodeConfiguration new("cluster.pending_tasks"), new("cluster.post_voting_config_exclusions"), new("cluster.put_settings"), + new("cluster.remote_info"), new("cluster.*_component_template"), diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index 88cee20738..ef40bf329b 100644 --- a/src/OpenSearch.Client/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/ApiUrlsLookup.cs @@ -70,7 +70,6 @@ internal static partial class ApiUrlsLookups internal static ApiUrls CatTemplates = new ApiUrls(new[]{"_cat/templates", "_cat/templates/{name}"}); internal static ApiUrls CatThreadPool = new ApiUrls(new[]{"_cat/thread_pool", "_cat/thread_pool/{thread_pool_patterns}"}); internal static ApiUrls NoNamespaceClearScroll = new ApiUrls(new[]{"_search/scroll"}); - internal static ApiUrls ClusterRemoteInfo = new ApiUrls(new[]{"_remote/info"}); internal static ApiUrls ClusterReroute = new ApiUrls(new[]{"_cluster/reroute"}); internal static ApiUrls ClusterState = new ApiUrls(new[]{"_cluster/state", "_cluster/state/{metric}", "_cluster/state/{metric}/{index}"}); internal static ApiUrls ClusterStats = new ApiUrls(new[]{"_cluster/stats", "_cluster/stats/nodes/{node_id}"}); diff --git a/src/OpenSearch.Client/Descriptors.Cluster.cs b/src/OpenSearch.Client/Descriptors.Cluster.cs index 50b0abd3fe..880c7cc62f 100644 --- a/src/OpenSearch.Client/Descriptors.Cluster.cs +++ b/src/OpenSearch.Client/Descriptors.Cluster.cs @@ -57,14 +57,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - ///Descriptor for RemoteInfo https://opensearch.org/docs/latest/opensearch/rest-api/remote-info/ - public partial class RemoteInfoDescriptor : RequestDescriptorBase, IRemoteInfoRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterRemoteInfo; - // values part of the url path - // Request parameters - } - ///Descriptor for Reroute public partial class ClusterRerouteDescriptor : RequestDescriptorBase, IClusterRerouteRequest { diff --git a/src/OpenSearch.Client/OpenSearchClient.Cluster.cs b/src/OpenSearch.Client/OpenSearchClient.Cluster.cs index 8fa563b232..4671ed9331 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Cluster.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Cluster.cs @@ -59,30 +59,6 @@ namespace OpenSearch.Client.Specification.ClusterApi /// public partial class ClusterNamespace : NamespacedClientProxy { - /// - /// GET request to the cluster.remote_info API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/remote-info/ - /// - public RemoteInfoResponse RemoteInfo(Func selector = null) => RemoteInfo(selector.InvokeOrDefault(new RemoteInfoDescriptor())); - /// - /// GET request to the cluster.remote_info API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/remote-info/ - /// - public Task RemoteInfoAsync(Func selector = null, CancellationToken ct = default) => RemoteInfoAsync(selector.InvokeOrDefault(new RemoteInfoDescriptor()), ct); - /// - /// GET request to the cluster.remote_info API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/remote-info/ - /// - public RemoteInfoResponse RemoteInfo(IRemoteInfoRequest request) => DoRequest(request, request.RequestParameters); - /// - /// GET request to the cluster.remote_info API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/remote-info/ - /// - public Task RemoteInfoAsync(IRemoteInfoRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct); /// /// POST request to the cluster.reroute API, read more about this API online: /// diff --git a/src/OpenSearch.Client/Requests.Cluster.cs b/src/OpenSearch.Client/Requests.Cluster.cs index 3913f5cda1..b539b2fed2 100644 --- a/src/OpenSearch.Client/Requests.Cluster.cs +++ b/src/OpenSearch.Client/Requests.Cluster.cs @@ -58,20 +58,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - [InterfaceDataContract] - public partial interface IRemoteInfoRequest : IRequest - { - } - - ///Request for RemoteInfo https://opensearch.org/docs/latest/opensearch/rest-api/remote-info/ - public partial class RemoteInfoRequest : PlainRequestBase, IRemoteInfoRequest - { - protected IRemoteInfoRequest Self => this; - internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterRemoteInfo; - // values part of the url path - // Request parameters - } - [InterfaceDataContract] public partial interface IClusterRerouteRequest : IRequest { diff --git a/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs b/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs index b854cb6e75..361444b10f 100644 --- a/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs @@ -76,6 +76,8 @@ internal static partial class ApiUrlsLookups internal static readonly ApiUrls ClusterPutSettings = new(new[] { "_cluster/settings" }); + internal static readonly ApiUrls ClusterRemoteInfo = new(new[] { "_remote/info" }); + internal static readonly ApiUrls NoNamespaceCreatePit = new(new[] { "{index}/_search/point_in_time" }); diff --git a/src/OpenSearch.Client/_Generated/Descriptors.Cluster.cs b/src/OpenSearch.Client/_Generated/Descriptors.Cluster.cs index a1f9a55d41..a679a76462 100644 --- a/src/OpenSearch.Client/_Generated/Descriptors.Cluster.cs +++ b/src/OpenSearch.Client/_Generated/Descriptors.Cluster.cs @@ -486,4 +486,18 @@ public ClusterPutSettingsDescriptor MasterTimeout(Time mastertimeout) => /// Operation timeout. public ClusterPutSettingsDescriptor Timeout(Time timeout) => Qs("timeout", timeout); } + + /// Descriptor for RemoteInfo https://opensearch.org/docs/latest/api-reference/remote-info/ + public partial class RemoteInfoDescriptor + : RequestDescriptorBase< + RemoteInfoDescriptor, + RemoteInfoRequestParameters, + IRemoteInfoRequest + >, + IRemoteInfoRequest + { + internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterRemoteInfo; + // values part of the url path + // Request parameters + } } diff --git a/src/OpenSearch.Client/_Generated/OpenSearchClient.Cluster.cs b/src/OpenSearch.Client/_Generated/OpenSearchClient.Cluster.cs index b1090052e7..3f5bfdd5c8 100644 --- a/src/OpenSearch.Client/_Generated/OpenSearchClient.Cluster.cs +++ b/src/OpenSearch.Client/_Generated/OpenSearchClient.Cluster.cs @@ -643,5 +643,47 @@ public Task PutSettingsAsync( request.RequestParameters, ct ); + + /// + /// GET request to the cluster.remote_info API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/remote-info/ + /// + public RemoteInfoResponse RemoteInfo( + Func selector = null + ) => RemoteInfo(selector.InvokeOrDefault(new RemoteInfoDescriptor())); + + /// + /// GET request to the cluster.remote_info API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/remote-info/ + /// + public Task RemoteInfoAsync( + Func selector = null, + CancellationToken ct = default + ) => RemoteInfoAsync(selector.InvokeOrDefault(new RemoteInfoDescriptor()), ct); + + /// + /// GET request to the cluster.remote_info API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/remote-info/ + /// + public RemoteInfoResponse RemoteInfo(IRemoteInfoRequest request) => + DoRequest(request, request.RequestParameters); + + /// + /// GET request to the cluster.remote_info API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/remote-info/ + /// + public Task RemoteInfoAsync( + IRemoteInfoRequest request, + CancellationToken ct = default + ) => + DoRequestAsync( + request, + request.RequestParameters, + ct + ); } } diff --git a/src/OpenSearch.Client/_Generated/Requests.Cluster.cs b/src/OpenSearch.Client/_Generated/Requests.Cluster.cs index 82974e335b..730f78e24c 100644 --- a/src/OpenSearch.Client/_Generated/Requests.Cluster.cs +++ b/src/OpenSearch.Client/_Generated/Requests.Cluster.cs @@ -653,4 +653,19 @@ public Time Timeout set => Q("timeout", value); } } + + [InterfaceDataContract] + public partial interface IRemoteInfoRequest : IRequest { } + + /// Request for RemoteInfo https://opensearch.org/docs/latest/api-reference/remote-info/ + public partial class RemoteInfoRequest + : PlainRequestBase, + IRemoteInfoRequest + { + protected IRemoteInfoRequest Self => this; + internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterRemoteInfo; + // values part of the url path + + // Request parameters + } } diff --git a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs index 4820bb66aa..1594a1fadd 100644 --- a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs +++ b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs @@ -51,13 +51,6 @@ // ReSharper disable once CheckNamespace namespace OpenSearch.Net.Specification.ClusterApi { - ///Request options for RemoteInfo https://opensearch.org/docs/latest/opensearch/rest-api/remote-info/ - public class RemoteInfoRequestParameters : RequestParameters - { - public override HttpMethod DefaultHttpMethod => HttpMethod.GET; - public override bool SupportsBody => false; - } - ///Request options for Reroute public class ClusterRerouteRequestParameters : RequestParameters { diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs index bc6cda6b98..1cbabf625a 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs @@ -66,15 +66,6 @@ namespace OpenSearch.Net.Specification.ClusterApi /// public partial class LowLevelClusterNamespace : NamespacedClientProxy { - ///GET on /_remote/info https://opensearch.org/docs/latest/opensearch/rest-api/remote-info/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse RemoteInfo(RemoteInfoRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, "_remote/info", null, RequestParams(requestParameters)); - ///GET on /_remote/info https://opensearch.org/docs/latest/opensearch/rest-api/remote-info/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cluster.remote_info", "")] - public Task RemoteInfoAsync(RemoteInfoRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, "_remote/info", ctx, null, RequestParams(requestParameters)); ///POST on /_cluster/reroute ///The definition of `commands` to perform (`move`, `cancel`, `allocate`) ///Request specific configuration such as querystring parameters & request specific connection settings. diff --git a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs index 3a60a7cf51..571dacc61e 100644 --- a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs @@ -482,4 +482,12 @@ public TimeSpan Timeout set => Q("timeout", value); } } + + /// Request options for RemoteInfo https://opensearch.org/docs/latest/api-reference/remote-info/ + public partial class RemoteInfoRequestParameters + : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + public override bool SupportsBody => false; + } } diff --git a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs index a72dc00646..ca54e927b4 100644 --- a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs @@ -460,5 +460,27 @@ public Task PutSettingsAsync( body, RequestParams(requestParameters) ); + + /// GET on /_remote/info https://opensearch.org/docs/latest/api-reference/remote-info/ + /// Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse RemoteInfo(RemoteInfoRequestParameters requestParameters = null) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest(GET, "_remote/info", null, RequestParams(requestParameters)); + + /// GET on /_remote/info https://opensearch.org/docs/latest/api-reference/remote-info/ + /// Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cluster.remote_info", "")] + public Task RemoteInfoAsync( + RemoteInfoRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + "_remote/info", + ctx, + null, + RequestParams(requestParameters) + ); } } From 12dd33b7ff48524e7438da4b73e3a2cf0dbb21c4 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Fri, 8 Sep 2023 16:58:29 +1200 Subject: [PATCH 4/7] Re-generate `cluster.reroute` Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 1 + src/OpenSearch.Client/ApiUrlsLookup.cs | 1 - src/OpenSearch.Client/Descriptors.Cluster.cs | 24 ------- .../OpenSearchClient.Cluster.cs | 24 ------- src/OpenSearch.Client/Requests.Cluster.cs | 64 ----------------- .../_Generated/ApiUrlsLookup.cs | 2 + .../_Generated/Descriptors.Cluster.cs | 42 ++++++++++++ .../_Generated/OpenSearchClient.Cluster.cs | 45 ++++++++++++ .../_Generated/Requests.Cluster.cs | 68 +++++++++++++++++++ .../RequestParameters.Cluster.cs | 57 ---------------- .../OpenSearchLowLevelClient.Cluster.cs | 11 --- .../RequestParameters.Cluster.cs | 61 +++++++++++++++++ .../OpenSearchLowLevelClient.Cluster.cs | 28 ++++++++ 13 files changed, 247 insertions(+), 181 deletions(-) diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index de9e3961af..b7349ef9c6 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -50,6 +50,7 @@ public static class CodeConfiguration new("cluster.post_voting_config_exclusions"), new("cluster.put_settings"), new("cluster.remote_info"), + new("cluster.reroute"), new("cluster.*_component_template"), diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index ef40bf329b..711245eec8 100644 --- a/src/OpenSearch.Client/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/ApiUrlsLookup.cs @@ -70,7 +70,6 @@ internal static partial class ApiUrlsLookups internal static ApiUrls CatTemplates = new ApiUrls(new[]{"_cat/templates", "_cat/templates/{name}"}); internal static ApiUrls CatThreadPool = new ApiUrls(new[]{"_cat/thread_pool", "_cat/thread_pool/{thread_pool_patterns}"}); internal static ApiUrls NoNamespaceClearScroll = new ApiUrls(new[]{"_search/scroll"}); - internal static ApiUrls ClusterReroute = new ApiUrls(new[]{"_cluster/reroute"}); internal static ApiUrls ClusterState = new ApiUrls(new[]{"_cluster/state", "_cluster/state/{metric}", "_cluster/state/{metric}/{index}"}); internal static ApiUrls ClusterStats = new ApiUrls(new[]{"_cluster/stats", "_cluster/stats/nodes/{node_id}"}); internal static ApiUrls NoNamespaceCount = new ApiUrls(new[]{"_count", "{index}/_count"}); diff --git a/src/OpenSearch.Client/Descriptors.Cluster.cs b/src/OpenSearch.Client/Descriptors.Cluster.cs index 880c7cc62f..40ec4a5585 100644 --- a/src/OpenSearch.Client/Descriptors.Cluster.cs +++ b/src/OpenSearch.Client/Descriptors.Cluster.cs @@ -57,30 +57,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - ///Descriptor for Reroute - public partial class ClusterRerouteDescriptor : RequestDescriptorBase, IClusterRerouteRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterReroute; - // values part of the url path - // Request parameters - ///Simulate the operation only and return the resulting state - public ClusterRerouteDescriptor DryRun(bool? dryrun = true) => Qs("dry_run", dryrun); - ///Return an explanation of why the commands can or cannot be executed - public ClusterRerouteDescriptor Explain(bool? explain = true) => Qs("explain", explain); - ///Explicit operation timeout for connection to master node - ///Deprecated as of OpenSearch 2.0, use instead - public ClusterRerouteDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); - ///Explicit operation timeout for connection to cluster_manager node - ///Introduced in OpenSearch 2.0 instead of - public ClusterRerouteDescriptor ClusterManagerTimeout(Time timeout) => Qs("cluster_manager_timeout", timeout); - ///Limit the information returned to the specified metrics. Defaults to all but metadata - public ClusterRerouteDescriptor Metric(params string[] metric) => Qs("metric", metric); - ///Retries allocation of shards that are blocked due to too many subsequent allocation failures - public ClusterRerouteDescriptor RetryFailed(bool? retryfailed = true) => Qs("retry_failed", retryfailed); - ///Explicit operation timeout - public ClusterRerouteDescriptor Timeout(Time timeout) => Qs("timeout", timeout); - } - ///Descriptor for State public partial class ClusterStateDescriptor : RequestDescriptorBase, IClusterStateRequest { diff --git a/src/OpenSearch.Client/OpenSearchClient.Cluster.cs b/src/OpenSearch.Client/OpenSearchClient.Cluster.cs index 4671ed9331..8a41c386a9 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Cluster.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Cluster.cs @@ -59,30 +59,6 @@ namespace OpenSearch.Client.Specification.ClusterApi /// public partial class ClusterNamespace : NamespacedClientProxy { - /// - /// POST request to the cluster.reroute API, read more about this API online: - /// - /// - /// - public ClusterRerouteResponse Reroute(Func selector = null) => Reroute(selector.InvokeOrDefault(new ClusterRerouteDescriptor())); - /// - /// POST request to the cluster.reroute API, read more about this API online: - /// - /// - /// - public Task RerouteAsync(Func selector = null, CancellationToken ct = default) => RerouteAsync(selector.InvokeOrDefault(new ClusterRerouteDescriptor()), ct); - /// - /// POST request to the cluster.reroute API, read more about this API online: - /// - /// - /// - public ClusterRerouteResponse Reroute(IClusterRerouteRequest request) => DoRequest(request, request.RequestParameters); - /// - /// POST request to the cluster.reroute API, read more about this API online: - /// - /// - /// - public Task RerouteAsync(IClusterRerouteRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct); /// /// GET request to the cluster.state API, read more about this API online: /// diff --git a/src/OpenSearch.Client/Requests.Cluster.cs b/src/OpenSearch.Client/Requests.Cluster.cs index b539b2fed2..d38d277c9a 100644 --- a/src/OpenSearch.Client/Requests.Cluster.cs +++ b/src/OpenSearch.Client/Requests.Cluster.cs @@ -58,70 +58,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - [InterfaceDataContract] - public partial interface IClusterRerouteRequest : IRequest - { - } - - ///Request for Reroute - public partial class ClusterRerouteRequest : PlainRequestBase, IClusterRerouteRequest - { - protected IClusterRerouteRequest Self => this; - internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterReroute; - // values part of the url path - // Request parameters - ///Simulate the operation only and return the resulting state - public bool? DryRun - { - get => Q("dry_run"); - set => Q("dry_run", value); - } - - ///Return an explanation of why the commands can or cannot be executed - public bool? Explain - { - get => Q("explain"); - set => Q("explain", 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 LowLevelClusterNamespace : NamespacedClientProxy { - ///POST on /_cluster/reroute - ///The definition of `commands` to perform (`move`, `cancel`, `allocate`) - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse Reroute(PostData body, ClusterRerouteRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(POST, "_cluster/reroute", body, RequestParams(requestParameters)); - ///POST on /_cluster/reroute - ///The definition of `commands` to perform (`move`, `cancel`, `allocate`) - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cluster.reroute", "body")] - public Task RerouteAsync(PostData body, ClusterRerouteRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(POST, "_cluster/reroute", ctx, body, RequestParams(requestParameters)); ///GET on /_cluster/state ///Request specific configuration such as querystring parameters & request specific connection settings. public TResponse State(ClusterStateRequestParameters requestParameters = null) diff --git a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs index 571dacc61e..0e6969d43d 100644 --- a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs @@ -490,4 +490,65 @@ public partial class RemoteInfoRequestParameters public override HttpMethod DefaultHttpMethod => HttpMethod.GET; public override bool SupportsBody => false; } + + /// Request options for Reroute https://opensearch.org/docs/latest + public partial class ClusterRerouteRequestParameters + : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + public override bool SupportsBody => true; + + /// 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); + } + + /// Simulate the operation only and return the resulting state. + public bool? DryRun + { + get => Q("dry_run"); + set => Q("dry_run", value); + } + + /// Return an explanation of why the commands can or cannot be executed. + public bool? Explain + { + get => Q("explain"); + set => Q("explain", 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); + } + + /// Limit the information returned to the specified metrics. Defaults to all but metadata. + public string[] Metric + { + get => Q("metric"); + set => Q("metric", value); + } + + /// Retries allocation of shards that are blocked due to too many subsequent allocation failures. + public bool? RetryFailed + { + get => Q("retry_failed"); + set => Q("retry_failed", value); + } + + /// Operation timeout. + public TimeSpan Timeout + { + get => Q("timeout"); + set => Q("timeout", value); + } + } } diff --git a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs index ca54e927b4..691963cff9 100644 --- a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs @@ -482,5 +482,33 @@ public Task RemoteInfoAsync( null, RequestParams(requestParameters) ); + + /// POST on /_cluster/reroute https://opensearch.org/docs/latest + /// The definition of `commands` to perform (`move`, `cancel`, `allocate`) + /// Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse Reroute( + PostData body, + ClusterRerouteRequestParameters requestParameters = null + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest(POST, "_cluster/reroute", body, RequestParams(requestParameters)); + + /// POST on /_cluster/reroute https://opensearch.org/docs/latest + /// The definition of `commands` to perform (`move`, `cancel`, `allocate`) + /// Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cluster.reroute", "body")] + public Task RerouteAsync( + PostData body, + ClusterRerouteRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + POST, + "_cluster/reroute", + ctx, + body, + RequestParams(requestParameters) + ); } } From adcfc5d540f632af0f7874e3ebcf43eabf23727c Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Fri, 8 Sep 2023 17:23:24 +1200 Subject: [PATCH 5/7] Re-generate `cluster.state` Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 1 + src/OpenSearch.Client/ApiUrlsLookup.cs | 1 - src/OpenSearch.Client/Descriptors.Cluster.cs | 57 --------- .../OpenSearchClient.Cluster.cs | 24 ---- src/OpenSearch.Client/Requests.Cluster.cs | 114 ------------------ .../_Generated/ApiUrlsLookup.cs | 10 ++ .../_Generated/Descriptors.Cluster.cs | 87 +++++++++++++ .../_Generated/OpenSearchClient.Cluster.cs | 51 ++++++++ .../_Generated/Requests.Cluster.cs | 112 +++++++++++++++++ src/OpenSearch.Net/Api/Enums.cs | 50 -------- .../RequestParameters.Cluster.cs | 74 ------------ .../OpenSearchLowLevelClient.Cluster.cs | 33 ----- src/OpenSearch.Net/_Generated/Api/Enums.cs | 59 +++++++++ .../RequestParameters.Cluster.cs | 78 ++++++++++++ .../OpenSearchLowLevelClient.Cluster.cs | 92 ++++++++++++++ 15 files changed, 490 insertions(+), 353 deletions(-) diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index b7349ef9c6..aac8094e03 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -51,6 +51,7 @@ public static class CodeConfiguration new("cluster.put_settings"), new("cluster.remote_info"), new("cluster.reroute"), + new("cluster.state"), new("cluster.*_component_template"), diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index 711245eec8..4cd1f08ab1 100644 --- a/src/OpenSearch.Client/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/ApiUrlsLookup.cs @@ -70,7 +70,6 @@ internal static partial class ApiUrlsLookups internal static ApiUrls CatTemplates = new ApiUrls(new[]{"_cat/templates", "_cat/templates/{name}"}); internal static ApiUrls CatThreadPool = new ApiUrls(new[]{"_cat/thread_pool", "_cat/thread_pool/{thread_pool_patterns}"}); internal static ApiUrls NoNamespaceClearScroll = new ApiUrls(new[]{"_search/scroll"}); - internal static ApiUrls ClusterState = new ApiUrls(new[]{"_cluster/state", "_cluster/state/{metric}", "_cluster/state/{metric}/{index}"}); internal static ApiUrls ClusterStats = new ApiUrls(new[]{"_cluster/stats", "_cluster/stats/nodes/{node_id}"}); internal static ApiUrls NoNamespaceCount = new ApiUrls(new[]{"_count", "{index}/_count"}); internal static ApiUrls NoNamespaceCreate = new ApiUrls(new[]{"{index}/_create/{id}"}); diff --git a/src/OpenSearch.Client/Descriptors.Cluster.cs b/src/OpenSearch.Client/Descriptors.Cluster.cs index 40ec4a5585..1aa7da1807 100644 --- a/src/OpenSearch.Client/Descriptors.Cluster.cs +++ b/src/OpenSearch.Client/Descriptors.Cluster.cs @@ -57,63 +57,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - ///Descriptor for State - public partial class ClusterStateDescriptor : RequestDescriptorBase, IClusterStateRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterState; - ////_cluster/state - public ClusterStateDescriptor(): base() - { - } - - ////_cluster/state/{metric} - ///Optional, accepts null - public ClusterStateDescriptor(Metrics metric): base(r => r.Optional("metric", metric)) - { - } - - ////_cluster/state/{metric}/{index} - ///Optional, accepts null - ///Optional, accepts null - public ClusterStateDescriptor(Metrics metric, Indices index): base(r => r.Optional("metric", metric).Optional("index", index)) - { - } - - // values part of the url path - Metrics IClusterStateRequest.Metric => Self.RouteValues.Get("metric"); - Indices IClusterStateRequest.Index => Self.RouteValues.Get("index"); - ///Limit the information returned to the specified metrics - public ClusterStateDescriptor Metric(Metrics metric) => Assign(metric, (a, v) => a.RouteValues.Optional("metric", v)); - ///A comma-separated list of index names; use the special string `_all` or Indices.All to perform the operation on all indices - public ClusterStateDescriptor Index(Indices index) => Assign(index, (a, v) => a.RouteValues.Optional("index", v)); - ///a shortcut into calling Index(typeof(TOther)) - public ClusterStateDescriptor Index() - where TOther : class => Assign(typeof(TOther), (a, v) => a.RouteValues.Optional("index", (Indices)v)); - ///A shortcut into calling Index(Indices.All) - public ClusterStateDescriptor AllIndices() => Index(Indices.All); - // Request parameters - ///Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified) - public ClusterStateDescriptor AllowNoIndices(bool? allownoindices = true) => Qs("allow_no_indices", allownoindices); - ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public ClusterStateDescriptor ExpandWildcards(ExpandWildcards? expandwildcards) => Qs("expand_wildcards", expandwildcards); - ///Return settings in flat format (default: false) - public ClusterStateDescriptor FlatSettings(bool? flatsettings = true) => Qs("flat_settings", flatsettings); - ///Whether specified concrete indices should be ignored when unavailable (missing or closed) - public ClusterStateDescriptor IgnoreUnavailable(bool? ignoreunavailable = true) => Qs("ignore_unavailable", ignoreunavailable); - ///Return local information, do not retrieve the state from cluster_manager node (default: false) - public ClusterStateDescriptor Local(bool? local = true) => Qs("local", local); - ///Explicit operation timeout for connection to master node - ///Deprecated as of OpenSearch 2.0, use instead - public ClusterStateDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); - ///Explicit operation timeout for connection to cluster_manager node - ///Introduced in OpenSearch 2.0 instead of - public ClusterStateDescriptor ClusterManagerTimeout(Time timeout) => Qs("cluster_manager_timeout", timeout); - ///Wait for the metadata version to be equal or greater than the specified metadata version - public ClusterStateDescriptor WaitForMetadataVersion(long? waitformetadataversion) => Qs("wait_for_metadata_version", waitformetadataversion); - ///The maximum time to wait for wait_for_metadata_version before timing out - public ClusterStateDescriptor WaitForTimeout(Time waitfortimeout) => Qs("wait_for_timeout", waitfortimeout); - } - ///Descriptor for Stats public partial class ClusterStatsDescriptor : RequestDescriptorBase, IClusterStatsRequest { diff --git a/src/OpenSearch.Client/OpenSearchClient.Cluster.cs b/src/OpenSearch.Client/OpenSearchClient.Cluster.cs index 8a41c386a9..b25e661f80 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Cluster.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Cluster.cs @@ -59,30 +59,6 @@ namespace OpenSearch.Client.Specification.ClusterApi /// public partial class ClusterNamespace : NamespacedClientProxy { - /// - /// GET request to the cluster.state API, read more about this API online: - /// - /// - /// - public ClusterStateResponse State(Indices index = null, Func selector = null) => State(selector.InvokeOrDefault(new ClusterStateDescriptor().Index(index: index))); - /// - /// GET request to the cluster.state API, read more about this API online: - /// - /// - /// - public Task StateAsync(Indices index = null, Func selector = null, CancellationToken ct = default) => StateAsync(selector.InvokeOrDefault(new ClusterStateDescriptor().Index(index: index)), ct); - /// - /// GET request to the cluster.state API, read more about this API online: - /// - /// - /// - public ClusterStateResponse State(IClusterStateRequest request) => DoRequest(request, request.RequestParameters); - /// - /// GET request to the cluster.state API, read more about this API online: - /// - /// - /// - public Task StateAsync(IClusterStateRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct); /// /// GET request to the cluster.stats API, read more about this API online: /// diff --git a/src/OpenSearch.Client/Requests.Cluster.cs b/src/OpenSearch.Client/Requests.Cluster.cs index d38d277c9a..8a1df1c7ab 100644 --- a/src/OpenSearch.Client/Requests.Cluster.cs +++ b/src/OpenSearch.Client/Requests.Cluster.cs @@ -58,120 +58,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - [InterfaceDataContract] - public partial interface IClusterStateRequest : IRequest - { - [IgnoreDataMember] - Metrics Metric - { - get; - } - - [IgnoreDataMember] - Indices Index - { - get; - } - } - - ///Request for State - public partial class ClusterStateRequest : PlainRequestBase, IClusterStateRequest - { - protected IClusterStateRequest Self => this; - internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterState; - ////_cluster/state - public ClusterStateRequest(): base() - { - } - - ////_cluster/state/{metric} - ///Optional, accepts null - public ClusterStateRequest(Metrics metric): base(r => r.Optional("metric", metric)) - { - } - - ////_cluster/state/{metric}/{index} - ///Optional, accepts null - ///Optional, accepts null - public ClusterStateRequest(Metrics metric, Indices index): base(r => r.Optional("metric", metric).Optional("index", index)) - { - } - - // values part of the url path - [IgnoreDataMember] - Metrics IClusterStateRequest.Metric => Self.RouteValues.Get("metric"); - [IgnoreDataMember] - Indices IClusterStateRequest.Index => Self.RouteValues.Get("index"); - // Request parameters - /// - /// Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have - /// been specified) - /// - public bool? AllowNoIndices - { - get => Q("allow_no_indices"); - set => Q("allow_no_indices", value); - } - - ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public ExpandWildcards? ExpandWildcards - { - get => Q("expand_wildcards"); - set => Q("expand_wildcards", value); - } - - ///Return settings in flat format (default: false) - public bool? FlatSettings - { - get => Q("flat_settings"); - set => Q("flat_settings", value); - } - - ///Whether specified concrete indices should be ignored when unavailable (missing or closed) - public bool? IgnoreUnavailable - { - get => Q("ignore_unavailable"); - set => Q("ignore_unavailable", 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); - } - - ///Specify timeout for connection to master node - ///Deprecated as of OpenSearch 2.0, use instead - public Time MasterTimeout - { - get => Q public partial class LowLevelClusterNamespace : NamespacedClientProxy { - ///GET on /_cluster/state - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse State(ClusterStateRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, "_cluster/state", null, RequestParams(requestParameters)); - ///GET on /_cluster/state - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cluster.state", "")] - public Task StateAsync(ClusterStateRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, "_cluster/state", ctx, null, RequestParams(requestParameters)); - ///GET on /_cluster/state/{metric} - ///Limit the information returned to the specified metrics - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse State(string metric, ClusterStateRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, Url($"_cluster/state/{metric:metric}"), null, RequestParams(requestParameters)); - ///GET on /_cluster/state/{metric} - ///Limit the information returned to the specified metrics - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cluster.state", "metric")] - public Task StateAsync(string metric, ClusterStateRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, Url($"_cluster/state/{metric:metric}"), ctx, null, RequestParams(requestParameters)); - ///GET on /_cluster/state/{metric}/{index} - ///Limit the information returned to the specified metrics - ///A comma-separated list of index names; use the special string `_all` or Indices.All to perform the operation on all indices - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse State(string metric, string index, ClusterStateRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, Url($"_cluster/state/{metric:metric}/{index:index}"), null, RequestParams(requestParameters)); - ///GET on /_cluster/state/{metric}/{index} - ///Limit the information returned to the specified metrics - ///A comma-separated list of index names; use the special string `_all` or Indices.All to perform the operation on all indices - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cluster.state", "metric, index")] - public Task StateAsync(string metric, string index, ClusterStateRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, Url($"_cluster/state/{metric:metric}/{index:index}"), ctx, null, RequestParams(requestParameters)); ///GET on /_cluster/stats ///Request specific configuration such as querystring parameters & request specific connection settings. public TResponse Stats(ClusterStatsRequestParameters requestParameters = null) diff --git a/src/OpenSearch.Net/_Generated/Api/Enums.cs b/src/OpenSearch.Net/_Generated/Api/Enums.cs index e29577a10c..9cef5115b9 100644 --- a/src/OpenSearch.Net/_Generated/Api/Enums.cs +++ b/src/OpenSearch.Net/_Generated/Api/Enums.cs @@ -52,6 +52,37 @@ namespace OpenSearch.Net { + [Flags, StringEnum] + public enum ClusterStateMetric + { + [EnumMember(Value = "blocks")] + Blocks = 1 << 0, + + [EnumMember(Value = "metadata")] + Metadata = 1 << 1, + + [EnumMember(Value = "nodes")] + Nodes = 1 << 2, + + [EnumMember(Value = "routing_table")] + RoutingTable = 1 << 3, + + [EnumMember(Value = "routing_nodes")] + RoutingNodes = 1 << 4, + + [EnumMember(Value = "master_node")] + MasterNode = 1 << 5, + + [EnumMember(Value = "cluster_manager_node")] + ClusterManagerNode = 1 << 6, + + [EnumMember(Value = "version")] + Version = 1 << 7, + + [EnumMember(Value = "_all")] + All = 1 << 8 + } + [Flags, StringEnum] public enum NodesInfoMetric { @@ -304,6 +335,10 @@ public static partial class KnownEnums { static partial void RegisterEnumStringResolvers() { + EnumStringResolvers.TryAdd( + typeof(ClusterStateMetric), + e => GetStringValue((ClusterStateMetric)e) + ); EnumStringResolvers.TryAdd( typeof(NodesInfoMetric), e => GetStringValue((NodesInfoMetric)e) @@ -344,6 +379,30 @@ static partial void RegisterEnumStringResolvers() EnumStringResolvers.TryAdd(typeof(GroupBy), e => GetStringValue((GroupBy)e)); } + public static string GetStringValue(this ClusterStateMetric enumValue) + { + if ((enumValue & ClusterStateMetric.All) != 0) + return "_all"; + var list = new List(); + if ((enumValue & ClusterStateMetric.Blocks) != 0) + list.Add("blocks"); + if ((enumValue & ClusterStateMetric.Metadata) != 0) + list.Add("metadata"); + if ((enumValue & ClusterStateMetric.Nodes) != 0) + list.Add("nodes"); + if ((enumValue & ClusterStateMetric.RoutingTable) != 0) + list.Add("routing_table"); + if ((enumValue & ClusterStateMetric.RoutingNodes) != 0) + list.Add("routing_nodes"); + if ((enumValue & ClusterStateMetric.MasterNode) != 0) + list.Add("master_node"); + if ((enumValue & ClusterStateMetric.ClusterManagerNode) != 0) + list.Add("cluster_manager_node"); + if ((enumValue & ClusterStateMetric.Version) != 0) + list.Add("version"); + return string.Join(",", list); + } + public static string GetStringValue(this NodesInfoMetric enumValue) { var list = new List(); diff --git a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs index 0e6969d43d..39eacbe270 100644 --- a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs @@ -551,4 +551,82 @@ public TimeSpan Timeout set => Q("timeout", value); } } + + /// Request options for State https://opensearch.org/docs/latest + public partial class ClusterStateRequestParameters + : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + public override bool SupportsBody => false; + + /// + /// Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have + /// been specified). + /// + public bool? AllowNoIndices + { + get => Q("allow_no_indices"); + set => Q("allow_no_indices", 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); + } + + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + public ExpandWildcards? ExpandWildcards + { + get => Q("expand_wildcards"); + set => Q("expand_wildcards", value); + } + + /// Return settings in flat format. + public bool? FlatSettings + { + get => Q("flat_settings"); + set => Q("flat_settings", value); + } + + /// Whether specified concrete indices should be ignored when unavailable (missing or closed). + public bool? IgnoreUnavailable + { + get => Q("ignore_unavailable"); + set => Q("ignore_unavailable", 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); + } + + /// Wait for the metadata version to be equal or greater than the specified metadata version. + public long? WaitForMetadataVersion + { + get => Q("wait_for_metadata_version"); + set => Q("wait_for_metadata_version", value); + } + + /// The maximum time to wait for wait_for_metadata_version before timing out. + public TimeSpan WaitForTimeout + { + get => Q("wait_for_timeout"); + set => Q("wait_for_timeout", value); + } + } } diff --git a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs index 691963cff9..4c82b60794 100644 --- a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs @@ -510,5 +510,97 @@ public Task RerouteAsync( body, RequestParams(requestParameters) ); + + /// GET on /_cluster/state https://opensearch.org/docs/latest + /// Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse State(ClusterStateRequestParameters requestParameters = null) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest(GET, "_cluster/state", null, RequestParams(requestParameters)); + + /// GET on /_cluster/state https://opensearch.org/docs/latest + /// Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cluster.state", "")] + public Task StateAsync( + ClusterStateRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + "_cluster/state", + ctx, + null, + RequestParams(requestParameters) + ); + + /// GET on /_cluster/state/{metric} https://opensearch.org/docs/latest + /// Limit the information returned to the specified metrics. + /// Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse State( + string metric, + ClusterStateRequestParameters requestParameters = null + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest( + GET, + Url($"_cluster/state/{metric:metric}"), + null, + RequestParams(requestParameters) + ); + + /// GET on /_cluster/state/{metric} https://opensearch.org/docs/latest + /// Limit the information returned to the specified metrics. + /// Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cluster.state", "metric")] + public Task StateAsync( + string metric, + ClusterStateRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + Url($"_cluster/state/{metric:metric}"), + ctx, + null, + RequestParams(requestParameters) + ); + + /// GET on /_cluster/state/{metric}/{index} https://opensearch.org/docs/latest + /// Limit the information returned to the specified metrics. + /// Comma-separated list of indices; use the special string `_all` or Indices.All to perform the operation on all indices. + /// Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse State( + string metric, + string index, + ClusterStateRequestParameters requestParameters = null + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest( + GET, + Url($"_cluster/state/{metric:metric}/{index:index}"), + null, + RequestParams(requestParameters) + ); + + /// GET on /_cluster/state/{metric}/{index} https://opensearch.org/docs/latest + /// Limit the information returned to the specified metrics. + /// Comma-separated list of indices; use the special string `_all` or Indices.All to perform the operation on all indices. + /// Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cluster.state", "metric, index")] + public Task StateAsync( + string metric, + string index, + ClusterStateRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + Url($"_cluster/state/{metric:metric}/{index:index}"), + ctx, + null, + RequestParams(requestParameters) + ); } } From d9dd128dedded6baa000cb09776c9167f2f80884 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Fri, 8 Sep 2023 17:40:32 +1200 Subject: [PATCH 6/7] Re-generate `cluster.stats` Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 1 + src/OpenSearch.Client/ApiUrlsLookup.cs | 1 - src/OpenSearch.Client/Descriptors.Cluster.cs | 85 -------------- .../OpenSearchClient.Cluster.cs | 87 --------------- src/OpenSearch.Client/Requests.Cluster.cs | 105 ------------------ .../_Generated/ApiUrlsLookup.cs | 3 + .../_Generated/Descriptors.Cluster.cs | 36 ++++++ .../_Generated/OpenSearchClient.Cluster.cs | 45 ++++++++ .../_Generated/Requests.Cluster.cs | 44 ++++++++ .../RequestParameters.Cluster.cs | 73 ------------ .../OpenSearchLowLevelClient.Cluster.cs | 90 --------------- .../RequestParameters.Cluster.cs | 22 ++++ .../OpenSearchLowLevelClient.Cluster.cs | 55 +++++++++ 13 files changed, 206 insertions(+), 441 deletions(-) delete mode 100644 src/OpenSearch.Client/Descriptors.Cluster.cs delete mode 100644 src/OpenSearch.Client/OpenSearchClient.Cluster.cs delete mode 100644 src/OpenSearch.Client/Requests.Cluster.cs delete mode 100644 src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs delete mode 100644 src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index aac8094e03..7a139188a2 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -52,6 +52,7 @@ public static class CodeConfiguration new("cluster.remote_info"), new("cluster.reroute"), new("cluster.state"), + new("cluster.stats"), new("cluster.*_component_template"), diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index 4cd1f08ab1..1d8ba9ee50 100644 --- a/src/OpenSearch.Client/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/ApiUrlsLookup.cs @@ -70,7 +70,6 @@ internal static partial class ApiUrlsLookups internal static ApiUrls CatTemplates = new ApiUrls(new[]{"_cat/templates", "_cat/templates/{name}"}); internal static ApiUrls CatThreadPool = new ApiUrls(new[]{"_cat/thread_pool", "_cat/thread_pool/{thread_pool_patterns}"}); internal static ApiUrls NoNamespaceClearScroll = new ApiUrls(new[]{"_search/scroll"}); - internal static ApiUrls ClusterStats = new ApiUrls(new[]{"_cluster/stats", "_cluster/stats/nodes/{node_id}"}); internal static ApiUrls NoNamespaceCount = new ApiUrls(new[]{"_count", "{index}/_count"}); internal static ApiUrls NoNamespaceCreate = new ApiUrls(new[]{"{index}/_create/{id}"}); internal static ApiUrls NoNamespaceDelete = new ApiUrls(new[]{"{index}/_doc/{id}"}); diff --git a/src/OpenSearch.Client/Descriptors.Cluster.cs b/src/OpenSearch.Client/Descriptors.Cluster.cs deleted file mode 100644 index 1aa7da1807..0000000000 --- a/src/OpenSearch.Client/Descriptors.Cluster.cs +++ /dev/null @@ -1,85 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 -* -* The OpenSearch Contributors require contributions made to -* this file be licensed under the Apache-2.0 license or a -* compatible open source license. -*/ -/* -* Modifications Copyright OpenSearch Contributors. See -* GitHub history for details. -* -* Licensed to Elasticsearch B.V. under one or more contributor -* license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright -* ownership. Elasticsearch B.V. licenses this file to you under -* the Apache License, Version 2.0 (the "License"); you may -* not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ -// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ -// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ -// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ -// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ -// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ -// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ -// ----------------------------------------------- -// -// This file is automatically generated -// Please do not edit these files manually -// Run the following in the root of the repos: -// -// *NIX : ./build.sh codegen -// Windows : build.bat codegen -// -// ----------------------------------------------- -// ReSharper disable RedundantUsingDirective -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Linq.Expressions; -using OpenSearch.Net; -using OpenSearch.Net.Utf8Json; -using OpenSearch.Net.Specification.ClusterApi; - -// ReSharper disable RedundantBaseConstructorCall -// ReSharper disable UnusedTypeParameter -// ReSharper disable PartialMethodWithSinglePart -// ReSharper disable RedundantNameQualifier -namespace OpenSearch.Client -{ - ///Descriptor for Stats - public partial class ClusterStatsDescriptor : RequestDescriptorBase, IClusterStatsRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterStats; - ////_cluster/stats - public ClusterStatsDescriptor(): base() - { - } - - ////_cluster/stats/nodes/{node_id} - ///Optional, accepts null - public ClusterStatsDescriptor(NodeIds nodeId): base(r => r.Optional("node_id", nodeId)) - { - } - - // values part of the url path - NodeIds IClusterStatsRequest.NodeId => Self.RouteValues.Get("node_id"); - ///A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes - public ClusterStatsDescriptor NodeId(NodeIds nodeId) => Assign(nodeId, (a, v) => a.RouteValues.Optional("node_id", v)); - // Request parameters - ///Return settings in flat format (default: false) - public ClusterStatsDescriptor FlatSettings(bool? flatsettings = true) => Qs("flat_settings", flatsettings); - ///Explicit operation timeout - public ClusterStatsDescriptor Timeout(Time timeout) => Qs("timeout", timeout); - } -} diff --git a/src/OpenSearch.Client/OpenSearchClient.Cluster.cs b/src/OpenSearch.Client/OpenSearchClient.Cluster.cs deleted file mode 100644 index b25e661f80..0000000000 --- a/src/OpenSearch.Client/OpenSearchClient.Cluster.cs +++ /dev/null @@ -1,87 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 -* -* The OpenSearch Contributors require contributions made to -* this file be licensed under the Apache-2.0 license or a -* compatible open source license. -*/ -/* -* Modifications Copyright OpenSearch Contributors. See -* GitHub history for details. -* -* Licensed to Elasticsearch B.V. under one or more contributor -* license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright -* ownership. Elasticsearch B.V. licenses this file to you under -* the Apache License, Version 2.0 (the "License"); you may -* not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ -// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ -// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ -// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ -// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ -// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ -// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ -// ----------------------------------------------- -// -// This file is automatically generated -// Please do not edit these files manually -// Run the following in the root of the repos: -// -// *NIX : ./build.sh codegen -// Windows : build.bat codegen -// -// ----------------------------------------------- -// ReSharper disable RedundantUsingDirective -using System; -using System.Threading; -using System.Threading.Tasks; -using OpenSearch.Net.Specification.ClusterApi; - -// ReSharper disable once CheckNamespace -// ReSharper disable RedundantTypeArgumentsOfMethod -namespace OpenSearch.Client.Specification.ClusterApi -{ - /// - /// Cluster APIs. - /// Not intended to be instantiated directly. Use the property - /// on . - /// - /// - public partial class ClusterNamespace : NamespacedClientProxy - { - /// - /// GET request to the cluster.stats API, read more about this API online: - /// - /// - /// - public ClusterStatsResponse Stats(Func selector = null) => Stats(selector.InvokeOrDefault(new ClusterStatsDescriptor())); - /// - /// GET request to the cluster.stats API, read more about this API online: - /// - /// - /// - public Task StatsAsync(Func selector = null, CancellationToken ct = default) => StatsAsync(selector.InvokeOrDefault(new ClusterStatsDescriptor()), ct); - /// - /// GET request to the cluster.stats API, read more about this API online: - /// - /// - /// - public ClusterStatsResponse Stats(IClusterStatsRequest request) => DoRequest(request, request.RequestParameters); - /// - /// GET request to the cluster.stats API, read more about this API online: - /// - /// - /// - public Task StatsAsync(IClusterStatsRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct); - } -} diff --git a/src/OpenSearch.Client/Requests.Cluster.cs b/src/OpenSearch.Client/Requests.Cluster.cs deleted file mode 100644 index 8a1df1c7ab..0000000000 --- a/src/OpenSearch.Client/Requests.Cluster.cs +++ /dev/null @@ -1,105 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 -* -* The OpenSearch Contributors require contributions made to -* this file be licensed under the Apache-2.0 license or a -* compatible open source license. -*/ -/* -* Modifications Copyright OpenSearch Contributors. See -* GitHub history for details. -* -* Licensed to Elasticsearch B.V. under one or more contributor -* license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright -* ownership. Elasticsearch B.V. licenses this file to you under -* the Apache License, Version 2.0 (the "License"); you may -* not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ -// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ -// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ -// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ -// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ -// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ -// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ -// ----------------------------------------------- -// -// This file is automatically generated -// Please do not edit these files manually -// Run the following in the root of the repos: -// -// *NIX : ./build.sh codegen -// Windows : build.bat codegen -// -// ----------------------------------------------- -// ReSharper disable RedundantUsingDirective -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Linq.Expressions; -using System.Runtime.Serialization; -using OpenSearch.Net; -using OpenSearch.Net.Utf8Json; -using OpenSearch.Net.Specification.ClusterApi; - -// ReSharper disable RedundantBaseConstructorCall -// ReSharper disable UnusedTypeParameter -// ReSharper disable PartialMethodWithSinglePart -// ReSharper disable RedundantNameQualifier -namespace OpenSearch.Client -{ - [InterfaceDataContract] - public partial interface IClusterStatsRequest : IRequest - { - [IgnoreDataMember] - NodeIds NodeId - { - get; - } - } - - ///Request for Stats - public partial class ClusterStatsRequest : PlainRequestBase, IClusterStatsRequest - { - protected IClusterStatsRequest Self => this; - internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterStats; - ////_cluster/stats - public ClusterStatsRequest(): base() - { - } - - ////_cluster/stats/nodes/{node_id} - ///Optional, accepts null - public ClusterStatsRequest(NodeIds nodeId): base(r => r.Optional("node_id", nodeId)) - { - } - - // values part of the url path - [IgnoreDataMember] - NodeIds IClusterStatsRequest.NodeId => Self.RouteValues.Get("node_id"); - // Request parameters - ///Return settings in flat format (default: false) - public bool? FlatSettings - { - get => Q("flat_settings"); - set => Q("flat_settings", value); - } - - ///Explicit operation timeout - public Time Timeout - { - get => Q