From 4c47670bdc875f1992b5b4079095a6fd2b65b4dd Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Thu, 7 Sep 2023 14:31:31 +1200 Subject: [PATCH] Re-generate `nodes` namespace (#352) * Use specification naming for enums Signed-off-by: Thomas Farr * Handle deprecated paths Signed-off-by: Thomas Farr * Re-generate `nodes.hot_threads` Signed-off-by: Thomas Farr * Handle overloaded param Signed-off-by: Thomas Farr * Better sorting Signed-off-by: Thomas Farr * Re-generate `nodes.info` Signed-off-by: Thomas Farr * Re-generate `nodes.reload_secure_settings` Signed-off-by: Thomas Farr * Sort URL parts Signed-off-by: Thomas Farr * Re-generate `nodes.stats` Signed-off-by: Thomas Farr * Correctly handle URL part enum options Signed-off-by: Thomas Farr * Make ApiUrls readonly Signed-off-by: Thomas Farr * Re-generate `nodes.usage` Signed-off-by: Thomas Farr --------- Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 2 +- .../Endpoints/NodesHotThreadsOverrides.cs | 41 -- .../Domain/ApiQueryParametersPatcher.cs | 3 +- src/ApiGenerator/Domain/RestApiSpec.cs | 64 +- .../Domain/Specification/ApiEndpoint.cs | 26 +- .../Domain/Specification/UrlInformation.cs | 10 +- .../Generator/ApiEndpointFactory.cs | 65 +- src/ApiGenerator/Generator/ApiGenerator.cs | 2 + src/ApiGenerator/OpenSearch.openapi.json | 48 +- .../HighLevel/Requests/ApiUrlsLookup.cshtml | 4 +- src/ApiGenerator/Views/LowLevel/Enums.cshtml | 2 +- src/OpenSearch.Client/ApiUrlsLookup.cs | 5 - src/OpenSearch.Client/Descriptors.Nodes.cs | 280 -------- .../IOpenSearchClient.Generated.cs | 6 - .../OpenSearchClient.NoNamespace.cs | 8 - .../OpenSearchClient.Nodes.cs | 187 ----- src/OpenSearch.Client/Requests.Nodes.cs | 427 ------------ .../_Generated/ApiUrlsLookup.cs | 92 ++- .../_Generated/Descriptors.Nodes.cs | 346 ++++++++++ .../_Generated/IOpenSearchClient.cs | 4 + .../_Generated/OpenSearchClient.Nodes.cs | 287 ++++++++ .../_Generated/OpenSearchClient.cs | 5 + .../_Generated/Requests.Nodes.cs | 413 +++++++++++ src/OpenSearch.Client/_Generated/Requests.cs | 1 + src/OpenSearch.Net/Api/Enums.cs | 208 ------ .../RequestParameters.Nodes.cs | 209 ------ .../IOpenSearchLowLevelClient.Generated.cs | 6 - .../OpenSearchLowLevelClient.NoNamespace.cs | 7 - .../OpenSearchLowLevelClient.Nodes.cs | 278 -------- src/OpenSearch.Net/_Generated/Api/Enums.cs | 326 ++++++++- .../RequestParameters.Nodes.cs | 219 ++++++ .../_Generated/IOpenSearchLowLevelClient.cs | 4 + .../OpenSearchLowLevelClient.Nodes.cs | 650 ++++++++++++++++++ .../_Generated/OpenSearchLowLevelClient.cs | 3 + 34 files changed, 2461 insertions(+), 1777 deletions(-) delete mode 100644 src/ApiGenerator/Configuration/Overrides/Endpoints/NodesHotThreadsOverrides.cs delete mode 100644 src/OpenSearch.Client/Descriptors.Nodes.cs delete mode 100644 src/OpenSearch.Client/OpenSearchClient.Nodes.cs delete mode 100644 src/OpenSearch.Client/Requests.Nodes.cs create mode 100644 src/OpenSearch.Client/_Generated/Descriptors.Nodes.cs create mode 100644 src/OpenSearch.Client/_Generated/OpenSearchClient.Nodes.cs create mode 100644 src/OpenSearch.Client/_Generated/Requests.Nodes.cs delete mode 100644 src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Nodes.cs delete mode 100644 src/OpenSearch.Net/OpenSearchLowLevelClient.Nodes.cs create mode 100644 src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.Nodes.cs create mode 100644 src/OpenSearch.Net/_Generated/OpenSearchLowLevelClient.Nodes.cs diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index e26d906491..e143193073 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -39,9 +39,9 @@ public static class CodeConfiguration { private static readonly Glob[] OperationsToInclude = { - // e.g. new Glob("nodes.*"), new("dangling_indices.*"), new("ingest.*"), + new("nodes.*"), new("snapshot.*"), new("tasks.*") }; diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/NodesHotThreadsOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/NodesHotThreadsOverrides.cs deleted file mode 100644 index 409876cf2d..0000000000 --- a/src/ApiGenerator/Configuration/Overrides/Endpoints/NodesHotThreadsOverrides.cs +++ /dev/null @@ -1,41 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 -* -* The OpenSearch Contributors require contributions made to -* this file be licensed under the Apache-2.0 license or a -* compatible open source license. -*/ -/* -* Modifications Copyright OpenSearch Contributors. See -* GitHub history for details. -* -* Licensed to Elasticsearch B.V. under one or more contributor -* license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright -* ownership. Elasticsearch B.V. licenses this file to you under -* the Apache License, Version 2.0 (the "License"); you may -* not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ - -using System.Collections.Generic; - -namespace ApiGenerator.Configuration.Overrides.Endpoints -{ - // ReSharper disable once UnusedMember.Global - public class NodesHotThreadsOverrides : EndpointOverridesBase - { - public override IDictionary RenameQueryStringParams => new Dictionary - { - { "type", "thread_type" } - }; - } -} diff --git a/src/ApiGenerator/Domain/ApiQueryParametersPatcher.cs b/src/ApiGenerator/Domain/ApiQueryParametersPatcher.cs index 744ec2af00..d5757a3a23 100644 --- a/src/ApiGenerator/Domain/ApiQueryParametersPatcher.cs +++ b/src/ApiGenerator/Domain/ApiQueryParametersPatcher.cs @@ -58,7 +58,8 @@ IEndpointOverrides overrides value.QueryStringKey = queryStringKey; if (!renameLookup.TryGetValue(queryStringKey, out var preferredName)) preferredName = queryStringKey; - value.ClsName = CreateCSharpName(preferredName, endpointName); + + value.ClsName ??= CreateCSharpName(preferredName, endpointName); if (skipList.Contains(queryStringKey)) value.Skip = true; diff --git a/src/ApiGenerator/Domain/RestApiSpec.cs b/src/ApiGenerator/Domain/RestApiSpec.cs index e6a1740f6c..c474fa71d6 100644 --- a/src/ApiGenerator/Domain/RestApiSpec.cs +++ b/src/ApiGenerator/Domain/RestApiSpec.cs @@ -43,7 +43,7 @@ public class EnumDescription public class RestApiSpec { - public IDictionary Endpoints { get; set; } + public ImmutableSortedDictionary Endpoints { get; set; } public ImmutableSortedDictionary> EndpointsPerNamespaceLowLevel => Endpoints.Values.GroupBy(e=>e.CsharpNames.Namespace) @@ -63,44 +63,32 @@ public IEnumerable EnumsInTheSpec { if (_enumDescriptions != null) return _enumDescriptions; - string CreateName(string name, string methodName, string @namespace) - { - if ( - name.ToLowerInvariant().Contains("metric") - ||(name.ToLowerInvariant() == "status") - ||(name.ToLowerInvariant() == "format") - ) - { - if (methodName.StartsWith(@namespace)) - return methodName + name; - else - return @namespace + methodName + name; - } + var urlParameterEnums = Endpoints + .Values + .SelectMany(e => e.Url.Params.Values) + .Where(p => p.Options != null && p.Options.Any()) + .Select(p => new EnumDescription + { + Name = p.ClsName, + Options = p.Options + }) + .ToList(); - return name; - } - - var urlParameterEnums = ( - from e in Endpoints.Values - from para in e.Url.Params.Values - where para.Options != null && para.Options.Any() - let name = CreateName(para.ClsName, e.CsharpNames.MethodName, e.CsharpNames.Namespace) - where name != "Time" - select new EnumDescription - { - Name = name, - Options = para.Options - }).ToList(); - - var urlPartEnums = ( - from e in Endpoints.Values - from part in e.Url.Parts - where part.Options != null && part.Options.Any() - select new EnumDescription - { - Name = CreateName(part.Name.ToPascalCase(), e.CsharpNames.MethodName, e.CsharpNames.Namespace), - Options = part.Options - }).ToList(); + var urlPartEnums = Endpoints + .Values + .SelectMany(e => e.Url.Parts, (e, part) => new { e, part }) + .Where(p => p.part.Options != null && p.part.Options.Any()) + .Select(p => + { + var ns = p.e.CsharpNames.Namespace; + var m = p.e.CsharpNames.MethodName; + return new EnumDescription + { + Name = (!m.StartsWith(ns) ? ns : string.Empty) + m + p.part.Name.ToPascalCase(), + Options = p.part.Options + }; + }). + ToList(); _enumDescriptions = urlPartEnums .Concat(urlParameterEnums) diff --git a/src/ApiGenerator/Domain/Specification/ApiEndpoint.cs b/src/ApiGenerator/Domain/Specification/ApiEndpoint.cs index d1ffdeb14b..8ff2f8c41f 100644 --- a/src/ApiGenerator/Domain/Specification/ApiEndpoint.cs +++ b/src/ApiGenerator/Domain/Specification/ApiEndpoint.cs @@ -62,44 +62,46 @@ public class ApiEndpoint public IEndpointOverrides Overrides { get; internal set; } - public RequestInterface RequestInterface => new RequestInterface - { + private IEnumerable ParamsToGenerate => Url.Params.Values.Where(p => !p.Skip).OrderBy(p => p.ClsName); + + public RequestInterface RequestInterface => new() + { CsharpNames = CsharpNames, UrlParts = Url.Parts, PartialParameters = - Body == null ? Enumerable.Empty().ToList() : Url.Params.Values.Where(p => p.RenderPartial && !p.Skip).ToList(), + Body == null ? Enumerable.Empty().ToList() : ParamsToGenerate.Where(p => p.RenderPartial).ToList(), OfficialDocumentationLink = OfficialDocumentationLink?.Url }; - public RequestPartialImplementation RequestPartialImplementation => new RequestPartialImplementation - { + public RequestPartialImplementation RequestPartialImplementation => new() + { CsharpNames = CsharpNames, OfficialDocumentationLink = OfficialDocumentationLink?.Url, Stability = Stability, Paths = Url.Paths, Parts = Url.Parts, - Params = Url.Params.Values.Where(p => !p.Skip).ToList(), + Params = ParamsToGenerate.ToList(), Constructors = Constructor.RequestConstructors(CsharpNames, Url, inheritsFromPlainRequestBase: true).ToList(), GenericConstructors = Constructor.RequestConstructors(CsharpNames, Url, inheritsFromPlainRequestBase: false).ToList(), HasBody = Body != null, }; - public DescriptorPartialImplementation DescriptorPartialImplementation => new DescriptorPartialImplementation - { + public DescriptorPartialImplementation DescriptorPartialImplementation => new() + { CsharpNames = CsharpNames, OfficialDocumentationLink = OfficialDocumentationLink?.Url, Constructors = Constructor.DescriptorConstructors(CsharpNames, Url).ToList(), Paths = Url.Paths, Parts = Url.Parts, - Params = Url.Params.Values.Where(p => !p.Skip).ToList(), + Params = ParamsToGenerate.ToList(), HasBody = Body != null, }; - public RequestParameterImplementation RequestParameterImplementation => new RequestParameterImplementation - { + public RequestParameterImplementation RequestParameterImplementation => new() + { CsharpNames = CsharpNames, OfficialDocumentationLink = OfficialDocumentationLink?.Url, - Params = Url.Params.Values.Where(p => !p.Skip).ToList(), + Params = ParamsToGenerate.ToList(), HttpMethod = PreferredHttpMethod }; diff --git a/src/ApiGenerator/Domain/Specification/UrlInformation.cs b/src/ApiGenerator/Domain/Specification/UrlInformation.cs index 0c05bcd805..e64e36d2ff 100644 --- a/src/ApiGenerator/Domain/Specification/UrlInformation.cs +++ b/src/ApiGenerator/Domain/Specification/UrlInformation.cs @@ -28,6 +28,7 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; namespace ApiGenerator.Domain.Specification @@ -42,7 +43,7 @@ public class UrlInformation public IDictionary OriginalParts { get; set; } - private IReadOnlyCollection DeprecatedPaths { get; set; } + public IList DeprecatedPaths { get; set; } = new List(); private List _paths; public IReadOnlyCollection Paths @@ -113,7 +114,11 @@ public IReadOnlyCollection PathsWithDeprecations } - public IReadOnlyCollection Parts => Paths.SelectMany(p => p.Parts).DistinctBy(p => p.Name).ToList(); + public IReadOnlyCollection Parts => Paths + .SelectMany(p => p.Parts) + .DistinctBy(p => p.Name) + .OrderBy(p => p.Name) + .ToList(); public bool IsPartless => !Parts.Any(); @@ -135,6 +140,5 @@ public bool TryGetDocumentApiPath(out UrlPath path) path = new UrlPath(mostVerbosePath.Path, OriginalParts, mostVerbosePath.Parts); return true; } - } } diff --git a/src/ApiGenerator/Generator/ApiEndpointFactory.cs b/src/ApiGenerator/Generator/ApiEndpointFactory.cs index c5ae4a719a..a8640adbe5 100644 --- a/src/ApiGenerator/Generator/ApiEndpointFactory.cs +++ b/src/ApiGenerator/Generator/ApiEndpointFactory.cs @@ -37,6 +37,7 @@ using ApiGenerator.Domain.Code; using ApiGenerator.Domain.Specification; using NJsonSchema; +using NJsonSchema.References; using NSwag; namespace ApiGenerator.Generator @@ -55,16 +56,37 @@ public static ApiEndpoint From(string name, List<(string HttpPath, OpenApiPathIt foreach (var (httpPath, path, _, operation) in variants.DistinctBy(v => v.HttpPath)) { - urlInfo.OriginalPaths.Add(httpPath); + if (!operation.IsDeprecated) + urlInfo.OriginalPaths.Add(httpPath); + else + { + urlInfo.DeprecatedPaths.Add(new DeprecatedPath + { + Path = httpPath, + Version = operation.GetExtension("x-version-deprecated") as string, + Description = operation.GetExtension("x-deprecation-message") as string + }); + } + var pathParams = path.Parameters .Concat(operation.Parameters) .Where(p => p.Kind == OpenApiParameterKind.Path) .ToList(); + + foreach (var overloadedParam in pathParams.Where(p => p.Schema.XOverloadedParam() != null)) + { + urlInfo.OriginalPaths.Add(httpPath.Replace( + $"{{{overloadedParam.Name}}}", + $"{{{overloadedParam.Schema.XOverloadedParam()}}}" + )); + } + var paramNames = pathParams.Select(p => p.Name); - if (requiredPathParams != null) + if (requiredPathParams != null) requiredPathParams.IntersectWith(paramNames); else requiredPathParams = new HashSet(paramNames); + allPathParams.AddRange(pathParams); } @@ -84,15 +106,7 @@ public static ApiEndpoint From(string name, List<(string HttpPath, OpenApiPathIt urlInfo.Params = variants.SelectMany(v => v.Path.Parameters.Concat(v.Operation.Parameters)) .Where(p => p.Kind == OpenApiParameterKind.Query) .DistinctBy(p => p.Name) - .ToImmutableSortedDictionary(p => p.Name, - p => new QueryParameters - { - Type = GetOpenSearchType(p.Schema), - Description = p.Description, - Options = GetEnumOptions(p.Schema), - Deprecated = GetDeprecation(p.Schema), - VersionAdded = p.Schema.XVersionAdded() - }); + .ToImmutableSortedDictionary(p => p.Name, BuildQueryParam); var endpoint = new ApiEndpoint { @@ -138,6 +152,25 @@ private static void PatchRequestParameters(ApiEndpoint endpoint) => endpoint.Url.Params = ApiQueryParametersPatcher.Patch(endpoint.Name, endpoint.Url.Params, endpoint.Overrides) ?? throw new ArgumentNullException("ApiQueryParametersPatcher.Patch(endpoint.Name, endpoint.Url.Params, endpoint.Overrides)"); + private static QueryParameters BuildQueryParam(OpenApiParameter p) + { + var param = new QueryParameters + { + Type = GetOpenSearchType(p.Schema), + Description = p.Description, + Options = GetEnumOptions(p.Schema), + Deprecated = GetDeprecation(p.Schema), + VersionAdded = p.Schema.XVersionAdded(), + }; + + if (param.Type == "enum" && p.Schema.HasReference) + { + param.ClsName = ((IJsonReference)p.Schema).ReferencePath.Split('/').Last(); + } + + return param; + } + private static string GetOpenSearchType(JsonSchema schema) { schema = schema.ActualSchema; @@ -155,7 +188,9 @@ private static string GetOpenSearchType(JsonSchema schema) } private static IEnumerable GetEnumOptions(JsonSchema schema) => - schema.ActualSchema.Enumeration?.Select(e => e.ToString()) ?? Enumerable.Empty(); + schema.ActualSchema.XEnumOptions() + ?? schema.ActualSchema.Enumeration?.Select(e => e.ToString()) + ?? Enumerable.Empty(); private static QueryParameterDeprecation GetDeprecation(IJsonExtensionObject schema) => (schema.XDeprecationMessage(), schema.XVersionDeprecated()) switch @@ -186,6 +221,12 @@ private static string XVersionAdded(this IJsonExtensionObject schema) => private static string XDataType(this IJsonExtensionObject schema) => schema.GetExtension("x-data-type") as string; + private static string XOverloadedParam(this IJsonExtensionObject schema) => + schema.GetExtension("x-overloaded-param") as string; + + private static IEnumerable XEnumOptions(this IJsonExtensionObject schema) => + schema.GetExtension("x-enum-options") is object[] opts ? opts.Cast() : null; + private static object GetExtension(this IJsonExtensionObject schema, string key) => schema.ExtensionData?.TryGetValue(key, out var value) ?? false ? value : null; } diff --git a/src/ApiGenerator/Generator/ApiGenerator.cs b/src/ApiGenerator/Generator/ApiGenerator.cs index 9dae100585..9b0d7d4f13 100644 --- a/src/ApiGenerator/Generator/ApiGenerator.cs +++ b/src/ApiGenerator/Generator/ApiGenerator.cs @@ -36,6 +36,7 @@ using ApiGenerator.Configuration; using ApiGenerator.Domain; using ApiGenerator.Generator.Razor; +using NJsonSchema; using NSwag; using ShellProgressBar; @@ -92,6 +93,7 @@ await DoGenerate( public static async Task CreateRestApiSpecModel(CancellationToken token = default) { var document = await OpenApiYamlDocument.FromFileAsync(GeneratorLocations.OpenApiSpecFile, token); + JsonSchemaReferenceUtilities.UpdateSchemaReferencePaths(document); var endpoints = document.Paths .Select(kv => new { HttpPath = kv.Key, PathItem = kv.Value }) diff --git a/src/ApiGenerator/OpenSearch.openapi.json b/src/ApiGenerator/OpenSearch.openapi.json index fb73202fd2..438eafcb6c 100644 --- a/src/ApiGenerator/OpenSearch.openapi.json +++ b/src/ApiGenerator/OpenSearch.openapi.json @@ -10646,21 +10646,23 @@ "description": "Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified.", "x-enum-options": [ "_all", - "completion", - "docs", - "fielddata", - "query_cache", - "flush", - "get", + "store", "indexing", + "get", + "search", "merge", - "request_cache", + "flush", "refresh", - "search", - "segments", - "store", + "query_cache", + "fielddata", + "docs", "warmer", - "suggest" + "completion", + "segments", + "translog", + "suggest", + "request_cache", + "recovery" ], "x-data-type": "array" }, @@ -11444,21 +11446,23 @@ "description": "Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified.", "x-enum-options": [ "_all", - "completion", - "docs", - "fielddata", - "query_cache", - "flush", - "get", + "store", "indexing", + "get", + "search", "merge", - "request_cache", + "flush", "refresh", - "search", - "segments", - "store", + "query_cache", + "fielddata", + "docs", "warmer", - "suggest" + "completion", + "segments", + "translog", + "suggest", + "request_cache", + "recovery" ], "x-data-type": "array" }, diff --git a/src/ApiGenerator/Views/HighLevel/Requests/ApiUrlsLookup.cshtml b/src/ApiGenerator/Views/HighLevel/Requests/ApiUrlsLookup.cshtml index be7a574d24..68d92443e6 100644 --- a/src/ApiGenerator/Views/HighLevel/Requests/ApiUrlsLookup.cshtml +++ b/src/ApiGenerator/Views/HighLevel/Requests/ApiUrlsLookup.cshtml @@ -6,7 +6,7 @@ @{ await IncludeGeneratorNotice(); } namespace OpenSearch.Client { - internal static partial class ApiUrlsLookups + internal static partial class ApiUrlsLookups { @foreach (var endpoint in Model.Endpoints.Values) { @@ -17,7 +17,7 @@ namespace OpenSearch.Client var propertyName = $"{endpoint.CsharpNames.Namespace}{endpoint.CsharpNames.MethodName}"; var paths = endpoint.Url.Paths.Count == 0 ? endpoint.Url.PathsWithDeprecations : endpoint.Url.Paths; - internal static ApiUrls @(Raw(propertyName)) = new(new [] {@Raw(string.Join(", ", paths.Select(p=>$"\"{p.Path.TrimStart('/')}\"")))}); + internal static readonly ApiUrls @(Raw(propertyName)) = new(new [] {@Raw(string.Join(", ", paths.Select(p=>$"\"{p.Path.TrimStart('/')}\"")))}); } } diff --git a/src/ApiGenerator/Views/LowLevel/Enums.cshtml b/src/ApiGenerator/Views/LowLevel/Enums.cshtml index 630392bd6e..30ba1f0109 100644 --- a/src/ApiGenerator/Views/LowLevel/Enums.cshtml +++ b/src/ApiGenerator/Views/LowLevel/Enums.cshtml @@ -69,7 +69,7 @@ namespace OpenSearch.Net { @foreach (var e in Model.EnumsInTheSpec) { - EnumStringResolvers.TryAdd(typeof(@(e.Name)), (e) => GetStringValue((@(e.Name))e)); + EnumStringResolvers.TryAdd(typeof(@(e.Name)), e => GetStringValue((@(e.Name))e)); } } diff --git a/src/OpenSearch.Client/ApiUrlsLookup.cs b/src/OpenSearch.Client/ApiUrlsLookup.cs index 6ae591abcb..f542ad80f7 100644 --- a/src/OpenSearch.Client/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/ApiUrlsLookup.cs @@ -138,11 +138,6 @@ internal static partial class ApiUrlsLookups internal static ApiUrls NoNamespaceMultiSearch = new ApiUrls(new[]{"_msearch", "{index}/_msearch"}); internal static ApiUrls NoNamespaceMultiSearchTemplate = new ApiUrls(new[]{"_msearch/template", "{index}/_msearch/template"}); internal static ApiUrls NoNamespaceMultiTermVectors = new ApiUrls(new[]{"_mtermvectors", "{index}/_mtermvectors"}); - internal static ApiUrls NodesHotThreads = new ApiUrls(new[]{"_nodes/hot_threads", "_nodes/{node_id}/hot_threads"}); - internal static ApiUrls NodesInfo = new ApiUrls(new[]{"_nodes", "_nodes/{node_id}", "_nodes/{metric}", "_nodes/{node_id}/{metric}"}); - internal static ApiUrls NodesReloadSecureSettings = new ApiUrls(new[]{"_nodes/reload_secure_settings", "_nodes/{node_id}/reload_secure_settings"}); - internal static ApiUrls NodesStats = new ApiUrls(new[]{"_nodes/stats", "_nodes/{node_id}/stats", "_nodes/stats/{metric}", "_nodes/{node_id}/stats/{metric}", "_nodes/stats/{metric}/{index_metric}", "_nodes/{node_id}/stats/{metric}/{index_metric}"}); - internal static ApiUrls NodesUsage = new ApiUrls(new[]{"_nodes/usage", "_nodes/{node_id}/usage", "_nodes/usage/{metric}", "_nodes/{node_id}/usage/{metric}"}); internal static ApiUrls NoNamespacePing = new ApiUrls(new[]{""}); internal static ApiUrls NoNamespacePutScript = new ApiUrls(new[]{"_scripts/{id}", "_scripts/{id}/{context}"}); internal static ApiUrls NoNamespaceReindexOnServer = new ApiUrls(new[]{"_reindex"}); diff --git a/src/OpenSearch.Client/Descriptors.Nodes.cs b/src/OpenSearch.Client/Descriptors.Nodes.cs deleted file mode 100644 index e7631f92e2..0000000000 --- a/src/OpenSearch.Client/Descriptors.Nodes.cs +++ /dev/null @@ -1,280 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 -* -* The OpenSearch Contributors require contributions made to -* this file be licensed under the Apache-2.0 license or a -* compatible open source license. -*/ -/* -* Modifications Copyright OpenSearch Contributors. See -* GitHub history for details. -* -* Licensed to Elasticsearch B.V. under one or more contributor -* license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright -* ownership. Elasticsearch B.V. licenses this file to you under -* the Apache License, Version 2.0 (the "License"); you may -* not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ -// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ -// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ -// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ -// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ -// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ -// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ -// ----------------------------------------------- -// -// This file is automatically generated -// Please do not edit these files manually -// Run the following in the root of the repos: -// -// *NIX : ./build.sh codegen -// Windows : build.bat codegen -// -// ----------------------------------------------- -// ReSharper disable RedundantUsingDirective -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Linq.Expressions; -using OpenSearch.Net; -using OpenSearch.Net.Utf8Json; -using OpenSearch.Net.Specification.NodesApi; - -// ReSharper disable RedundantBaseConstructorCall -// ReSharper disable UnusedTypeParameter -// ReSharper disable PartialMethodWithSinglePart -// ReSharper disable RedundantNameQualifier -namespace OpenSearch.Client.Specification.NodesApi -{ - ///Descriptor for HotThreads - public partial class NodesHotThreadsDescriptor : RequestDescriptorBase, INodesHotThreadsRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.NodesHotThreads; - ////_nodes/hot_threads - public NodesHotThreadsDescriptor(): base() - { - } - - ////_nodes/{node_id}/hot_threads - ///Optional, accepts null - public NodesHotThreadsDescriptor(NodeIds nodeId): base(r => r.Optional("node_id", nodeId)) - { - } - - // values part of the url path - NodeIds INodesHotThreadsRequest.NodeId => Self.RouteValues.Get("node_id"); - ///A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes - public NodesHotThreadsDescriptor NodeId(NodeIds nodeId) => Assign(nodeId, (a, v) => a.RouteValues.Optional("node_id", v)); - // Request parameters - ///Don't show threads that are in known-idle places, such as waiting on a socket select or pulling from an empty task queue (default: true) - public NodesHotThreadsDescriptor IgnoreIdleThreads(bool? ignoreidlethreads = true) => Qs("ignore_idle_threads", ignoreidlethreads); - ///The interval for the second sampling of threads - public NodesHotThreadsDescriptor Interval(Time interval) => Qs("interval", interval); - ///Number of samples of thread stacktrace (default: 10) - public NodesHotThreadsDescriptor Snapshots(long? snapshots) => Qs("snapshots", snapshots); - ///The type to sample (default: cpu) - public NodesHotThreadsDescriptor ThreadType(ThreadType? threadtype) => Qs("type", threadtype); - ///Specify the number of threads to provide information for (default: 3) - public NodesHotThreadsDescriptor Threads(long? threads) => Qs("threads", threads); - ///Explicit operation timeout - public NodesHotThreadsDescriptor Timeout(Time timeout) => Qs("timeout", timeout); - } - - ///Descriptor for Info https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-nodes/ - public partial class NodesInfoDescriptor : RequestDescriptorBase, INodesInfoRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.NodesInfo; - ////_nodes - public NodesInfoDescriptor(): base() - { - } - - ////_nodes/{node_id} - ///Optional, accepts null - public NodesInfoDescriptor(NodeIds nodeId): base(r => r.Optional("node_id", nodeId)) - { - } - - ////_nodes/{metric} - ///Optional, accepts null - public NodesInfoDescriptor(Metrics metric): base(r => r.Optional("metric", metric)) - { - } - - ////_nodes/{node_id}/{metric} - ///Optional, accepts null - ///Optional, accepts null - public NodesInfoDescriptor(NodeIds nodeId, Metrics metric): base(r => r.Optional("node_id", nodeId).Optional("metric", metric)) - { - } - - // values part of the url path - NodeIds INodesInfoRequest.NodeId => Self.RouteValues.Get("node_id"); - Metrics INodesInfoRequest.Metric => Self.RouteValues.Get("metric"); - ///A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes - public NodesInfoDescriptor NodeId(NodeIds nodeId) => Assign(nodeId, (a, v) => a.RouteValues.Optional("node_id", v)); - ///A comma-separated list of metrics you wish returned. Leave empty to return all. - public NodesInfoDescriptor Metric(Metrics metric) => Assign(metric, (a, v) => a.RouteValues.Optional("metric", v)); - // Request parameters - ///Return settings in flat format (default: false) - public NodesInfoDescriptor FlatSettings(bool? flatsettings = true) => Qs("flat_settings", flatsettings); - ///Explicit operation timeout - public NodesInfoDescriptor Timeout(Time timeout) => Qs("timeout", timeout); - } - - ///Descriptor for ReloadSecureSettings - public partial class ReloadSecureSettingsDescriptor : RequestDescriptorBase, IReloadSecureSettingsRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.NodesReloadSecureSettings; - ////_nodes/reload_secure_settings - public ReloadSecureSettingsDescriptor(): base() - { - } - - ////_nodes/{node_id}/reload_secure_settings - ///Optional, accepts null - public ReloadSecureSettingsDescriptor(NodeIds nodeId): base(r => r.Optional("node_id", nodeId)) - { - } - - // values part of the url path - NodeIds IReloadSecureSettingsRequest.NodeId => Self.RouteValues.Get("node_id"); - ///A comma-separated list of node IDs to span the reload/reinit call. Should stay empty because reloading usually involves all cluster nodes. - public ReloadSecureSettingsDescriptor NodeId(NodeIds nodeId) => Assign(nodeId, (a, v) => a.RouteValues.Optional("node_id", v)); - // Request parameters - ///Explicit operation timeout - public ReloadSecureSettingsDescriptor Timeout(Time timeout) => Qs("timeout", timeout); - } - - ///Descriptor for Stats https://opensearch.org/docs/latest/opensearch/stats-api/ - public partial class NodesStatsDescriptor : RequestDescriptorBase, INodesStatsRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.NodesStats; - ////_nodes/stats - public NodesStatsDescriptor(): base() - { - } - - ////_nodes/{node_id}/stats - ///Optional, accepts null - public NodesStatsDescriptor(NodeIds nodeId): base(r => r.Optional("node_id", nodeId)) - { - } - - ////_nodes/stats/{metric} - ///Optional, accepts null - public NodesStatsDescriptor(Metrics metric): base(r => r.Optional("metric", metric)) - { - } - - ////_nodes/{node_id}/stats/{metric} - ///Optional, accepts null - ///Optional, accepts null - public NodesStatsDescriptor(NodeIds nodeId, Metrics metric): base(r => r.Optional("node_id", nodeId).Optional("metric", metric)) - { - } - - ////_nodes/stats/{metric}/{index_metric} - ///Optional, accepts null - ///Optional, accepts null - public NodesStatsDescriptor(Metrics metric, IndexMetrics indexMetric): base(r => r.Optional("metric", metric).Optional("index_metric", indexMetric)) - { - } - - ////_nodes/{node_id}/stats/{metric}/{index_metric} - ///Optional, accepts null - ///Optional, accepts null - ///Optional, accepts null - public NodesStatsDescriptor(NodeIds nodeId, Metrics metric, IndexMetrics indexMetric): base(r => r.Optional("node_id", nodeId).Optional("metric", metric).Optional("index_metric", indexMetric)) - { - } - - // values part of the url path - NodeIds INodesStatsRequest.NodeId => Self.RouteValues.Get("node_id"); - Metrics INodesStatsRequest.Metric => Self.RouteValues.Get("metric"); - IndexMetrics INodesStatsRequest.IndexMetric => Self.RouteValues.Get("index_metric"); - ///A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes - public NodesStatsDescriptor NodeId(NodeIds nodeId) => Assign(nodeId, (a, v) => a.RouteValues.Optional("node_id", v)); - ///Limit the information returned to the specified metrics - public NodesStatsDescriptor Metric(Metrics metric) => Assign(metric, (a, v) => a.RouteValues.Optional("metric", v)); - ///Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified. - public NodesStatsDescriptor IndexMetric(IndexMetrics indexMetric) => Assign(indexMetric, (a, v) => a.RouteValues.Optional("index_metric", v)); - // Request parameters - ///A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) - public NodesStatsDescriptor CompletionFields(Fields completionfields) => Qs("completion_fields", completionfields); - ///A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards) - public NodesStatsDescriptor CompletionFields(params Expression>[] fields) - where T : class => Qs("completion_fields", fields?.Select(e => (Field)e)); - ///A comma-separated list of fields for `fielddata` index metric (supports wildcards) - public NodesStatsDescriptor FielddataFields(Fields fielddatafields) => Qs("fielddata_fields", fielddatafields); - ///A comma-separated list of fields for `fielddata` index metric (supports wildcards) - public NodesStatsDescriptor FielddataFields(params Expression>[] fields) - where T : class => Qs("fielddata_fields", fields?.Select(e => (Field)e)); - ///A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) - public NodesStatsDescriptor Fields(Fields fields) => Qs("fields", fields); - ///A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards) - public NodesStatsDescriptor Fields(params Expression>[] fields) - where T : class => Qs("fields", fields?.Select(e => (Field)e)); - ///A comma-separated list of search groups for `search` index metric - public NodesStatsDescriptor Groups(bool? groups = true) => Qs("groups", groups); - ///Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested) - public NodesStatsDescriptor IncludeSegmentFileSizes(bool? includesegmentfilesizes = true) => Qs("include_segment_file_sizes", includesegmentfilesizes); - ///Return indices stats aggregated at index, node or shard level - public NodesStatsDescriptor Level(Level? level) => Qs("level", level); - ///Explicit operation timeout - public NodesStatsDescriptor Timeout(Time timeout) => Qs("timeout", timeout); - ///A comma-separated list of document types for the `indexing` index metric - public NodesStatsDescriptor Types(params string[] types) => Qs("types", types); - } - - ///Descriptor for Usage - public partial class NodesUsageDescriptor : RequestDescriptorBase, INodesUsageRequest - { - internal override ApiUrls ApiUrls => ApiUrlsLookups.NodesUsage; - ////_nodes/usage - public NodesUsageDescriptor(): base() - { - } - - ////_nodes/{node_id}/usage - ///Optional, accepts null - public NodesUsageDescriptor(NodeIds nodeId): base(r => r.Optional("node_id", nodeId)) - { - } - - ////_nodes/usage/{metric} - ///Optional, accepts null - public NodesUsageDescriptor(Metrics metric): base(r => r.Optional("metric", metric)) - { - } - - ////_nodes/{node_id}/usage/{metric} - ///Optional, accepts null - ///Optional, accepts null - public NodesUsageDescriptor(NodeIds nodeId, Metrics metric): base(r => r.Optional("node_id", nodeId).Optional("metric", metric)) - { - } - - // values part of the url path - NodeIds INodesUsageRequest.NodeId => Self.RouteValues.Get("node_id"); - Metrics INodesUsageRequest.Metric => Self.RouteValues.Get("metric"); - ///A comma-separated list of node IDs or names to limit the returned information; use `_local` to return information from the node you're connecting to, leave empty to get information from all nodes - public NodesUsageDescriptor NodeId(NodeIds nodeId) => Assign(nodeId, (a, v) => a.RouteValues.Optional("node_id", v)); - ///Limit the information returned to the specified metrics - public NodesUsageDescriptor Metric(Metrics metric) => Assign(metric, (a, v) => a.RouteValues.Optional("metric", v)); - // Request parameters - ///Explicit operation timeout - public NodesUsageDescriptor Timeout(Time timeout) => Qs("timeout", timeout); - } -} diff --git a/src/OpenSearch.Client/IOpenSearchClient.Generated.cs b/src/OpenSearch.Client/IOpenSearchClient.Generated.cs index fa3da95db4..6ca8082709 100644 --- a/src/OpenSearch.Client/IOpenSearchClient.Generated.cs +++ b/src/OpenSearch.Client/IOpenSearchClient.Generated.cs @@ -82,12 +82,6 @@ IndicesNamespace Indices get; } - ///Nodes APIs - NodesNamespace Nodes - { - get; - } - /// /// POST request to the bulk API, read more about this API online: /// diff --git a/src/OpenSearch.Client/OpenSearchClient.NoNamespace.cs b/src/OpenSearch.Client/OpenSearchClient.NoNamespace.cs index 777c72111a..705ca3749d 100644 --- a/src/OpenSearch.Client/OpenSearchClient.NoNamespace.cs +++ b/src/OpenSearch.Client/OpenSearchClient.NoNamespace.cs @@ -84,19 +84,11 @@ public IndicesNamespace Indices private set; } - ///Nodes APIs - public NodesNamespace Nodes - { - get; - private set; - } - partial void SetupNamespaces() { Cat = new CatNamespace(this); Cluster = new ClusterNamespace(this); Indices = new IndicesNamespace(this); - Nodes = new NodesNamespace(this); } /// diff --git a/src/OpenSearch.Client/OpenSearchClient.Nodes.cs b/src/OpenSearch.Client/OpenSearchClient.Nodes.cs deleted file mode 100644 index bf60517610..0000000000 --- a/src/OpenSearch.Client/OpenSearchClient.Nodes.cs +++ /dev/null @@ -1,187 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 -* -* The OpenSearch Contributors require contributions made to -* this file be licensed under the Apache-2.0 license or a -* compatible open source license. -*/ -/* -* Modifications Copyright OpenSearch Contributors. See -* GitHub history for details. -* -* Licensed to Elasticsearch B.V. under one or more contributor -* license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright -* ownership. Elasticsearch B.V. licenses this file to you under -* the Apache License, Version 2.0 (the "License"); you may -* not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ -// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ -// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ -// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ -// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ -// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ -// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ -// ----------------------------------------------- -// -// This file is automatically generated -// Please do not edit these files manually -// Run the following in the root of the repos: -// -// *NIX : ./build.sh codegen -// Windows : build.bat codegen -// -// ----------------------------------------------- -// ReSharper disable RedundantUsingDirective -using System; -using System.Threading; -using System.Threading.Tasks; -using OpenSearch.Net.Specification.NodesApi; - -// ReSharper disable once CheckNamespace -// ReSharper disable RedundantTypeArgumentsOfMethod -namespace OpenSearch.Client.Specification.NodesApi -{ - /// - /// Nodes APIs. - /// Not intended to be instantiated directly. Use the property - /// on . - /// - /// - public class NodesNamespace : NamespacedClientProxy - { - internal NodesNamespace(OpenSearchClient client): base(client) - { - } - - /// - /// GET request to the nodes.hot_threads API, read more about this API online: - /// - /// - /// - public NodesHotThreadsResponse HotThreads(Func selector = null) => HotThreads(selector.InvokeOrDefault(new NodesHotThreadsDescriptor())); - /// - /// GET request to the nodes.hot_threads API, read more about this API online: - /// - /// - /// - public Task HotThreadsAsync(Func selector = null, CancellationToken ct = default) => HotThreadsAsync(selector.InvokeOrDefault(new NodesHotThreadsDescriptor()), ct); - /// - /// GET request to the nodes.hot_threads API, read more about this API online: - /// - /// - /// - public NodesHotThreadsResponse HotThreads(INodesHotThreadsRequest request) => DoRequest(request, request.RequestParameters); - /// - /// GET request to the nodes.hot_threads API, read more about this API online: - /// - /// - /// - public Task HotThreadsAsync(INodesHotThreadsRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct); - /// - /// GET request to the nodes.info API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-nodes/ - /// - public NodesInfoResponse Info(Func selector = null) => Info(selector.InvokeOrDefault(new NodesInfoDescriptor())); - /// - /// GET request to the nodes.info API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-nodes/ - /// - public Task InfoAsync(Func selector = null, CancellationToken ct = default) => InfoAsync(selector.InvokeOrDefault(new NodesInfoDescriptor()), ct); - /// - /// GET request to the nodes.info API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-nodes/ - /// - public NodesInfoResponse Info(INodesInfoRequest request) => DoRequest(request, request.RequestParameters); - /// - /// GET request to the nodes.info API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-nodes/ - /// - public Task InfoAsync(INodesInfoRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct); - /// - /// POST request to the nodes.reload_secure_settings API, read more about this API online: - /// - /// - /// - public ReloadSecureSettingsResponse ReloadSecureSettings(Func selector = null) => ReloadSecureSettings(selector.InvokeOrDefault(new ReloadSecureSettingsDescriptor())); - /// - /// POST request to the nodes.reload_secure_settings API, read more about this API online: - /// - /// - /// - public Task ReloadSecureSettingsAsync(Func selector = null, CancellationToken ct = default) => ReloadSecureSettingsAsync(selector.InvokeOrDefault(new ReloadSecureSettingsDescriptor()), ct); - /// - /// POST request to the nodes.reload_secure_settings API, read more about this API online: - /// - /// - /// - public ReloadSecureSettingsResponse ReloadSecureSettings(IReloadSecureSettingsRequest request) => DoRequest(request, request.RequestParameters); - /// - /// POST request to the nodes.reload_secure_settings API, read more about this API online: - /// - /// - /// - public Task ReloadSecureSettingsAsync(IReloadSecureSettingsRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct); - /// - /// GET request to the nodes.stats API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/stats-api/ - /// - public NodesStatsResponse Stats(Func selector = null) => Stats(selector.InvokeOrDefault(new NodesStatsDescriptor())); - /// - /// GET request to the nodes.stats API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/stats-api/ - /// - public Task StatsAsync(Func selector = null, CancellationToken ct = default) => StatsAsync(selector.InvokeOrDefault(new NodesStatsDescriptor()), ct); - /// - /// GET request to the nodes.stats API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/stats-api/ - /// - public NodesStatsResponse Stats(INodesStatsRequest request) => DoRequest(request, request.RequestParameters); - /// - /// GET request to the nodes.stats API, read more about this API online: - /// - /// https://opensearch.org/docs/latest/opensearch/stats-api/ - /// - public Task StatsAsync(INodesStatsRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct); - /// - /// GET request to the nodes.usage API, read more about this API online: - /// - /// - /// - public NodesUsageResponse Usage(Func selector = null) => Usage(selector.InvokeOrDefault(new NodesUsageDescriptor())); - /// - /// GET request to the nodes.usage API, read more about this API online: - /// - /// - /// - public Task UsageAsync(Func selector = null, CancellationToken ct = default) => UsageAsync(selector.InvokeOrDefault(new NodesUsageDescriptor()), ct); - /// - /// GET request to the nodes.usage API, read more about this API online: - /// - /// - /// - public NodesUsageResponse Usage(INodesUsageRequest request) => DoRequest(request, request.RequestParameters); - /// - /// GET request to the nodes.usage API, read more about this API online: - /// - /// - /// - public Task UsageAsync(INodesUsageRequest request, CancellationToken ct = default) => DoRequestAsync(request, request.RequestParameters, ct); - } -} diff --git a/src/OpenSearch.Client/Requests.Nodes.cs b/src/OpenSearch.Client/Requests.Nodes.cs deleted file mode 100644 index b4df515004..0000000000 --- a/src/OpenSearch.Client/Requests.Nodes.cs +++ /dev/null @@ -1,427 +0,0 @@ -/* SPDX-License-Identifier: Apache-2.0 -* -* The OpenSearch Contributors require contributions made to -* this file be licensed under the Apache-2.0 license or a -* compatible open source license. -*/ -/* -* Modifications Copyright OpenSearch Contributors. See -* GitHub history for details. -* -* Licensed to Elasticsearch B.V. under one or more contributor -* license agreements. See the NOTICE file distributed with -* this work for additional information regarding copyright -* ownership. Elasticsearch B.V. licenses this file to you under -* the Apache License, Version 2.0 (the "License"); you may -* not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -*/ -// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ -// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ -// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ -// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ -// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ -// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ -// ----------------------------------------------- -// -// This file is automatically generated -// Please do not edit these files manually -// Run the following in the root of the repos: -// -// *NIX : ./build.sh codegen -// Windows : build.bat codegen -// -// ----------------------------------------------- -// ReSharper disable RedundantUsingDirective -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Linq.Expressions; -using System.Runtime.Serialization; -using OpenSearch.Net; -using OpenSearch.Net.Utf8Json; -using OpenSearch.Net.Specification.NodesApi; - -// ReSharper disable RedundantBaseConstructorCall -// ReSharper disable UnusedTypeParameter -// ReSharper disable PartialMethodWithSinglePart -// ReSharper disable RedundantNameQualifier -namespace OpenSearch.Client.Specification.NodesApi -{ - [InterfaceDataContract] - public partial interface INodesHotThreadsRequest : IRequest - { - [IgnoreDataMember] - NodeIds NodeId - { - get; - } - } - - ///Request for HotThreads - public partial class NodesHotThreadsRequest : PlainRequestBase, INodesHotThreadsRequest - { - protected INodesHotThreadsRequest Self => this; - internal override ApiUrls ApiUrls => ApiUrlsLookups.NodesHotThreads; - ////_nodes/hot_threads - public NodesHotThreadsRequest(): base() - { - } - - ////_nodes/{node_id}/hot_threads - ///Optional, accepts null - public NodesHotThreadsRequest(NodeIds nodeId): base(r => r.Optional("node_id", nodeId)) - { - } - - // values part of the url path - [IgnoreDataMember] - NodeIds INodesHotThreadsRequest.NodeId => Self.RouteValues.Get("node_id"); - // Request parameters - ///Don't show threads that are in known-idle places, such as waiting on a socket select or pulling from an empty task queue (default: true) - public bool? IgnoreIdleThreads - { - get => Q("ignore_idle_threads"); - set => Q("ignore_idle_threads", value); - } - - ///The interval for the second sampling of threads - public Time Interval - { - get => Q