From f1df48dad8044121dd02f5ab133b349162026f81 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Wed, 4 Oct 2023 13:21:13 +1300 Subject: [PATCH] Re-generate `cluster` namespace (part 1) (#356) * Re-generate `cluster.allocation_explain` Signed-off-by: Thomas Farr * Re-generate `cluster.delete_component_template` Signed-off-by: Thomas Farr * Re-generate `cluster.delete_voting_config_exclusions` Signed-off-by: Thomas Farr * Re-generate `cluster.exists_component_template` Signed-off-by: Thomas Farr * Re-generate `cluster.get_component_template` Signed-off-by: Thomas Farr * Re-generate `cluster.get_settings` Signed-off-by: Thomas Farr * Re-generate `cluster.health` Signed-off-by: Thomas Farr * Re-generate `cluster.pending_tasks` Signed-off-by: Thomas Farr --------- Signed-off-by: Thomas Farr --- CHANGELOG.md | 2 +- .../Configuration/CodeConfiguration.cs | 9 + src/ApiGenerator/OpenSearch.openapi.json | 60 +-- src/OpenSearch.Client/ApiUrlsLookup.cs | 5 - src/OpenSearch.Client/Descriptors.Cluster.cs | 111 ------ .../IOpenSearchClient.Generated.cs | 6 - .../OpenSearchClient.Cluster.cs | 126 +----- .../OpenSearchClient.NoNamespace.cs | 8 - src/OpenSearch.Client/Requests.Cluster.cs | 250 ------------ .../_Generated/ApiUrlsLookup.cs | 14 + .../_Generated/Descriptors.Cluster.cs | 265 +++++++++++++ .../_Generated/IOpenSearchClient.cs | 4 + .../_Generated/OpenSearchClient.Cluster.cs | 318 +++++++++++++++ .../_Generated/OpenSearchClient.cs | 5 + .../_Generated/Requests.Cluster.cs | 341 ++++++++++++++++ src/OpenSearch.Client/_Generated/Requests.cs | 1 + src/OpenSearch.Net/Api/Enums.cs | 101 ----- .../RequestParameters.Cluster.cs | 284 ------------- .../IOpenSearchLowLevelClient.Generated.cs | 6 - .../OpenSearchLowLevelClient.Cluster.cs | 112 +----- .../OpenSearchLowLevelClient.NoNamespace.cs | 7 - src/OpenSearch.Net/_Generated/Api/Enums.cs | 162 ++++++++ .../RequestParameters.Cluster.cs | 372 ++++++++++++++++++ .../_Generated/IOpenSearchLowLevelClient.cs | 4 + .../OpenSearchLowLevelClient.Cluster.cs | 370 +++++++++++++++++ .../_Generated/OpenSearchLowLevelClient.cs | 3 + .../ClusterHealth/ClusterHealthApiTests.cs | 4 +- 27 files changed, 1910 insertions(+), 1040 deletions(-) create mode 100644 src/OpenSearch.Client/_Generated/Descriptors.Cluster.cs create mode 100644 src/OpenSearch.Client/_Generated/OpenSearchClient.Cluster.cs create mode 100644 src/OpenSearch.Client/_Generated/Requests.Cluster.cs create mode 100644 src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs create mode 100644 src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a06a3a3f4..90156f7f32 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -106,4 +106,4 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) [Unreleased]: https://github.com/opensearch-project/opensearch-net/compare/v1.5.0...main [1.5.0]: https://github.com/opensearch-project/opensearch-net/compare/v1.4.0...v1.5.0 [1.4.0]: https://github.com/opensearch-project/opensearch-net/compare/v1.3.0...v1.4.0 -[1.3.0]: https://github.com/opensearch-project/opensearch-net/compare/v1.2.0...v1.3.0 \ No newline at end of file +[1.3.0]: https://github.com/opensearch-project/opensearch-net/compare/v1.2.0...v1.3.0 diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index e143193073..8e182c4d14 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -39,6 +39,15 @@ public static class CodeConfiguration { private static readonly Glob[] OperationsToInclude = { + new("cluster.allocation_explain"), + new("cluster.delete_component_template"), + new("cluster.delete_voting_config_exclusions"), + new("cluster.exists_component_template"), + new("cluster.get_component_template"), + new("cluster.get_settings"), + new("cluster.health"), + new("cluster.pending_tasks"), + new("dangling_indices.*"), new("ingest.*"), new("nodes.*"), diff --git a/src/ApiGenerator/OpenSearch.openapi.json b/src/ApiGenerator/OpenSearch.openapi.json index 438eafcb6c..a34c78380d 100644 --- a/src/ApiGenerator/OpenSearch.openapi.json +++ b/src/ApiGenerator/OpenSearch.openapi.json @@ -11823,7 +11823,8 @@ "$ref": "#/components/schemas/PatchActionGroupsInputPayload" } } - } + }, + "required": true }, "responses": { "200": { @@ -11948,7 +11949,8 @@ "$ref": "#/components/schemas/PatchActionGroupInputPayload" } } - } + }, + "required": true }, "parameters": [ { @@ -11989,7 +11991,8 @@ "$ref": "#/components/schemas/Action_Group" } } - } + }, + "required": true }, "parameters": [ { @@ -13244,7 +13247,8 @@ "$ref": "#/components/schemas/CreateTenantParams" } } - } + }, + "required": true }, "parameters": [ { @@ -17925,21 +17929,23 @@ "description": "Limit the information returned the specific metrics.", "x-enum-options": [ "_all", - "completion", - "docs", - "fielddata", - "query_cache", - "flush", - "get", + "store", "indexing", + "get", + "search", "merge", - "request_cache", + "flush", "refresh", - "search", - "segments", - "store", + "query_cache", + "fielddata", + "docs", "warmer", - "suggest" + "completion", + "segments", + "translog", + "suggest", + "request_cache", + "recovery" ], "x-data-type": "array" }, @@ -28506,21 +28512,23 @@ "description": "Limit the information returned the specific metrics.", "x-enum-options": [ "_all", - "completion", - "docs", - "fielddata", - "query_cache", - "flush", - "get", + "store", "indexing", + "get", + "search", "merge", - "request_cache", + "flush", "refresh", - "search", - "segments", - "store", + "query_cache", + "fielddata", + "docs", "warmer", - "suggest" + "completion", + "segments", + "translog", + "suggest", + "request_cache", + "recovery" ], "x-data-type": "array" }, diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index f542ad80f7..4bb7d9d61a 100644 --- a/src/OpenSearch.Client/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/ApiUrlsLookup.cs @@ -70,11 +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 ClusterAllocationExplain = new ApiUrls(new[]{"_cluster/allocation/explain"}); - internal static ApiUrls ClusterDeleteVotingConfigExclusions = new ApiUrls(new[]{"_cluster/voting_config_exclusions"}); - internal static ApiUrls ClusterGetSettings = new ApiUrls(new[]{"_cluster/settings"}); - internal static ApiUrls ClusterHealth = new ApiUrls(new[]{"_cluster/health", "_cluster/health/{index}"}); - internal static ApiUrls ClusterPendingTasks = new ApiUrls(new[]{"_cluster/pending_tasks"}); 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"}); diff --git a/src/OpenSearch.Client/Descriptors.Cluster.cs b/src/OpenSearch.Client/Descriptors.Cluster.cs index ee2804640b..83fdbea648 100644 --- a/src/OpenSearch.Client/Descriptors.Cluster.cs +++ b/src/OpenSearch.Client/Descriptors.Cluster.cs @@ -57,117 +57,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client.Specification.ClusterApi { - ///Descriptor for AllocationExplain https://opensearch.org/docs/latest/opensearch/rest-api/cluster-allocation/ - public partial class ClusterAllocationExplainDescriptor : RequestDescriptorBase, IClusterAllocationExplainRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterAllocationExplain; - // values part of the url path - // Request parameters - ///Return information about disk usage and shard sizes (default: false) - public ClusterAllocationExplainDescriptor IncludeDiskInfo(bool? includediskinfo = true) => Qs("include_disk_info", includediskinfo); - ///Return 'YES' decisions in explanation (default: false) - public ClusterAllocationExplainDescriptor IncludeYesDecisions(bool? includeyesdecisions = true) => Qs("include_yes_decisions", includeyesdecisions); - } - - ///Descriptor for DeleteVotingConfigExclusions - public partial class DeleteVotingConfigExclusionsDescriptor : RequestDescriptorBase, IDeleteVotingConfigExclusionsRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterDeleteVotingConfigExclusions; - // values part of the url path - // Request parameters - ///Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list. - public DeleteVotingConfigExclusionsDescriptor WaitForRemoval(bool? waitforremoval = true) => Qs("wait_for_removal", waitforremoval); - } - - ///Descriptor for GetSettings https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/ - public partial class ClusterGetSettingsDescriptor : RequestDescriptorBase, IClusterGetSettingsRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterGetSettings; - // values part of the url path - // Request parameters - ///Return settings in flat format (default: false) - public ClusterGetSettingsDescriptor FlatSettings(bool? flatsettings = true) => Qs("flat_settings", flatsettings); - ///Whether to return all default clusters setting. - public ClusterGetSettingsDescriptor IncludeDefaults(bool? includedefaults = true) => Qs("include_defaults", includedefaults); - ///Explicit operation timeout for connection to master node - ///Deprecated as of OpenSearch 2.0, use instead - public ClusterGetSettingsDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); - ///Explicit operation timeout for connection to cluster_manager node - ///Introduced in OpenSearch 2.0 instead of - public ClusterGetSettingsDescriptor ClusterManagerTimeout(Time timeout) => Qs("cluster_manager_timeout", timeout); - ///Explicit operation timeout - public ClusterGetSettingsDescriptor Timeout(Time timeout) => Qs("timeout", timeout); - } - - ///Descriptor for Health https://opensearch.org/docs/latest/opensearch/rest-api/cluster-health/ - public partial class ClusterHealthDescriptor : RequestDescriptorBase, IClusterHealthRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterHealth; - ////_cluster/health - public ClusterHealthDescriptor(): base() - { - } - - ////_cluster/health/{index} - ///Optional, accepts null - public ClusterHealthDescriptor(Indices index): base(r => r.Optional("index", index)) - { - } - - // values part of the url path - Indices IClusterHealthRequest.Index => Self.RouteValues.Get("index"); - ///Limit the information returned to a specific index - public ClusterHealthDescriptor Index(Indices index) => Assign(index, (a, v) => a.RouteValues.Optional("index", v)); - ///a shortcut into calling Index(typeof(TOther)) - public ClusterHealthDescriptor Index() - where TOther : class => Assign(typeof(TOther), (a, v) => a.RouteValues.Optional("index", (Indices)v)); - ///A shortcut into calling Index(Indices.All) - public ClusterHealthDescriptor AllIndices() => Index(Indices.All); - // Request parameters - ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public ClusterHealthDescriptor ExpandWildcards(ExpandWildcards? expandwildcards) => Qs("expand_wildcards", expandwildcards); - ///Specify the level of detail for returned information - public ClusterHealthDescriptor Level(Level? level) => Qs("level", level); - ///Return local information, do not retrieve the state from cluster_manager node (default: false) - public ClusterHealthDescriptor Local(bool? local = true) => Qs("local", local); - ///Explicit operation timeout for connection to master node - ///Deprecated as of OpenSearch 2.0, use instead - public ClusterHealthDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); - ///Explicit operation timeout for connection to cluster_manager node - ///Introduced in OpenSearch 2.0 instead of - public ClusterHealthDescriptor ClusterManagerTimeout(Time timeout) => Qs("cluster_manager_timeout", timeout); - ///Explicit operation timeout - public ClusterHealthDescriptor Timeout(Time timeout) => Qs("timeout", timeout); - ///Wait until the specified number of shards is active - public ClusterHealthDescriptor WaitForActiveShards(string waitforactiveshards) => Qs("wait_for_active_shards", waitforactiveshards); - ///Wait until all currently queued events with the given priority are processed - public ClusterHealthDescriptor WaitForEvents(WaitForEvents? waitforevents) => Qs("wait_for_events", waitforevents); - ///Whether to wait until there are no initializing shards in the cluster - public ClusterHealthDescriptor WaitForNoInitializingShards(bool? waitfornoinitializingshards = true) => Qs("wait_for_no_initializing_shards", waitfornoinitializingshards); - ///Whether to wait until there are no relocating shards in the cluster - public ClusterHealthDescriptor WaitForNoRelocatingShards(bool? waitfornorelocatingshards = true) => Qs("wait_for_no_relocating_shards", waitfornorelocatingshards); - ///Wait until the specified number of nodes is available - public ClusterHealthDescriptor WaitForNodes(string waitfornodes) => Qs("wait_for_nodes", waitfornodes); - ///Wait until cluster is in a specific state - public ClusterHealthDescriptor WaitForStatus(WaitForStatus? waitforstatus) => Qs("wait_for_status", waitforstatus); - } - - ///Descriptor for PendingTasks https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-pending-tasks/ - public partial class ClusterPendingTasksDescriptor : RequestDescriptorBase, IClusterPendingTasksRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterPendingTasks; - // values part of the url path - // Request parameters - ///Return local information, do not retrieve the state from cluster_manager node (default: false) - public ClusterPendingTasksDescriptor Local(bool? local = true) => Qs("local", local); - ///Explicit operation timeout for connection to master node - ///Deprecated as of OpenSearch 2.0, use instead - public ClusterPendingTasksDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); - ///Explicit operation timeout for connection to cluster_manager node - ///Introduced in OpenSearch 2.0 instead of - public ClusterPendingTasksDescriptor ClusterManagerTimeout(Time timeout) => Qs("cluster_manager_timeout", timeout); - } - ///Descriptor for PostVotingConfigExclusions public partial class PostVotingConfigExclusionsDescriptor : RequestDescriptorBase, IPostVotingConfigExclusionsRequest { diff --git a/src/OpenSearch.Client/IOpenSearchClient.Generated.cs b/src/OpenSearch.Client/IOpenSearchClient.Generated.cs index 6ca8082709..c9cecbaad7 100644 --- a/src/OpenSearch.Client/IOpenSearchClient.Generated.cs +++ b/src/OpenSearch.Client/IOpenSearchClient.Generated.cs @@ -70,12 +70,6 @@ CatNamespace Cat get; } - ///Cluster APIs - ClusterNamespace Cluster - { - get; - } - ///Indices APIs IndicesNamespace Indices { diff --git a/src/OpenSearch.Client/OpenSearchClient.Cluster.cs b/src/OpenSearch.Client/OpenSearchClient.Cluster.cs index efb6503f7f..22d773b053 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Cluster.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Cluster.cs @@ -57,132 +57,8 @@ namespace OpenSearch.Client.Specification.ClusterApi /// on . /// /// - public class ClusterNamespace : NamespacedClientProxy + public partial class ClusterNamespace : NamespacedClientProxy { - internal ClusterNamespace(OpenSearchClient client): base(client) - { - } - - /// - /// POST request to the cluster.allocation_explain API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cluster-allocation/ - /// - public ClusterAllocationExplainResponse AllocationExplain(Func selector = null) => AllocationExplain(selector.InvokeOrDefault(new ClusterAllocationExplainDescriptor())); - /// - /// POST request to the cluster.allocation_explain API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cluster-allocation/ - /// - public Task AllocationExplainAsync(Func selector = null, CancellationToken ct = default) => AllocationExplainAsync(selector.InvokeOrDefault(new ClusterAllocationExplainDescriptor()), ct); - /// - /// POST request to the cluster.allocation_explain API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cluster-allocation/ - /// - public ClusterAllocationExplainResponse AllocationExplain(IClusterAllocationExplainRequest request) => DoRequest(request, request.RequestParameters); - /// - /// POST request to the cluster.allocation_explain API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cluster-allocation/ - /// - public Task AllocationExplainAsync(IClusterAllocationExplainRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct); - /// - /// DELETE request to the cluster.delete_voting_config_exclusions API, read more about this API online: - /// - /// - /// - public DeleteVotingConfigExclusionsResponse DeleteVotingConfigExclusions(Func selector = null) => DeleteVotingConfigExclusions(selector.InvokeOrDefault(new DeleteVotingConfigExclusionsDescriptor())); - /// - /// DELETE request to the cluster.delete_voting_config_exclusions API, read more about this API online: - /// - /// - /// - public Task DeleteVotingConfigExclusionsAsync(Func selector = null, CancellationToken ct = default) => DeleteVotingConfigExclusionsAsync(selector.InvokeOrDefault(new DeleteVotingConfigExclusionsDescriptor()), ct); - /// - /// DELETE request to the cluster.delete_voting_config_exclusions API, read more about this API online: - /// - /// - /// - public DeleteVotingConfigExclusionsResponse DeleteVotingConfigExclusions(IDeleteVotingConfigExclusionsRequest request) => DoRequest(request, request.RequestParameters); - /// - /// DELETE request to the cluster.delete_voting_config_exclusions API, read more about this API online: - /// - /// - /// - public Task DeleteVotingConfigExclusionsAsync(IDeleteVotingConfigExclusionsRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct); - /// - /// GET request to the cluster.get_settings API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/ - /// - public ClusterGetSettingsResponse GetSettings(Func selector = null) => GetSettings(selector.InvokeOrDefault(new ClusterGetSettingsDescriptor())); - /// - /// GET request to the cluster.get_settings API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/ - /// - public Task GetSettingsAsync(Func selector = null, CancellationToken ct = default) => GetSettingsAsync(selector.InvokeOrDefault(new ClusterGetSettingsDescriptor()), ct); - /// - /// GET request to the cluster.get_settings API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/ - /// - public ClusterGetSettingsResponse GetSettings(IClusterGetSettingsRequest request) => DoRequest(request, request.RequestParameters); - /// - /// GET request to the cluster.get_settings API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/ - /// - public Task GetSettingsAsync(IClusterGetSettingsRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct); - /// - /// GET request to the cluster.health API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cluster-health/ - /// - public ClusterHealthResponse Health(Indices index = null, Func selector = null) => Health(selector.InvokeOrDefault(new ClusterHealthDescriptor().Index(index: index))); - /// - /// GET request to the cluster.health API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cluster-health/ - /// - public Task HealthAsync(Indices index = null, Func selector = null, CancellationToken ct = default) => HealthAsync(selector.InvokeOrDefault(new ClusterHealthDescriptor().Index(index: index)), ct); - /// - /// GET request to the cluster.health API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cluster-health/ - /// - public ClusterHealthResponse Health(IClusterHealthRequest request) => DoRequest(request, request.RequestParameters); - /// - /// GET request to the cluster.health API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cluster-health/ - /// - public Task HealthAsync(IClusterHealthRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct); - /// - /// GET request to the cluster.pending_tasks API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-pending-tasks/ - /// - public ClusterPendingTasksResponse PendingTasks(Func selector = null) => PendingTasks(selector.InvokeOrDefault(new ClusterPendingTasksDescriptor())); - /// - /// GET request to the cluster.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 ClusterPendingTasksDescriptor()), ct); - /// - /// GET request to the cluster.pending_tasks API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-pending-tasks/ - /// - public ClusterPendingTasksResponse PendingTasks(IClusterPendingTasksRequest request) => DoRequest(request, request.RequestParameters); - /// - /// GET request to the cluster.pending_tasks API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-pending-tasks/ - /// - public Task PendingTasksAsync(IClusterPendingTasksRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct); /// /// POST request to the cluster.post_voting_config_exclusions API, read more about this API online: /// diff --git a/src/OpenSearch.Client/OpenSearchClient.NoNamespace.cs b/src/OpenSearch.Client/OpenSearchClient.NoNamespace.cs index 705ca3749d..7f268282a8 100644 --- a/src/OpenSearch.Client/OpenSearchClient.NoNamespace.cs +++ b/src/OpenSearch.Client/OpenSearchClient.NoNamespace.cs @@ -70,13 +70,6 @@ public CatNamespace Cat private set; } - ///Cluster APIs - public ClusterNamespace Cluster - { - get; - private set; - } - ///Indices APIs public IndicesNamespace Indices { @@ -87,7 +80,6 @@ public IndicesNamespace Indices partial void SetupNamespaces() { Cat = new CatNamespace(this); - Cluster = new ClusterNamespace(this); Indices = new IndicesNamespace(this); } diff --git a/src/OpenSearch.Client/Requests.Cluster.cs b/src/OpenSearch.Client/Requests.Cluster.cs index ee4f102612..70003d7e18 100644 --- a/src/OpenSearch.Client/Requests.Cluster.cs +++ b/src/OpenSearch.Client/Requests.Cluster.cs @@ -58,256 +58,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client.Specification.ClusterApi { - [InterfaceDataContract] - public partial interface IClusterAllocationExplainRequest : IRequest - { - } - - ///Request for AllocationExplain https://opensearch.org/docs/latest/opensearch/rest-api/cluster-allocation/ - public partial class ClusterAllocationExplainRequest : PlainRequestBase, IClusterAllocationExplainRequest - { - protected IClusterAllocationExplainRequest Self => this; - internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterAllocationExplain; - // values part of the url path - // Request parameters - ///Return information about disk usage and shard sizes (default: false) - public bool? IncludeDiskInfo - { - get => Q("include_disk_info"); - set => Q("include_disk_info", value); - } - - ///Return 'YES' decisions in explanation (default: false) - public bool? IncludeYesDecisions - { - get => Q("include_yes_decisions"); - set => Q("include_yes_decisions", value); - } - } - - [InterfaceDataContract] - public partial interface IDeleteVotingConfigExclusionsRequest : IRequest - { - } - - ///Request for DeleteVotingConfigExclusions - public partial class DeleteVotingConfigExclusionsRequest : PlainRequestBase, IDeleteVotingConfigExclusionsRequest - { - protected IDeleteVotingConfigExclusionsRequest Self => this; - internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterDeleteVotingConfigExclusions; - // values part of the url path - // Request parameters - ///Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list. - public bool? WaitForRemoval - { - get => Q("wait_for_removal"); - set => Q("wait_for_removal", value); - } - } - - [InterfaceDataContract] - public partial interface IClusterGetSettingsRequest : IRequest - { - } - - ///Request for GetSettings https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/ - public partial class ClusterGetSettingsRequest : PlainRequestBase, IClusterGetSettingsRequest - { - protected IClusterGetSettingsRequest Self => this; - internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterGetSettings; - // 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); - } - - ///Whether to return all default clusters setting. - public bool? IncludeDefaults - { - get => Q("include_defaults"); - set => Q("include_defaults", value); - } - - ///Explicit operation timeout for connection to master node - ///Deprecated as of OpenSearch 2.0, use instead - public Time MasterTimeout - { - get => Q public partial interface IOpenSearchClient { + ///Cluster APIs + ClusterNamespace Cluster { get; } + ///Dangling Indices APIs DanglingIndicesNamespace DanglingIndices { get; } diff --git a/src/OpenSearch.Client/_Generated/OpenSearchClient.Cluster.cs b/src/OpenSearch.Client/_Generated/OpenSearchClient.Cluster.cs new file mode 100644 index 0000000000..0f551bcb3c --- /dev/null +++ b/src/OpenSearch.Client/_Generated/OpenSearchClient.Cluster.cs @@ -0,0 +1,318 @@ +/* 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 + { + internal ClusterNamespace(OpenSearchClient client) + : base(client) { } + + /// + /// POST request to the cluster.allocation_explain API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-allocation/ + /// + public ClusterAllocationExplainResponse AllocationExplain( + Func selector = + null + ) => AllocationExplain(selector.InvokeOrDefault(new ClusterAllocationExplainDescriptor())); + + /// + /// POST request to the cluster.allocation_explain API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-allocation/ + /// + public Task AllocationExplainAsync( + Func selector = + null, + CancellationToken ct = default + ) => + AllocationExplainAsync( + selector.InvokeOrDefault(new ClusterAllocationExplainDescriptor()), + ct + ); + + /// + /// POST request to the cluster.allocation_explain API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-allocation/ + /// + public ClusterAllocationExplainResponse AllocationExplain( + IClusterAllocationExplainRequest request + ) => + DoRequest( + request, + request.RequestParameters + ); + + /// + /// POST request to the cluster.allocation_explain API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-allocation/ + /// + public Task AllocationExplainAsync( + IClusterAllocationExplainRequest request, + CancellationToken ct = default + ) => + DoRequestAsync( + request, + request.RequestParameters, + ct + ); + + /// + /// DELETE request to the cluster.delete_voting_config_exclusions API, read more about this API online: + /// + /// https://opensearch.org/docs/latest + /// + public DeleteVotingConfigExclusionsResponse DeleteVotingConfigExclusions( + Func< + DeleteVotingConfigExclusionsDescriptor, + IDeleteVotingConfigExclusionsRequest + > selector = null + ) => + DeleteVotingConfigExclusions( + selector.InvokeOrDefault(new DeleteVotingConfigExclusionsDescriptor()) + ); + + /// + /// DELETE request to the cluster.delete_voting_config_exclusions API, read more about this API online: + /// + /// https://opensearch.org/docs/latest + /// + public Task DeleteVotingConfigExclusionsAsync( + Func< + DeleteVotingConfigExclusionsDescriptor, + IDeleteVotingConfigExclusionsRequest + > selector = null, + CancellationToken ct = default + ) => + DeleteVotingConfigExclusionsAsync( + selector.InvokeOrDefault(new DeleteVotingConfigExclusionsDescriptor()), + ct + ); + + /// + /// DELETE request to the cluster.delete_voting_config_exclusions API, read more about this API online: + /// + /// https://opensearch.org/docs/latest + /// + public DeleteVotingConfigExclusionsResponse DeleteVotingConfigExclusions( + IDeleteVotingConfigExclusionsRequest request + ) => + DoRequest( + request, + request.RequestParameters + ); + + /// + /// DELETE request to the cluster.delete_voting_config_exclusions API, read more about this API online: + /// + /// https://opensearch.org/docs/latest + /// + public Task DeleteVotingConfigExclusionsAsync( + IDeleteVotingConfigExclusionsRequest request, + CancellationToken ct = default + ) => + DoRequestAsync< + IDeleteVotingConfigExclusionsRequest, + DeleteVotingConfigExclusionsResponse + >(request, request.RequestParameters, ct); + + /// + /// GET request to the cluster.get_settings API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-settings/ + /// + public ClusterGetSettingsResponse GetSettings( + Func selector = null + ) => GetSettings(selector.InvokeOrDefault(new ClusterGetSettingsDescriptor())); + + /// + /// GET request to the cluster.get_settings API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-settings/ + /// + public Task GetSettingsAsync( + Func selector = null, + CancellationToken ct = default + ) => GetSettingsAsync(selector.InvokeOrDefault(new ClusterGetSettingsDescriptor()), ct); + + /// + /// GET request to the cluster.get_settings API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-settings/ + /// + public ClusterGetSettingsResponse GetSettings(IClusterGetSettingsRequest request) => + DoRequest( + request, + request.RequestParameters + ); + + /// + /// GET request to the cluster.get_settings API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-settings/ + /// + public Task GetSettingsAsync( + IClusterGetSettingsRequest request, + CancellationToken ct = default + ) => + DoRequestAsync( + request, + request.RequestParameters, + ct + ); + + /// + /// GET request to the cluster.health API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-health/ + /// + public ClusterHealthResponse Health( + Indices index = null, + Func selector = null + ) => Health(selector.InvokeOrDefault(new ClusterHealthDescriptor().Index(index: index))); + + /// + /// GET request to the cluster.health API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-health/ + /// + public Task HealthAsync( + Indices index = null, + Func selector = null, + CancellationToken ct = default + ) => + HealthAsync( + selector.InvokeOrDefault(new ClusterHealthDescriptor().Index(index: index)), + ct + ); + + /// + /// GET request to the cluster.health API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-health/ + /// + public ClusterHealthResponse Health(IClusterHealthRequest request) => + DoRequest( + request, + request.RequestParameters + ); + + /// + /// GET request to the cluster.health API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-health/ + /// + public Task HealthAsync( + IClusterHealthRequest request, + CancellationToken ct = default + ) => + DoRequestAsync( + request, + request.RequestParameters, + ct + ); + + /// + /// GET request to the cluster.pending_tasks API, read more about this API online: + /// + /// https://opensearch.org/docs/latest + /// + public ClusterPendingTasksResponse PendingTasks( + Func selector = null + ) => PendingTasks(selector.InvokeOrDefault(new ClusterPendingTasksDescriptor())); + + /// + /// GET request to the cluster.pending_tasks API, read more about this API online: + /// + /// https://opensearch.org/docs/latest + /// + public Task PendingTasksAsync( + Func selector = null, + CancellationToken ct = default + ) => PendingTasksAsync(selector.InvokeOrDefault(new ClusterPendingTasksDescriptor()), ct); + + /// + /// GET request to the cluster.pending_tasks API, read more about this API online: + /// + /// https://opensearch.org/docs/latest + /// + public ClusterPendingTasksResponse PendingTasks(IClusterPendingTasksRequest request) => + DoRequest( + request, + request.RequestParameters + ); + + /// + /// GET request to the cluster.pending_tasks API, read more about this API online: + /// + /// https://opensearch.org/docs/latest + /// + public Task PendingTasksAsync( + IClusterPendingTasksRequest request, + CancellationToken ct = default + ) => + DoRequestAsync( + request, + request.RequestParameters, + ct + ); + } +} diff --git a/src/OpenSearch.Client/_Generated/OpenSearchClient.cs b/src/OpenSearch.Client/_Generated/OpenSearchClient.cs index 738afefd9f..e1947d5d8f 100644 --- a/src/OpenSearch.Client/_Generated/OpenSearchClient.cs +++ b/src/OpenSearch.Client/_Generated/OpenSearchClient.cs @@ -46,6 +46,7 @@ using System.Threading; using System.Threading.Tasks; using OpenSearch.Client; +using OpenSearch.Client.Specification.ClusterApi; using OpenSearch.Client.Specification.DanglingIndicesApi; using OpenSearch.Client.Specification.IngestApi; using OpenSearch.Client.Specification.NodesApi; @@ -60,6 +61,9 @@ namespace OpenSearch.Client /// public partial class OpenSearchClient : IOpenSearchClient { + ///Cluster APIs + public ClusterNamespace Cluster { get; private set; } + ///Dangling Indices APIs public DanglingIndicesNamespace DanglingIndices { get; private set; } @@ -77,6 +81,7 @@ public partial class OpenSearchClient : IOpenSearchClient partial void SetupGeneratedNamespaces() { + Cluster = new ClusterNamespace(this); DanglingIndices = new DanglingIndicesNamespace(this); Ingest = new IngestNamespace(this); Nodes = new NodesNamespace(this); diff --git a/src/OpenSearch.Client/_Generated/Requests.Cluster.cs b/src/OpenSearch.Client/_Generated/Requests.Cluster.cs new file mode 100644 index 0000000000..cbf2b0ea8a --- /dev/null +++ b/src/OpenSearch.Client/_Generated/Requests.Cluster.cs @@ -0,0 +1,341 @@ +/* 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.Specification.ClusterApi +{ + [InterfaceDataContract] + public partial interface IClusterAllocationExplainRequest + : IRequest { } + + ///Request for AllocationExplain https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-allocation/ + public partial class ClusterAllocationExplainRequest + : PlainRequestBase, + IClusterAllocationExplainRequest + { + protected IClusterAllocationExplainRequest Self => this; + internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterAllocationExplain; + + // values part of the url path + + // Request parameters + ///Return information about disk usage and shard sizes. + public bool? IncludeDiskInfo + { + get => Q("include_disk_info"); + set => Q("include_disk_info", value); + } + + ///Return 'YES' decisions in explanation. + public bool? IncludeYesDecisions + { + get => Q("include_yes_decisions"); + set => Q("include_yes_decisions", value); + } + } + + [InterfaceDataContract] + public partial interface IDeleteVotingConfigExclusionsRequest + : IRequest { } + + ///Request for DeleteVotingConfigExclusions https://opensearch.org/docs/latest + public partial class DeleteVotingConfigExclusionsRequest + : PlainRequestBase, + IDeleteVotingConfigExclusionsRequest + { + protected IDeleteVotingConfigExclusionsRequest Self => this; + internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterDeleteVotingConfigExclusions; + + // values part of the url path + + // Request parameters + ///Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list. + public bool? WaitForRemoval + { + get => Q("wait_for_removal"); + set => Q("wait_for_removal", value); + } + } + + [InterfaceDataContract] + public partial interface IClusterGetSettingsRequest + : IRequest { } + + ///Request for GetSettings https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-settings/ + public partial class ClusterGetSettingsRequest + : PlainRequestBase, + IClusterGetSettingsRequest + { + protected IClusterGetSettingsRequest Self => this; + internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterGetSettings; + + // values part of the url path + + // Request parameters + ///Operation timeout for connection to cluster-manager node. + ///Supported by OpenSearch servers of version 2.0.0 or greater. + public Time ClusterManagerTimeout + { + get => Q