From 4744e9d3935acdfcf56c484105a73089cded268c Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Tue, 12 Sep 2023 15:48:34 +1200 Subject: [PATCH 01/13] Re-generate `cat.aliases` Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 2 + src/OpenSearch.Client/ApiUrlsLookup.cs | 1 - src/OpenSearch.Client/Descriptors.Cat.cs | 36 ----- .../IOpenSearchClient.Generated.cs | 6 - src/OpenSearch.Client/OpenSearchClient.Cat.cs | 30 +--- .../OpenSearchClient.NoNamespace.cs | 9 -- src/OpenSearch.Client/Requests.Cat.cs | 84 ---------- .../_Generated/ApiUrlsLookup.cs | 3 + .../_Generated/Descriptors.Cat.cs | 111 ++++++++++++++ .../_Generated/IOpenSearchClient.cs | 4 + .../_Generated/OpenSearchClient.Cat.cs | 106 +++++++++++++ .../_Generated/OpenSearchClient.cs | 5 + .../_Generated/Requests.Cat.cs | 143 ++++++++++++++++++ src/OpenSearch.Client/_Generated/Requests.cs | 1 + .../RequestParameters.Cat.cs | 59 -------- .../IOpenSearchLowLevelClient.Generated.cs | 6 - .../OpenSearchLowLevelClient.Cat.cs | 38 +---- .../OpenSearchLowLevelClient.NoNamespace.cs | 8 - .../RequestParameters.Cat.cs | 115 ++++++++++++++ .../_Generated/IOpenSearchLowLevelClient.cs | 4 + .../OpenSearchLowLevelClient.Cat.cs | 129 ++++++++++++++++ .../_Generated/OpenSearchLowLevelClient.cs | 3 + 22 files changed, 631 insertions(+), 272 deletions(-) create mode 100644 src/OpenSearch.Client/_Generated/Descriptors.Cat.cs create mode 100644 src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs create mode 100644 src/OpenSearch.Client/_Generated/Requests.Cat.cs create mode 100644 src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs create mode 100644 src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index b09c34bb95..cf76d90bdd 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -41,6 +41,8 @@ public static class CodeConfiguration { new("{create,delete}_pit"), new("{delete,get}_all_pits"), + + new("cat.aliases"), new("cluster.*"), new("dangling_indices.*"), diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index 1d8ba9ee50..045b8d686d 100644 --- a/src/OpenSearch.Client/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/ApiUrlsLookup.cs @@ -46,7 +46,6 @@ namespace OpenSearch.Client internal static partial class ApiUrlsLookups { internal static ApiUrls NoNamespaceBulk = new ApiUrls(new[]{"_bulk", "{index}/_bulk"}); - internal static ApiUrls CatAliases = new ApiUrls(new[]{"_cat/aliases", "_cat/aliases/{name}"}); internal static ApiUrls CatAllocation = new ApiUrls(new[]{"_cat/allocation", "_cat/allocation/{node_id}"}); internal static ApiUrls CatCount = new ApiUrls(new[]{"_cat/count", "_cat/count/{index}"}); ///Introduced in OpenSearch 2.0 instead of diff --git a/src/OpenSearch.Client/Descriptors.Cat.cs b/src/OpenSearch.Client/Descriptors.Cat.cs index f2d3ed6224..29230e437e 100644 --- a/src/OpenSearch.Client/Descriptors.Cat.cs +++ b/src/OpenSearch.Client/Descriptors.Cat.cs @@ -57,42 +57,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - ///Descriptor for Aliases https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-aliases/ - public partial class CatAliasesDescriptor : RequestDescriptorBase, ICatAliasesRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.CatAliases; - ////_cat/aliases - public CatAliasesDescriptor(): base() - { - } - - ////_cat/aliases/{name} - ///Optional, accepts null - public CatAliasesDescriptor(Names name): base(r => r.Optional("name", name)) - { - } - - // values part of the url path - Names ICatAliasesRequest.Name => Self.RouteValues.Get("name"); - ///A comma-separated list of alias names to return - public CatAliasesDescriptor Name(Names name) => Assign(name, (a, v) => a.RouteValues.Optional("name", v)); - // Request parameters - ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public CatAliasesDescriptor ExpandWildcards(ExpandWildcards? expandwildcards) => Qs("expand_wildcards", expandwildcards); - ///a short version of the Accept header, e.g. json, yaml - public CatAliasesDescriptor Format(string format) => Qs("format", format); - ///Comma-separated list of column names to display - public CatAliasesDescriptor Headers(params string[] headers) => Qs("h", headers); - ///Return help information - public CatAliasesDescriptor Help(bool? help = true) => Qs("help", help); - ///Return local information, do not retrieve the state from cluster_manager node (default: false) - public CatAliasesDescriptor Local(bool? local = true) => Qs("local", local); - ///Comma-separated list of column names or column aliases to sort by - public CatAliasesDescriptor SortByColumns(params string[] sortbycolumns) => Qs("s", sortbycolumns); - ///Verbose mode. Display column headers - public CatAliasesDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); - } - ///Descriptor for Allocation https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-allocation/ public partial class CatAllocationDescriptor : RequestDescriptorBase, ICatAllocationRequest { diff --git a/src/OpenSearch.Client/IOpenSearchClient.Generated.cs b/src/OpenSearch.Client/IOpenSearchClient.Generated.cs index c582459651..1d895c73e6 100644 --- a/src/OpenSearch.Client/IOpenSearchClient.Generated.cs +++ b/src/OpenSearch.Client/IOpenSearchClient.Generated.cs @@ -64,12 +64,6 @@ namespace OpenSearch.Client /// public partial interface IOpenSearchClient { - ///Cat APIs - CatNamespace Cat - { - get; - } - /// /// POST request to the bulk API, read more about this API online: /// diff --git a/src/OpenSearch.Client/OpenSearchClient.Cat.cs b/src/OpenSearch.Client/OpenSearchClient.Cat.cs index ebf3fa065d..f5c41f498e 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Cat.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Cat.cs @@ -57,36 +57,8 @@ namespace OpenSearch.Client.Specification.CatApi /// on . /// /// - public class CatNamespace : NamespacedClientProxy + public partial class CatNamespace : NamespacedClientProxy { - internal CatNamespace(OpenSearchClient client): base(client) - { - } - - /// - /// GET request to the cat.aliases API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-aliases/ - /// - public CatResponse Aliases(Func selector = null) => Aliases(selector.InvokeOrDefault(new CatAliasesDescriptor())); - /// - /// GET request to the cat.aliases API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-aliases/ - /// - public Task> AliasesAsync(Func selector = null, CancellationToken ct = default) => AliasesAsync(selector.InvokeOrDefault(new CatAliasesDescriptor()), ct); - /// - /// GET request to the cat.aliases API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-aliases/ - /// - public CatResponse Aliases(ICatAliasesRequest request) => DoCat(request); - /// - /// GET request to the cat.aliases API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-aliases/ - /// - public Task> AliasesAsync(ICatAliasesRequest request, CancellationToken ct = default) => DoCatAsync(request, ct); /// /// GET request to the cat.allocation API, read more about this API online: /// diff --git a/src/OpenSearch.Client/OpenSearchClient.NoNamespace.cs b/src/OpenSearch.Client/OpenSearchClient.NoNamespace.cs index 6d2d7b0f71..6a7caf1e77 100644 --- a/src/OpenSearch.Client/OpenSearchClient.NoNamespace.cs +++ b/src/OpenSearch.Client/OpenSearchClient.NoNamespace.cs @@ -63,15 +63,6 @@ namespace OpenSearch.Client /// public partial class OpenSearchClient : IOpenSearchClient { - ///Cat APIs - public CatNamespace Cat - { - get; - private set; - } - - partial void SetupNamespaces() => Cat = new CatNamespace(this); - /// /// POST request to the bulk API, read more about this API online: /// diff --git a/src/OpenSearch.Client/Requests.Cat.cs b/src/OpenSearch.Client/Requests.Cat.cs index 77d8241f9e..59485feedf 100644 --- a/src/OpenSearch.Client/Requests.Cat.cs +++ b/src/OpenSearch.Client/Requests.Cat.cs @@ -58,90 +58,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - [InterfaceDataContract] - public partial interface ICatAliasesRequest : IRequest - { - [IgnoreDataMember] - Names Name - { - get; - } - } - - ///Request for Aliases https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-aliases/ - public partial class CatAliasesRequest : PlainRequestBase, ICatAliasesRequest - { - protected ICatAliasesRequest Self => this; - internal override ApiUrls ApiUrls => ApiUrlsLookups.CatAliases; - ////_cat/aliases - public CatAliasesRequest(): base() - { - } - - ////_cat/aliases/{name} - ///Optional, accepts null - public CatAliasesRequest(Names name): base(r => r.Optional("name", name)) - { - } - - // values part of the url path - [IgnoreDataMember] - Names ICatAliasesRequest.Name => Self.RouteValues.Get("name"); - // 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); - } - - ///a short version of the Accept header, e.g. json, yaml - public string Format - { - get => Q("format"); - set - { - Q("format", value); - SetAcceptHeader(value); - } - } - - ///Comma-separated list of column names to display - public string[] Headers - { - get => Q("h"); - set => Q("h", value); - } - - ///Return help information - public bool? Help - { - get => Q("help"); - set => Q("help", value); - } - - ///Return local information, do not retrieve the state from cluster_manager node (default: false) - public bool? Local - { - get => Q("local"); - set => Q("local", value); - } - - ///Comma-separated list of column names or column aliases to sort by - public string[] SortByColumns - { - get => Q("s"); - set => Q("s", value); - } - - ///Verbose mode. Display column headers - public bool? Verbose - { - get => Q("v"); - set => Q("v", value); - } - } - [InterfaceDataContract] public partial interface ICatAllocationRequest : IRequest { diff --git a/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs b/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs index 3455575bce..f6d349c233 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 CatAliases = + new(new[] { "_cat/aliases", "_cat/aliases/{name}" }); + internal static readonly ApiUrls ClusterAllocationExplain = new(new[] { "_cluster/allocation/explain" }); diff --git a/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs b/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs new file mode 100644 index 0000000000..f706f5b0bf --- /dev/null +++ b/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs @@ -0,0 +1,111 @@ +/* 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.Linq.Expressions; +using System.Text; +using OpenSearch.Net; +using OpenSearch.Net.Specification.CatApi; +using OpenSearch.Net.Utf8Json; + +// ReSharper disable RedundantBaseConstructorCall +// ReSharper disable UnusedTypeParameter +// ReSharper disable PartialMethodWithSinglePart +// ReSharper disable RedundantNameQualifier +namespace OpenSearch.Client +{ + /// Descriptor for Aliases https://opensearch.org/docs/latest/api-reference/cat/cat-aliases/ + public partial class CatAliasesDescriptor + : RequestDescriptorBase< + CatAliasesDescriptor, + CatAliasesRequestParameters, + ICatAliasesRequest + >, + ICatAliasesRequest + { + internal override ApiUrls ApiUrls => ApiUrlsLookups.CatAliases; + + /// /_cat/aliases + public CatAliasesDescriptor() + : base() { } + + /// /_cat/aliases/{name} + /// Optional, accepts null + public CatAliasesDescriptor(Names name) + : base(r => r.Optional("name", name)) { } + + // values part of the url path + Names ICatAliasesRequest.Name => Self.RouteValues.Get("name"); + + /// Comma-separated list of alias names. + public CatAliasesDescriptor Name(Names name) => + Assign(name, (a, v) => a.RouteValues.Optional("name", v)); + + // Request parameters + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + public CatAliasesDescriptor ExpandWildcards(ExpandWildcards? expandwildcards) => + Qs("expand_wildcards", expandwildcards); + + /// A short version of the Accept header, e.g. json, yaml. + public CatAliasesDescriptor Format(string format) => Qs("format", format); + + /// Comma-separated list of column names to display. + public CatAliasesDescriptor Headers(params string[] headers) => Qs("h", headers); + + /// Return help information. + public CatAliasesDescriptor Help(bool? help = true) => Qs("help", help); + + /// Return local information, do not retrieve the state from cluster-manager node. + public CatAliasesDescriptor Local(bool? local = true) => Qs("local", local); + + /// Comma-separated list of column names or column aliases to sort by. + public CatAliasesDescriptor SortByColumns(params string[] sortbycolumns) => + Qs("s", sortbycolumns); + + /// Verbose mode. Display column headers. + public CatAliasesDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); + } +} diff --git a/src/OpenSearch.Client/_Generated/IOpenSearchClient.cs b/src/OpenSearch.Client/_Generated/IOpenSearchClient.cs index 22732f559a..1db4dc4f29 100644 --- a/src/OpenSearch.Client/_Generated/IOpenSearchClient.cs +++ b/src/OpenSearch.Client/_Generated/IOpenSearchClient.cs @@ -48,6 +48,7 @@ using System.Threading; using System.Threading.Tasks; using OpenSearch.Client; +using OpenSearch.Client.Specification.CatApi; using OpenSearch.Client.Specification.ClusterApi; using OpenSearch.Client.Specification.DanglingIndicesApi; using OpenSearch.Client.Specification.HttpApi; @@ -64,6 +65,9 @@ namespace OpenSearch.Client /// public partial interface IOpenSearchClient { + /// Cat APIs + CatNamespace Cat { get; } + /// Cluster APIs ClusterNamespace Cluster { get; } diff --git a/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs b/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs new file mode 100644 index 0000000000..c7acb80752 --- /dev/null +++ b/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs @@ -0,0 +1,106 @@ +/* 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.CatApi; + +// ReSharper disable once CheckNamespace +// ReSharper disable RedundantTypeArgumentsOfMethod +namespace OpenSearch.Client.Specification.CatApi +{ + /// + /// Cat APIs. + /// Not intended to be instantiated directly. Use the property + /// on . + /// + /// + public partial class CatNamespace : NamespacedClientProxy + { + internal CatNamespace(OpenSearchClient client) + : base(client) { } + + /// + /// GET request to the cat.aliases API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/cat-aliases/ + /// + public CatResponse Aliases( + Func selector = null + ) => Aliases(selector.InvokeOrDefault(new CatAliasesDescriptor())); + + /// + /// GET request to the cat.aliases API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/cat-aliases/ + /// + public Task> AliasesAsync( + Func selector = null, + CancellationToken ct = default + ) => AliasesAsync(selector.InvokeOrDefault(new CatAliasesDescriptor()), ct); + + /// + /// GET request to the cat.aliases API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/cat-aliases/ + /// + public CatResponse Aliases(ICatAliasesRequest request) => + DoCat(request); + + /// + /// GET request to the cat.aliases API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/cat-aliases/ + /// + public Task> AliasesAsync( + ICatAliasesRequest request, + CancellationToken ct = default + ) => + DoCatAsync( + request, + ct + ); + } +} diff --git a/src/OpenSearch.Client/_Generated/OpenSearchClient.cs b/src/OpenSearch.Client/_Generated/OpenSearchClient.cs index 28f5994f96..6f12c13f45 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.CatApi; using OpenSearch.Client.Specification.ClusterApi; using OpenSearch.Client.Specification.DanglingIndicesApi; using OpenSearch.Client.Specification.HttpApi; @@ -63,6 +64,9 @@ namespace OpenSearch.Client /// public partial class OpenSearchClient : IOpenSearchClient { + /// Cat APIs + public CatNamespace Cat { get; private set; } + /// Cluster APIs public ClusterNamespace Cluster { get; private set; } @@ -89,6 +93,7 @@ public partial class OpenSearchClient : IOpenSearchClient partial void SetupGeneratedNamespaces() { + Cat = new CatNamespace(this); Cluster = new ClusterNamespace(this); DanglingIndices = new DanglingIndicesNamespace(this); Indices = new IndicesNamespace(this); diff --git a/src/OpenSearch.Client/_Generated/Requests.Cat.cs b/src/OpenSearch.Client/_Generated/Requests.Cat.cs new file mode 100644 index 0000000000..f0aba65792 --- /dev/null +++ b/src/OpenSearch.Client/_Generated/Requests.Cat.cs @@ -0,0 +1,143 @@ +/* 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.Linq.Expressions; +using System.Runtime.Serialization; +using System.Text; +using OpenSearch.Net; +using OpenSearch.Net.Specification.CatApi; +using OpenSearch.Net.Utf8Json; + +// ReSharper disable RedundantBaseConstructorCall +// ReSharper disable UnusedTypeParameter +// ReSharper disable PartialMethodWithSinglePart +// ReSharper disable RedundantNameQualifier +namespace OpenSearch.Client +{ + [InterfaceDataContract] + public partial interface ICatAliasesRequest : IRequest + { + [IgnoreDataMember] + Names Name { get; } + } + + /// Request for Aliases https://opensearch.org/docs/latest/api-reference/cat/cat-aliases/ + public partial class CatAliasesRequest + : PlainRequestBase, + ICatAliasesRequest + { + protected ICatAliasesRequest Self => this; + internal override ApiUrls ApiUrls => ApiUrlsLookups.CatAliases; + + /// /_cat/aliases + public CatAliasesRequest() + : base() { } + + /// /_cat/aliases/{name} + /// Optional, accepts null + public CatAliasesRequest(Names name) + : base(r => r.Optional("name", name)) { } + + // values part of the url path + [IgnoreDataMember] + Names ICatAliasesRequest.Name => Self.RouteValues.Get("name"); + + // 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); + } + + /// A short version of the Accept header, e.g. json, yaml. + public string Format + { + get => Q("format"); + set + { + Q("format", value); + SetAcceptHeader(value); + } + } + + /// Comma-separated list of column names to display. + public string[] Headers + { + get => Q("h"); + set => Q("h", value); + } + + /// Return help information. + public bool? Help + { + get => Q("help"); + set => Q("help", value); + } + + /// Return local information, do not retrieve the state from cluster-manager node. + public bool? Local + { + get => Q("local"); + set => Q("local", value); + } + + /// Comma-separated list of column names or column aliases to sort by. + public string[] SortByColumns + { + get => Q("s"); + set => Q("s", value); + } + + /// Verbose mode. Display column headers. + public bool? Verbose + { + get => Q("v"); + set => Q("v", value); + } + } +} diff --git a/src/OpenSearch.Client/_Generated/Requests.cs b/src/OpenSearch.Client/_Generated/Requests.cs index 2c386704aa..64af2783e3 100644 --- a/src/OpenSearch.Client/_Generated/Requests.cs +++ b/src/OpenSearch.Client/_Generated/Requests.cs @@ -49,6 +49,7 @@ using System.Runtime.Serialization; using System.Text; using OpenSearch.Net; +using OpenSearch.Net.Specification.CatApi; using OpenSearch.Net.Specification.ClusterApi; using OpenSearch.Net.Specification.DanglingIndicesApi; using OpenSearch.Net.Specification.HttpApi; diff --git a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs index fe66f89aa4..13f2630d3e 100644 --- a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs +++ b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs @@ -51,65 +51,6 @@ // ReSharper disable once CheckNamespace namespace OpenSearch.Net.Specification.CatApi { - ///Request options for Aliases https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-aliases/ - public class CatAliasesRequestParameters : RequestParameters - { - public override HttpMethod DefaultHttpMethod => HttpMethod.GET; - public override bool SupportsBody => false; - ///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); - } - - ///a short version of the Accept header, e.g. json, yaml - public string Format - { - get => Q("format"); - set - { - Q("format", value); - SetAcceptHeader(value); - } - } - - ///Comma-separated list of column names to display - public string[] Headers - { - get => Q("h"); - set => Q("h", value); - } - - ///Return help information - public bool? Help - { - get => Q("help"); - set => Q("help", value); - } - - ///Return local information, do not retrieve the state from cluster_manager node (default: false) - public bool? Local - { - get => Q("local"); - set => Q("local", value); - } - - ///Comma-separated list of column names or column aliases to sort by - public string[] SortByColumns - { - get => Q("s"); - set => Q("s", value); - } - - ///Verbose mode. Display column headers - public bool? Verbose - { - get => Q("v"); - set => Q("v", value); - } - } - ///Request options for Allocation https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-allocation/ public class CatAllocationRequestParameters : RequestParameters { diff --git a/src/OpenSearch.Net/IOpenSearchLowLevelClient.Generated.cs b/src/OpenSearch.Net/IOpenSearchLowLevelClient.Generated.cs index a2d1e172e8..83848d4194 100644 --- a/src/OpenSearch.Net/IOpenSearchLowLevelClient.Generated.cs +++ b/src/OpenSearch.Net/IOpenSearchLowLevelClient.Generated.cs @@ -66,12 +66,6 @@ namespace OpenSearch.Net /// public partial interface IOpenSearchLowLevelClient { - ///Cat APIs - LowLevelCatNamespace Cat - { - get; - } - ///POST on /_bulk https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/bulk/ ///The operation definition and data (action-data pairs), separated by newlines ///Request specific configuration such as querystring parameters & request specific connection settings. diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs index b5ef5081f2..9678feaa4b 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.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,36 +66,6 @@ namespace OpenSearch.Net.Specification.CatApi /// public partial class LowLevelCatNamespace : NamespacedClientProxy { - internal LowLevelCatNamespace(OpenSearchLowLevelClient client): base(client) - { - } - - protected override string ContentType - { - get; - } - - = "text/plain"; - ///GET on /_cat/aliases https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-aliases/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse Aliases(CatAliasesRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, "_cat/aliases", null, RequestParams(requestParameters)); - ///GET on /_cat/aliases https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-aliases/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cat.aliases", "")] - public Task AliasesAsync(CatAliasesRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, "_cat/aliases", ctx, null, RequestParams(requestParameters)); - ///GET on /_cat/aliases/{name} https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-aliases/ - ///A comma-separated list of alias names to return - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse Aliases(string name, CatAliasesRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, Url($"_cat/aliases/{name:name}"), null, RequestParams(requestParameters)); - ///GET on /_cat/aliases/{name} https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-aliases/ - ///A comma-separated list of alias names to return - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cat.aliases", "name")] - public Task AliasesAsync(string name, CatAliasesRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, Url($"_cat/aliases/{name:name}"), ctx, null, RequestParams(requestParameters)); ///GET on /_cat/allocation https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-allocation/ ///Request specific configuration such as querystring parameters & request specific connection settings. public TResponse Allocation(CatAllocationRequestParameters requestParameters = null) diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.NoNamespace.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.NoNamespace.cs index f8afe925cd..85eb12f38c 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.NoNamespace.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.NoNamespace.cs @@ -69,14 +69,6 @@ namespace OpenSearch.Net /// public partial class OpenSearchLowLevelClient : IOpenSearchLowLevelClient { - public LowLevelCatNamespace Cat - { - get; - private set; - } - - partial void SetupNamespaces() => Cat = new LowLevelCatNamespace(this); - ///POST on /_bulk https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/bulk/ ///The operation definition and data (action-data pairs), separated by newlines ///Request specific configuration such as querystring parameters & request specific connection settings. diff --git a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs new file mode 100644 index 0000000000..e0ad11a82b --- /dev/null +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs @@ -0,0 +1,115 @@ +/* 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.Linq.Expressions; +using System.Text; + +// ReSharper disable once CheckNamespace +namespace OpenSearch.Net.Specification.CatApi +{ + /// Request options for Aliases https://opensearch.org/docs/latest/api-reference/cat/cat-aliases/ + public partial class CatAliasesRequestParameters + : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + public override bool SupportsBody => false; + + /// 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); + } + + /// A short version of the Accept header, e.g. json, yaml. + public string Format + { + get => Q("format"); + set + { + Q("format", value); + SetAcceptHeader(value); + } + } + + /// Comma-separated list of column names to display. + public string[] Headers + { + get => Q("h"); + set => Q("h", value); + } + + /// Return help information. + public bool? Help + { + get => Q("help"); + set => Q("help", value); + } + + /// Return local information, do not retrieve the state from cluster-manager node. + public bool? Local + { + get => Q("local"); + set => Q("local", value); + } + + /// Comma-separated list of column names or column aliases to sort by. + public string[] SortByColumns + { + get => Q("s"); + set => Q("s", value); + } + + /// Verbose mode. Display column headers. + public bool? Verbose + { + get => Q("v"); + set => Q("v", value); + } + } +} diff --git a/src/OpenSearch.Net/_Generated/IOpenSearchLowLevelClient.cs b/src/OpenSearch.Net/_Generated/IOpenSearchLowLevelClient.cs index 8d7f5692b3..cc99433fef 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.CatApi; using OpenSearch.Net.Specification.ClusterApi; using OpenSearch.Net.Specification.DanglingIndicesApi; using OpenSearch.Net.Specification.HttpApi; @@ -66,6 +67,9 @@ namespace OpenSearch.Net /// public partial interface IOpenSearchLowLevelClient { + /// Cat APIs + LowLevelCatNamespace Cat { get; } + /// Cluster APIs LowLevelClusterNamespace Cluster { get; } diff --git a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs new file mode 100644 index 0000000000..1572945e32 --- /dev/null +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs @@ -0,0 +1,129 @@ +/* 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.CatApi +{ + /// + /// Cat APIs. + /// Not intended to be instantiated directly. Use the property + /// on . + /// + /// + public partial class LowLevelCatNamespace : NamespacedClientProxy + { + internal LowLevelCatNamespace(OpenSearchLowLevelClient client) + : base(client) { } + + protected override string ContentType => "text/plain"; + + /// GET on /_cat/aliases https://opensearch.org/docs/latest/api-reference/cat/cat-aliases/ + /// Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse Aliases(CatAliasesRequestParameters requestParameters = null) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest(GET, "_cat/aliases", null, RequestParams(requestParameters)); + + /// GET on /_cat/aliases https://opensearch.org/docs/latest/api-reference/cat/cat-aliases/ + /// Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cat.aliases", "")] + public Task AliasesAsync( + CatAliasesRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + "_cat/aliases", + ctx, + null, + RequestParams(requestParameters) + ); + + /// GET on /_cat/aliases/{name} https://opensearch.org/docs/latest/api-reference/cat/cat-aliases/ + /// Comma-separated list of alias names. + /// Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse Aliases( + string name, + CatAliasesRequestParameters requestParameters = null + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest( + GET, + Url($"_cat/aliases/{name:name}"), + null, + RequestParams(requestParameters) + ); + + /// GET on /_cat/aliases/{name} https://opensearch.org/docs/latest/api-reference/cat/cat-aliases/ + /// Comma-separated list of alias names. + /// Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cat.aliases", "name")] + public Task AliasesAsync( + string name, + CatAliasesRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + Url($"_cat/aliases/{name:name}"), + ctx, + null, + RequestParams(requestParameters) + ); + } +} diff --git a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.cs b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.cs index 3b60d35f12..23812f522c 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.CatApi; using OpenSearch.Net.Specification.ClusterApi; using OpenSearch.Net.Specification.DanglingIndicesApi; using OpenSearch.Net.Specification.HttpApi; @@ -69,6 +70,7 @@ namespace OpenSearch.Net /// public partial class OpenSearchLowLevelClient : IOpenSearchLowLevelClient { + public LowLevelCatNamespace Cat { get; private set; } public LowLevelClusterNamespace Cluster { get; private set; } public LowLevelDanglingIndicesNamespace DanglingIndices { get; private set; } public LowLevelIndicesNamespace Indices { get; private set; } @@ -80,6 +82,7 @@ public partial class OpenSearchLowLevelClient : IOpenSearchLowLevelClient partial void SetupGeneratedNamespaces() { + Cat = new LowLevelCatNamespace(this); Cluster = new LowLevelClusterNamespace(this); DanglingIndices = new LowLevelDanglingIndicesNamespace(this); Indices = new LowLevelIndicesNamespace(this); From c6029f11b01402f629efebacc29e15b3b94050dd Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Thu, 14 Sep 2023 14:35:01 +1200 Subject: [PATCH 02/13] Re-generate `cat.allocation` Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 1 + src/OpenSearch.Client/ApiUrlsLookup.cs | 1 - src/OpenSearch.Client/Descriptors.Cat.cs | 42 -------- src/OpenSearch.Client/OpenSearchClient.Cat.cs | 24 ----- src/OpenSearch.Client/Requests.Cat.cs | 100 ----------------- .../_Generated/ApiUrlsLookup.cs | 3 + .../_Generated/Descriptors.Cat.cs | 63 +++++++++++ .../_Generated/OpenSearchClient.Cat.cs | 43 ++++++++ .../_Generated/Requests.Cat.cs | 101 ++++++++++++++++++ src/OpenSearch.Net/Api/Enums.cs | 59 ---------- .../RequestParameters.Cat.cs | 75 ------------- .../OpenSearchLowLevelClient.Cat.cs | 20 ---- src/OpenSearch.Net/_Generated/Api/Enums.cs | 70 ++++++++++++ .../RequestParameters.Cat.cs | 79 ++++++++++++++ .../OpenSearchLowLevelClient.Cat.cs | 57 ++++++++++ 15 files changed, 417 insertions(+), 321 deletions(-) diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index cf76d90bdd..f2d5c93f4b 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -43,6 +43,7 @@ public static class CodeConfiguration new("{delete,get}_all_pits"), new("cat.aliases"), + new("cat.allocation"), new("cluster.*"), new("dangling_indices.*"), diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index 045b8d686d..f5b972f035 100644 --- a/src/OpenSearch.Client/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/ApiUrlsLookup.cs @@ -46,7 +46,6 @@ namespace OpenSearch.Client internal static partial class ApiUrlsLookups { internal static ApiUrls NoNamespaceBulk = new ApiUrls(new[]{"_bulk", "{index}/_bulk"}); - internal static ApiUrls CatAllocation = new ApiUrls(new[]{"_cat/allocation", "_cat/allocation/{node_id}"}); internal static ApiUrls CatCount = new ApiUrls(new[]{"_cat/count", "_cat/count/{index}"}); ///Introduced in OpenSearch 2.0 instead of internal static ApiUrls CatClusterManager = new ApiUrls(new[]{"_cat/cluster_manager"}); diff --git a/src/OpenSearch.Client/Descriptors.Cat.cs b/src/OpenSearch.Client/Descriptors.Cat.cs index 29230e437e..dc7d43c653 100644 --- a/src/OpenSearch.Client/Descriptors.Cat.cs +++ b/src/OpenSearch.Client/Descriptors.Cat.cs @@ -57,48 +57,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - ///Descriptor for Allocation https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-allocation/ - public partial class CatAllocationDescriptor : RequestDescriptorBase, ICatAllocationRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.CatAllocation; - ////_cat/allocation - public CatAllocationDescriptor(): base() - { - } - - ////_cat/allocation/{node_id} - ///Optional, accepts null - public CatAllocationDescriptor(NodeIds nodeId): base(r => r.Optional("node_id", nodeId)) - { - } - - // values part of the url path - NodeIds ICatAllocationRequest.NodeId => Self.RouteValues.Get("node_id"); - ///A comma-separated list of node IDs or names to limit the returned information - public CatAllocationDescriptor NodeId(NodeIds nodeId) => Assign(nodeId, (a, v) => a.RouteValues.Optional("node_id", v)); - // Request parameters - ///The unit in which to display byte values - public CatAllocationDescriptor Bytes(Bytes? bytes) => Qs("bytes", bytes); - ///a short version of the Accept header, e.g. json, yaml - public CatAllocationDescriptor Format(string format) => Qs("format", format); - ///Comma-separated list of column names to display - public CatAllocationDescriptor Headers(params string[] headers) => Qs("h", headers); - ///Return help information - public CatAllocationDescriptor Help(bool? help = true) => Qs("help", help); - ///Return local information, do not retrieve the state from cluster_manager node (default: false) - public CatAllocationDescriptor Local(bool? local = true) => Qs("local", local); - ///Explicit operation timeout for connection to master node - ///Deprecated as of OpenSearch 2.0, use instead - public CatAllocationDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); - ///Explicit operation timeout for connection to cluster_manager node - ///Introduced in OpenSearch 2.0 instead of - public CatAllocationDescriptor ClusterManagerTimeout(Time timeout) => Qs("cluster_manager_timeout", timeout); - ///Comma-separated list of column names or column aliases to sort by - public CatAllocationDescriptor SortByColumns(params string[] sortbycolumns) => Qs("s", sortbycolumns); - ///Verbose mode. Display column headers - public CatAllocationDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); - } - ///Descriptor for Count https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-count/ public partial class CatCountDescriptor : RequestDescriptorBase, ICatCountRequest { diff --git a/src/OpenSearch.Client/OpenSearchClient.Cat.cs b/src/OpenSearch.Client/OpenSearchClient.Cat.cs index f5c41f498e..4910dcdeae 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Cat.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Cat.cs @@ -59,30 +59,6 @@ namespace OpenSearch.Client.Specification.CatApi /// public partial class CatNamespace : NamespacedClientProxy { - /// - /// GET request to the cat.allocation API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-allocation/ - /// - public CatResponse Allocation(Func selector = null) => Allocation(selector.InvokeOrDefault(new CatAllocationDescriptor())); - /// - /// GET request to the cat.allocation API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-allocation/ - /// - public Task> AllocationAsync(Func selector = null, CancellationToken ct = default) => AllocationAsync(selector.InvokeOrDefault(new CatAllocationDescriptor()), ct); - /// - /// GET request to the cat.allocation API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-allocation/ - /// - public CatResponse Allocation(ICatAllocationRequest request) => DoCat(request); - /// - /// GET request to the cat.allocation API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-allocation/ - /// - public Task> AllocationAsync(ICatAllocationRequest request, CancellationToken ct = default) => DoCatAsync(request, ct); /// /// GET request to the cat.count API, read more about this API online: /// diff --git a/src/OpenSearch.Client/Requests.Cat.cs b/src/OpenSearch.Client/Requests.Cat.cs index 59485feedf..c12d46c26e 100644 --- a/src/OpenSearch.Client/Requests.Cat.cs +++ b/src/OpenSearch.Client/Requests.Cat.cs @@ -58,106 +58,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - [InterfaceDataContract] - public partial interface ICatAllocationRequest : IRequest - { - [IgnoreDataMember] - NodeIds NodeId - { - get; - } - } - - ///Request for Allocation https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-allocation/ - public partial class CatAllocationRequest : PlainRequestBase, ICatAllocationRequest - { - protected ICatAllocationRequest Self => this; - internal override ApiUrls ApiUrls => ApiUrlsLookups.CatAllocation; - ////_cat/allocation - public CatAllocationRequest(): base() - { - } - - ////_cat/allocation/{node_id} - ///Optional, accepts null - public CatAllocationRequest(NodeIds nodeId): base(r => r.Optional("node_id", nodeId)) - { - } - - // values part of the url path - [IgnoreDataMember] - NodeIds ICatAllocationRequest.NodeId => Self.RouteValues.Get("node_id"); - // Request parameters - ///The unit in which to display byte values - public Bytes? Bytes - { - get => Q("bytes"); - set => Q("bytes", value); - } - - ///a short version of the Accept header, e.g. json, yaml - public string Format - { - get => Q("format"); - set - { - Q("format", value); - SetAcceptHeader(value); - } - } - - ///Comma-separated list of column names to display - public string[] Headers - { - get => Q("h"); - set => Q("h", value); - } - - ///Return help information - public bool? Help - { - get => Q("help"); - set => Q("help", value); - } - - ///Return local information, do not retrieve the state from cluster_manager node (default: false) - public bool? Local - { - get => Q("local"); - set => Q("local", value); - } - - ///Explicit operation timeout for connection to master node - ///Deprecated as of OpenSearch 2.0, use instead - public Time MasterTimeout - { - get => Q public partial class LowLevelCatNamespace : NamespacedClientProxy { - ///GET on /_cat/allocation https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-allocation/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse Allocation(CatAllocationRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, "_cat/allocation", null, RequestParams(requestParameters)); - ///GET on /_cat/allocation https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-allocation/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cat.allocation", "")] - public Task AllocationAsync(CatAllocationRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, "_cat/allocation", ctx, null, RequestParams(requestParameters)); - ///GET on /_cat/allocation/{node_id} https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-allocation/ - ///A comma-separated list of node IDs or names to limit the returned information - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse Allocation(string nodeId, CatAllocationRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, Url($"_cat/allocation/{nodeId:nodeId}"), null, RequestParams(requestParameters)); - ///GET on /_cat/allocation/{node_id} https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-allocation/ - ///A comma-separated list of node IDs or names to limit the returned information - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cat.allocation", "node_id")] - public Task AllocationAsync(string nodeId, CatAllocationRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, Url($"_cat/allocation/{nodeId:nodeId}"), ctx, null, RequestParams(requestParameters)); ///GET on /_cat/count https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-count/ ///Request specific configuration such as querystring parameters & request specific connection settings. public TResponse Count(CatCountRequestParameters requestParameters = null) diff --git a/src/OpenSearch.Net/_Generated/Api/Enums.cs b/src/OpenSearch.Net/_Generated/Api/Enums.cs index 9cef5115b9..9e85658740 100644 --- a/src/OpenSearch.Net/_Generated/Api/Enums.cs +++ b/src/OpenSearch.Net/_Generated/Api/Enums.cs @@ -241,6 +241,43 @@ public enum ExpandWildcards None } + [StringEnum] + public enum Bytes + { + [EnumMember(Value = "b")] + B, + + [EnumMember(Value = "k")] + K, + + [EnumMember(Value = "kb")] + Kb, + + [EnumMember(Value = "m")] + M, + + [EnumMember(Value = "mb")] + Mb, + + [EnumMember(Value = "g")] + G, + + [EnumMember(Value = "gb")] + Gb, + + [EnumMember(Value = "t")] + T, + + [EnumMember(Value = "tb")] + Tb, + + [EnumMember(Value = "p")] + P, + + [EnumMember(Value = "pb")] + Pb + } + [StringEnum] public enum ClusterHealthLevel { @@ -359,6 +396,7 @@ static partial void RegisterEnumStringResolvers() typeof(ExpandWildcards), e => GetStringValue((ExpandWildcards)e) ); + EnumStringResolvers.TryAdd(typeof(Bytes), e => GetStringValue((Bytes)e)); EnumStringResolvers.TryAdd( typeof(ClusterHealthLevel), e => GetStringValue((ClusterHealthLevel)e) @@ -529,6 +567,38 @@ public static string GetStringValue(this ExpandWildcards enumValue) ); } + public static string GetStringValue(this Bytes enumValue) + { + switch (enumValue) + { + case Bytes.B: + return "b"; + case Bytes.K: + return "k"; + case Bytes.Kb: + return "kb"; + case Bytes.M: + return "m"; + case Bytes.Mb: + return "mb"; + case Bytes.G: + return "g"; + case Bytes.Gb: + return "gb"; + case Bytes.T: + return "t"; + case Bytes.Tb: + return "tb"; + case Bytes.P: + return "p"; + case Bytes.Pb: + return "pb"; + } + throw new ArgumentException( + $"'{enumValue.ToString()}' is not a valid value for enum 'Bytes'" + ); + } + public static string GetStringValue(this ClusterHealthLevel enumValue) { switch (enumValue) diff --git a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs index e0ad11a82b..4c86756107 100644 --- a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs @@ -112,4 +112,83 @@ public bool? Verbose set => Q("v", value); } } + + ///Request options for Allocation https://opensearch.org/docs/latest/api-reference/cat/cat-allocation/ + public partial class CatAllocationRequestParameters + : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + public override bool SupportsBody => false; + + ///The unit in which to display byte values. + public Bytes? Bytes + { + get => Q("bytes"); + set => Q("bytes", value); + } + + ///Operation timeout for connection to cluster-manager node. + ///Supported by OpenSearch servers of version 2.0.0 or greater. + public TimeSpan ClusterManagerTimeout + { + get => Q("cluster_manager_timeout"); + set => Q("cluster_manager_timeout", value); + } + + ///A short version of the Accept header, e.g. json, yaml. + public string Format + { + get => Q("format"); + set + { + Q("format", value); + SetAcceptHeader(value); + } + } + + ///Comma-separated list of column names to display. + public string[] Headers + { + get => Q("h"); + set => Q("h", value); + } + + ///Return help information. + public bool? Help + { + get => Q("help"); + set => Q("help", value); + } + + ///Return local information, do not retrieve the state from cluster-manager node. + public bool? Local + { + get => Q("local"); + set => Q("local", value); + } + + ///Operation timeout for connection to master node. + [Obsolete( + "Deprecated as of: 2.0.0, reason: To promote inclusive language, use 'cluster_manager_timeout' instead." + )] + public TimeSpan MasterTimeout + { + get => Q("master_timeout"); + set => Q("master_timeout", value); + } + + ///Comma-separated list of column names or column aliases to sort by. + public string[] SortByColumns + { + get => Q("s"); + set => Q("s", value); + } + + ///Verbose mode. Display column headers. + public bool? Verbose + { + get => Q("v"); + set => Q("v", value); + } + } } diff --git a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs index 1572945e32..3bc14c8c54 100644 --- a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs @@ -125,5 +125,62 @@ public Task AliasesAsync( null, RequestParams(requestParameters) ); + + ///GET on /_cat/allocation https://opensearch.org/docs/latest/api-reference/cat/cat-allocation/ + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse Allocation( + CatAllocationRequestParameters requestParameters = null + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest(GET, "_cat/allocation", null, RequestParams(requestParameters)); + + ///GET on /_cat/allocation https://opensearch.org/docs/latest/api-reference/cat/cat-allocation/ + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cat.allocation", "")] + public Task AllocationAsync( + CatAllocationRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + "_cat/allocation", + ctx, + null, + RequestParams(requestParameters) + ); + + ///GET on /_cat/allocation/{node_id} https://opensearch.org/docs/latest/api-reference/cat/cat-allocation/ + ///Comma-separated list of node IDs or names to limit the returned information. + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse Allocation( + string nodeId, + CatAllocationRequestParameters requestParameters = null + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest( + GET, + Url($"_cat/allocation/{nodeId:nodeId}"), + null, + RequestParams(requestParameters) + ); + + ///GET on /_cat/allocation/{node_id} https://opensearch.org/docs/latest/api-reference/cat/cat-allocation/ + ///Comma-separated list of node IDs or names to limit the returned information. + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cat.allocation", "node_id")] + public Task AllocationAsync( + string nodeId, + CatAllocationRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + Url($"_cat/allocation/{nodeId:nodeId}"), + ctx, + null, + RequestParams(requestParameters) + ); } } From 9e77fcac526d63adffe0f0bb9837893e7eab2fe7 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Thu, 14 Sep 2023 15:43:40 +1200 Subject: [PATCH 03/13] Re-generate `cat.count` Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 1 + src/OpenSearch.Client/ApiUrlsLookup.cs | 1 - src/OpenSearch.Client/Descriptors.Cat.cs | 37 ---------- src/OpenSearch.Client/OpenSearchClient.Cat.cs | 24 ------- src/OpenSearch.Client/Requests.Cat.cs | 70 ------------------- .../_Generated/ApiUrlsLookup.cs | 3 + .../_Generated/Descriptors.Cat.cs | 49 +++++++++++++ .../_Generated/OpenSearchClient.Cat.cs | 37 ++++++++++ .../_Generated/Requests.Cat.cs | 69 ++++++++++++++++++ .../RequestParameters.Cat.cs | 45 ------------ .../OpenSearchLowLevelClient.Cat.cs | 20 ------ .../RequestParameters.Cat.cs | 46 ++++++++++++ .../OpenSearchLowLevelClient.Cat.cs | 55 +++++++++++++++ 13 files changed, 260 insertions(+), 197 deletions(-) diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index f2d5c93f4b..1ec791524d 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -44,6 +44,7 @@ public static class CodeConfiguration new("cat.aliases"), new("cat.allocation"), + new("cat.count"), new("cluster.*"), new("dangling_indices.*"), diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index f5b972f035..8388e64a28 100644 --- a/src/OpenSearch.Client/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/ApiUrlsLookup.cs @@ -46,7 +46,6 @@ namespace OpenSearch.Client internal static partial class ApiUrlsLookups { internal static ApiUrls NoNamespaceBulk = new ApiUrls(new[]{"_bulk", "{index}/_bulk"}); - internal static ApiUrls CatCount = new ApiUrls(new[]{"_cat/count", "_cat/count/{index}"}); ///Introduced in OpenSearch 2.0 instead of internal static ApiUrls CatClusterManager = new ApiUrls(new[]{"_cat/cluster_manager"}); internal static ApiUrls CatFielddata = new ApiUrls(new[]{"_cat/fielddata", "_cat/fielddata/{fields}"}); diff --git a/src/OpenSearch.Client/Descriptors.Cat.cs b/src/OpenSearch.Client/Descriptors.Cat.cs index dc7d43c653..ccd0f6ff89 100644 --- a/src/OpenSearch.Client/Descriptors.Cat.cs +++ b/src/OpenSearch.Client/Descriptors.Cat.cs @@ -57,43 +57,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - ///Descriptor for Count https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-count/ - public partial class CatCountDescriptor : RequestDescriptorBase, ICatCountRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.CatCount; - ////_cat/count - public CatCountDescriptor(): base() - { - } - - ////_cat/count/{index} - ///Optional, accepts null - public CatCountDescriptor(Indices index): base(r => r.Optional("index", index)) - { - } - - // values part of the url path - Indices ICatCountRequest.Index => Self.RouteValues.Get("index"); - ///A comma-separated list of index names to limit the returned information - public CatCountDescriptor Index(Indices index) => Assign(index, (a, v) => a.RouteValues.Optional("index", v)); - ///a shortcut into calling Index(typeof(TOther)) - public CatCountDescriptor Index() - where TOther : class => Assign(typeof(TOther), (a, v) => a.RouteValues.Optional("index", (Indices)v)); - ///A shortcut into calling Index(Indices.All) - public CatCountDescriptor AllIndices() => Index(Indices.All); - // Request parameters - ///a short version of the Accept header, e.g. json, yaml - public CatCountDescriptor Format(string format) => Qs("format", format); - ///Comma-separated list of column names to display - public CatCountDescriptor Headers(params string[] headers) => Qs("h", headers); - ///Return help information - public CatCountDescriptor Help(bool? help = true) => Qs("help", help); - ///Comma-separated list of column names or column aliases to sort by - public CatCountDescriptor SortByColumns(params string[] sortbycolumns) => Qs("s", sortbycolumns); - ///Verbose mode. Display column headers - public CatCountDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); - } - ///Descriptor for Fielddata https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-field-data/ public partial class CatFielddataDescriptor : RequestDescriptorBase, ICatFielddataRequest { diff --git a/src/OpenSearch.Client/OpenSearchClient.Cat.cs b/src/OpenSearch.Client/OpenSearchClient.Cat.cs index 4910dcdeae..a2e7e5b607 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Cat.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Cat.cs @@ -59,30 +59,6 @@ namespace OpenSearch.Client.Specification.CatApi /// public partial class CatNamespace : NamespacedClientProxy { - /// - /// GET request to the cat.count API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-count/ - /// - public CatResponse Count(Func selector = null) => Count(selector.InvokeOrDefault(new CatCountDescriptor())); - /// - /// GET request to the cat.count API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-count/ - /// - public Task> CountAsync(Func selector = null, CancellationToken ct = default) => CountAsync(selector.InvokeOrDefault(new CatCountDescriptor()), ct); - /// - /// GET request to the cat.count API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-count/ - /// - public CatResponse Count(ICatCountRequest request) => DoCat(request); - /// - /// GET request to the cat.count API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-count/ - /// - public Task> CountAsync(ICatCountRequest request, CancellationToken ct = default) => DoCatAsync(request, ct); /// /// GET request to the cat.fielddata API, read more about this API online: /// diff --git a/src/OpenSearch.Client/Requests.Cat.cs b/src/OpenSearch.Client/Requests.Cat.cs index c12d46c26e..adf974aaec 100644 --- a/src/OpenSearch.Client/Requests.Cat.cs +++ b/src/OpenSearch.Client/Requests.Cat.cs @@ -58,76 +58,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - [InterfaceDataContract] - public partial interface ICatCountRequest : IRequest - { - [IgnoreDataMember] - Indices Index - { - get; - } - } - - ///Request for Count https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-count/ - public partial class CatCountRequest : PlainRequestBase, ICatCountRequest - { - protected ICatCountRequest Self => this; - internal override ApiUrls ApiUrls => ApiUrlsLookups.CatCount; - ////_cat/count - public CatCountRequest(): base() - { - } - - ////_cat/count/{index} - ///Optional, accepts null - public CatCountRequest(Indices index): base(r => r.Optional("index", index)) - { - } - - // values part of the url path - [IgnoreDataMember] - Indices ICatCountRequest.Index => Self.RouteValues.Get("index"); - // Request parameters - ///a short version of the Accept header, e.g. json, yaml - public string Format - { - get => Q("format"); - set - { - Q("format", value); - SetAcceptHeader(value); - } - } - - ///Comma-separated list of column names to display - public string[] Headers - { - get => Q("h"); - set => Q("h", value); - } - - ///Return help information - public bool? Help - { - get => Q("help"); - set => Q("help", value); - } - - ///Comma-separated list of column names or column aliases to sort by - public string[] SortByColumns - { - get => Q("s"); - set => Q("s", value); - } - - ///Verbose mode. Display column headers - public bool? Verbose - { - get => Q("v"); - set => Q("v", value); - } - } - [InterfaceDataContract] public partial interface ICatFielddataRequest : IRequest { diff --git a/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs b/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs index b5975b6fb4..519650865f 100644 --- a/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs @@ -51,6 +51,9 @@ internal static partial class ApiUrlsLookups internal static readonly ApiUrls CatAllocation = new(new[] { "_cat/allocation", "_cat/allocation/{node_id}" }); + internal static readonly ApiUrls CatCount = + new(new[] { "_cat/count", "_cat/count/{index}" }); + internal static readonly ApiUrls ClusterAllocationExplain = new(new[] { "_cluster/allocation/explain" }); diff --git a/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs b/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs index 18c95c2820..17d1bb2133 100644 --- a/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs +++ b/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs @@ -171,4 +171,53 @@ public CatAllocationDescriptor SortByColumns(params string[] sortbycolumns) => ///Verbose mode. Display column headers. public CatAllocationDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); } + + ///Descriptor for Count https://opensearch.org/docs/latest/api-reference/cat/cat-count/ + public partial class CatCountDescriptor + : RequestDescriptorBase, + ICatCountRequest + { + internal override ApiUrls ApiUrls => ApiUrlsLookups.CatCount; + + ////_cat/count + public CatCountDescriptor() + : base() { } + + ////_cat/count/{index} + ///Optional, accepts null + public CatCountDescriptor(Indices index) + : base(r => r.Optional("index", index)) { } + + // values part of the url path + Indices ICatCountRequest.Index => Self.RouteValues.Get("index"); + + ///Comma-separated list of indices to limit the returned information. + public CatCountDescriptor Index(Indices index) => + Assign(index, (a, v) => a.RouteValues.Optional("index", v)); + + ///a shortcut into calling Index(typeof(TOther)) + public CatCountDescriptor Index() + where TOther : class => + Assign(typeof(TOther), (a, v) => a.RouteValues.Optional("index", (Indices)v)); + + ///A shortcut into calling Index(Indices.All) + public CatCountDescriptor AllIndices() => Index(Indices.All); + + // Request parameters + ///A short version of the Accept header, e.g. json, yaml. + public CatCountDescriptor Format(string format) => Qs("format", format); + + ///Comma-separated list of column names to display. + public CatCountDescriptor Headers(params string[] headers) => Qs("h", headers); + + ///Return help information. + public CatCountDescriptor Help(bool? help = true) => Qs("help", help); + + ///Comma-separated list of column names or column aliases to sort by. + public CatCountDescriptor SortByColumns(params string[] sortbycolumns) => + Qs("s", sortbycolumns); + + ///Verbose mode. Display column headers. + public CatCountDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); + } } diff --git a/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs b/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs index 00611a69c2..fffcdd2e8f 100644 --- a/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs +++ b/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs @@ -145,5 +145,42 @@ public Task> AllocationAsync( request, ct ); + + /// + /// GET request to the cat.count API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/cat-count/ + /// + public CatResponse Count( + Func selector = null + ) => Count(selector.InvokeOrDefault(new CatCountDescriptor())); + + /// + /// GET request to the cat.count API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/cat-count/ + /// + public Task> CountAsync( + Func selector = null, + CancellationToken ct = default + ) => CountAsync(selector.InvokeOrDefault(new CatCountDescriptor()), ct); + + /// + /// GET request to the cat.count API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/cat-count/ + /// + public CatResponse Count(ICatCountRequest request) => + DoCat(request); + + /// + /// GET request to the cat.count API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/cat-count/ + /// + public Task> CountAsync( + ICatCountRequest request, + CancellationToken ct = default + ) => DoCatAsync(request, ct); } } diff --git a/src/OpenSearch.Client/_Generated/Requests.Cat.cs b/src/OpenSearch.Client/_Generated/Requests.Cat.cs index 2e955492c4..3d82adaeed 100644 --- a/src/OpenSearch.Client/_Generated/Requests.Cat.cs +++ b/src/OpenSearch.Client/_Generated/Requests.Cat.cs @@ -241,4 +241,73 @@ public bool? Verbose set => Q("v", value); } } + + [InterfaceDataContract] + public partial interface ICatCountRequest : IRequest + { + [IgnoreDataMember] + Indices Index { get; } + } + + ///Request for Count https://opensearch.org/docs/latest/api-reference/cat/cat-count/ + public partial class CatCountRequest + : PlainRequestBase, + ICatCountRequest + { + protected ICatCountRequest Self => this; + internal override ApiUrls ApiUrls => ApiUrlsLookups.CatCount; + + ////_cat/count + public CatCountRequest() + : base() { } + + ////_cat/count/{index} + ///Optional, accepts null + public CatCountRequest(Indices index) + : base(r => r.Optional("index", index)) { } + + // values part of the url path + [IgnoreDataMember] + Indices ICatCountRequest.Index => Self.RouteValues.Get("index"); + + // Request parameters + ///A short version of the Accept header, e.g. json, yaml. + public string Format + { + get => Q("format"); + set + { + Q("format", value); + SetAcceptHeader(value); + } + } + + ///Comma-separated list of column names to display. + public string[] Headers + { + get => Q("h"); + set => Q("h", value); + } + + ///Return help information. + public bool? Help + { + get => Q("help"); + set => Q("help", value); + } + + ///Comma-separated list of column names or column aliases to sort by. + public string[] SortByColumns + { + get => Q("s"); + set => Q("s", value); + } + + ///Verbose mode. Display column headers. + public bool? Verbose + { + get => Q("v"); + set => Q("v", value); + } + } } diff --git a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs index 291e937061..757eaaa4ca 100644 --- a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs +++ b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs @@ -51,51 +51,6 @@ // ReSharper disable once CheckNamespace namespace OpenSearch.Net.Specification.CatApi { - ///Request options for Count https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-count/ - public class CatCountRequestParameters : RequestParameters - { - public override HttpMethod DefaultHttpMethod => HttpMethod.GET; - public override bool SupportsBody => false; - ///a short version of the Accept header, e.g. json, yaml - public string Format - { - get => Q("format"); - set - { - Q("format", value); - SetAcceptHeader(value); - } - } - - ///Comma-separated list of column names to display - public string[] Headers - { - get => Q("h"); - set => Q("h", value); - } - - ///Return help information - public bool? Help - { - get => Q("help"); - set => Q("help", value); - } - - ///Comma-separated list of column names or column aliases to sort by - public string[] SortByColumns - { - get => Q("s"); - set => Q("s", value); - } - - ///Verbose mode. Display column headers - public bool? Verbose - { - get => Q("v"); - set => Q("v", value); - } - } - ///Request options for Fielddata https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-field-data/ public class CatFielddataRequestParameters : RequestParameters { diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs index b58d628b0a..6d706e95b3 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs @@ -66,26 +66,6 @@ namespace OpenSearch.Net.Specification.CatApi /// public partial class LowLevelCatNamespace : NamespacedClientProxy { - ///GET on /_cat/count https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-count/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse Count(CatCountRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, "_cat/count", null, RequestParams(requestParameters)); - ///GET on /_cat/count https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-count/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cat.count", "")] - public Task CountAsync(CatCountRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, "_cat/count", ctx, null, RequestParams(requestParameters)); - ///GET on /_cat/count/{index} https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-count/ - ///A comma-separated list of index names to limit the returned information - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse Count(string index, CatCountRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, Url($"_cat/count/{index:index}"), null, RequestParams(requestParameters)); - ///GET on /_cat/count/{index} https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-count/ - ///A comma-separated list of index names to limit the returned information - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cat.count", "index")] - public Task CountAsync(string index, CatCountRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, Url($"_cat/count/{index:index}"), ctx, null, RequestParams(requestParameters)); ///GET on /_cat/fielddata https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-field-data/ ///Request specific configuration such as querystring parameters & request specific connection settings. public TResponse Fielddata(CatFielddataRequestParameters requestParameters = null) diff --git a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs index 4c86756107..ce7ee5ab15 100644 --- a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs @@ -191,4 +191,50 @@ public bool? Verbose set => Q("v", value); } } + + ///Request options for Count https://opensearch.org/docs/latest/api-reference/cat/cat-count/ + public partial class CatCountRequestParameters : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + public override bool SupportsBody => false; + + ///A short version of the Accept header, e.g. json, yaml. + public string Format + { + get => Q("format"); + set + { + Q("format", value); + SetAcceptHeader(value); + } + } + + ///Comma-separated list of column names to display. + public string[] Headers + { + get => Q("h"); + set => Q("h", value); + } + + ///Return help information. + public bool? Help + { + get => Q("help"); + set => Q("help", value); + } + + ///Comma-separated list of column names or column aliases to sort by. + public string[] SortByColumns + { + get => Q("s"); + set => Q("s", value); + } + + ///Verbose mode. Display column headers. + public bool? Verbose + { + get => Q("v"); + set => Q("v", value); + } + } } diff --git a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs index 3bc14c8c54..c779bea066 100644 --- a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs @@ -182,5 +182,60 @@ public Task AllocationAsync( null, RequestParams(requestParameters) ); + + ///GET on /_cat/count https://opensearch.org/docs/latest/api-reference/cat/cat-count/ + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse Count(CatCountRequestParameters requestParameters = null) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest(GET, "_cat/count", null, RequestParams(requestParameters)); + + ///GET on /_cat/count https://opensearch.org/docs/latest/api-reference/cat/cat-count/ + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cat.count", "")] + public Task CountAsync( + CatCountRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + "_cat/count", + ctx, + null, + RequestParams(requestParameters) + ); + + ///GET on /_cat/count/{index} https://opensearch.org/docs/latest/api-reference/cat/cat-count/ + ///Comma-separated list of indices to limit the returned information. + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse Count( + string index, + CatCountRequestParameters requestParameters = null + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest( + GET, + Url($"_cat/count/{index:index}"), + null, + RequestParams(requestParameters) + ); + + ///GET on /_cat/count/{index} https://opensearch.org/docs/latest/api-reference/cat/cat-count/ + ///Comma-separated list of indices to limit the returned information. + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cat.count", "index")] + public Task CountAsync( + string index, + CatCountRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + Url($"_cat/count/{index:index}"), + ctx, + null, + RequestParams(requestParameters) + ); } } From 900c5d4e5db2793ffa704c4ea320087ab0bbddee Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Fri, 15 Sep 2023 17:13:24 +1200 Subject: [PATCH 04/13] Re-generate `cat.fielddata` Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 1 + src/OpenSearch.Client/ApiUrlsLookup.cs | 1 - src/OpenSearch.Client/Descriptors.Cat.cs | 36 --------- src/OpenSearch.Client/OpenSearchClient.Cat.cs | 24 ------ src/OpenSearch.Client/Requests.Cat.cs | 77 ------------------- .../_Generated/ApiUrlsLookup.cs | 3 + .../_Generated/Descriptors.Cat.cs | 52 +++++++++++++ .../_Generated/OpenSearchClient.Cat.cs | 41 ++++++++++ .../_Generated/Requests.Cat.cs | 76 ++++++++++++++++++ .../RequestParameters.Cat.cs | 59 -------------- .../OpenSearchLowLevelClient.Cat.cs | 20 ----- .../RequestParameters.Cat.cs | 61 +++++++++++++++ .../OpenSearchLowLevelClient.Cat.cs | 57 ++++++++++++++ 13 files changed, 291 insertions(+), 217 deletions(-) diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index 1ec791524d..3b44f00be3 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -45,6 +45,7 @@ public static class CodeConfiguration new("cat.aliases"), new("cat.allocation"), new("cat.count"), + new("cat.fielddata"), new("cluster.*"), new("dangling_indices.*"), diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index 8388e64a28..4622bc4f48 100644 --- a/src/OpenSearch.Client/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/ApiUrlsLookup.cs @@ -48,7 +48,6 @@ internal static partial class ApiUrlsLookups internal static ApiUrls NoNamespaceBulk = new ApiUrls(new[]{"_bulk", "{index}/_bulk"}); ///Introduced in OpenSearch 2.0 instead of internal static ApiUrls CatClusterManager = new ApiUrls(new[]{"_cat/cluster_manager"}); - internal static ApiUrls CatFielddata = new ApiUrls(new[]{"_cat/fielddata", "_cat/fielddata/{fields}"}); internal static ApiUrls CatHealth = new ApiUrls(new[]{"_cat/health"}); internal static ApiUrls CatHelp = new ApiUrls(new[]{"_cat"}); internal static ApiUrls CatIndices = new ApiUrls(new[]{"_cat/indices", "_cat/indices/{index}"}); diff --git a/src/OpenSearch.Client/Descriptors.Cat.cs b/src/OpenSearch.Client/Descriptors.Cat.cs index ccd0f6ff89..8816b73a59 100644 --- a/src/OpenSearch.Client/Descriptors.Cat.cs +++ b/src/OpenSearch.Client/Descriptors.Cat.cs @@ -57,42 +57,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - ///Descriptor for Fielddata https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-field-data/ - public partial class CatFielddataDescriptor : RequestDescriptorBase, ICatFielddataRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.CatFielddata; - ////_cat/fielddata - public CatFielddataDescriptor(): base() - { - } - - ////_cat/fielddata/{fields} - ///Optional, accepts null - public CatFielddataDescriptor(Fields fields): base(r => r.Optional("fields", fields)) - { - } - - // values part of the url path - Fields ICatFielddataRequest.Fields => Self.RouteValues.Get("fields"); - ///A comma-separated list of fields to return the fielddata size - public CatFielddataDescriptor Fields(Fields fields) => Assign(fields, (a, v) => a.RouteValues.Optional("fields", v)); - ///A comma-separated list of fields to return the fielddata size - public CatFielddataDescriptor Fields(params Expression>[] fields) => Assign(fields, (a, v) => a.RouteValues.Optional("fields", (Fields)v)); - // Request parameters - ///The unit in which to display byte values - public CatFielddataDescriptor Bytes(Bytes? bytes) => Qs("bytes", bytes); - ///a short version of the Accept header, e.g. json, yaml - public CatFielddataDescriptor Format(string format) => Qs("format", format); - ///Comma-separated list of column names to display - public CatFielddataDescriptor Headers(params string[] headers) => Qs("h", headers); - ///Return help information - public CatFielddataDescriptor Help(bool? help = true) => Qs("help", help); - ///Comma-separated list of column names or column aliases to sort by - public CatFielddataDescriptor SortByColumns(params string[] sortbycolumns) => Qs("s", sortbycolumns); - ///Verbose mode. Display column headers - public CatFielddataDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); - } - ///Descriptor for Health https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-health/ public partial class CatHealthDescriptor : RequestDescriptorBase, ICatHealthRequest { diff --git a/src/OpenSearch.Client/OpenSearchClient.Cat.cs b/src/OpenSearch.Client/OpenSearchClient.Cat.cs index a2e7e5b607..2f50174171 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Cat.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Cat.cs @@ -59,30 +59,6 @@ namespace OpenSearch.Client.Specification.CatApi /// public partial class CatNamespace : NamespacedClientProxy { - /// - /// GET request to the cat.fielddata API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-field-data/ - /// - public CatResponse Fielddata(Func selector = null) => Fielddata(selector.InvokeOrDefault(new CatFielddataDescriptor())); - /// - /// GET request to the cat.fielddata API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-field-data/ - /// - public Task> FielddataAsync(Func selector = null, CancellationToken ct = default) => FielddataAsync(selector.InvokeOrDefault(new CatFielddataDescriptor()), ct); - /// - /// GET request to the cat.fielddata API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-field-data/ - /// - public CatResponse Fielddata(ICatFielddataRequest request) => DoCat(request); - /// - /// GET request to the cat.fielddata API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-field-data/ - /// - public Task> FielddataAsync(ICatFielddataRequest request, CancellationToken ct = default) => DoCatAsync(request, ct); /// /// GET request to the cat.health API, read more about this API online: /// diff --git a/src/OpenSearch.Client/Requests.Cat.cs b/src/OpenSearch.Client/Requests.Cat.cs index adf974aaec..fb11d8d54c 100644 --- a/src/OpenSearch.Client/Requests.Cat.cs +++ b/src/OpenSearch.Client/Requests.Cat.cs @@ -58,83 +58,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - [InterfaceDataContract] - public partial interface ICatFielddataRequest : IRequest - { - [IgnoreDataMember] - Fields Fields - { - get; - } - } - - ///Request for Fielddata https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-field-data/ - public partial class CatFielddataRequest : PlainRequestBase, ICatFielddataRequest - { - protected ICatFielddataRequest Self => this; - internal override ApiUrls ApiUrls => ApiUrlsLookups.CatFielddata; - ////_cat/fielddata - public CatFielddataRequest(): base() - { - } - - ////_cat/fielddata/{fields} - ///Optional, accepts null - public CatFielddataRequest(Fields fields): base(r => r.Optional("fields", fields)) - { - } - - // values part of the url path - [IgnoreDataMember] - Fields ICatFielddataRequest.Fields => Self.RouteValues.Get("fields"); - // Request parameters - ///The unit in which to display byte values - public Bytes? Bytes - { - get => Q("bytes"); - set => Q("bytes", value); - } - - ///a short version of the Accept header, e.g. json, yaml - public string Format - { - get => Q("format"); - set - { - Q("format", value); - SetAcceptHeader(value); - } - } - - ///Comma-separated list of column names to display - public string[] Headers - { - get => Q("h"); - set => Q("h", value); - } - - ///Return help information - public bool? Help - { - get => Q("help"); - set => Q("help", value); - } - - ///Comma-separated list of column names or column aliases to sort by - public string[] SortByColumns - { - get => Q("s"); - set => Q("s", value); - } - - ///Verbose mode. Display column headers - public bool? Verbose - { - get => Q("v"); - set => Q("v", value); - } - } - [InterfaceDataContract] public partial interface ICatHealthRequest : IRequest { diff --git a/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs b/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs index 519650865f..e664071737 100644 --- a/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs @@ -54,6 +54,9 @@ internal static partial class ApiUrlsLookups internal static readonly ApiUrls CatCount = new(new[] { "_cat/count", "_cat/count/{index}" }); + internal static readonly ApiUrls CatFielddata = + new(new[] { "_cat/fielddata", "_cat/fielddata/{fields}" }); + internal static readonly ApiUrls ClusterAllocationExplain = new(new[] { "_cluster/allocation/explain" }); diff --git a/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs b/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs index 17d1bb2133..ea01fd7f6f 100644 --- a/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs +++ b/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs @@ -220,4 +220,56 @@ public CatCountDescriptor SortByColumns(params string[] sortbycolumns) => ///Verbose mode. Display column headers. public CatCountDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); } + + ///Descriptor for Fielddata https://opensearch.org/docs/latest/api-reference/cat/cat-field-data/ + public partial class CatFielddataDescriptor + : RequestDescriptorBase< + CatFielddataDescriptor, + CatFielddataRequestParameters, + ICatFielddataRequest + >, + ICatFielddataRequest + { + internal override ApiUrls ApiUrls => ApiUrlsLookups.CatFielddata; + + ////_cat/fielddata + public CatFielddataDescriptor() + : base() { } + + ////_cat/fielddata/{fields} + ///Optional, accepts null + public CatFielddataDescriptor(Fields fields) + : base(r => r.Optional("fields", fields)) { } + + // values part of the url path + Fields ICatFielddataRequest.Fields => Self.RouteValues.Get("fields"); + + ///Comma-separated list of fields to return the fielddata size. + public CatFielddataDescriptor Fields(Fields fields) => + Assign(fields, (a, v) => a.RouteValues.Optional("fields", v)); + + ///Comma-separated list of fields to return the fielddata size. + public CatFielddataDescriptor Fields(params Expression>[] fields) => + Assign(fields, (a, v) => a.RouteValues.Optional("fields", (Fields)v)); + + // Request parameters + ///The unit in which to display byte values. + public CatFielddataDescriptor Bytes(Bytes? bytes) => Qs("bytes", bytes); + + ///A short version of the Accept header, e.g. json, yaml. + public CatFielddataDescriptor Format(string format) => Qs("format", format); + + ///Comma-separated list of column names to display. + public CatFielddataDescriptor Headers(params string[] headers) => Qs("h", headers); + + ///Return help information. + public CatFielddataDescriptor Help(bool? help = true) => Qs("help", help); + + ///Comma-separated list of column names or column aliases to sort by. + public CatFielddataDescriptor SortByColumns(params string[] sortbycolumns) => + Qs("s", sortbycolumns); + + ///Verbose mode. Display column headers. + public CatFielddataDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); + } } diff --git a/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs b/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs index fffcdd2e8f..f18df4e26c 100644 --- a/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs +++ b/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs @@ -182,5 +182,46 @@ public Task> CountAsync( ICatCountRequest request, CancellationToken ct = default ) => DoCatAsync(request, ct); + + /// + /// GET request to the cat.fielddata API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/cat-field-data/ + /// + public CatResponse Fielddata( + Func selector = null + ) => Fielddata(selector.InvokeOrDefault(new CatFielddataDescriptor())); + + /// + /// GET request to the cat.fielddata API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/cat-field-data/ + /// + public Task> FielddataAsync( + Func selector = null, + CancellationToken ct = default + ) => FielddataAsync(selector.InvokeOrDefault(new CatFielddataDescriptor()), ct); + + /// + /// GET request to the cat.fielddata API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/cat-field-data/ + /// + public CatResponse Fielddata(ICatFielddataRequest request) => + DoCat(request); + + /// + /// GET request to the cat.fielddata API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/cat-field-data/ + /// + public Task> FielddataAsync( + ICatFielddataRequest request, + CancellationToken ct = default + ) => + DoCatAsync( + request, + ct + ); } } diff --git a/src/OpenSearch.Client/_Generated/Requests.Cat.cs b/src/OpenSearch.Client/_Generated/Requests.Cat.cs index 3d82adaeed..1933bb8a50 100644 --- a/src/OpenSearch.Client/_Generated/Requests.Cat.cs +++ b/src/OpenSearch.Client/_Generated/Requests.Cat.cs @@ -310,4 +310,80 @@ public bool? Verbose set => Q("v", value); } } + + [InterfaceDataContract] + public partial interface ICatFielddataRequest : IRequest + { + [IgnoreDataMember] + Fields Fields { get; } + } + + ///Request for Fielddata https://opensearch.org/docs/latest/api-reference/cat/cat-field-data/ + public partial class CatFielddataRequest + : PlainRequestBase, + ICatFielddataRequest + { + protected ICatFielddataRequest Self => this; + internal override ApiUrls ApiUrls => ApiUrlsLookups.CatFielddata; + + ////_cat/fielddata + public CatFielddataRequest() + : base() { } + + ////_cat/fielddata/{fields} + ///Optional, accepts null + public CatFielddataRequest(Fields fields) + : base(r => r.Optional("fields", fields)) { } + + // values part of the url path + [IgnoreDataMember] + Fields ICatFielddataRequest.Fields => Self.RouteValues.Get("fields"); + + // Request parameters + ///The unit in which to display byte values. + public Bytes? Bytes + { + get => Q("bytes"); + set => Q("bytes", value); + } + + ///A short version of the Accept header, e.g. json, yaml. + public string Format + { + get => Q("format"); + set + { + Q("format", value); + SetAcceptHeader(value); + } + } + + ///Comma-separated list of column names to display. + public string[] Headers + { + get => Q("h"); + set => Q("h", value); + } + + ///Return help information. + public bool? Help + { + get => Q("help"); + set => Q("help", value); + } + + ///Comma-separated list of column names or column aliases to sort by. + public string[] SortByColumns + { + get => Q("s"); + set => Q("s", value); + } + + ///Verbose mode. Display column headers. + public bool? Verbose + { + get => Q("v"); + set => Q("v", value); + } + } } diff --git a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs index 757eaaa4ca..873611251a 100644 --- a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs +++ b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs @@ -51,65 +51,6 @@ // ReSharper disable once CheckNamespace namespace OpenSearch.Net.Specification.CatApi { - ///Request options for Fielddata https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-field-data/ - public class CatFielddataRequestParameters : RequestParameters - { - public override HttpMethod DefaultHttpMethod => HttpMethod.GET; - public override bool SupportsBody => false; - ///The unit in which to display byte values - public Bytes? Bytes - { - get => Q("bytes"); - set => Q("bytes", value); - } - - ///A comma-separated list of fields to return in the output - public string[] Fields - { - get => Q("fields"); - set => Q("fields", value); - } - - ///a short version of the Accept header, e.g. json, yaml - public string Format - { - get => Q("format"); - set - { - Q("format", value); - SetAcceptHeader(value); - } - } - - ///Comma-separated list of column names to display - public string[] Headers - { - get => Q("h"); - set => Q("h", value); - } - - ///Return help information - public bool? Help - { - get => Q("help"); - set => Q("help", value); - } - - ///Comma-separated list of column names or column aliases to sort by - public string[] SortByColumns - { - get => Q("s"); - set => Q("s", value); - } - - ///Verbose mode. Display column headers - public bool? Verbose - { - get => Q("v"); - set => Q("v", value); - } - } - ///Request options for Health https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-health/ public class CatHealthRequestParameters : RequestParameters { diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs index 6d706e95b3..5dd8ef722d 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs @@ -66,26 +66,6 @@ namespace OpenSearch.Net.Specification.CatApi /// public partial class LowLevelCatNamespace : NamespacedClientProxy { - ///GET on /_cat/fielddata https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-field-data/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse Fielddata(CatFielddataRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, "_cat/fielddata", null, RequestParams(requestParameters)); - ///GET on /_cat/fielddata https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-field-data/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cat.fielddata", "")] - public Task FielddataAsync(CatFielddataRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, "_cat/fielddata", ctx, null, RequestParams(requestParameters)); - ///GET on /_cat/fielddata/{fields} https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-field-data/ - ///A comma-separated list of fields to return the fielddata size - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse Fielddata(string fields, CatFielddataRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, Url($"_cat/fielddata/{fields:fields}"), null, RequestParams(requestParameters)); - ///GET on /_cat/fielddata/{fields} https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-field-data/ - ///A comma-separated list of fields to return the fielddata size - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cat.fielddata", "fields")] - public Task FielddataAsync(string fields, CatFielddataRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, Url($"_cat/fielddata/{fields:fields}"), ctx, null, RequestParams(requestParameters)); ///GET on /_cat/health https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-health/ ///Request specific configuration such as querystring parameters & request specific connection settings. public TResponse Health(CatHealthRequestParameters requestParameters = null) diff --git a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs index ce7ee5ab15..96eba7ceb5 100644 --- a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs @@ -237,4 +237,65 @@ public bool? Verbose set => Q("v", value); } } + + ///Request options for Fielddata https://opensearch.org/docs/latest/api-reference/cat/cat-field-data/ + public partial class CatFielddataRequestParameters + : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + public override bool SupportsBody => false; + + ///The unit in which to display byte values. + public Bytes? Bytes + { + get => Q("bytes"); + set => Q("bytes", value); + } + + ///Comma-separated list of fields to return in the output. + public string[] Fields + { + get => Q("fields"); + set => Q("fields", value); + } + + ///A short version of the Accept header, e.g. json, yaml. + public string Format + { + get => Q("format"); + set + { + Q("format", value); + SetAcceptHeader(value); + } + } + + ///Comma-separated list of column names to display. + public string[] Headers + { + get => Q("h"); + set => Q("h", value); + } + + ///Return help information. + public bool? Help + { + get => Q("help"); + set => Q("help", value); + } + + ///Comma-separated list of column names or column aliases to sort by. + public string[] SortByColumns + { + get => Q("s"); + set => Q("s", value); + } + + ///Verbose mode. Display column headers. + public bool? Verbose + { + get => Q("v"); + set => Q("v", value); + } + } } diff --git a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs index c779bea066..660e586cea 100644 --- a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs @@ -237,5 +237,62 @@ public Task CountAsync( null, RequestParams(requestParameters) ); + + ///GET on /_cat/fielddata https://opensearch.org/docs/latest/api-reference/cat/cat-field-data/ + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse Fielddata( + CatFielddataRequestParameters requestParameters = null + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest(GET, "_cat/fielddata", null, RequestParams(requestParameters)); + + ///GET on /_cat/fielddata https://opensearch.org/docs/latest/api-reference/cat/cat-field-data/ + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cat.fielddata", "")] + public Task FielddataAsync( + CatFielddataRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + "_cat/fielddata", + ctx, + null, + RequestParams(requestParameters) + ); + + ///GET on /_cat/fielddata/{fields} https://opensearch.org/docs/latest/api-reference/cat/cat-field-data/ + ///Comma-separated list of fields to return the fielddata size. + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse Fielddata( + string fields, + CatFielddataRequestParameters requestParameters = null + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest( + GET, + Url($"_cat/fielddata/{fields:fields}"), + null, + RequestParams(requestParameters) + ); + + ///GET on /_cat/fielddata/{fields} https://opensearch.org/docs/latest/api-reference/cat/cat-field-data/ + ///Comma-separated list of fields to return the fielddata size. + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cat.fielddata", "fields")] + public Task FielddataAsync( + string fields, + CatFielddataRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + Url($"_cat/fielddata/{fields:fields}"), + ctx, + null, + RequestParams(requestParameters) + ); } } From 7e1a58a1a21bd686f8b39fd246801f6a600f9a3e Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Mon, 18 Sep 2023 10:32:46 +1200 Subject: [PATCH 05/13] Re-generate `cat.health` Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 1 + src/OpenSearch.Client/ApiUrlsLookup.cs | 1 - src/OpenSearch.Client/Descriptors.Cat.cs | 20 ------ src/OpenSearch.Client/OpenSearchClient.Cat.cs | 24 -------- src/OpenSearch.Client/Requests.Cat.cs | 59 ------------------ .../_Generated/ApiUrlsLookup.cs | 2 + .../_Generated/Descriptors.Cat.cs | 30 +++++++++ .../_Generated/OpenSearchClient.Cat.cs | 38 ++++++++++++ .../_Generated/Requests.Cat.cs | 61 +++++++++++++++++++ .../RequestParameters.Cat.cs | 52 ---------------- .../OpenSearchLowLevelClient.Cat.cs | 9 --- .../RequestParameters.Cat.cs | 53 ++++++++++++++++ .../OpenSearchLowLevelClient.Cat.cs | 22 +++++++ 13 files changed, 207 insertions(+), 165 deletions(-) diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index 3b44f00be3..e89c6116a9 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -46,6 +46,7 @@ public static class CodeConfiguration new("cat.allocation"), new("cat.count"), new("cat.fielddata"), + new("cat.health"), new("cluster.*"), new("dangling_indices.*"), diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index 4622bc4f48..90c9754511 100644 --- a/src/OpenSearch.Client/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/ApiUrlsLookup.cs @@ -48,7 +48,6 @@ internal static partial class ApiUrlsLookups internal static ApiUrls NoNamespaceBulk = new ApiUrls(new[]{"_bulk", "{index}/_bulk"}); ///Introduced in OpenSearch 2.0 instead of internal static ApiUrls CatClusterManager = new ApiUrls(new[]{"_cat/cluster_manager"}); - internal static ApiUrls CatHealth = new ApiUrls(new[]{"_cat/health"}); internal static ApiUrls CatHelp = new ApiUrls(new[]{"_cat"}); internal static ApiUrls CatIndices = new ApiUrls(new[]{"_cat/indices", "_cat/indices/{index}"}); ///Deprecated as of OpenSearch 2.0, use instead diff --git a/src/OpenSearch.Client/Descriptors.Cat.cs b/src/OpenSearch.Client/Descriptors.Cat.cs index 8816b73a59..289399be3a 100644 --- a/src/OpenSearch.Client/Descriptors.Cat.cs +++ b/src/OpenSearch.Client/Descriptors.Cat.cs @@ -57,26 +57,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - ///Descriptor for Health https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-health/ - public partial class CatHealthDescriptor : RequestDescriptorBase, ICatHealthRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.CatHealth; - // values part of the url path - // Request parameters - ///a short version of the Accept header, e.g. json, yaml - public CatHealthDescriptor Format(string format) => Qs("format", format); - ///Comma-separated list of column names to display - public CatHealthDescriptor Headers(params string[] headers) => Qs("h", headers); - ///Return help information - public CatHealthDescriptor Help(bool? help = true) => Qs("help", help); - ///Set to false to disable timestamping - public CatHealthDescriptor IncludeTimestamp(bool? includetimestamp = true) => Qs("ts", includetimestamp); - ///Comma-separated list of column names or column aliases to sort by - public CatHealthDescriptor SortByColumns(params string[] sortbycolumns) => Qs("s", sortbycolumns); - ///Verbose mode. Display column headers - public CatHealthDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); - } - ///Descriptor for Help https://opensearch.org/docs/latest/opensearch/rest-api/cat/index/ public partial class CatHelpDescriptor : RequestDescriptorBase, ICatHelpRequest { diff --git a/src/OpenSearch.Client/OpenSearchClient.Cat.cs b/src/OpenSearch.Client/OpenSearchClient.Cat.cs index 2f50174171..2be1123b23 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Cat.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Cat.cs @@ -59,30 +59,6 @@ namespace OpenSearch.Client.Specification.CatApi /// public partial class CatNamespace : NamespacedClientProxy { - /// - /// GET request to the cat.health API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-health/ - /// - public CatResponse Health(Func selector = null) => Health(selector.InvokeOrDefault(new CatHealthDescriptor())); - /// - /// GET request to the cat.health API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-health/ - /// - public Task> HealthAsync(Func selector = null, CancellationToken ct = default) => HealthAsync(selector.InvokeOrDefault(new CatHealthDescriptor()), ct); - /// - /// GET request to the cat.health API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-health/ - /// - public CatResponse Health(ICatHealthRequest request) => DoCat(request); - /// - /// GET request to the cat.health API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-health/ - /// - public Task> HealthAsync(ICatHealthRequest request, CancellationToken ct = default) => DoCatAsync(request, ct); /// /// GET request to the cat.help API, read more about this API online: /// diff --git a/src/OpenSearch.Client/Requests.Cat.cs b/src/OpenSearch.Client/Requests.Cat.cs index fb11d8d54c..11f58b3f07 100644 --- a/src/OpenSearch.Client/Requests.Cat.cs +++ b/src/OpenSearch.Client/Requests.Cat.cs @@ -58,65 +58,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - [InterfaceDataContract] - public partial interface ICatHealthRequest : IRequest - { - } - - ///Request for Health https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-health/ - public partial class CatHealthRequest : PlainRequestBase, ICatHealthRequest - { - protected ICatHealthRequest Self => this; - internal override ApiUrls ApiUrls => ApiUrlsLookups.CatHealth; - // values part of the url path - // Request parameters - ///a short version of the Accept header, e.g. json, yaml - public string Format - { - get => Q("format"); - set - { - Q("format", value); - SetAcceptHeader(value); - } - } - - ///Comma-separated list of column names to display - public string[] Headers - { - get => Q("h"); - set => Q("h", value); - } - - ///Return help information - public bool? Help - { - get => Q("help"); - set => Q("help", value); - } - - ///Set to false to disable timestamping - public bool? IncludeTimestamp - { - get => Q("ts"); - set => Q("ts", value); - } - - ///Comma-separated list of column names or column aliases to sort by - public string[] SortByColumns - { - get => Q("s"); - set => Q("s", value); - } - - ///Verbose mode. Display column headers - public bool? Verbose - { - get => Q("v"); - set => Q("v", value); - } - } - [InterfaceDataContract] public partial interface ICatHelpRequest : IRequest { diff --git a/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs b/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs index e664071737..8df46b5568 100644 --- a/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs @@ -57,6 +57,8 @@ internal static partial class ApiUrlsLookups internal static readonly ApiUrls CatFielddata = new(new[] { "_cat/fielddata", "_cat/fielddata/{fields}" }); + internal static readonly ApiUrls CatHealth = new(new[] { "_cat/health" }); + internal static readonly ApiUrls ClusterAllocationExplain = new(new[] { "_cluster/allocation/explain" }); diff --git a/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs b/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs index ea01fd7f6f..567ac50545 100644 --- a/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs +++ b/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs @@ -272,4 +272,34 @@ public CatFielddataDescriptor SortByColumns(params string[] sortbycolumns) => ///Verbose mode. Display column headers. public CatFielddataDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); } + + ///Descriptor for Health https://opensearch.org/docs/latest/api-reference/cat/cat-health/ + public partial class CatHealthDescriptor + : RequestDescriptorBase, + ICatHealthRequest + { + internal override ApiUrls ApiUrls => ApiUrlsLookups.CatHealth; + + // values part of the url path + // Request parameters + ///A short version of the Accept header, e.g. json, yaml. + public CatHealthDescriptor Format(string format) => Qs("format", format); + + ///Comma-separated list of column names to display. + public CatHealthDescriptor Headers(params string[] headers) => Qs("h", headers); + + ///Return help information. + public CatHealthDescriptor Help(bool? help = true) => Qs("help", help); + + ///Set to false to disable timestamping. + public CatHealthDescriptor IncludeTimestamp(bool? includetimestamp = true) => + Qs("ts", includetimestamp); + + ///Comma-separated list of column names or column aliases to sort by. + public CatHealthDescriptor SortByColumns(params string[] sortbycolumns) => + Qs("s", sortbycolumns); + + ///Verbose mode. Display column headers. + public CatHealthDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); + } } diff --git a/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs b/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs index f18df4e26c..93f7313a1f 100644 --- a/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs +++ b/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs @@ -223,5 +223,43 @@ public Task> FielddataAsync( request, ct ); + + /// + /// GET request to the cat.health API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/cat-health/ + /// + public CatResponse Health( + Func selector = null + ) => Health(selector.InvokeOrDefault(new CatHealthDescriptor())); + + /// + /// GET request to the cat.health API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/cat-health/ + /// + public Task> HealthAsync( + Func selector = null, + CancellationToken ct = default + ) => HealthAsync(selector.InvokeOrDefault(new CatHealthDescriptor()), ct); + + /// + /// GET request to the cat.health API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/cat-health/ + /// + public CatResponse Health(ICatHealthRequest request) => + DoCat(request); + + /// + /// GET request to the cat.health API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/cat-health/ + /// + public Task> HealthAsync( + ICatHealthRequest request, + CancellationToken ct = default + ) => + DoCatAsync(request, ct); } } diff --git a/src/OpenSearch.Client/_Generated/Requests.Cat.cs b/src/OpenSearch.Client/_Generated/Requests.Cat.cs index 1933bb8a50..ed5300694d 100644 --- a/src/OpenSearch.Client/_Generated/Requests.Cat.cs +++ b/src/OpenSearch.Client/_Generated/Requests.Cat.cs @@ -386,4 +386,65 @@ public bool? Verbose set => Q("v", value); } } + + [InterfaceDataContract] + public partial interface ICatHealthRequest : IRequest { } + + ///Request for Health https://opensearch.org/docs/latest/api-reference/cat/cat-health/ + public partial class CatHealthRequest + : PlainRequestBase, + ICatHealthRequest + { + protected ICatHealthRequest Self => this; + internal override ApiUrls ApiUrls => ApiUrlsLookups.CatHealth; + + // values part of the url path + + // Request parameters + ///A short version of the Accept header, e.g. json, yaml. + public string Format + { + get => Q("format"); + set + { + Q("format", value); + SetAcceptHeader(value); + } + } + + ///Comma-separated list of column names to display. + public string[] Headers + { + get => Q("h"); + set => Q("h", value); + } + + ///Return help information. + public bool? Help + { + get => Q("help"); + set => Q("help", value); + } + + ///Set to false to disable timestamping. + public bool? IncludeTimestamp + { + get => Q("ts"); + set => Q("ts", value); + } + + ///Comma-separated list of column names or column aliases to sort by. + public string[] SortByColumns + { + get => Q("s"); + set => Q("s", value); + } + + ///Verbose mode. Display column headers. + public bool? Verbose + { + get => Q("v"); + set => Q("v", value); + } + } } diff --git a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs index 873611251a..64b6f6d490 100644 --- a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs +++ b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs @@ -51,58 +51,6 @@ // ReSharper disable once CheckNamespace namespace OpenSearch.Net.Specification.CatApi { - ///Request options for Health https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-health/ - public class CatHealthRequestParameters : RequestParameters - { - public override HttpMethod DefaultHttpMethod => HttpMethod.GET; - public override bool SupportsBody => false; - ///a short version of the Accept header, e.g. json, yaml - public string Format - { - get => Q("format"); - set - { - Q("format", value); - SetAcceptHeader(value); - } - } - - ///Comma-separated list of column names to display - public string[] Headers - { - get => Q("h"); - set => Q("h", value); - } - - ///Return help information - public bool? Help - { - get => Q("help"); - set => Q("help", value); - } - - ///Set to false to disable timestamping - public bool? IncludeTimestamp - { - get => Q("ts"); - set => Q("ts", value); - } - - ///Comma-separated list of column names or column aliases to sort by - public string[] SortByColumns - { - get => Q("s"); - set => Q("s", value); - } - - ///Verbose mode. Display column headers - public bool? Verbose - { - get => Q("v"); - set => Q("v", value); - } - } - ///Request options for Help https://opensearch.org/docs/latest/opensearch/rest-api/cat/index/ public class CatHelpRequestParameters : RequestParameters { diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs index 5dd8ef722d..350e148235 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs @@ -66,15 +66,6 @@ namespace OpenSearch.Net.Specification.CatApi /// public partial class LowLevelCatNamespace : NamespacedClientProxy { - ///GET on /_cat/health https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-health/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse Health(CatHealthRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, "_cat/health", null, RequestParams(requestParameters)); - ///GET on /_cat/health https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-health/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cat.health", "")] - public Task HealthAsync(CatHealthRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, "_cat/health", ctx, null, RequestParams(requestParameters)); ///GET on /_cat https://opensearch.org/docs/latest/opensearch/rest-api/cat/index/ ///Request specific configuration such as querystring parameters & request specific connection settings. public TResponse Help(CatHelpRequestParameters requestParameters = null) diff --git a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs index 96eba7ceb5..410ae044ae 100644 --- a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs @@ -298,4 +298,57 @@ public bool? Verbose set => Q("v", value); } } + + ///Request options for Health https://opensearch.org/docs/latest/api-reference/cat/cat-health/ + public partial class CatHealthRequestParameters : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + public override bool SupportsBody => false; + + ///A short version of the Accept header, e.g. json, yaml. + public string Format + { + get => Q("format"); + set + { + Q("format", value); + SetAcceptHeader(value); + } + } + + ///Comma-separated list of column names to display. + public string[] Headers + { + get => Q("h"); + set => Q("h", value); + } + + ///Return help information. + public bool? Help + { + get => Q("help"); + set => Q("help", value); + } + + ///Set to false to disable timestamping. + public bool? IncludeTimestamp + { + get => Q("ts"); + set => Q("ts", value); + } + + ///Comma-separated list of column names or column aliases to sort by. + public string[] SortByColumns + { + get => Q("s"); + set => Q("s", value); + } + + ///Verbose mode. Display column headers. + public bool? Verbose + { + get => Q("v"); + set => Q("v", value); + } + } } diff --git a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs index 660e586cea..bc687d6da6 100644 --- a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs @@ -294,5 +294,27 @@ public Task FielddataAsync( null, RequestParams(requestParameters) ); + + ///GET on /_cat/health https://opensearch.org/docs/latest/api-reference/cat/cat-health/ + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse Health(CatHealthRequestParameters requestParameters = null) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest(GET, "_cat/health", null, RequestParams(requestParameters)); + + ///GET on /_cat/health https://opensearch.org/docs/latest/api-reference/cat/cat-health/ + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cat.health", "")] + public Task HealthAsync( + CatHealthRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + "_cat/health", + ctx, + null, + RequestParams(requestParameters) + ); } } From 62d708653390c8ff8d210315543d0347ef797795 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Mon, 18 Sep 2023 10:57:19 +1200 Subject: [PATCH 06/13] Re-generate `cat.help` Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 1 + src/OpenSearch.Client/ApiUrlsLookup.cs | 1 - src/OpenSearch.Client/Descriptors.Cat.cs | 12 ------ src/OpenSearch.Client/OpenSearchClient.Cat.cs | 24 ------------ src/OpenSearch.Client/Requests.Cat.cs | 27 -------------- .../_Generated/ApiUrlsLookup.cs | 2 + .../_Generated/Descriptors.Cat.cs | 17 +++++++++ .../_Generated/OpenSearchClient.Cat.cs | 37 +++++++++++++++++++ .../_Generated/Requests.Cat.cs | 29 +++++++++++++++ .../RequestParameters.Cat.cs | 20 ---------- .../OpenSearchLowLevelClient.Cat.cs | 9 ----- .../RequestParameters.Cat.cs | 21 +++++++++++ .../OpenSearchLowLevelClient.Cat.cs | 16 ++++++++ 13 files changed, 123 insertions(+), 93 deletions(-) diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index e89c6116a9..086daab8e3 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -47,6 +47,7 @@ public static class CodeConfiguration new("cat.count"), new("cat.fielddata"), new("cat.health"), + new("cat.help"), new("cluster.*"), new("dangling_indices.*"), diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index 90c9754511..84422e8e79 100644 --- a/src/OpenSearch.Client/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/ApiUrlsLookup.cs @@ -48,7 +48,6 @@ internal static partial class ApiUrlsLookups internal static ApiUrls NoNamespaceBulk = new ApiUrls(new[]{"_bulk", "{index}/_bulk"}); ///Introduced in OpenSearch 2.0 instead of internal static ApiUrls CatClusterManager = new ApiUrls(new[]{"_cat/cluster_manager"}); - internal static ApiUrls CatHelp = new ApiUrls(new[]{"_cat"}); internal static ApiUrls CatIndices = new ApiUrls(new[]{"_cat/indices", "_cat/indices/{index}"}); ///Deprecated as of OpenSearch 2.0, use instead internal static ApiUrls CatMaster = new ApiUrls(new[]{"_cat/master"}); diff --git a/src/OpenSearch.Client/Descriptors.Cat.cs b/src/OpenSearch.Client/Descriptors.Cat.cs index 289399be3a..6b2d0d21e3 100644 --- a/src/OpenSearch.Client/Descriptors.Cat.cs +++ b/src/OpenSearch.Client/Descriptors.Cat.cs @@ -57,18 +57,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - ///Descriptor for Help https://opensearch.org/docs/latest/opensearch/rest-api/cat/index/ - public partial class CatHelpDescriptor : RequestDescriptorBase, ICatHelpRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.CatHelp; - // values part of the url path - // Request parameters - ///Return help information - public CatHelpDescriptor Help(bool? help = true) => Qs("help", help); - ///Comma-separated list of column names or column aliases to sort by - public CatHelpDescriptor SortByColumns(params string[] sortbycolumns) => Qs("s", sortbycolumns); - } - ///Descriptor for Indices https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-indices/ public partial class CatIndicesDescriptor : RequestDescriptorBase, ICatIndicesRequest { diff --git a/src/OpenSearch.Client/OpenSearchClient.Cat.cs b/src/OpenSearch.Client/OpenSearchClient.Cat.cs index 2be1123b23..e15cd76ee1 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Cat.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Cat.cs @@ -59,30 +59,6 @@ namespace OpenSearch.Client.Specification.CatApi /// public partial class CatNamespace : NamespacedClientProxy { - /// - /// GET request to the cat.help API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/index/ - /// - public CatResponse Help(Func selector = null) => Help(selector.InvokeOrDefault(new CatHelpDescriptor())); - /// - /// GET request to the cat.help API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/index/ - /// - public Task> HelpAsync(Func selector = null, CancellationToken ct = default) => HelpAsync(selector.InvokeOrDefault(new CatHelpDescriptor()), ct); - /// - /// GET request to the cat.help API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/index/ - /// - public CatResponse Help(ICatHelpRequest request) => DoCat(request); - /// - /// GET request to the cat.help API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/index/ - /// - public Task> HelpAsync(ICatHelpRequest request, CancellationToken ct = default) => DoCatAsync(request, ct); /// /// GET request to the cat.indices API, read more about this API online: /// diff --git a/src/OpenSearch.Client/Requests.Cat.cs b/src/OpenSearch.Client/Requests.Cat.cs index 11f58b3f07..88cd980445 100644 --- a/src/OpenSearch.Client/Requests.Cat.cs +++ b/src/OpenSearch.Client/Requests.Cat.cs @@ -58,33 +58,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - [InterfaceDataContract] - public partial interface ICatHelpRequest : IRequest - { - } - - ///Request for Help https://opensearch.org/docs/latest/opensearch/rest-api/cat/index/ - public partial class CatHelpRequest : PlainRequestBase, ICatHelpRequest - { - protected ICatHelpRequest Self => this; - internal override ApiUrls ApiUrls => ApiUrlsLookups.CatHelp; - // values part of the url path - // Request parameters - ///Return help information - public bool? Help - { - get => Q("help"); - set => Q("help", value); - } - - ///Comma-separated list of column names or column aliases to sort by - public string[] SortByColumns - { - get => Q("s"); - set => Q("s", value); - } - } - [InterfaceDataContract] public partial interface ICatIndicesRequest : IRequest { diff --git a/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs b/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs index 8df46b5568..cf23d1e868 100644 --- a/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs @@ -59,6 +59,8 @@ internal static partial class ApiUrlsLookups internal static readonly ApiUrls CatHealth = new(new[] { "_cat/health" }); + internal static readonly ApiUrls CatHelp = new(new[] { "_cat" }); + internal static readonly ApiUrls ClusterAllocationExplain = new(new[] { "_cluster/allocation/explain" }); diff --git a/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs b/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs index 567ac50545..f81826e134 100644 --- a/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs +++ b/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs @@ -302,4 +302,21 @@ public CatHealthDescriptor SortByColumns(params string[] sortbycolumns) => ///Verbose mode. Display column headers. public CatHealthDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); } + + ///Descriptor for Help https://opensearch.org/docs/latest/api-reference/cat/index/ + public partial class CatHelpDescriptor + : RequestDescriptorBase, + ICatHelpRequest + { + internal override ApiUrls ApiUrls => ApiUrlsLookups.CatHelp; + + // values part of the url path + // Request parameters + ///Return help information. + public CatHelpDescriptor Help(bool? help = true) => Qs("help", help); + + ///Comma-separated list of column names or column aliases to sort by. + public CatHelpDescriptor SortByColumns(params string[] sortbycolumns) => + Qs("s", sortbycolumns); + } } diff --git a/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs b/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs index 93f7313a1f..b716834972 100644 --- a/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs +++ b/src/OpenSearch.Client/_Generated/OpenSearchClient.Cat.cs @@ -261,5 +261,42 @@ public Task> HealthAsync( CancellationToken ct = default ) => DoCatAsync(request, ct); + + /// + /// GET request to the cat.help API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/index/ + /// + public CatResponse Help( + Func selector = null + ) => Help(selector.InvokeOrDefault(new CatHelpDescriptor())); + + /// + /// GET request to the cat.help API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/index/ + /// + public Task> HelpAsync( + Func selector = null, + CancellationToken ct = default + ) => HelpAsync(selector.InvokeOrDefault(new CatHelpDescriptor()), ct); + + /// + /// GET request to the cat.help API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/index/ + /// + public CatResponse Help(ICatHelpRequest request) => + DoCat(request); + + /// + /// GET request to the cat.help API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/api-reference/cat/index/ + /// + public Task> HelpAsync( + ICatHelpRequest request, + CancellationToken ct = default + ) => DoCatAsync(request, ct); } } diff --git a/src/OpenSearch.Client/_Generated/Requests.Cat.cs b/src/OpenSearch.Client/_Generated/Requests.Cat.cs index ed5300694d..bafbf7a839 100644 --- a/src/OpenSearch.Client/_Generated/Requests.Cat.cs +++ b/src/OpenSearch.Client/_Generated/Requests.Cat.cs @@ -447,4 +447,33 @@ public bool? Verbose set => Q("v", value); } } + + [InterfaceDataContract] + public partial interface ICatHelpRequest : IRequest { } + + ///Request for Help https://opensearch.org/docs/latest/api-reference/cat/index/ + public partial class CatHelpRequest + : PlainRequestBase, + ICatHelpRequest + { + protected ICatHelpRequest Self => this; + internal override ApiUrls ApiUrls => ApiUrlsLookups.CatHelp; + + // values part of the url path + + // Request parameters + ///Return help information. + public bool? Help + { + get => Q("help"); + set => Q("help", value); + } + + ///Comma-separated list of column names or column aliases to sort by. + public string[] SortByColumns + { + get => Q("s"); + set => Q("s", value); + } + } } diff --git a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs index 64b6f6d490..1653167b9b 100644 --- a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs +++ b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs @@ -51,26 +51,6 @@ // ReSharper disable once CheckNamespace namespace OpenSearch.Net.Specification.CatApi { - ///Request options for Help https://opensearch.org/docs/latest/opensearch/rest-api/cat/index/ - public class CatHelpRequestParameters : RequestParameters - { - public override HttpMethod DefaultHttpMethod => HttpMethod.GET; - public override bool SupportsBody => false; - ///Return help information - public bool? Help - { - get => Q("help"); - set => Q("help", value); - } - - ///Comma-separated list of column names or column aliases to sort by - public string[] SortByColumns - { - get => Q("s"); - set => Q("s", value); - } - } - ///Request options for Indices https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-indices/ public class CatIndicesRequestParameters : RequestParameters { diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs index 350e148235..e7716ccdf9 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs @@ -66,15 +66,6 @@ namespace OpenSearch.Net.Specification.CatApi /// public partial class LowLevelCatNamespace : NamespacedClientProxy { - ///GET on /_cat https://opensearch.org/docs/latest/opensearch/rest-api/cat/index/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse Help(CatHelpRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, "_cat", null, RequestParams(requestParameters)); - ///GET on /_cat https://opensearch.org/docs/latest/opensearch/rest-api/cat/index/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cat.help", "")] - public Task HelpAsync(CatHelpRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, "_cat", ctx, null, RequestParams(requestParameters)); ///GET on /_cat/indices https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-indices/ ///Request specific configuration such as querystring parameters & request specific connection settings. public TResponse Indices(CatIndicesRequestParameters requestParameters = null) diff --git a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs index 410ae044ae..9e5c4cb495 100644 --- a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs @@ -351,4 +351,25 @@ public bool? Verbose set => Q("v", value); } } + + ///Request options for Help https://opensearch.org/docs/latest/api-reference/cat/index/ + public partial class CatHelpRequestParameters : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + public override bool SupportsBody => false; + + ///Return help information. + public bool? Help + { + get => Q("help"); + set => Q("help", value); + } + + ///Comma-separated list of column names or column aliases to sort by. + public string[] SortByColumns + { + get => Q("s"); + set => Q("s", value); + } + } } diff --git a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs index bc687d6da6..02bac5dd2f 100644 --- a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs @@ -316,5 +316,21 @@ public Task HealthAsync( null, RequestParams(requestParameters) ); + + ///GET on /_cat https://opensearch.org/docs/latest/api-reference/cat/index/ + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse Help(CatHelpRequestParameters requestParameters = null) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest(GET, "_cat", null, RequestParams(requestParameters)); + + ///GET on /_cat https://opensearch.org/docs/latest/api-reference/cat/index/ + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cat.help", "")] + public Task HelpAsync( + CatHelpRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync(GET, "_cat", ctx, null, RequestParams(requestParameters)); } } From e5e5f099fbb8451482030039a17aeda7e277b326 Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Mon, 18 Sep 2023 11:16:54 +1200 Subject: [PATCH 07/13] Re-generate `cat.indices` Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 1 + src/OpenSearch.Client/ApiUrlsLookup.cs | 1 - src/OpenSearch.Client/Descriptors.Cat.cs | 55 -------- src/OpenSearch.Client/OpenSearchClient.Cat.cs | 24 ---- src/OpenSearch.Client/Requests.Cat.cs | 128 ----------------- .../_Generated/ApiUrlsLookup.cs | 3 + .../_Generated/Descriptors.Cat.cs | 85 ++++++++++++ .../_Generated/OpenSearchClient.Cat.cs | 41 ++++++ .../_Generated/Requests.Cat.cs | 129 ++++++++++++++++++ src/OpenSearch.Net/Api/Enums.cs | 27 ---- .../RequestParameters.Cat.cs | 103 -------------- .../OpenSearchLowLevelClient.Cat.cs | 20 --- src/OpenSearch.Net/_Generated/Api/Enums.cs | 30 ++++ .../RequestParameters.Cat.cs | 107 +++++++++++++++ .../OpenSearchLowLevelClient.Cat.cs | 55 ++++++++ 15 files changed, 451 insertions(+), 358 deletions(-) diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index 086daab8e3..19adcc1ce4 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -48,6 +48,7 @@ public static class CodeConfiguration new("cat.fielddata"), new("cat.health"), new("cat.help"), + new("cat.indices"), new("cluster.*"), new("dangling_indices.*"), diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index 84422e8e79..84a757a058 100644 --- a/src/OpenSearch.Client/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/ApiUrlsLookup.cs @@ -48,7 +48,6 @@ internal static partial class ApiUrlsLookups internal static ApiUrls NoNamespaceBulk = new ApiUrls(new[]{"_bulk", "{index}/_bulk"}); ///Introduced in OpenSearch 2.0 instead of internal static ApiUrls CatClusterManager = new ApiUrls(new[]{"_cat/cluster_manager"}); - internal static ApiUrls CatIndices = new ApiUrls(new[]{"_cat/indices", "_cat/indices/{index}"}); ///Deprecated as of OpenSearch 2.0, use instead internal static ApiUrls CatMaster = new ApiUrls(new[]{"_cat/master"}); internal static ApiUrls CatNodeAttributes = new ApiUrls(new[]{"_cat/nodeattrs"}); diff --git a/src/OpenSearch.Client/Descriptors.Cat.cs b/src/OpenSearch.Client/Descriptors.Cat.cs index 6b2d0d21e3..acaf3bf38b 100644 --- a/src/OpenSearch.Client/Descriptors.Cat.cs +++ b/src/OpenSearch.Client/Descriptors.Cat.cs @@ -57,61 +57,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - ///Descriptor for Indices https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-indices/ - public partial class CatIndicesDescriptor : RequestDescriptorBase, ICatIndicesRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.CatIndices; - ////_cat/indices - public CatIndicesDescriptor(): base() - { - } - - ////_cat/indices/{index} - ///Optional, accepts null - public CatIndicesDescriptor(Indices index): base(r => r.Optional("index", index)) - { - } - - // values part of the url path - Indices ICatIndicesRequest.Index => Self.RouteValues.Get("index"); - ///A comma-separated list of index names to limit the returned information - public CatIndicesDescriptor Index(Indices index) => Assign(index, (a, v) => a.RouteValues.Optional("index", v)); - ///a shortcut into calling Index(typeof(TOther)) - public CatIndicesDescriptor Index() - where TOther : class => Assign(typeof(TOther), (a, v) => a.RouteValues.Optional("index", (Indices)v)); - ///A shortcut into calling Index(Indices.All) - public CatIndicesDescriptor AllIndices() => Index(Indices.All); - // Request parameters - ///The unit in which to display byte values - public CatIndicesDescriptor Bytes(Bytes? bytes) => Qs("bytes", bytes); - ///Whether to expand wildcard expression to concrete indices that are open, closed or both. - public CatIndicesDescriptor ExpandWildcards(ExpandWildcards? expandwildcards) => Qs("expand_wildcards", expandwildcards); - ///a short version of the Accept header, e.g. json, yaml - public CatIndicesDescriptor Format(string format) => Qs("format", format); - ///Comma-separated list of column names to display - public CatIndicesDescriptor Headers(params string[] headers) => Qs("h", headers); - ///A health status ("green", "yellow", or "red" to filter only indices matching the specified health status - public CatIndicesDescriptor Health(Health? health) => Qs("health", health); - ///Return help information - public CatIndicesDescriptor Help(bool? help = true) => Qs("help", help); - ///If set to true segment stats will include stats for segments that are not currently loaded into memory - public CatIndicesDescriptor IncludeUnloadedSegments(bool? includeunloadedsegments = true) => Qs("include_unloaded_segments", includeunloadedsegments); - ///Return local information, do not retrieve the state from cluster_manager node (default: false) - public CatIndicesDescriptor Local(bool? local = true) => Qs("local", local); - ///Explicit operation timeout for connection to master node - ///Deprecated as of OpenSearch 2.0, use instead - public CatIndicesDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); - ///Explicit operation timeout for connection to cluster_manager node - ///Introduced in OpenSearch 2.0 instead of - public CatIndicesDescriptor ClusterManagerTimeout(Time timeout) => Qs("cluster_manager_timeout", timeout); - ///Set to true to return stats only for primary shards - public CatIndicesDescriptor Pri(bool? pri = true) => Qs("pri", pri); - ///Comma-separated list of column names or column aliases to sort by - public CatIndicesDescriptor SortByColumns(params string[] sortbycolumns) => Qs("s", sortbycolumns); - ///Verbose mode. Display column headers - public CatIndicesDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); - } - ///Descriptor for Master https://opensearch.org/docs/1.2/opensearch/rest-api/cat/cat-master/ ///Deprecated as of OpenSearch 2.0, use instead public partial class CatMasterDescriptor : RequestDescriptorBase, ICatMasterRequest diff --git a/src/OpenSearch.Client/OpenSearchClient.Cat.cs b/src/OpenSearch.Client/OpenSearchClient.Cat.cs index e15cd76ee1..2ecf70a0f2 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Cat.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Cat.cs @@ -59,30 +59,6 @@ namespace OpenSearch.Client.Specification.CatApi /// public partial class CatNamespace : NamespacedClientProxy { - /// - /// GET request to the cat.indices API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-indices/ - /// - public CatResponse Indices(Func selector = null) => Indices(selector.InvokeOrDefault(new CatIndicesDescriptor())); - /// - /// GET request to the cat.indices API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-indices/ - /// - public Task> IndicesAsync(Func selector = null, CancellationToken ct = default) => IndicesAsync(selector.InvokeOrDefault(new CatIndicesDescriptor()), ct); - /// - /// GET request to the cat.indices API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-indices/ - /// - public CatResponse Indices(ICatIndicesRequest request) => DoCat(request); - /// - /// GET request to the cat.indices API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-indices/ - /// - public Task> IndicesAsync(ICatIndicesRequest request, CancellationToken ct = default) => DoCatAsync(request, ct); /// /// GET request to the cat.master API, read more about this API online: /// diff --git a/src/OpenSearch.Client/Requests.Cat.cs b/src/OpenSearch.Client/Requests.Cat.cs index 88cd980445..c3df5cc573 100644 --- a/src/OpenSearch.Client/Requests.Cat.cs +++ b/src/OpenSearch.Client/Requests.Cat.cs @@ -58,134 +58,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - [InterfaceDataContract] - public partial interface ICatIndicesRequest : IRequest - { - [IgnoreDataMember] - Indices Index - { - get; - } - } - - ///Request for Indices https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-indices/ - public partial class CatIndicesRequest : PlainRequestBase, ICatIndicesRequest - { - protected ICatIndicesRequest Self => this; - internal override ApiUrls ApiUrls => ApiUrlsLookups.CatIndices; - ////_cat/indices - public CatIndicesRequest(): base() - { - } - - ////_cat/indices/{index} - ///Optional, accepts null - public CatIndicesRequest(Indices index): base(r => r.Optional("index", index)) - { - } - - // values part of the url path - [IgnoreDataMember] - Indices ICatIndicesRequest.Index => Self.RouteValues.Get("index"); - // Request parameters - ///The unit in which to display byte values - public Bytes? Bytes - { - get => Q("bytes"); - set => Q("bytes", 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); - } - - ///a short version of the Accept header, e.g. json, yaml - public string Format - { - get => Q("format"); - set - { - Q("format", value); - SetAcceptHeader(value); - } - } - - ///Comma-separated list of column names to display - public string[] Headers - { - get => Q("h"); - set => Q("h", value); - } - - ///A health status ("green", "yellow", or "red" to filter only indices matching the specified health status - public Health? Health - { - get => Q("health"); - set => Q("health", value); - } - - ///Return help information - public bool? Help - { - get => Q("help"); - set => Q("help", value); - } - - ///If set to true segment stats will include stats for segments that are not currently loaded into memory - public bool? IncludeUnloadedSegments - { - get => Q("include_unloaded_segments"); - set => Q("include_unloaded_segments", value); - } - - ///Return local information, do not retrieve the state from cluster_manager node (default: false) - public bool? Local - { - get => Q("local"); - set => Q("local", value); - } - - ///Explicit operation timeout for connection to master node - ///Deprecated as of OpenSearch 2.0, use instead - public Time MasterTimeout - { - get => Q public partial class LowLevelCatNamespace : NamespacedClientProxy { - ///GET on /_cat/indices https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-indices/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse Indices(CatIndicesRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, "_cat/indices", null, RequestParams(requestParameters)); - ///GET on /_cat/indices https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-indices/ - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cat.indices", "")] - public Task IndicesAsync(CatIndicesRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, "_cat/indices", ctx, null, RequestParams(requestParameters)); - ///GET on /_cat/indices/{index} https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-indices/ - ///A comma-separated list of index names to limit the returned information - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse Indices(string index, CatIndicesRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, Url($"_cat/indices/{index:index}"), null, RequestParams(requestParameters)); - ///GET on /_cat/indices/{index} https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-indices/ - ///A comma-separated list of index names to limit the returned information - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cat.indices", "index")] - public Task IndicesAsync(string index, CatIndicesRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, Url($"_cat/indices/{index:index}"), ctx, null, RequestParams(requestParameters)); ///GET on /_cat/master https://opensearch.org/docs/1.2/opensearch/rest-api/cat/cat-master/ ///Deprecated as of OpenSearch 2.0, use instead ///Request specific configuration such as querystring parameters & request specific connection settings. diff --git a/src/OpenSearch.Net/_Generated/Api/Enums.cs b/src/OpenSearch.Net/_Generated/Api/Enums.cs index 9e85658740..be4655a46f 100644 --- a/src/OpenSearch.Net/_Generated/Api/Enums.cs +++ b/src/OpenSearch.Net/_Generated/Api/Enums.cs @@ -278,6 +278,19 @@ public enum Bytes Pb } + [StringEnum] + public enum Health + { + [EnumMember(Value = "green")] + Green, + + [EnumMember(Value = "yellow")] + Yellow, + + [EnumMember(Value = "red")] + Red + } + [StringEnum] public enum ClusterHealthLevel { @@ -397,6 +410,7 @@ static partial void RegisterEnumStringResolvers() e => GetStringValue((ExpandWildcards)e) ); EnumStringResolvers.TryAdd(typeof(Bytes), e => GetStringValue((Bytes)e)); + EnumStringResolvers.TryAdd(typeof(Health), e => GetStringValue((Health)e)); EnumStringResolvers.TryAdd( typeof(ClusterHealthLevel), e => GetStringValue((ClusterHealthLevel)e) @@ -599,6 +613,22 @@ public static string GetStringValue(this Bytes enumValue) ); } + public static string GetStringValue(this Health enumValue) + { + switch (enumValue) + { + case Health.Green: + return "green"; + case Health.Yellow: + return "yellow"; + case Health.Red: + return "red"; + } + throw new ArgumentException( + $"'{enumValue.ToString()}' is not a valid value for enum 'Health'" + ); + } + public static string GetStringValue(this ClusterHealthLevel enumValue) { switch (enumValue) diff --git a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs index 9e5c4cb495..67a9e18737 100644 --- a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs @@ -372,4 +372,111 @@ public string[] SortByColumns set => Q("s", value); } } + + ///Request options for Indices https://opensearch.org/docs/latest/api-reference/cat/cat-indices/ + public partial class CatIndicesRequestParameters + : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + public override bool SupportsBody => false; + + ///The unit in which to display byte values. + public Bytes? Bytes + { + get => Q("bytes"); + set => Q("bytes", value); + } + + ///Operation timeout for connection to cluster-manager node. + ///Supported by OpenSearch servers of version 2.0.0 or greater. + public TimeSpan ClusterManagerTimeout + { + get => Q("cluster_manager_timeout"); + set => Q("cluster_manager_timeout", value); + } + + ///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); + } + + ///A short version of the Accept header, e.g. json, yaml. + public string Format + { + get => Q("format"); + set + { + Q("format", value); + SetAcceptHeader(value); + } + } + + ///Comma-separated list of column names to display. + public string[] Headers + { + get => Q("h"); + set => Q("h", value); + } + + ///Health status ('green', 'yellow', or 'red') to filter only indices matching the specified health status. + public Health? Health + { + get => Q("health"); + set => Q("health", value); + } + + ///Return help information. + public bool? Help + { + get => Q("help"); + set => Q("help", value); + } + + ///If set to true segment stats will include stats for segments that are not currently loaded into memory. + public bool? IncludeUnloadedSegments + { + get => Q("include_unloaded_segments"); + set => Q("include_unloaded_segments", 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); + } + + ///Set to true to return stats only for primary shards. + public bool? Pri + { + get => Q("pri"); + set => Q("pri", value); + } + + ///Comma-separated list of column names or column aliases to sort by. + public string[] SortByColumns + { + get => Q("s"); + set => Q("s", value); + } + + ///Verbose mode. Display column headers. + public bool? Verbose + { + get => Q("v"); + set => Q("v", value); + } + } } diff --git a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs index 02bac5dd2f..a0e68deb75 100644 --- a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs @@ -332,5 +332,60 @@ public Task HelpAsync( ) where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, "_cat", ctx, null, RequestParams(requestParameters)); + + ///GET on /_cat/indices https://opensearch.org/docs/latest/api-reference/cat/cat-indices/ + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse Indices(CatIndicesRequestParameters requestParameters = null) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest(GET, "_cat/indices", null, RequestParams(requestParameters)); + + ///GET on /_cat/indices https://opensearch.org/docs/latest/api-reference/cat/cat-indices/ + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cat.indices", "")] + public Task IndicesAsync( + CatIndicesRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + "_cat/indices", + ctx, + null, + RequestParams(requestParameters) + ); + + ///GET on /_cat/indices/{index} https://opensearch.org/docs/latest/api-reference/cat/cat-indices/ + ///Comma-separated list of indices to limit the returned information. + ///Request specific configuration such as querystring parameters & request specific connection settings. + public TResponse Indices( + string index, + CatIndicesRequestParameters requestParameters = null + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest( + GET, + Url($"_cat/indices/{index:index}"), + null, + RequestParams(requestParameters) + ); + + ///GET on /_cat/indices/{index} https://opensearch.org/docs/latest/api-reference/cat/cat-indices/ + ///Comma-separated list of indices to limit the returned information. + ///Request specific configuration such as querystring parameters & request specific connection settings. + [MapsApi("cat.indices", "index")] + public Task IndicesAsync( + string index, + CatIndicesRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + Url($"_cat/indices/{index:index}"), + ctx, + null, + RequestParams(requestParameters) + ); } } From 0fa3c4a3c34cf4299450a5a760f86bda32c112fd Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Tue, 19 Sep 2023 10:13:38 +1200 Subject: [PATCH 08/13] Re-generate `cat.master` Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 1 + src/ApiGenerator/OpenSearch.openapi.json | 2 +- src/OpenSearch.Client/ApiUrlsLookup.cs | 2 - src/OpenSearch.Client/Descriptors.Cat.cs | 23 ------ src/OpenSearch.Client/OpenSearchClient.Cat.cs | 28 ------- src/OpenSearch.Client/Requests.Cat.cs | 67 ---------------- .../_Generated/ApiUrlsLookup.cs | 2 + .../_Generated/Descriptors.Cat.cs | 41 ++++++++++ .../_Generated/OpenSearchClient.Cat.cs | 50 ++++++++++++ .../_Generated/Requests.Cat.cs | 79 +++++++++++++++++++ .../RequestParameters.Cat.cs | 69 ---------------- .../OpenSearchLowLevelClient.Cat.cs | 11 --- .../RequestParameters.Cat.cs | 71 +++++++++++++++++ .../OpenSearchLowLevelClient.Cat.cs | 28 +++++++ tests/Tests.Reproduce/GithubIssue4243.cs | 2 + .../Tests/Cat/CatMaster/CatMasterApiTests.cs | 1 + .../Tests/Cat/CatMaster/CatMasterUrlTests.cs | 1 + 17 files changed, 277 insertions(+), 201 deletions(-) diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index 19adcc1ce4..fafd8d19cd 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -49,6 +49,7 @@ public static class CodeConfiguration new("cat.health"), new("cat.help"), new("cat.indices"), + new("cat.master"), new("cluster.*"), new("dangling_indices.*"), diff --git a/src/ApiGenerator/OpenSearch.openapi.json b/src/ApiGenerator/OpenSearch.openapi.json index fe1126c5e3..2269287047 100644 --- a/src/ApiGenerator/OpenSearch.openapi.json +++ b/src/ApiGenerator/OpenSearch.openapi.json @@ -2239,7 +2239,7 @@ "x-deprecation-message": "To promote inclusive language, please use '/_cat/cluster_manager' instead.", "x-operation-group": "cat.master", "x-version-added": "1.0", - "x-version-deprecated": "1.0" + "x-version-deprecated": "2.0" } }, "/_cat/nodeattrs": { diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index 84a757a058..8d5cd4c094 100644 --- a/src/OpenSearch.Client/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/ApiUrlsLookup.cs @@ -48,8 +48,6 @@ internal static partial class ApiUrlsLookups internal static ApiUrls NoNamespaceBulk = new ApiUrls(new[]{"_bulk", "{index}/_bulk"}); ///Introduced in OpenSearch 2.0 instead of internal static ApiUrls CatClusterManager = new ApiUrls(new[]{"_cat/cluster_manager"}); - ///Deprecated as of OpenSearch 2.0, use instead - internal static ApiUrls CatMaster = new ApiUrls(new[]{"_cat/master"}); internal static ApiUrls CatNodeAttributes = new ApiUrls(new[]{"_cat/nodeattrs"}); internal static ApiUrls CatNodes = new ApiUrls(new[]{"_cat/nodes"}); internal static ApiUrls CatPendingTasks = new ApiUrls(new[]{"_cat/pending_tasks"}); diff --git a/src/OpenSearch.Client/Descriptors.Cat.cs b/src/OpenSearch.Client/Descriptors.Cat.cs index acaf3bf38b..2505e6061a 100644 --- a/src/OpenSearch.Client/Descriptors.Cat.cs +++ b/src/OpenSearch.Client/Descriptors.Cat.cs @@ -57,29 +57,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - ///Descriptor for Master https://opensearch.org/docs/1.2/opensearch/rest-api/cat/cat-master/ - ///Deprecated as of OpenSearch 2.0, use instead - public partial class CatMasterDescriptor : RequestDescriptorBase, ICatMasterRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.CatMaster; - // values part of the url path - // Request parameters - ///a short version of the Accept header, e.g. json, yaml - public CatMasterDescriptor Format(string format) => Qs("format", format); - ///Comma-separated list of column names to display - public CatMasterDescriptor Headers(params string[] headers) => Qs("h", headers); - ///Return help information - public CatMasterDescriptor Help(bool? help = true) => Qs("help", help); - ///Return local information, do not retrieve the state from cluster_manager node (default: false) - public CatMasterDescriptor Local(bool? local = true) => Qs("local", local); - ///Explicit operation timeout for connection to master node - public CatMasterDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); - ///Comma-separated list of column names or column aliases to sort by - public CatMasterDescriptor SortByColumns(params string[] sortbycolumns) => Qs("s", sortbycolumns); - ///Verbose mode. Display column headers - public CatMasterDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); - } - ///Descriptor for Master https://opensearch.org/docs/1.2/opensearch/rest-api/cat/cat-master/ ///Introduced in OpenSearch 2.0 instead of public partial class CatClusterManagerDescriptor : RequestDescriptorBase, ICatClusterManagerRequest diff --git a/src/OpenSearch.Client/OpenSearchClient.Cat.cs b/src/OpenSearch.Client/OpenSearchClient.Cat.cs index 2ecf70a0f2..6e5c9ff72a 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Cat.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Cat.cs @@ -59,34 +59,6 @@ namespace OpenSearch.Client.Specification.CatApi /// public partial class CatNamespace : NamespacedClientProxy { - /// - /// GET request to the cat.master API, read more about this API online: - /// - /// https://opensearch.org/docs/1.2/opensearch/rest-api/cat/cat-master/ - /// Deprecated as of OpenSearch 2.0, use instead - /// - public CatResponse Master(Func selector = null) => Master(selector.InvokeOrDefault(new CatMasterDescriptor())); - /// - /// GET request to the cat.master API, read more about this API online: - /// - /// https://opensearch.org/docs/1.2/opensearch/rest-api/cat/cat-master/ - /// Deprecated as of OpenSearch 2.0, use instead - /// - public Task> MasterAsync(Func selector = null, CancellationToken ct = default) => MasterAsync(selector.InvokeOrDefault(new CatMasterDescriptor()), ct); - /// - /// GET request to the cat.master API, read more about this API online: - /// - /// https://opensearch.org/docs/1.2/opensearch/rest-api/cat/cat-master/ - /// Deprecated as of OpenSearch 2.0, use instead - /// - public CatResponse Master(ICatMasterRequest request) => DoCat(request); - /// - /// GET request to the cat.master API, read more about this API online: - /// - /// https://opensearch.org/docs/1.2/opensearch/rest-api/cat/cat-master/ - /// Deprecated as of OpenSearch 2.0, use instead - /// - public Task> MasterAsync(ICatMasterRequest request, CancellationToken ct = default) => DoCatAsync(request, ct); /// /// GET request to the cat.cluster_manager API, read more about this API online: /// diff --git a/src/OpenSearch.Client/Requests.Cat.cs b/src/OpenSearch.Client/Requests.Cat.cs index c3df5cc573..233c3e20f3 100644 --- a/src/OpenSearch.Client/Requests.Cat.cs +++ b/src/OpenSearch.Client/Requests.Cat.cs @@ -58,73 +58,6 @@ // ReSharper disable RedundantNameQualifier namespace OpenSearch.Client { - [InterfaceDataContract] - public partial interface ICatMasterRequest : IRequest - { - } - - ///Request for Master https://opensearch.org/docs/1.2/opensearch/rest-api/cat/cat-master/ - ///Deprecated as of OpenSearch 2.0, use instead - public partial class CatMasterRequest : PlainRequestBase, ICatMasterRequest - { - protected ICatMasterRequest Self => this; - internal override ApiUrls ApiUrls => ApiUrlsLookups.CatMaster; - // values part of the url path - // Request parameters - ///a short version of the Accept header, e.g. json, yaml - public string Format - { - get => Q("format"); - set - { - Q("format", value); - SetAcceptHeader(value); - } - } - - ///Comma-separated list of column names to display - public string[] Headers - { - get => Q("h"); - set => Q("h", value); - } - - ///Return help information - public bool? Help - { - get => Q("help"); - set => Q("help", value); - } - - ///Return local information, do not retrieve the state from cluster_manager node (default: false) - public bool? Local - { - get => Q("local"); - set => Q("local", value); - } - - ///Explicit operation timeout for connection to master node - public Time MasterTimeout - { - get => Q public partial class LowLevelCatNamespace : NamespacedClientProxy { - ///GET on /_cat/master https://opensearch.org/docs/1.2/opensearch/rest-api/cat/cat-master/ - ///Deprecated as of OpenSearch 2.0, use instead - ///Request specific configuration such as querystring parameters & request specific connection settings. - public TResponse Master(CatMasterRequestParameters requestParameters = null) - where TResponse : class, IOpenSearchResponse, new() => DoRequest(GET, "_cat/master", null, RequestParams(requestParameters)); - ///GET on /_cat/master https://opensearch.org/docs/1.2/opensearch/rest-api/cat/cat-master/ - ///Deprecated as of OpenSearch 2.0, use instead - ///Request specific configuration such as querystring parameters & request specific connection settings. - [MapsApi("cat.master", "")] - public Task MasterAsync(CatMasterRequestParameters requestParameters = null, CancellationToken ctx = default) - where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync(GET, "_cat/master", ctx, null, RequestParams(requestParameters)); ///GET on /_cat/cluster_manager https://opensearch.org/docs/2.0/opensearch/rest-api/cat/cat-cluster_manager/ ///Introduced in OpenSearch 2.0 instead of ///Request specific configuration such as querystring parameters & request specific connection settings. diff --git a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs index 67a9e18737..944b3342b5 100644 --- a/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs +++ b/src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Cat.cs @@ -479,4 +479,75 @@ public bool? Verbose set => Q("v", value); } } + + ///Request options for Master https://opensearch.org/docs/latest/api-reference/cat/cat-cluster_manager/ + public partial class CatMasterRequestParameters : RequestParameters + { + public override HttpMethod DefaultHttpMethod => HttpMethod.GET; + public override bool SupportsBody => false; + + ///Operation timeout for connection to cluster-manager node. + ///Supported by OpenSearch servers of version 2.0.0 or greater. + public TimeSpan ClusterManagerTimeout + { + get => Q("cluster_manager_timeout"); + set => Q("cluster_manager_timeout", value); + } + + ///A short version of the Accept header, e.g. json, yaml. + public string Format + { + get => Q("format"); + set + { + Q("format", value); + SetAcceptHeader(value); + } + } + + ///Comma-separated list of column names to display. + public string[] Headers + { + get => Q("h"); + set => Q("h", value); + } + + ///Return help information. + public bool? Help + { + get => Q("help"); + set => Q("help", value); + } + + ///Return local information, do not retrieve the state from cluster-manager node. + public bool? Local + { + get => Q("local"); + set => Q("local", value); + } + + ///Operation timeout for connection to master node. + [Obsolete( + "Deprecated as of: 2.0.0, reason: To promote inclusive language, use 'cluster_manager_timeout' instead." + )] + public TimeSpan MasterTimeout + { + get => Q("master_timeout"); + set => Q("master_timeout", value); + } + + ///Comma-separated list of column names or column aliases to sort by. + public string[] SortByColumns + { + get => Q("s"); + set => Q("s", value); + } + + ///Verbose mode. Display column headers. + public bool? Verbose + { + get => Q("v"); + set => Q("v", value); + } + } } diff --git a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs index a0e68deb75..3455842e05 100644 --- a/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs +++ b/src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Cat.cs @@ -387,5 +387,33 @@ public Task IndicesAsync( null, RequestParams(requestParameters) ); + + ///GET on /_cat/master https://opensearch.org/docs/latest/api-reference/cat/cat-cluster_manager/ + ///Request specific configuration such as querystring parameters & request specific connection settings. + [Obsolete( + "Deprecated in version 2.0: To promote inclusive language, please use '/_cat/cluster_manager' instead." + )] + public TResponse Master(CatMasterRequestParameters requestParameters = null) + where TResponse : class, IOpenSearchResponse, new() => + DoRequest(GET, "_cat/master", null, RequestParams(requestParameters)); + + ///GET on /_cat/master https://opensearch.org/docs/latest/api-reference/cat/cat-cluster_manager/ + ///Request specific configuration such as querystring parameters & request specific connection settings. + [Obsolete( + "Deprecated in version 2.0: To promote inclusive language, please use '/_cat/cluster_manager' instead." + )] + [MapsApi("cat.master", "")] + public Task MasterAsync( + CatMasterRequestParameters requestParameters = null, + CancellationToken ctx = default + ) + where TResponse : class, IOpenSearchResponse, new() => + DoRequestAsync( + GET, + "_cat/master", + ctx, + null, + RequestParams(requestParameters) + ); } } diff --git a/tests/Tests.Reproduce/GithubIssue4243.cs b/tests/Tests.Reproduce/GithubIssue4243.cs index 8bdefd27f5..865fa360ef 100644 --- a/tests/Tests.Reproduce/GithubIssue4243.cs +++ b/tests/Tests.Reproduce/GithubIssue4243.cs @@ -47,7 +47,9 @@ public async Task UsingFormatJsonIsSuccessfulResponse() var lowLevelClient = _cluster.Client.LowLevel; var response = _cluster.ClusterConfiguration.Version < "2.0.0" +#pragma warning disable CS0618 // Type or member is obsolete ? await lowLevelClient.Cat.MasterAsync(new CatMasterRequestParameters { Format = "JSON" }) +#pragma warning restore CS0618 // Type or member is obsolete : await lowLevelClient.Cat.ClusterManagerAsync(new CatClusterManagerRequestParameters { Format = "JSON" }); response.Success.Should().BeTrue(); diff --git a/tests/Tests/Cat/CatMaster/CatMasterApiTests.cs b/tests/Tests/Cat/CatMaster/CatMasterApiTests.cs index b264b16ae1..899a113f36 100644 --- a/tests/Tests/Cat/CatMaster/CatMasterApiTests.cs +++ b/tests/Tests/Cat/CatMaster/CatMasterApiTests.cs @@ -33,6 +33,7 @@ using Tests.Framework.EndpointTests; using Tests.Framework.EndpointTests.TestState; using OpenSearch.OpenSearch.Xunit.XunitPlumbing; +#pragma warning disable CS0618 // Type or member is obsolete namespace Tests.Cat.CatMaster { diff --git a/tests/Tests/Cat/CatMaster/CatMasterUrlTests.cs b/tests/Tests/Cat/CatMaster/CatMasterUrlTests.cs index 932e9b1f47..62477e5c75 100644 --- a/tests/Tests/Cat/CatMaster/CatMasterUrlTests.cs +++ b/tests/Tests/Cat/CatMaster/CatMasterUrlTests.cs @@ -31,6 +31,7 @@ using OpenSearch.Client; using Tests.Framework.EndpointTests; using static Tests.Framework.EndpointTests.UrlTester; +#pragma warning disable CS0618 // Type or member is obsolete namespace Tests.Cat.CatMaster { From 3af20a5c300996ca58419eb404b1f504ac65587c Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Wed, 20 Sep 2023 16:48:04 +1200 Subject: [PATCH 09/13] Improve formatting Signed-off-by: Thomas Farr --- .../_Generated/Descriptors.Cat.cs | 160 +++++++++--------- .../_Generated/Requests.Cat.cs | 142 ++++++++-------- .../RequestParameters.Cat.cs | 120 ++++++------- .../OpenSearchLowLevelClient.Cat.cs | 104 ++++++------ 4 files changed, 263 insertions(+), 263 deletions(-) diff --git a/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs b/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs index c65625e35b..c51542bbef 100644 --- a/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs +++ b/src/OpenSearch.Client/_Generated/Descriptors.Cat.cs @@ -109,7 +109,7 @@ public CatAliasesDescriptor SortByColumns(params string[] sortbycolumns) => public CatAliasesDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); } - ///Descriptor for Allocation https://opensearch.org/docs/latest/api-reference/cat/cat-allocation/ + /// Descriptor for Allocation https://opensearch.org/docs/latest/api-reference/cat/cat-allocation/ public partial class CatAllocationDescriptor : RequestDescriptorBase< CatAllocationDescriptor, @@ -120,108 +120,108 @@ public partial class CatAllocationDescriptor { internal override ApiUrls ApiUrls => ApiUrlsLookups.CatAllocation; - ////_cat/allocation + /// /_cat/allocation public CatAllocationDescriptor() : base() { } - ////_cat/allocation/{node_id} - ///Optional, accepts null + /// /_cat/allocation/{node_id} + /// Optional, accepts null public CatAllocationDescriptor(NodeIds nodeId) : base(r => r.Optional("node_id", nodeId)) { } // values part of the url path NodeIds ICatAllocationRequest.NodeId => Self.RouteValues.Get("node_id"); - ///Comma-separated list of node IDs or names to limit the returned information. + /// Comma-separated list of node IDs or names to limit the returned information. public CatAllocationDescriptor NodeId(NodeIds nodeId) => Assign(nodeId, (a, v) => a.RouteValues.Optional("node_id", v)); // Request parameters - ///The unit in which to display byte values. + /// The unit in which to display byte values. public CatAllocationDescriptor Bytes(Bytes? bytes) => Qs("bytes", bytes); - ///Operation timeout for connection to cluster-manager node. - ///Supported by OpenSearch servers of version 2.0.0 or greater. + /// Operation timeout for connection to cluster-manager node. + /// Supported by OpenSearch servers of version 2.0.0 or greater. public CatAllocationDescriptor ClusterManagerTimeout(Time clustermanagertimeout) => Qs("cluster_manager_timeout", clustermanagertimeout); - ///A short version of the Accept header, e.g. json, yaml. + /// A short version of the Accept header, e.g. json, yaml. public CatAllocationDescriptor Format(string format) => Qs("format", format); - ///Comma-separated list of column names to display. + /// Comma-separated list of column names to display. public CatAllocationDescriptor Headers(params string[] headers) => Qs("h", headers); - ///Return help information. + /// Return help information. public CatAllocationDescriptor Help(bool? help = true) => Qs("help", help); - ///Return local information, do not retrieve the state from cluster-manager node. + /// Return local information, do not retrieve the state from cluster-manager node. public CatAllocationDescriptor Local(bool? local = true) => Qs("local", local); - ///Operation timeout for connection to master node. + /// 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 CatAllocationDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); - ///Comma-separated list of column names or column aliases to sort by. + /// Comma-separated list of column names or column aliases to sort by. public CatAllocationDescriptor SortByColumns(params string[] sortbycolumns) => Qs("s", sortbycolumns); - ///Verbose mode. Display column headers. + /// Verbose mode. Display column headers. public CatAllocationDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); } - ///Descriptor for Count https://opensearch.org/docs/latest/api-reference/cat/cat-count/ + /// Descriptor for Count https://opensearch.org/docs/latest/api-reference/cat/cat-count/ public partial class CatCountDescriptor : RequestDescriptorBase, ICatCountRequest { internal override ApiUrls ApiUrls => ApiUrlsLookups.CatCount; - ////_cat/count + /// /_cat/count public CatCountDescriptor() : base() { } - ////_cat/count/{index} - ///Optional, accepts null + /// /_cat/count/{index} + /// Optional, accepts null public CatCountDescriptor(Indices index) : base(r => r.Optional("index", index)) { } // values part of the url path Indices ICatCountRequest.Index => Self.RouteValues.Get("index"); - ///Comma-separated list of indices to limit the returned information. + /// Comma-separated list of indices to limit the returned information. public CatCountDescriptor Index(Indices index) => Assign(index, (a, v) => a.RouteValues.Optional("index", v)); - ///a shortcut into calling Index(typeof(TOther)) + /// a shortcut into calling Index(typeof(TOther)) public CatCountDescriptor Index() where TOther : class => Assign(typeof(TOther), (a, v) => a.RouteValues.Optional("index", (Indices)v)); - ///A shortcut into calling Index(Indices.All) + /// A shortcut into calling Index(Indices.All) public CatCountDescriptor AllIndices() => Index(Indices.All); // Request parameters - ///A short version of the Accept header, e.g. json, yaml. + /// A short version of the Accept header, e.g. json, yaml. public CatCountDescriptor Format(string format) => Qs("format", format); - ///Comma-separated list of column names to display. + /// Comma-separated list of column names to display. public CatCountDescriptor Headers(params string[] headers) => Qs("h", headers); - ///Return help information. + /// Return help information. public CatCountDescriptor Help(bool? help = true) => Qs("help", help); - ///Comma-separated list of column names or column aliases to sort by. + /// Comma-separated list of column names or column aliases to sort by. public CatCountDescriptor SortByColumns(params string[] sortbycolumns) => Qs("s", sortbycolumns); - ///Verbose mode. Display column headers. + /// Verbose mode. Display column headers. public CatCountDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); } - ///Descriptor for Fielddata https://opensearch.org/docs/latest/api-reference/cat/cat-field-data/ + /// Descriptor for Fielddata https://opensearch.org/docs/latest/api-reference/cat/cat-field-data/ public partial class CatFielddataDescriptor : RequestDescriptorBase< CatFielddataDescriptor, @@ -232,48 +232,48 @@ public partial class CatFielddataDescriptor { internal override ApiUrls ApiUrls => ApiUrlsLookups.CatFielddata; - ////_cat/fielddata + /// /_cat/fielddata public CatFielddataDescriptor() : base() { } - ////_cat/fielddata/{fields} - ///Optional, accepts null + /// /_cat/fielddata/{fields} + /// Optional, accepts null public CatFielddataDescriptor(Fields fields) : base(r => r.Optional("fields", fields)) { } // values part of the url path Fields ICatFielddataRequest.Fields => Self.RouteValues.Get("fields"); - ///Comma-separated list of fields to return the fielddata size. + /// Comma-separated list of fields to return the fielddata size. public CatFielddataDescriptor Fields(Fields fields) => Assign(fields, (a, v) => a.RouteValues.Optional("fields", v)); - ///Comma-separated list of fields to return the fielddata size. + /// Comma-separated list of fields to return the fielddata size. public CatFielddataDescriptor Fields(params Expression>[] fields) => Assign(fields, (a, v) => a.RouteValues.Optional("fields", (Fields)v)); // Request parameters - ///The unit in which to display byte values. + /// The unit in which to display byte values. public CatFielddataDescriptor Bytes(Bytes? bytes) => Qs("bytes", bytes); - ///A short version of the Accept header, e.g. json, yaml. + /// A short version of the Accept header, e.g. json, yaml. public CatFielddataDescriptor Format(string format) => Qs("format", format); - ///Comma-separated list of column names to display. + /// Comma-separated list of column names to display. public CatFielddataDescriptor Headers(params string[] headers) => Qs("h", headers); - ///Return help information. + /// Return help information. public CatFielddataDescriptor Help(bool? help = true) => Qs("help", help); - ///Comma-separated list of column names or column aliases to sort by. + /// Comma-separated list of column names or column aliases to sort by. public CatFielddataDescriptor SortByColumns(params string[] sortbycolumns) => Qs("s", sortbycolumns); - ///Verbose mode. Display column headers. + /// Verbose mode. Display column headers. public CatFielddataDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); } - ///Descriptor for Health https://opensearch.org/docs/latest/api-reference/cat/cat-health/ + /// Descriptor for Health https://opensearch.org/docs/latest/api-reference/cat/cat-health/ public partial class CatHealthDescriptor : RequestDescriptorBase, ICatHealthRequest @@ -282,28 +282,28 @@ public partial class CatHealthDescriptor // values part of the url path // Request parameters - ///A short version of the Accept header, e.g. json, yaml. + /// A short version of the Accept header, e.g. json, yaml. public CatHealthDescriptor Format(string format) => Qs("format", format); - ///Comma-separated list of column names to display. + /// Comma-separated list of column names to display. public CatHealthDescriptor Headers(params string[] headers) => Qs("h", headers); - ///Return help information. + /// Return help information. public CatHealthDescriptor Help(bool? help = true) => Qs("help", help); - ///Set to false to disable timestamping. + /// Set to false to disable timestamping. public CatHealthDescriptor IncludeTimestamp(bool? includetimestamp = true) => Qs("ts", includetimestamp); - ///Comma-separated list of column names or column aliases to sort by. + /// Comma-separated list of column names or column aliases to sort by. public CatHealthDescriptor SortByColumns(params string[] sortbycolumns) => Qs("s", sortbycolumns); - ///Verbose mode. Display column headers. + /// Verbose mode. Display column headers. public CatHealthDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); } - ///Descriptor for Help https://opensearch.org/docs/latest/api-reference/cat/index/ + /// Descriptor for Help https://opensearch.org/docs/latest/api-reference/cat/index/ public partial class CatHelpDescriptor : RequestDescriptorBase, ICatHelpRequest @@ -312,15 +312,15 @@ public partial class CatHelpDescriptor // values part of the url path // Request parameters - ///Return help information. + /// Return help information. public CatHelpDescriptor Help(bool? help = true) => Qs("help", help); - ///Comma-separated list of column names or column aliases to sort by. + /// Comma-separated list of column names or column aliases to sort by. public CatHelpDescriptor SortByColumns(params string[] sortbycolumns) => Qs("s", sortbycolumns); } - ///Descriptor for Indices https://opensearch.org/docs/latest/api-reference/cat/cat-indices/ + /// Descriptor for Indices https://opensearch.org/docs/latest/api-reference/cat/cat-indices/ public partial class CatIndicesDescriptor : RequestDescriptorBase< CatIndicesDescriptor, @@ -331,81 +331,81 @@ public partial class CatIndicesDescriptor { internal override ApiUrls ApiUrls => ApiUrlsLookups.CatIndices; - ////_cat/indices + /// /_cat/indices public CatIndicesDescriptor() : base() { } - ////_cat/indices/{index} - ///Optional, accepts null + /// /_cat/indices/{index} + /// Optional, accepts null public CatIndicesDescriptor(Indices index) : base(r => r.Optional("index", index)) { } // values part of the url path Indices ICatIndicesRequest.Index => Self.RouteValues.Get("index"); - ///Comma-separated list of indices to limit the returned information. + /// Comma-separated list of indices to limit the returned information. public CatIndicesDescriptor Index(Indices index) => Assign(index, (a, v) => a.RouteValues.Optional("index", v)); - ///a shortcut into calling Index(typeof(TOther)) + /// a shortcut into calling Index(typeof(TOther)) public CatIndicesDescriptor Index() where TOther : class => Assign(typeof(TOther), (a, v) => a.RouteValues.Optional("index", (Indices)v)); - ///A shortcut into calling Index(Indices.All) + /// A shortcut into calling Index(Indices.All) public CatIndicesDescriptor AllIndices() => Index(Indices.All); // Request parameters - ///The unit in which to display byte values. + /// The unit in which to display byte values. public CatIndicesDescriptor Bytes(Bytes? bytes) => Qs("bytes", bytes); - ///Operation timeout for connection to cluster-manager node. - ///Supported by OpenSearch servers of version 2.0.0 or greater. + /// Operation timeout for connection to cluster-manager node. + /// Supported by OpenSearch servers of version 2.0.0 or greater. public CatIndicesDescriptor ClusterManagerTimeout(Time clustermanagertimeout) => Qs("cluster_manager_timeout", clustermanagertimeout); - ///Whether to expand wildcard expression to concrete indices that are open, closed or both. + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. public CatIndicesDescriptor ExpandWildcards(ExpandWildcards? expandwildcards) => Qs("expand_wildcards", expandwildcards); - ///A short version of the Accept header, e.g. json, yaml. + /// A short version of the Accept header, e.g. json, yaml. public CatIndicesDescriptor Format(string format) => Qs("format", format); - ///Comma-separated list of column names to display. + /// Comma-separated list of column names to display. public CatIndicesDescriptor Headers(params string[] headers) => Qs("h", headers); - ///Health status ('green', 'yellow', or 'red') to filter only indices matching the specified health status. + /// Health status ('green', 'yellow', or 'red') to filter only indices matching the specified health status. public CatIndicesDescriptor Health(Health? health) => Qs("health", health); - ///Return help information. + /// Return help information. public CatIndicesDescriptor Help(bool? help = true) => Qs("help", help); - ///If set to true segment stats will include stats for segments that are not currently loaded into memory. + /// If set to true segment stats will include stats for segments that are not currently loaded into memory. public CatIndicesDescriptor IncludeUnloadedSegments(bool? includeunloadedsegments = true) => Qs("include_unloaded_segments", includeunloadedsegments); - ///Return local information, do not retrieve the state from cluster-manager node. + /// Return local information, do not retrieve the state from cluster-manager node. public CatIndicesDescriptor Local(bool? local = true) => Qs("local", local); - ///Operation timeout for connection to master node. + /// 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 CatIndicesDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); - ///Set to true to return stats only for primary shards. + /// Set to true to return stats only for primary shards. public CatIndicesDescriptor Pri(bool? pri = true) => Qs("pri", pri); - ///Comma-separated list of column names or column aliases to sort by. + /// Comma-separated list of column names or column aliases to sort by. public CatIndicesDescriptor SortByColumns(params string[] sortbycolumns) => Qs("s", sortbycolumns); - ///Verbose mode. Display column headers. + /// Verbose mode. Display column headers. public CatIndicesDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); } - ///Descriptor for Master https://opensearch.org/docs/latest/api-reference/cat/cat-cluster_manager/ + /// Descriptor for Master https://opensearch.org/docs/latest/api-reference/cat/cat-cluster_manager/ public partial class CatMasterDescriptor : RequestDescriptorBase, ICatMasterRequest @@ -414,35 +414,35 @@ public partial class CatMasterDescriptor // values part of the url path // Request parameters - ///Operation timeout for connection to cluster-manager node. - ///Supported by OpenSearch servers of version 2.0.0 or greater. + /// Operation timeout for connection to cluster-manager node. + /// Supported by OpenSearch servers of version 2.0.0 or greater. public CatMasterDescriptor ClusterManagerTimeout(Time clustermanagertimeout) => Qs("cluster_manager_timeout", clustermanagertimeout); - ///A short version of the Accept header, e.g. json, yaml. + /// A short version of the Accept header, e.g. json, yaml. public CatMasterDescriptor Format(string format) => Qs("format", format); - ///Comma-separated list of column names to display. + /// Comma-separated list of column names to display. public CatMasterDescriptor Headers(params string[] headers) => Qs("h", headers); - ///Return help information. + /// Return help information. public CatMasterDescriptor Help(bool? help = true) => Qs("help", help); - ///Return local information, do not retrieve the state from cluster-manager node. + /// Return local information, do not retrieve the state from cluster-manager node. public CatMasterDescriptor Local(bool? local = true) => Qs("local", local); - ///Operation timeout for connection to master node. + /// 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 CatMasterDescriptor MasterTimeout(Time mastertimeout) => Qs("master_timeout", mastertimeout); - ///Comma-separated list of column names or column aliases to sort by. + /// Comma-separated list of column names or column aliases to sort by. public CatMasterDescriptor SortByColumns(params string[] sortbycolumns) => Qs("s", sortbycolumns); - ///Verbose mode. Display column headers. + /// Verbose mode. Display column headers. public CatMasterDescriptor Verbose(bool? verbose = true) => Qs("v", verbose); } } diff --git a/src/OpenSearch.Client/_Generated/Requests.Cat.cs b/src/OpenSearch.Client/_Generated/Requests.Cat.cs index 222fba86a5..74af1feea8 100644 --- a/src/OpenSearch.Client/_Generated/Requests.Cat.cs +++ b/src/OpenSearch.Client/_Generated/Requests.Cat.cs @@ -148,7 +148,7 @@ public partial interface ICatAllocationRequest : IRequestRequest for Allocation https://opensearch.org/docs/latest/api-reference/cat/cat-allocation/ + /// Request for Allocation https://opensearch.org/docs/latest/api-reference/cat/cat-allocation/ public partial class CatAllocationRequest : PlainRequestBase, ICatAllocationRequest @@ -156,12 +156,12 @@ public partial class CatAllocationRequest protected ICatAllocationRequest Self => this; internal override ApiUrls ApiUrls => ApiUrlsLookups.CatAllocation; - ////_cat/allocation + /// /_cat/allocation public CatAllocationRequest() : base() { } - ////_cat/allocation/{node_id} - ///Optional, accepts null + /// /_cat/allocation/{node_id} + /// Optional, accepts null public CatAllocationRequest(NodeIds nodeId) : base(r => r.Optional("node_id", nodeId)) { } @@ -170,22 +170,22 @@ public CatAllocationRequest(NodeIds nodeId) NodeIds ICatAllocationRequest.NodeId => Self.RouteValues.Get("node_id"); // Request parameters - ///The unit in which to display byte values. + /// The unit in which to display byte values. public Bytes? Bytes { get => Q("bytes"); set => Q("bytes", value); } - ///Operation timeout for connection to cluster-manager node. - ///Supported by OpenSearch servers of version 2.0.0 or greater. + /// Operation timeout for connection to cluster-manager node. + /// Supported by OpenSearch servers of version 2.0.0 or greater. public Time ClusterManagerTimeout { get => Q