From e67acf3219af6a169e60765dfa5c2629f0931f07 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Tue, 5 Sep 2023 13:03:35 +1200 Subject: [PATCH 1/8] Re-generate `cluster.allocation_explain` Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 1 + src/OpenSearch.Client/ApiUrlsLookup.cs | 1 - src/OpenSearch.Client/Descriptors.Cluster.cs | 12 -- .../IOpenSearchClient.Generated.cs | 6 - .../OpenSearchClient.Cluster.cs | 30 +---- .../OpenSearchClient.NoNamespace.cs | 8 -- src/OpenSearch.Client/Requests.Cluster.cs | 27 ---- .../_Generated/ApiUrlsLookup.cs | 3 + .../_Generated/Descriptors.Cluster.cs | 83 ++++++++++++ .../_Generated/IOpenSearchClient.cs | 4 + .../_Generated/OpenSearchClient.Cluster.cs | 118 ++++++++++++++++++ .../_Generated/OpenSearchClient.cs | 5 + .../_Generated/Requests.Cluster.cs | 90 +++++++++++++ src/OpenSearch.Client/_Generated/Requests.cs | 1 + .../RequestParameters.Cluster.cs | 20 --- .../IOpenSearchLowLevelClient.Generated.cs | 6 - .../OpenSearchLowLevelClient.Cluster.cs | 23 +--- .../OpenSearchLowLevelClient.NoNamespace.cs | 7 -- .../RequestParameters.Cluster.cs | 76 +++++++++++ .../_Generated/IOpenSearchLowLevelClient.cs | 4 + .../OpenSearchLowLevelClient.Cluster.cs | 105 ++++++++++++++++ .../_Generated/OpenSearchLowLevelClient.cs | 3 + 22 files changed, 498 insertions(+), 135 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/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index e143193073..6a5aa9f3dd 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -39,6 +39,7 @@ public static class CodeConfiguration { private static readonly Glob[] OperationsToInclude = { + new("cluster.allocation_explain"), new("dangling_indices.*"), new("ingest.*"), new("nodes.*"), diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index f542ad80f7..b796432de1 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 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}"}); diff --git a/src/OpenSearch.Client/Descriptors.Cluster.cs b/src/OpenSearch.Client/Descriptors.Cluster.cs index ee2804640b..5be8bc26b6 100644 --- a/src/OpenSearch.Client/Descriptors.Cluster.cs +++ b/src/OpenSearch.Client/Descriptors.Cluster.cs @@ -57,18 +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 { 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..e07c6041ac 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Cluster.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Cluster.cs @@ -57,36 +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: /// 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..1d2dfc8841 100644 --- a/src/OpenSearch.Client/Requests.Cluster.cs +++ b/src/OpenSearch.Client/Requests.Cluster.cs @@ -58,33 +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 { diff --git a/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs b/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs index b471341e0d..edf5cdc630 100644 --- a/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs @@ -45,6 +45,9 @@ namespace OpenSearch.Client { internal static partial class ApiUrlsLookups { + internal static readonly ApiUrls ClusterAllocationExplain = + new(new[] { "_cluster/allocation/explain" }); + internal static readonly ApiUrls DanglingIndicesDeleteDanglingIndex = new(new[] { "_dangling/{index_uuid}" }); diff --git a/src/OpenSearch.Client/_Generated/Descriptors.Cluster.cs b/src/OpenSearch.Client/_Generated/Descriptors.Cluster.cs new file mode 100644 index 0000000000..086423deb6 --- /dev/null +++ b/src/OpenSearch.Client/_Generated/Descriptors.Cluster.cs @@ -0,0 +1,83 @@ +/* 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.Specification.ClusterApi +{ + ///Descriptor for AllocationExplain https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-allocation/ + public partial class ClusterAllocationExplainDescriptor + : RequestDescriptorBase< + ClusterAllocationExplainDescriptor, + ClusterAllocationExplainRequestParameters, + IClusterAllocationExplainRequest + >, + IClusterAllocationExplainRequest + { + internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterAllocationExplain; + + // values part of the url path + // Request parameters + ///Return information about disk usage and shard sizes. + public ClusterAllocationExplainDescriptor IncludeDiskInfo(bool? includediskinfo = true) => + Qs("include_disk_info", includediskinfo); + + ///Return 'YES' decisions in explanation. + public ClusterAllocationExplainDescriptor IncludeYesDecisions( + bool? includeyesdecisions = true + ) => Qs("include_yes_decisions", includeyesdecisions); + } +} diff --git a/src/OpenSearch.Client/_Generated/IOpenSearchClient.cs b/src/OpenSearch.Client/_Generated/IOpenSearchClient.cs index 0f61375bcf..62f5947fb3 100644 --- a/src/OpenSearch.Client/_Generated/IOpenSearchClient.cs +++ b/src/OpenSearch.Client/_Generated/IOpenSearchClient.cs @@ -48,6 +48,7 @@ using System.Threading.Tasks; using System.Linq; using OpenSearch.Client; +using OpenSearch.Client.Specification.ClusterApi; using OpenSearch.Client.Specification.DanglingIndicesApi; using OpenSearch.Client.Specification.IngestApi; using OpenSearch.Client.Specification.NodesApi; @@ -61,6 +62,9 @@ namespace OpenSearch.Client /// 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..9fe52211d6 --- /dev/null +++ b/src/OpenSearch.Client/_Generated/OpenSearchClient.Cluster.cs @@ -0,0 +1,118 @@ +/* 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 + ); + } +} 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..839540270e --- /dev/null +++ b/src/OpenSearch.Client/_Generated/Requests.Cluster.cs @@ -0,0 +1,90 @@ +/* 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); + } + } +} diff --git a/src/OpenSearch.Client/_Generated/Requests.cs b/src/OpenSearch.Client/_Generated/Requests.cs index d3fc07b373..595d9f8cee 100644 --- a/src/OpenSearch.Client/_Generated/Requests.cs +++ b/src/OpenSearch.Client/_Generated/Requests.cs @@ -50,6 +50,7 @@ using System.Runtime.Serialization; using OpenSearch.Net; using OpenSearch.Net.Utf8Json; +using OpenSearch.Net.Specification.ClusterApi; using OpenSearch.Net.Specification.DanglingIndicesApi; using OpenSearch.Net.Specification.IngestApi; using OpenSearch.Net.Specification.NodesApi; diff --git a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs index 720586fd85..293c75fae8 100644 --- a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs +++ b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs @@ -51,26 +51,6 @@ // ReSharper disable once CheckNamespace namespace OpenSearch.Net.Specification.ClusterApi { - ///Request options for AllocationExplain https://opensearch.org/docs/latest/opensearch/rest-api/cluster-allocation/ - public class ClusterAllocationExplainRequestParameters : RequestParameters - { - public override HttpMethod DefaultHttpMethod => HttpMethod.POST; - public override bool SupportsBody => true; - ///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); - } - } - ///Request options for DeleteComponentTemplate https://opensearch.org/docs/latest/opensearch/index-templates/ public class DeleteComponentTemplateRequestParameters : RequestParameters { diff --git a/src/OpenSearch.Net/IOpenSearchLowLevelClient.Generated.cs b/src/OpenSearch.Net/IOpenSearchLowLevelClient.Generated.cs index 649a151bd2..6f60bc476a 100644 --- a/src/OpenSearch.Net/IOpenSearchLowLevelClient.Generated.cs +++ b/src/OpenSearch.Net/IOpenSearchLowLevelClient.Generated.cs @@ -72,12 +72,6 @@ LowLevelCatNamespace Cat get; } - ///Cluster APIs - LowLevelClusterNamespace Cluster - { - get; - } - ///Indices APIs LowLevelIndicesNamespace Indices { diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs index f59fc6f431..faf53432c1 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs @@ -27,13 +27,13 @@ */ // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ -// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ -// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ // ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ // ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ // ----------------------------------------------- -// -// This file is automatically generated +// +// This file is automatically generated // Please do not edit these files manually // Run the following in the root of the repos: // @@ -66,21 +66,6 @@ namespace OpenSearch.Net.Specification.ClusterApi /// public partial class LowLevelClusterNamespace : NamespacedClientProxy { - internal LowLevelClusterNamespace(OpenSearchLowLevelClient client): base(client) - { - } - - ///POST on /_cluster/allocation/explain https://opensearch.org/docs/latest/opensearch/rest-api/cluster-allocation/ - ///The index, shard, and primary flag to explain. Empty means 'explain the first unassigned shard' - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse AllocationExplain(PostData body, ClusterAllocationExplainRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(POST, "_cluster/allocation/explain", body, RequestParams(requestParameters)); - ///POST on /_cluster/allocation/explain https://opensearch.org/docs/latest/opensearch/rest-api/cluster-allocation/ - ///The index, shard, and primary flag to explain. Empty means 'explain the first unassigned shard' - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cluster.allocation_explain", "body")] - public Task AllocationExplainAsync(PostData body, ClusterAllocationExplainRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(POST, "_cluster/allocation/explain", ctx, body, RequestParams(requestParameters)); ///DELETE on /_component_template/{name} https://opensearch.org/docs/latest/opensearch/index-templates/ ///The name of the template ///Request specific configuration such as querystring parameters & request specific connection settings. diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.NoNamespace.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.NoNamespace.cs index f999383ab6..567e63a192 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.NoNamespace.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.NoNamespace.cs @@ -75,12 +75,6 @@ public LowLevelCatNamespace Cat private set; } - public LowLevelClusterNamespace Cluster - { - get; - private set; - } - public LowLevelIndicesNamespace Indices { get; @@ -90,7 +84,6 @@ public LowLevelIndicesNamespace Indices partial void SetupNamespaces() { Cat = new LowLevelCatNamespace(this); - Cluster = new LowLevelClusterNamespace(this); Indices = new LowLevelIndicesNamespace(this); } diff --git a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs new file mode 100644 index 0000000000..15cc6ca7d1 --- /dev/null +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs @@ -0,0 +1,76 @@ +/* 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; + +// ReSharper disable once CheckNamespace +namespace OpenSearch.Net.Specification.ClusterApi +{ + ///Request options for AllocationExplain https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-allocation/ + public partial class ClusterAllocationExplainRequestParameters + : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.POST; + public override bool SupportsBody => true; + + ///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); + } + } +} diff --git a/src/OpenSearch.Net/_Generated/IOpenSearchLowLevelClient.cs b/src/OpenSearch.Net/_Generated/IOpenSearchLowLevelClient.cs index 9e9d9ca975..8882fa62a0 100644 --- a/src/OpenSearch.Net/_Generated/IOpenSearchLowLevelClient.cs +++ b/src/OpenSearch.Net/_Generated/IOpenSearchLowLevelClient.cs @@ -50,6 +50,7 @@ using System.Threading; using System.Threading.Tasks; using OpenSearch.Net; +using OpenSearch.Net.Specification.ClusterApi; using OpenSearch.Net.Specification.DanglingIndicesApi; using OpenSearch.Net.Specification.IngestApi; using OpenSearch.Net.Specification.NodesApi; @@ -63,6 +64,9 @@ namespace OpenSearch.Net /// public partial interface IOpenSearchLowLevelClient { + ///Cluster APIs + LowLevelClusterNamespace Cluster { get; } + ///Dangling Indices APIs LowLevelDanglingIndicesNamespace DanglingIndices { get; } diff --git a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs new file mode 100644 index 0000000000..c8d3d87196 --- /dev/null +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs @@ -0,0 +1,105 @@ +/* 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.Collections.Specialized; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using OpenSearch.Net; +using static OpenSearch.Net.HttpMethod; + +// ReSharper disable InterpolatedStringExpressionIsNotIFormattable +// ReSharper disable once CheckNamespace +// ReSharper disable InterpolatedStringExpressionIsNotIFormattable +// ReSharper disable RedundantExtendsListEntry +namespace OpenSearch.Net.Specification.ClusterApi +{ + /// + /// Cluster APIs. + /// Not intended to be instantiated directly. Use the property + /// on . + /// + /// + public partial class LowLevelClusterNamespace : NamespacedClientProxy + { + internal LowLevelClusterNamespace(OpenSearchLowLevelClient client) + : base(client) { } + + ///POST on /_cluster/allocation/explain https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-allocation/ + ///The index, shard, and primary flag to explain. Empty means 'explain the first unassigned shard' + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse AllocationExplain( + PostData body, + ClusterAllocationExplainRequestParameters requestParameters = null + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest( + POST, + "_cluster/allocation/explain", + body, + RequestParams(requestParameters) + ); + + ///POST on /_cluster/allocation/explain https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-allocation/ + ///The index, shard, and primary flag to explain. Empty means 'explain the first unassigned shard' + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cluster.allocation_explain", "body")] + public Task AllocationExplainAsync( + PostData body, + ClusterAllocationExplainRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + POST, + "_cluster/allocation/explain", + ctx, + body, + RequestParams(requestParameters) + ); + } +} diff --git a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.cs b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.cs index ef62080270..6f3f7f67e2 100644 --- a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.cs +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.cs @@ -50,6 +50,7 @@ using System.Threading; using System.Threading.Tasks; using OpenSearch.Net; +using OpenSearch.Net.Specification.ClusterApi; using OpenSearch.Net.Specification.DanglingIndicesApi; using OpenSearch.Net.Specification.IngestApi; using OpenSearch.Net.Specification.NodesApi; @@ -66,6 +67,7 @@ namespace OpenSearch.Net /// public partial class OpenSearchLowLevelClient : IOpenSearchLowLevelClient { + public LowLevelClusterNamespace Cluster { get; private set; } public LowLevelDanglingIndicesNamespace DanglingIndices { get; private set; } public LowLevelIngestNamespace Ingest { get; private set; } public LowLevelNodesNamespace Nodes { get; private set; } @@ -74,6 +76,7 @@ public partial class OpenSearchLowLevelClient : IOpenSearchLowLevelClient partial void SetupGeneratedNamespaces() { + Cluster = new LowLevelClusterNamespace(this); DanglingIndices = new LowLevelDanglingIndicesNamespace(this); Ingest = new LowLevelIngestNamespace(this); Nodes = new LowLevelNodesNamespace(this); From 86a38c18478176c409b8be41c8dff240e3384175 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Wed, 6 Sep 2023 17:03:49 +1200 Subject: [PATCH 2/8] Re-generate `cluster.delete_component_template` Signed-off-by: Thomas Farr --- CHANGELOG.md | 2 +- .../Configuration/CodeConfiguration.cs | 2 + src/ApiGenerator/OpenSearch.openapi.json | 60 +++++++++++-------- .../RequestParameters.Cluster.cs | 29 --------- .../OpenSearchLowLevelClient.Cluster.cs | 11 ---- .../RequestParameters.Cluster.cs | 33 ++++++++++ .../OpenSearchLowLevelClient.Cluster.cs | 33 ++++++++++ 7 files changed, 103 insertions(+), 67 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c5fdf8411..be07c72df5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -97,4 +97,4 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) [Unreleased]: https://github.com/opensearch-project/opensearch-net/compare/v1.4.0...main [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 6a5aa9f3dd..61c61b5ff1 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -40,6 +40,8 @@ public static class CodeConfiguration private static readonly Glob[] OperationsToInclude = { new("cluster.allocation_explain"), + new("cluster.delete_component_template"), + 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.Net/Api/RequestParameters/RequestParameters.Cluster.cs b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs index 293c75fae8..0725551ac3 100644 --- a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs +++ b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs @@ -51,35 +51,6 @@ // ReSharper disable once CheckNamespace namespace OpenSearch.Net.Specification.ClusterApi { - ///Request options for DeleteComponentTemplate https://opensearch.org/docs/latest/opensearch/index-templates/ - public class DeleteComponentTemplateRequestParameters : RequestParameters - { - public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE; - public override bool SupportsBody => false; - ///Specify timeout for connection to master node - ///Deprecated as of OpenSearch 2.0, use instead - public TimeSpan MasterTimeout - { - get => Q("master_timeout"); - set => Q("master_timeout", value); - } - - ///Specify timeout for connection to cluster_manager node - ///Introduced in OpenSearch 2.0 instead of - public TimeSpan ClusterManagerTimeout - { - get => Q("cluster_manager_timeout"); - set => Q("cluster_manager_timeout", value); - } - - ///Explicit operation timeout - public TimeSpan Timeout - { - get => Q("timeout"); - set => Q("timeout", value); - } - } - ///Request options for DeleteVotingConfigExclusions public class DeleteVotingConfigExclusionsRequestParameters : RequestParameters { diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs index faf53432c1..1d91de233c 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs @@ -66,17 +66,6 @@ namespace OpenSearch.Net.Specification.ClusterApi /// public partial class LowLevelClusterNamespace : NamespacedClientProxy { - ///DELETE on /_component_template/{name} https://opensearch.org/docs/latest/opensearch/index-templates/ - ///The name of the template - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse DeleteComponentTemplate(string name, DeleteComponentTemplateRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(DELETE, Url($"_component_template/{name:name}"), null, RequestParams(requestParameters)); - ///DELETE on /_component_template/{name} https://opensearch.org/docs/latest/opensearch/index-templates/ - ///The name of the template - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cluster.delete_component_template", "name")] - public Task DeleteComponentTemplateAsync(string name, DeleteComponentTemplateRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(DELETE, Url($"_component_template/{name:name}"), ctx, null, RequestParams(requestParameters)); ///DELETE on /_cluster/voting_config_exclusions ///Request specific configuration such as querystring parameters & request specific connection settings. public TResponse DeleteVotingConfigExclusions(DeleteVotingConfigExclusionsRequestParameters 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 15cc6ca7d1..c6d5cf8b8f 100644 --- a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs @@ -73,4 +73,37 @@ public bool? IncludeYesDecisions set => Q("include_yes_decisions", value); } } + + ///Request options for DeleteComponentTemplate https://opensearch.org/docs/latest + public partial class DeleteComponentTemplateRequestParameters + : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE; + public override bool SupportsBody => false; + + ///Operation timeout for connection to cluster-manager node. + ///Supported by OpenSearch servers of version 2.0.0 or greater. + public TimeSpan ClusterManagerTimeout + { + get => Q("cluster_manager_timeout"); + set => Q("cluster_manager_timeout", value); + } + + ///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 c8d3d87196..70f6221a05 100644 --- a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs @@ -101,5 +101,38 @@ public Task AllocationExplainAsync( body, RequestParams(requestParameters) ); + + ///DELETE on /_component_template/{name} https://opensearch.org/docs/latest + ///The name of the template. + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse DeleteComponentTemplate( + string name, + DeleteComponentTemplateRequestParameters requestParameters = null + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest( + DELETE, + Url($"_component_template/{name:name}"), + null, + RequestParams(requestParameters) + ); + + ///DELETE on /_component_template/{name} https://opensearch.org/docs/latest + ///The name of the template. + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cluster.delete_component_template", "name")] + public Task DeleteComponentTemplateAsync( + string name, + DeleteComponentTemplateRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + DELETE, + Url($"_component_template/{name:name}"), + ctx, + null, + RequestParams(requestParameters) + ); } } From 5864e52fd268e233a65eb9389da3942f74f99824 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Wed, 6 Sep 2023 17:19:06 +1200 Subject: [PATCH 3/8] Re-generate `cluster.delete_voting_config_exclusions` Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 1 + src/OpenSearch.Client/ApiUrlsLookup.cs | 1 - src/OpenSearch.Client/Descriptors.Cluster.cs | 10 ---- .../OpenSearchClient.Cluster.cs | 24 -------- src/OpenSearch.Client/Requests.Cluster.cs | 20 ------- .../_Generated/ApiUrlsLookup.cs | 3 + .../_Generated/Descriptors.Cluster.cs | 18 ++++++ .../_Generated/OpenSearchClient.Cluster.cs | 59 +++++++++++++++++++ .../_Generated/Requests.Cluster.cs | 23 ++++++++ .../RequestParameters.Cluster.cs | 13 ---- .../OpenSearchLowLevelClient.Cluster.cs | 9 --- .../RequestParameters.Cluster.cs | 15 +++++ .../OpenSearchLowLevelClient.Cluster.cs | 29 +++++++++ 13 files changed, 148 insertions(+), 77 deletions(-) diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index 61c61b5ff1..672e4daaf2 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -41,6 +41,7 @@ public static class CodeConfiguration { new("cluster.allocation_explain"), new("cluster.delete_component_template"), + new("cluster.delete_voting_config_exclusions"), new("dangling_indices.*"), new("ingest.*"), diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index b796432de1..1391d0e81a 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 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"}); diff --git a/src/OpenSearch.Client/Descriptors.Cluster.cs b/src/OpenSearch.Client/Descriptors.Cluster.cs index 5be8bc26b6..46d01c8d7d 100644 --- a/src/OpenSearch.Client/Descriptors.Cluster.cs +++ b/src/OpenSearch.Client/Descriptors.Cluster.cs @@ -57,16 +57,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client.Specification.ClusterApi { - ///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 { diff --git a/src/OpenSearch.Client/OpenSearchClient.Cluster.cs b/src/OpenSearch.Client/OpenSearchClient.Cluster.cs index e07c6041ac..51dd5703fc 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 { - /// - /// 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: /// diff --git a/src/OpenSearch.Client/Requests.Cluster.cs b/src/OpenSearch.Client/Requests.Cluster.cs index 1d2dfc8841..2b8f22ac8b 100644 --- a/src/OpenSearch.Client/Requests.Cluster.cs +++ b/src/OpenSearch.Client/Requests.Cluster.cs @@ -58,26 +58,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client.Specification.ClusterApi { - [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 { diff --git a/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs b/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs index edf5cdc630..e081a510f4 100644 --- a/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs @@ -48,6 +48,9 @@ internal static partial class ApiUrlsLookups internal static readonly ApiUrls ClusterAllocationExplain = new(new[] { "_cluster/allocation/explain" }); + internal static readonly ApiUrls ClusterDeleteVotingConfigExclusions = + new(new[] { "_cluster/voting_config_exclusions" }); + internal static readonly ApiUrls DanglingIndicesDeleteDanglingIndex = new(new[] { "_dangling/{index_uuid}" }); diff --git a/src/OpenSearch.Client/_Generated/Descriptors.Cluster.cs b/src/OpenSearch.Client/_Generated/Descriptors.Cluster.cs index 086423deb6..b2f64fbcd0 100644 --- a/src/OpenSearch.Client/_Generated/Descriptors.Cluster.cs +++ b/src/OpenSearch.Client/_Generated/Descriptors.Cluster.cs @@ -80,4 +80,22 @@ public ClusterAllocationExplainDescriptor IncludeYesDecisions( bool? includeyesdecisions = true ) => Qs("include_yes_decisions", includeyesdecisions); } + + ///Descriptor for DeleteVotingConfigExclusions https://opensearch.org/docs/latest + public partial class DeleteVotingConfigExclusionsDescriptor + : RequestDescriptorBase< + DeleteVotingConfigExclusionsDescriptor, + DeleteVotingConfigExclusionsRequestParameters, + IDeleteVotingConfigExclusionsRequest + >, + 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); + } } diff --git a/src/OpenSearch.Client/_Generated/OpenSearchClient.Cluster.cs b/src/OpenSearch.Client/_Generated/OpenSearchClient.Cluster.cs index 9fe52211d6..3e12f05246 100644 --- a/src/OpenSearch.Client/_Generated/OpenSearchClient.Cluster.cs +++ b/src/OpenSearch.Client/_Generated/OpenSearchClient.Cluster.cs @@ -114,5 +114,64 @@ public Task AllocationExplainAsync( 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); } } diff --git a/src/OpenSearch.Client/_Generated/Requests.Cluster.cs b/src/OpenSearch.Client/_Generated/Requests.Cluster.cs index 839540270e..0e3adf868c 100644 --- a/src/OpenSearch.Client/_Generated/Requests.Cluster.cs +++ b/src/OpenSearch.Client/_Generated/Requests.Cluster.cs @@ -87,4 +87,27 @@ public bool? IncludeYesDecisions 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); + } + } } diff --git a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs index 0725551ac3..e0ac5ee6fb 100644 --- a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs +++ b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs @@ -51,19 +51,6 @@ // ReSharper disable once CheckNamespace namespace OpenSearch.Net.Specification.ClusterApi { - ///Request options for DeleteVotingConfigExclusions - public class DeleteVotingConfigExclusionsRequestParameters : RequestParameters - { - public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE; - public override bool SupportsBody => false; - ///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); - } - } - ///Request options for ExistsComponentTemplate https://opensearch.org/docs/latest/opensearch/index-templates/ public class ExistsComponentTemplateRequestParameters : RequestParameters { diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs index 1d91de233c..a531d3fb72 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 { - ///DELETE on /_cluster/voting_config_exclusions - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse DeleteVotingConfigExclusions(DeleteVotingConfigExclusionsRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(DELETE, "_cluster/voting_config_exclusions", null, RequestParams(requestParameters)); - ///DELETE on /_cluster/voting_config_exclusions - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cluster.delete_voting_config_exclusions", "")] - public Task DeleteVotingConfigExclusionsAsync(DeleteVotingConfigExclusionsRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(DELETE, "_cluster/voting_config_exclusions", ctx, null, RequestParams(requestParameters)); ///HEAD on /_component_template/{name} https://opensearch.org/docs/latest/opensearch/index-templates/ ///The name of the template ///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 c6d5cf8b8f..292063e084 100644 --- a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs @@ -106,4 +106,19 @@ public TimeSpan Timeout set => Q("timeout", value); } } + + ///Request options for DeleteVotingConfigExclusions https://opensearch.org/docs/latest + public partial class DeleteVotingConfigExclusionsRequestParameters + : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.DELETE; + public override bool SupportsBody => false; + + ///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); + } + } } diff --git a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs index 70f6221a05..65537df411 100644 --- a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs @@ -134,5 +134,34 @@ public Task DeleteComponentTemplateAsync( null, RequestParams(requestParameters) ); + + ///DELETE on /_cluster/voting_config_exclusions https://opensearch.org/docs/latest + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse DeleteVotingConfigExclusions( + DeleteVotingConfigExclusionsRequestParameters requestParameters = null + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest( + DELETE, + "_cluster/voting_config_exclusions", + null, + RequestParams(requestParameters) + ); + + ///DELETE on /_cluster/voting_config_exclusions https://opensearch.org/docs/latest + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cluster.delete_voting_config_exclusions", "")] + public Task DeleteVotingConfigExclusionsAsync( + DeleteVotingConfigExclusionsRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + DELETE, + "_cluster/voting_config_exclusions", + ctx, + null, + RequestParams(requestParameters) + ); } } From 3fbfb734679fb366d1117f93d5581b768da5ee01 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Thu, 7 Sep 2023 14:12:04 +1200 Subject: [PATCH 4/8] Re-generate `cluster.exists_component_template` Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 1 + .../RequestParameters.Cluster.cs | 29 ---------------- .../OpenSearchLowLevelClient.Cluster.cs | 11 ------- .../RequestParameters.Cluster.cs | 25 ++++++++++++++ .../OpenSearchLowLevelClient.Cluster.cs | 33 +++++++++++++++++++ 5 files changed, 59 insertions(+), 40 deletions(-) diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index 672e4daaf2..87ad84d5d2 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -42,6 +42,7 @@ public static class CodeConfiguration new("cluster.allocation_explain"), new("cluster.delete_component_template"), new("cluster.delete_voting_config_exclusions"), + new("cluster.exists_component_template"), new("dangling_indices.*"), new("ingest.*"), diff --git a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs index e0ac5ee6fb..c5ae7a868f 100644 --- a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs +++ b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs @@ -51,35 +51,6 @@ // ReSharper disable once CheckNamespace namespace OpenSearch.Net.Specification.ClusterApi { - ///Request options for ExistsComponentTemplate https://opensearch.org/docs/latest/opensearch/index-templates/ - public class ExistsComponentTemplateRequestParameters : RequestParameters - { - public override HttpMethod DefaultHttpMethod => HttpMethod.HEAD; - public override bool SupportsBody => false; - ///Return local information, do not retrieve the state from cluster_manager node (default: false) - public bool? Local - { - get => Q("local"); - set => Q("local", value); - } - - ///Explicit operation timeout for connection to master node - ///Deprecated as of OpenSearch 2.0, use instead - public TimeSpan MasterTimeout - { - get => Q("master_timeout"); - set => Q("master_timeout", value); - } - - ///Explicit operation timeout for connection to cluster_manager node - ///Introduced in OpenSearch 2.0 instead of - public TimeSpan ClusterManagerTimeout - { - get => Q("cluster_manager_timeout"); - set => Q("cluster_manager_timeout", value); - } - } - ///Request options for GetComponentTemplate https://opensearch.org/docs/latest/opensearch/index-templates/ public class GetComponentTemplateRequestParameters : RequestParameters { diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs index a531d3fb72..1ebd9b697a 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs @@ -66,17 +66,6 @@ namespace OpenSearch.Net.Specification.ClusterApi /// public partial class LowLevelClusterNamespace : NamespacedClientProxy { - ///HEAD on /_component_template/{name} https://opensearch.org/docs/latest/opensearch/index-templates/ - ///The name of the template - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse ExistsComponentTemplate(string name, ExistsComponentTemplateRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(HEAD, Url($"_component_template/{name:name}"), null, RequestParams(requestParameters)); - ///HEAD on /_component_template/{name} https://opensearch.org/docs/latest/opensearch/index-templates/ - ///The name of the template - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cluster.exists_component_template", "name")] - public Task ExistsComponentTemplateAsync(string name, ExistsComponentTemplateRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(HEAD, Url($"_component_template/{name:name}"), ctx, null, RequestParams(requestParameters)); ///GET on /_component_template https://opensearch.org/docs/latest/opensearch/index-templates/ ///Request specific configuration such as querystring parameters & request specific connection settings. public TResponse GetComponentTemplate(GetComponentTemplateRequestParameters 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 292063e084..c3329e3cad 100644 --- a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs @@ -121,4 +121,29 @@ public bool? WaitForRemoval set => Q("wait_for_removal", value); } } + + ///Request options for ExistsComponentTemplate https://opensearch.org/docs/latest + public partial class ExistsComponentTemplateRequestParameters + : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.HEAD; + public override bool SupportsBody => false; + + ///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); + } + } } diff --git a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs index 65537df411..4c7201ba7b 100644 --- a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs @@ -163,5 +163,38 @@ public Task DeleteVotingConfigExclusionsAsync( null, RequestParams(requestParameters) ); + + ///HEAD on /_component_template/{name} https://opensearch.org/docs/latest + ///The name of the template. + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse ExistsComponentTemplate( + string name, + ExistsComponentTemplateRequestParameters requestParameters = null + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest( + HEAD, + Url($"_component_template/{name:name}"), + null, + RequestParams(requestParameters) + ); + + ///HEAD on /_component_template/{name} https://opensearch.org/docs/latest + ///The name of the template. + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cluster.exists_component_template", "name")] + public Task ExistsComponentTemplateAsync( + string name, + ExistsComponentTemplateRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + HEAD, + Url($"_component_template/{name:name}"), + ctx, + null, + RequestParams(requestParameters) + ); } } From f5564e1484aa575bf08a90d6580e403f0365bdc3 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Thu, 7 Sep 2023 14:28:10 +1200 Subject: [PATCH 5/8] Re-generate `cluster.get_component_template` Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 1 + .../RequestParameters.Cluster.cs | 29 --------- .../OpenSearchLowLevelClient.Cluster.cs | 20 ------ .../RequestParameters.Cluster.cs | 33 ++++++++++ .../OpenSearchLowLevelClient.Cluster.cs | 62 +++++++++++++++++++ 5 files changed, 96 insertions(+), 49 deletions(-) diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index 87ad84d5d2..b9e2f22104 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -43,6 +43,7 @@ public static class CodeConfiguration new("cluster.delete_component_template"), new("cluster.delete_voting_config_exclusions"), new("cluster.exists_component_template"), + new("cluster.get_component_template"), new("dangling_indices.*"), new("ingest.*"), diff --git a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs index c5ae7a868f..d6b573591e 100644 --- a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs +++ b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs @@ -51,35 +51,6 @@ // ReSharper disable once CheckNamespace namespace OpenSearch.Net.Specification.ClusterApi { - ///Request options for GetComponentTemplate https://opensearch.org/docs/latest/opensearch/index-templates/ - public class GetComponentTemplateRequestParameters : RequestParameters - { - public override HttpMethod DefaultHttpMethod => HttpMethod.GET; - public override bool SupportsBody => false; - ///Return local information, do not retrieve the state from cluster_manager node (default: false) - public bool? Local - { - get => Q("local"); - set => Q("local", value); - } - - ///Explicit operation timeout for connection to master node - ///Deprecated as of OpenSearch 2.0, use instead - public TimeSpan MasterTimeout - { - get => Q("master_timeout"); - set => Q("master_timeout", value); - } - - ///Explicit operation timeout for connection to cluster_manager node - ///Introduced in OpenSearch 2.0 instead of - public TimeSpan ClusterManagerTimeout - { - get => Q("cluster_manager_timeout"); - set => Q("cluster_manager_timeout", value); - } - } - ///Request options for GetSettings https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/ public class ClusterGetSettingsRequestParameters : RequestParameters { diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs index 1ebd9b697a..433f660227 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs @@ -66,26 +66,6 @@ namespace OpenSearch.Net.Specification.ClusterApi /// public partial class LowLevelClusterNamespace : NamespacedClientProxy { - ///GET on /_component_template https://opensearch.org/docs/latest/opensearch/index-templates/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse GetComponentTemplate(GetComponentTemplateRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, "_component_template", null, RequestParams(requestParameters)); - ///GET on /_component_template https://opensearch.org/docs/latest/opensearch/index-templates/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cluster.get_component_template", "")] - public Task GetComponentTemplateAsync(GetComponentTemplateRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, "_component_template", ctx, null, RequestParams(requestParameters)); - ///GET on /_component_template/{name} https://opensearch.org/docs/latest/opensearch/index-templates/ - ///The comma separated names of the component templates - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse GetComponentTemplate(string name, GetComponentTemplateRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, Url($"_component_template/{name:name}"), null, RequestParams(requestParameters)); - ///GET on /_component_template/{name} https://opensearch.org/docs/latest/opensearch/index-templates/ - ///The comma separated names of the component templates - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cluster.get_component_template", "name")] - public Task GetComponentTemplateAsync(string name, GetComponentTemplateRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, Url($"_component_template/{name:name}"), ctx, null, RequestParams(requestParameters)); ///GET on /_cluster/settings https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/ ///Request specific configuration such as querystring parameters & request specific connection settings. public TResponse GetSettings(ClusterGetSettingsRequestParameters 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 c3329e3cad..c2d05cf1c0 100644 --- a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs @@ -146,4 +146,37 @@ public TimeSpan MasterTimeout set => Q("master_timeout", value); } } + + ///Request options for GetComponentTemplate https://opensearch.org/docs/latest + public partial class GetComponentTemplateRequestParameters + : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + public override bool SupportsBody => false; + + ///Operation timeout for connection to cluster-manager node. + ///Supported by OpenSearch servers of version 2.0.0 or greater. + public TimeSpan ClusterManagerTimeout + { + get => Q("cluster_manager_timeout"); + set => Q("cluster_manager_timeout", value); + } + + ///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); + } + } } diff --git a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs index 4c7201ba7b..88310eea1b 100644 --- a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs @@ -196,5 +196,67 @@ public Task ExistsComponentTemplateAsync( null, RequestParams(requestParameters) ); + + ///GET on /_component_template https://opensearch.org/docs/latest + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse GetComponentTemplate( + GetComponentTemplateRequestParameters requestParameters = null + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest( + GET, + "_component_template", + null, + RequestParams(requestParameters) + ); + + ///GET on /_component_template https://opensearch.org/docs/latest + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cluster.get_component_template", "")] + public Task GetComponentTemplateAsync( + GetComponentTemplateRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + "_component_template", + ctx, + null, + RequestParams(requestParameters) + ); + + ///GET on /_component_template/{name} https://opensearch.org/docs/latest + ///The Comma-separated names of the component templates. + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse GetComponentTemplate( + string name, + GetComponentTemplateRequestParameters requestParameters = null + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest( + GET, + Url($"_component_template/{name:name}"), + null, + RequestParams(requestParameters) + ); + + ///GET on /_component_template/{name} https://opensearch.org/docs/latest + ///The Comma-separated names of the component templates. + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cluster.get_component_template", "name")] + public Task GetComponentTemplateAsync( + string name, + GetComponentTemplateRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + Url($"_component_template/{name:name}"), + ctx, + null, + RequestParams(requestParameters) + ); } } From aee800bfbc81e281c3cce4c1afe001784e40b240 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Thu, 7 Sep 2023 14:46:52 +1200 Subject: [PATCH 6/8] Re-generate `cluster.get_settings` Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 1 + src/OpenSearch.Client/ApiUrlsLookup.cs | 1 - src/OpenSearch.Client/Descriptors.Cluster.cs | 20 ------- .../OpenSearchClient.Cluster.cs | 24 -------- src/OpenSearch.Client/Requests.Cluster.cs | 50 ----------------- .../_Generated/ApiUrlsLookup.cs | 2 + .../_Generated/Descriptors.Cluster.cs | 37 +++++++++++++ .../_Generated/OpenSearchClient.Cluster.cs | 45 +++++++++++++++ .../_Generated/Requests.Cluster.cs | 55 +++++++++++++++++++ .../RequestParameters.Cluster.cs | 43 --------------- .../OpenSearchLowLevelClient.Cluster.cs | 9 --- .../RequestParameters.Cluster.cs | 47 ++++++++++++++++ .../OpenSearchLowLevelClient.Cluster.cs | 24 ++++++++ 13 files changed, 211 insertions(+), 147 deletions(-) diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index b9e2f22104..d8f649e091 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -44,6 +44,7 @@ public static class CodeConfiguration new("cluster.delete_voting_config_exclusions"), new("cluster.exists_component_template"), new("cluster.get_component_template"), + new("cluster.get_settings"), new("dangling_indices.*"), new("ingest.*"), diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index 1391d0e81a..5874f870a3 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 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"}); diff --git a/src/OpenSearch.Client/Descriptors.Cluster.cs b/src/OpenSearch.Client/Descriptors.Cluster.cs index 46d01c8d7d..e7d018c578 100644 --- a/src/OpenSearch.Client/Descriptors.Cluster.cs +++ b/src/OpenSearch.Client/Descriptors.Cluster.cs @@ -57,26 +57,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client.Specification.ClusterApi { - ///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 { diff --git a/src/OpenSearch.Client/OpenSearchClient.Cluster.cs b/src/OpenSearch.Client/OpenSearchClient.Cluster.cs index 51dd5703fc..1b4b35cfd7 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.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: /// diff --git a/src/OpenSearch.Client/Requests.Cluster.cs b/src/OpenSearch.Client/Requests.Cluster.cs index 2b8f22ac8b..3785375076 100644 --- a/src/OpenSearch.Client/Requests.Cluster.cs +++ b/src/OpenSearch.Client/Requests.Cluster.cs @@ -58,56 +58,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client.Specification.ClusterApi { - [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 class LowLevelClusterNamespace : NamespacedClientProxy { - ///GET on /_cluster/settings https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse GetSettings(ClusterGetSettingsRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, "_cluster/settings", null, RequestParams(requestParameters)); - ///GET on /_cluster/settings https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cluster.get_settings", "")] - public Task GetSettingsAsync(ClusterGetSettingsRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, "_cluster/settings", ctx, null, RequestParams(requestParameters)); ///GET on /_cluster/health https://opensearch.org/docs/latest/opensearch/rest-api/cluster-health/ ///Request specific configuration such as querystring parameters & request specific connection settings. public TResponse Health(ClusterHealthRequestParameters 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 c2d05cf1c0..1e4bd96a4c 100644 --- a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs @@ -179,4 +179,51 @@ public TimeSpan MasterTimeout set => Q("master_timeout", value); } } + + ///Request options for GetSettings https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-settings/ + public partial class ClusterGetSettingsRequestParameters + : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + public override bool SupportsBody => false; + + ///Operation timeout for connection to cluster-manager node. + ///Supported by OpenSearch servers of version 2.0.0 or greater. + public TimeSpan ClusterManagerTimeout + { + get => Q("cluster_manager_timeout"); + set => Q("cluster_manager_timeout", value); + } + + ///Return settings in flat format. + 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); + } + + ///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 88310eea1b..0fa26aece1 100644 --- a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs @@ -258,5 +258,29 @@ public Task GetComponentTemplateAsync( null, RequestParams(requestParameters) ); + + ///GET on /_cluster/settings https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-settings/ + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse GetSettings( + ClusterGetSettingsRequestParameters requestParameters = null + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest(GET, "_cluster/settings", null, RequestParams(requestParameters)); + + ///GET on /_cluster/settings https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-settings/ + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cluster.get_settings", "")] + public Task GetSettingsAsync( + ClusterGetSettingsRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + "_cluster/settings", + ctx, + null, + RequestParams(requestParameters) + ); } } From a1f117497216e278990966c3edbfc681d1d077d8 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Thu, 7 Sep 2023 15:32:58 +1200 Subject: [PATCH 7/8] Re-generate `cluster.health` Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 1 + src/OpenSearch.Client/ApiUrlsLookup.cs | 1 - src/OpenSearch.Client/Descriptors.Cluster.cs | 53 ------ .../OpenSearchClient.Cluster.cs | 24 --- src/OpenSearch.Client/Requests.Cluster.cs | 117 ------------- .../_Generated/ApiUrlsLookup.cs | 3 + .../_Generated/Descriptors.Cluster.cs | 98 +++++++++++ .../_Generated/OpenSearchClient.Cluster.cs | 51 ++++++ .../_Generated/Requests.Cluster.cs | 132 ++++++++++++++ src/OpenSearch.Net/Api/Enums.cs | 101 ----------- .../RequestParameters.Cluster.cs | 92 ---------- .../OpenSearchLowLevelClient.Cluster.cs | 20 --- src/OpenSearch.Net/_Generated/Api/Enums.cs | 162 ++++++++++++++++++ .../RequestParameters.Cluster.cs | 110 ++++++++++++ .../OpenSearchLowLevelClient.Cluster.cs | 55 ++++++ .../ClusterHealth/ClusterHealthApiTests.cs | 4 +- 16 files changed, 614 insertions(+), 410 deletions(-) diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index d8f649e091..c9b709fcdf 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -45,6 +45,7 @@ public static class CodeConfiguration new("cluster.exists_component_template"), new("cluster.get_component_template"), new("cluster.get_settings"), + new("cluster.health"), new("dangling_indices.*"), new("ingest.*"), diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index 5874f870a3..de4d812cff 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 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"}); diff --git a/src/OpenSearch.Client/Descriptors.Cluster.cs b/src/OpenSearch.Client/Descriptors.Cluster.cs index e7d018c578..10e6cc7598 100644 --- a/src/OpenSearch.Client/Descriptors.Cluster.cs +++ b/src/OpenSearch.Client/Descriptors.Cluster.cs @@ -57,59 +57,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client.Specification.ClusterApi { - ///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 { diff --git a/src/OpenSearch.Client/OpenSearchClient.Cluster.cs b/src/OpenSearch.Client/OpenSearchClient.Cluster.cs index 1b4b35cfd7..93c2307d14 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.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: /// diff --git a/src/OpenSearch.Client/Requests.Cluster.cs b/src/OpenSearch.Client/Requests.Cluster.cs index 3785375076..9a81b38dba 100644 --- a/src/OpenSearch.Client/Requests.Cluster.cs +++ b/src/OpenSearch.Client/Requests.Cluster.cs @@ -58,123 +58,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client.Specification.ClusterApi { - [InterfaceDataContract] - public partial interface IClusterHealthRequest : IRequest - { - [IgnoreDataMember] - Indices Index - { - get; - } - } - - ///Request for Health https://opensearch.org/docs/latest/opensearch/rest-api/cluster-health/ - public partial class ClusterHealthRequest : PlainRequestBase, IClusterHealthRequest - { - protected IClusterHealthRequest Self => this; - internal override ApiUrls ApiUrls => ApiUrlsLookups.ClusterHealth; - ////_cluster/health - public ClusterHealthRequest(): base() - { - } - - ////_cluster/health/{index} - ///Optional, accepts null - public ClusterHealthRequest(Indices index): base(r => r.Optional("index", index)) - { - } - - // values part of the url path - [IgnoreDataMember] - Indices IClusterHealthRequest.Index => Self.RouteValues.Get("index"); - // Request parameters - ///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); - } - - ///Specify the level of detail for returned information - public Level? Level - { - get => Q("level"); - set => Q("level", value); - } - - ///Return local information, do not retrieve the state from cluster_manager node (default: false) - public bool? Local - { - get => Q("local"); - set => Q("local", value); - } - - ///Explicit operation timeout for connection to master node - ///Deprecated as of OpenSearch 2.0, use instead - public Time MasterTimeout - { - get => Q public partial class LowLevelClusterNamespace : NamespacedClientProxy { - ///GET on /_cluster/health https://opensearch.org/docs/latest/opensearch/rest-api/cluster-health/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse Health(ClusterHealthRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, "_cluster/health", null, RequestParams(requestParameters)); - ///GET on /_cluster/health https://opensearch.org/docs/latest/opensearch/rest-api/cluster-health/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cluster.health", "")] - public Task HealthAsync(ClusterHealthRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, "_cluster/health", ctx, null, RequestParams(requestParameters)); - ///GET on /_cluster/health/{index} https://opensearch.org/docs/latest/opensearch/rest-api/cluster-health/ - ///Limit the information returned to a specific index - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse Health(string index, ClusterHealthRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, Url($"_cluster/health/{index:index}"), null, RequestParams(requestParameters)); - ///GET on /_cluster/health/{index} https://opensearch.org/docs/latest/opensearch/rest-api/cluster-health/ - ///Limit the information returned to a specific index - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cluster.health", "index")] - public Task HealthAsync(string index, ClusterHealthRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, Url($"_cluster/health/{index:index}"), ctx, null, RequestParams(requestParameters)); ///GET on /_cluster/pending_tasks https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-pending-tasks/ ///Request specific configuration such as querystring parameters & request specific connection settings. public TResponse PendingTasks(ClusterPendingTasksRequestParameters requestParameters = null) diff --git a/src/OpenSearch.Net/_Generated/Api/Enums.cs b/src/OpenSearch.Net/_Generated/Api/Enums.cs index c6f7705188..9a7b3ce13c 100644 --- a/src/OpenSearch.Net/_Generated/Api/Enums.cs +++ b/src/OpenSearch.Net/_Generated/Api/Enums.cs @@ -191,6 +191,76 @@ public enum NodesUsageMetric All = 1 << 1 } + [StringEnum] + public enum ExpandWildcards + { + [EnumMember(Value = "all")] + All, + + [EnumMember(Value = "open")] + Open, + + [EnumMember(Value = "closed")] + Closed, + + [EnumMember(Value = "hidden")] + Hidden, + + [EnumMember(Value = "none")] + None + } + + [StringEnum] + public enum ClusterHealthLevel + { + [EnumMember(Value = "cluster")] + Cluster, + + [EnumMember(Value = "indices")] + Indices, + + [EnumMember(Value = "shards")] + Shards, + + [EnumMember(Value = "awareness_attributes")] + AwarenessAttributes + } + + [StringEnum] + public enum WaitForEvents + { + [EnumMember(Value = "immediate")] + Immediate, + + [EnumMember(Value = "urgent")] + Urgent, + + [EnumMember(Value = "high")] + High, + + [EnumMember(Value = "normal")] + Normal, + + [EnumMember(Value = "low")] + Low, + + [EnumMember(Value = "languid")] + Languid + } + + [StringEnum] + public enum WaitForStatus + { + [EnumMember(Value = "green")] + Green, + + [EnumMember(Value = "yellow")] + Yellow, + + [EnumMember(Value = "red")] + Red + } + [StringEnum] public enum SampleType { @@ -250,6 +320,22 @@ static partial void RegisterEnumStringResolvers() typeof(NodesUsageMetric), e => GetStringValue((NodesUsageMetric)e) ); + EnumStringResolvers.TryAdd( + typeof(ExpandWildcards), + e => GetStringValue((ExpandWildcards)e) + ); + EnumStringResolvers.TryAdd( + typeof(ClusterHealthLevel), + e => GetStringValue((ClusterHealthLevel)e) + ); + EnumStringResolvers.TryAdd( + typeof(WaitForEvents), + e => GetStringValue((WaitForEvents)e) + ); + EnumStringResolvers.TryAdd( + typeof(WaitForStatus), + e => GetStringValue((WaitForStatus)e) + ); EnumStringResolvers.TryAdd(typeof(SampleType), e => GetStringValue((SampleType)e)); EnumStringResolvers.TryAdd( typeof(NodesStatLevel), @@ -364,6 +450,82 @@ public static string GetStringValue(this NodesUsageMetric enumValue) return string.Join(",", list); } + public static string GetStringValue(this ExpandWildcards enumValue) + { + switch (enumValue) + { + case ExpandWildcards.All: + return "all"; + case ExpandWildcards.Open: + return "open"; + case ExpandWildcards.Closed: + return "closed"; + case ExpandWildcards.Hidden: + return "hidden"; + case ExpandWildcards.None: + return "none"; + } + throw new ArgumentException( + $"'{enumValue.ToString()}' is not a valid value for enum 'ExpandWildcards'" + ); + } + + public static string GetStringValue(this ClusterHealthLevel enumValue) + { + switch (enumValue) + { + case ClusterHealthLevel.Cluster: + return "cluster"; + case ClusterHealthLevel.Indices: + return "indices"; + case ClusterHealthLevel.Shards: + return "shards"; + case ClusterHealthLevel.AwarenessAttributes: + return "awareness_attributes"; + } + throw new ArgumentException( + $"'{enumValue.ToString()}' is not a valid value for enum 'ClusterHealthLevel'" + ); + } + + public static string GetStringValue(this WaitForEvents enumValue) + { + switch (enumValue) + { + case WaitForEvents.Immediate: + return "immediate"; + case WaitForEvents.Urgent: + return "urgent"; + case WaitForEvents.High: + return "high"; + case WaitForEvents.Normal: + return "normal"; + case WaitForEvents.Low: + return "low"; + case WaitForEvents.Languid: + return "languid"; + } + throw new ArgumentException( + $"'{enumValue.ToString()}' is not a valid value for enum 'WaitForEvents'" + ); + } + + public static string GetStringValue(this WaitForStatus enumValue) + { + switch (enumValue) + { + case WaitForStatus.Green: + return "green"; + case WaitForStatus.Yellow: + return "yellow"; + case WaitForStatus.Red: + return "red"; + } + throw new ArgumentException( + $"'{enumValue.ToString()}' is not a valid value for enum 'WaitForStatus'" + ); + } + public static string GetStringValue(this SampleType enumValue) { switch (enumValue) diff --git a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs index 1e4bd96a4c..9a904d0678 100644 --- a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs @@ -226,4 +226,114 @@ public TimeSpan Timeout set => Q("timeout", value); } } + + ///Request options for Health https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-health/ + public partial class ClusterHealthRequestParameters + : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + public override bool SupportsBody => false; + + ///The awareness attribute for which the health is required. + public string AwarenessAttribute + { + get => Q("awareness_attribute"); + set => Q("awareness_attribute", value); + } + + ///Specify the level of detail for returned information. + public ClusterHealthLevel? ClusterHealthLevel + { + get => Q("level"); + set => Q("level", 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); + } + + ///Checks whether local node is commissioned or not. If set to true on a local call it will throw exception if node is decommissioned. + public bool? EnsureNodeCommissioned + { + get => Q("ensure_node_commissioned"); + set => Q("ensure_node_commissioned", 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 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); + } + + ///Operation timeout. + public TimeSpan Timeout + { + get => Q("timeout"); + set => Q("timeout", value); + } + + ///Wait until the specified number of shards is active. + public string WaitForActiveShards + { + get => Q("wait_for_active_shards"); + set => Q("wait_for_active_shards", value); + } + + ///Wait until all currently queued events with the given priority are processed. + public WaitForEvents? WaitForEvents + { + get => Q("wait_for_events"); + set => Q("wait_for_events", value); + } + + ///Wait until the specified number of nodes is available. + public string WaitForNodes + { + get => Q("wait_for_nodes"); + set => Q("wait_for_nodes", value); + } + + ///Whether to wait until there are no initializing shards in the cluster. + public bool? WaitForNoInitializingShards + { + get => Q("wait_for_no_initializing_shards"); + set => Q("wait_for_no_initializing_shards", value); + } + + ///Whether to wait until there are no relocating shards in the cluster. + public bool? WaitForNoRelocatingShards + { + get => Q("wait_for_no_relocating_shards"); + set => Q("wait_for_no_relocating_shards", value); + } + + ///Wait until cluster is in a specific state. + public WaitForStatus? WaitForStatus + { + get => Q("wait_for_status"); + set => Q("wait_for_status", value); + } + } } diff --git a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs index 0fa26aece1..454f8c56fa 100644 --- a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs @@ -282,5 +282,60 @@ public Task GetSettingsAsync( null, RequestParams(requestParameters) ); + + ///GET on /_cluster/health https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-health/ + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse Health(ClusterHealthRequestParameters requestParameters = null) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest(GET, "_cluster/health", null, RequestParams(requestParameters)); + + ///GET on /_cluster/health https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-health/ + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cluster.health", "")] + public Task HealthAsync( + ClusterHealthRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + "_cluster/health", + ctx, + null, + RequestParams(requestParameters) + ); + + ///GET on /_cluster/health/{index} https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-health/ + ///Limit the information returned to specific indicies. + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse Health( + string index, + ClusterHealthRequestParameters requestParameters = null + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest( + GET, + Url($"_cluster/health/{index:index}"), + null, + RequestParams(requestParameters) + ); + + ///GET on /_cluster/health/{index} https://opensearch.org/docs/latest/api-reference/cluster-api/cluster-health/ + ///Limit the information returned to specific indicies. + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cluster.health", "index")] + public Task HealthAsync( + string index, + ClusterHealthRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + Url($"_cluster/health/{index:index}"), + ctx, + null, + RequestParams(requestParameters) + ); } } diff --git a/tests/Tests/Cluster/ClusterHealth/ClusterHealthApiTests.cs b/tests/Tests/Cluster/ClusterHealth/ClusterHealthApiTests.cs index d8df8e5d1b..2d2ea2fff1 100644 --- a/tests/Tests/Cluster/ClusterHealth/ClusterHealthApiTests.cs +++ b/tests/Tests/Cluster/ClusterHealth/ClusterHealthApiTests.cs @@ -77,9 +77,9 @@ public ClusterHealthShardsApiTests(ReadOnlyCluster cluster, EndpointUsage usage) protected override bool ExpectIsValid => true; protected override int ExpectStatusCode => 200; - protected override Func Fluent => c => c.Level(Level.Shards); + protected override Func Fluent => c => c.ClusterHealthLevel(ClusterHealthLevel.Shards); protected override HttpMethod HttpMethod => HttpMethod.GET; - protected override ClusterHealthRequest Initializer => new ClusterHealthRequest { Level = Level.Shards }; + protected override ClusterHealthRequest Initializer => new ClusterHealthRequest { ClusterHealthLevel = ClusterHealthLevel.Shards }; protected override string UrlPath => "/_cluster/health?level=shards"; protected override LazyResponses ClientUsage() => Calls( From 7a246220403b4d08cd2a7b2a1d37a64ebbb74196 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Thu, 7 Sep 2023 16:34:10 +1200 Subject: [PATCH 8/8] Re-generate `cluster.pending_tasks` Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 1 + src/OpenSearch.Client/ApiUrlsLookup.cs | 1 - src/OpenSearch.Client/Descriptors.Cluster.cs | 16 ------- .../OpenSearchClient.Cluster.cs | 24 ---------- src/OpenSearch.Client/Requests.Cluster.cs | 36 --------------- .../_Generated/ApiUrlsLookup.cs | 3 ++ .../_Generated/Descriptors.Cluster.cs | 29 ++++++++++++ .../_Generated/OpenSearchClient.Cluster.cs | 45 +++++++++++++++++++ .../_Generated/Requests.Cluster.cs | 41 +++++++++++++++++ .../RequestParameters.Cluster.cs | 29 ------------ .../OpenSearchLowLevelClient.Cluster.cs | 9 ---- .../RequestParameters.Cluster.cs | 33 ++++++++++++++ .../OpenSearchLowLevelClient.Cluster.cs | 29 ++++++++++++ 13 files changed, 181 insertions(+), 115 deletions(-) diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index c9b709fcdf..8e182c4d14 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -46,6 +46,7 @@ public static class CodeConfiguration new("cluster.get_component_template"), new("cluster.get_settings"), new("cluster.health"), + new("cluster.pending_tasks"), new("dangling_indices.*"), new("ingest.*"), diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index de4d812cff..4bb7d9d61a 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 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 10e6cc7598..83fdbea648 100644 --- a/src/OpenSearch.Client/Descriptors.Cluster.cs +++ b/src/OpenSearch.Client/Descriptors.Cluster.cs @@ -57,22 +57,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client.Specification.ClusterApi { - ///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/OpenSearchClient.Cluster.cs b/src/OpenSearch.Client/OpenSearchClient.Cluster.cs index 93c2307d14..22d773b053 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.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/Requests.Cluster.cs b/src/OpenSearch.Client/Requests.Cluster.cs index 9a81b38dba..70003d7e18 100644 --- a/src/OpenSearch.Client/Requests.Cluster.cs +++ b/src/OpenSearch.Client/Requests.Cluster.cs @@ -58,42 +58,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client.Specification.ClusterApi { - [InterfaceDataContract] - public partial interface IClusterPendingTasksRequest : IRequest - { - } - - ///Request for PendingTasks https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-pending-tasks/ - public partial class ClusterPendingTasksRequest : PlainRequestBase, IClusterPendingTasksRequest - { - protected IClusterPendingTasksRequest Self => this; - 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 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/pending_tasks https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-pending-tasks/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse PendingTasks(ClusterPendingTasksRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, "_cluster/pending_tasks", null, RequestParams(requestParameters)); - ///GET on /_cluster/pending_tasks https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-pending-tasks/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cluster.pending_tasks", "")] - public Task PendingTasksAsync(ClusterPendingTasksRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, "_cluster/pending_tasks", ctx, null, RequestParams(requestParameters)); ///POST on /_cluster/voting_config_exclusions ///Request specific configuration such as querystring parameters & request specific connection settings. public TResponse PostVotingConfigExclusions(PostVotingConfigExclusionsRequestParameters 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 9a904d0678..26f58529a6 100644 --- a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cluster.cs @@ -336,4 +336,37 @@ public WaitForStatus? WaitForStatus set => Q("wait_for_status", value); } } + + ///Request options for PendingTasks https://opensearch.org/docs/latest + public partial class ClusterPendingTasksRequestParameters + : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + public override bool SupportsBody => false; + + ///Operation timeout for connection to cluster-manager node. + ///Supported by OpenSearch servers of version 2.0.0 or greater. + public TimeSpan ClusterManagerTimeout + { + get => Q("cluster_manager_timeout"); + set => Q("cluster_manager_timeout", value); + } + + ///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); + } + } } diff --git a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs index 454f8c56fa..7ac0a0c5b6 100644 --- a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cluster.cs @@ -337,5 +337,34 @@ public Task HealthAsync( null, RequestParams(requestParameters) ); + + ///GET on /_cluster/pending_tasks https://opensearch.org/docs/latest + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse PendingTasks( + ClusterPendingTasksRequestParameters requestParameters = null + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest( + GET, + "_cluster/pending_tasks", + null, + RequestParams(requestParameters) + ); + + ///GET on /_cluster/pending_tasks https://opensearch.org/docs/latest + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cluster.pending_tasks", "")] + public Task PendingTasksAsync( + ClusterPendingTasksRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + "_cluster/pending_tasks", + ctx, + null, + RequestParams(requestParameters) + ); } }