diff --git a/OpenSearch.sln b/OpenSearch.sln index 039df08e55..8fa85ddfc4 100644 --- a/OpenSearch.sln +++ b/OpenSearch.sln @@ -61,6 +61,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3EA11364-051 src\_PublishArtifacts.Build.props = src\_PublishArtifacts.Build.props EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ApiGenerator", "src\ApiGenerator\ApiGenerator.csproj", "{CA508E92-50AE-4858-BD94-8637E88A8FAC}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenSearch.Net.VirtualizedCluster", "src\OpenSearch.Net.VirtualizedCluster\OpenSearch.Net.VirtualizedCluster.csproj", "{CFE97627-8DD3-470B-B7CF-78B62E1D305D}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{29E53C13-34F7-4F0D-8D28-41EF768793E7}" @@ -120,6 +122,7 @@ Global {81473437-5722-4829-A5CD-125B17CCA238} = {6C4A2627-AF22-4388-9DF7-7A9AEACFD635} {E97CCF40-0BA6-43FE-9F2D-58D454134088} = {3EA11364-0513-44B7-AD6D-A675485E7448} {072BA7DA-7B60-407D-8B6E-95E3186BE70C} = {3EA11364-0513-44B7-AD6D-A675485E7448} + {CA508E92-50AE-4858-BD94-8637E88A8FAC} = {3EA11364-0513-44B7-AD6D-A675485E7448} {CFE97627-8DD3-470B-B7CF-78B62E1D305D} = {3EA11364-0513-44B7-AD6D-A675485E7448} {D6997ADC-E933-418E-831C-DE1A78897493} = {29E53C13-34F7-4F0D-8D28-41EF768793E7} {432D5575-2347-4D3C-BF8C-3E38410C46CA} = {29E53C13-34F7-4F0D-8D28-41EF768793E7} @@ -184,6 +187,10 @@ Global {81473437-5722-4829-A5CD-125B17CCA238}.Debug|Any CPU.Build.0 = Debug|Any CPU {81473437-5722-4829-A5CD-125B17CCA238}.Release|Any CPU.ActiveCfg = Release|Any CPU {81473437-5722-4829-A5CD-125B17CCA238}.Release|Any CPU.Build.0 = Release|Any CPU + {CA508E92-50AE-4858-BD94-8637E88A8FAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CA508E92-50AE-4858-BD94-8637E88A8FAC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CA508E92-50AE-4858-BD94-8637E88A8FAC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CA508E92-50AE-4858-BD94-8637E88A8FAC}.Release|Any CPU.Build.0 = Release|Any CPU {CFE97627-8DD3-470B-B7CF-78B62E1D305D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CFE97627-8DD3-470B-B7CF-78B62E1D305D}.Debug|Any CPU.Build.0 = Debug|Any CPU {CFE97627-8DD3-470B-B7CF-78B62E1D305D}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/build/scripts/Commandline.fs b/build/scripts/Commandline.fs index 72d32ef25d..03321c7d77 100644 --- a/build/scripts/Commandline.fs +++ b/build/scripts/Commandline.fs @@ -62,6 +62,8 @@ Targets: * benchmark [non-interactive] [url] [username] [password] - Runs a benchmark from Tests.Benchmarking and indexes the results to [url] when provided. If non-interactive runs all benchmarks without prompting +* codegen + - runs the code generator interactively NOTE: both the `test` and `integrate` targets can be suffixed with `-all` to force the tests against all suported TFM's @@ -192,6 +194,7 @@ Execution hints can be provided anywhere on the command line | ["build"] | ["clean"] | ["benchmark"] + | ["codegen"; ] | ["profile"] -> parsed | "rest-spec-tests" :: tail -> { parsed with RemainingArguments = tail } diff --git a/build/scripts/ReposTooling.fs b/build/scripts/ReposTooling.fs index edfb546426..e5252ec8eb 100644 --- a/build/scripts/ReposTooling.fs +++ b/build/scripts/ReposTooling.fs @@ -52,6 +52,14 @@ module ReposTooling = Shell.deleteDir tempDir + let GenerateApi () = + //TODO allow branch name to be passed for CI + let folder = Path.getDirectory (Paths.ProjFile "ApiGenerator") + let timeout = TimeSpan.FromMinutes(120.) + // Building to make sure XML docs files are there, faster then relying on the ApiGenerator to emit these + // from a compilation unit + Tooling.DotNet.ExecInWithTimeout folder ["run"; "-c"; " Release"; ] timeout |> ignore + let RestSpecTests args = let folder = Path.getDirectory (Paths.TestProjFile "Tests.YamlRunner") let timeout = TimeSpan.FromMinutes(120.) diff --git a/build/scripts/Targets.fs b/build/scripts/Targets.fs index 5c84bb65ab..1a70dc9fb1 100644 --- a/build/scripts/Targets.fs +++ b/build/scripts/Targets.fs @@ -130,6 +130,8 @@ module Main = command "cluster" [ "restore"; "full-build" ] <| fun _ -> ReposTooling.LaunchCluster parsed + command "codegen" [ ] ReposTooling.GenerateApi + command "rest-spec-tests" [ ] <| fun _ -> ReposTooling.RestSpecTests parsed.RemainingArguments diff --git a/src/ApiGenerator/ApiGenerator.csproj b/src/ApiGenerator/ApiGenerator.csproj new file mode 100644 index 0000000000..0c9d11077f --- /dev/null +++ b/src/ApiGenerator/ApiGenerator.csproj @@ -0,0 +1,24 @@ + + + + Exe + net6.0 + false + + CS1591;NU1701 + true + + + + + + + + + + + + + + + diff --git a/src/ApiGenerator/App.config b/src/ApiGenerator/App.config new file mode 100644 index 0000000000..434e45fb3e --- /dev/null +++ b/src/ApiGenerator/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/ApiGenerator/CodeTemplatePage.cs b/src/ApiGenerator/CodeTemplatePage.cs new file mode 100644 index 0000000000..7b59c684af --- /dev/null +++ b/src/ApiGenerator/CodeTemplatePage.cs @@ -0,0 +1,42 @@ +/* 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; +using System.Threading.Tasks; +using RazorLight; + +namespace ApiGenerator +{ + /// This only exists to make the IDE tooling happy, not actually used to render the templates + public class CodeTemplatePage : TemplatePage + { + public override Task ExecuteAsync() => throw new NotImplementedException(); + + public Task Execute() => Task.CompletedTask; + } +} diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs new file mode 100644 index 0000000000..b0053fef26 --- /dev/null +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -0,0 +1,248 @@ +/* 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; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; + +namespace ApiGenerator.Configuration +{ + public static class CodeConfiguration + { + /// These APIs are not implemented yet in the low and high level client + public static string[] IgnoredApis { get; } = + { + // To be removed + "indices.upgrade.json", + "indices.get_upgrade.json", + }; + + private static string[] IgnoredApisHighLevel { get; } = + { + "indices.delete_index_template.json", + "indices.exists_index_template.json", + "indices.get_index_template.json", + "indices.put_index_template.json", + "indices.simulate_index_template.json", + "indices.simulate_template.json", + + "get_script_context.json", // 7.7 experimental + "get_script_languages.json", // 7.7 experimental + + "indices.exist_type.json", // already removed on client + + "rank_eval.json", // 7.7 experimental + "scripts_painless_context.json", // 7.7 experimental + "cluster.delete_component_template.json", // 7.8 experimental + "cluster.get_component_template.json", // 7.8 experimental + "cluster.put_component_template.json", // 7.8 experimental + "cluster.exists_component_template.json", // 7.8 experimental + }; + + /// + /// Map API default names for API's we are only supporting on the low level client first + /// + private static readonly Dictionary LowLevelApiNameMapping = new Dictionary + { + { "indices.delete_index_template", "DeleteIndexTemplateV2" }, + { "indices.get_index_template", "GetIndexTemplateV2" }, + { "indices.put_index_template", "PutIndexTemplateV2" } + }; + + /// + /// Scan all OSC source code files for Requests and look for the [MapsApi(filename)] attribute. + /// The class name minus Request is used as the canonical .NET name for the API. + /// + public static readonly Dictionary HighLevelApiNameMapping = + (from f in new DirectoryInfo(GeneratorLocations.OpenSearchClientFolder).GetFiles("*.cs", SearchOption.AllDirectories) + let contents = File.ReadAllText(f.FullName) + let c = Regex.Replace(contents, @"^.+\[MapsApi\(""([^ \r\n]+)""\)\].*$", "$1", RegexOptions.Singleline) + where !c.Contains(" ") //filter results that did not match + select new { Value = f.Name.Replace("Request", ""), Key = c.Replace(".json", "") }) + .DistinctBy(v => v.Key) + .ToDictionary(k => k.Key, v => v.Value.Replace(".cs", "")); + + public static readonly HashSet EnableHighLevelCodeGen = new HashSet(); + + public static bool IsNewHighLevelApi(string apiFileName) => + // if its explicitly ignored we know about it. + !IgnoredApis.Contains(apiFileName) + && !IgnoredApisHighLevel.Contains(apiFileName) + // no requests with [MapsApi("filename.json")] found + && !HighLevelApiNameMapping.ContainsKey(apiFileName.Replace(".json", "")); + + public static bool IgnoreHighLevelApi(string apiFileName) + { + //explicitly ignored + if (IgnoredApis.Contains(apiFileName) || IgnoredApisHighLevel.Contains(apiFileName)) return true; + + //always generate already mapped requests + + if (HighLevelApiNameMapping.ContainsKey(apiFileName.Replace(".json", ""))) return false; + + return !EnableHighLevelCodeGen.Contains(apiFileName); + } + + private static Dictionary _apiNameMapping; + + public static Dictionary ApiNameMapping + { + get + { + if (_apiNameMapping != null) return _apiNameMapping; + lock (LowLevelApiNameMapping) + { + if (_apiNameMapping == null) + { + var mapping = new Dictionary(HighLevelApiNameMapping); + foreach (var (k, v) in LowLevelApiNameMapping) + mapping[k] = v; + _apiNameMapping = mapping; + } + return _apiNameMapping; + } + } + } + + private static readonly string ResponseBuilderAttributeRegex = @"^.+\[ResponseBuilderWithGeneric\(""([^ \r\n]+)""\)\].*$"; + /// + /// Scan all OSC source code files for Requests and look for the [MapsApi(filename)] attribute. + /// The class name minus Request is used as the canonical .NET name for the API. + /// + public static readonly Dictionary ResponseBuilderInClientCalls = + (from f in new DirectoryInfo(GeneratorLocations.OpenSearchClientFolder).GetFiles("*.cs", SearchOption.AllDirectories) + from l in File.ReadLines(f.FullName) + where Regex.IsMatch(l, ResponseBuilderAttributeRegex) + let c = Regex.Replace(l, @"^.+\[ResponseBuilderWithGeneric\(""([^ \r\n]+)""\)\].*$", "$1", RegexOptions.Singleline) + select new { Key = f.Name.Replace(".cs", ""), Value = c }) + .DistinctBy(v => v.Key) + .ToDictionary(k => k.Key, v => v.Value); + + public static readonly Dictionary DescriptorGenericsLookup = + (from f in new DirectoryInfo(GeneratorLocations.OpenSearchClientFolder).GetFiles("*Request.cs", SearchOption.AllDirectories) + let name = Path.GetFileNameWithoutExtension(f.Name).Replace("Request", "") + let contents = File.ReadAllText(f.FullName) + let c = Regex.Replace(contents, $@"^.+class ({name}Descriptor(?:<[^>\r\n]+>)?[^ \r\n]*).*$", "$1", RegexOptions.Singleline) + let key = $"{name}Descriptor" + select new { Key = key, Value = Regex.Replace(c, @"^.*?(?:(\<.+>).*?)?$", "$1") }) + .DistinctBy(v => v.Key) + .OrderBy(v => v.Key) + .ToDictionary(k => k.Key, v => v.Value); + + /// Scan all OSC files for request interfaces and note any generics declared on them + private static readonly List> AllKnownRequestInterfaces = ( + // find all files in OSC ending with Request.cs + from f in new DirectoryInfo(GeneratorLocations.OpenSearchClientFolder).GetFiles("*Request.cs", SearchOption.AllDirectories) + from l in File.ReadLines(f.FullName) + // attempt to locate all Request interfaces lines + where Regex.IsMatch(l, @"^.+interface [^ \r\n]+Request") + //grab the interface name including any generics declared on it + let c = Regex.Replace(l, @"^.+interface ([^ \r\n]+Request(?:<[^>\r\n]+>)?[^ \r\n]*).*$", "$1", RegexOptions.Singleline) + where c.StartsWith("I") && c.Contains("Request") + let request = Regex.Replace(c, "<.*$", "") + let generics = Regex.Replace(c, @"^.*?(?:(\<.+>).*?)?$", "$1") + select Tuple.Create(request, generics) + ) + .OrderBy(v=>v.Item1) + .ToList(); + + public static readonly HashSet GenericOnlyInterfaces = new HashSet(AllKnownRequestInterfaces + .GroupBy(v => v.Item1) + .Where(g => g.All(v => !string.IsNullOrEmpty(v.Item2))) + .Select(g => g.Key) + .ToList()); + + public static readonly HashSet DocumentRequests = new HashSet(( + // find all files in OSC ending with Request.cs + from f in new DirectoryInfo(GeneratorLocations.OpenSearchClientFolder).GetFiles("*Request.cs", SearchOption.AllDirectories) + from l in File.ReadLines(f.FullName) + // attempt to locate all Request interfaces lines + where Regex.IsMatch(l, @"^.+interface [^ \r\n]+Request") + where l.Contains("IDocumentRequest") + let c = Regex.Replace(l, @"^.+interface ([^ \r\n]+Request(?:<[^>\r\n]+>)?[^ \r\n]*).*$", "$1", RegexOptions.Singleline) + //grab the interface name including any generics declared on it + let request = Regex.Replace(c, "<.*$", "") + select request + ) + .ToList()); + + public static readonly Dictionary DescriptorConstructors = ( + // find all files in OSC ending with Request.cs + from f in new DirectoryInfo(GeneratorLocations.OpenSearchClientFolder).GetFiles("*Request.cs", SearchOption.AllDirectories) + let descriptor = Path.GetFileNameWithoutExtension(f.Name).Replace("Request", "Descriptor") + let re = $@"^.+public {descriptor}\(([^\r\n\)]+?)\).*$" + from l in File.ReadLines(f.FullName) + where Regex.IsMatch(l, re) + let args = Regex.Replace(l, re, "$1", RegexOptions.Singleline) + where !string.IsNullOrWhiteSpace(args) && !args.Contains(": base") + select (Descriptor: descriptor, Args: args) + ) + .ToDictionary(r => r.Descriptor, r => r.Args); + + public static readonly Dictionary RequestInterfaceGenericsLookup = + AllKnownRequestInterfaces + .GroupBy(v=>v.Item1) + .Select(g=>g.Last()) + .ToDictionary(k => k.Item1, v => v.Item2); + + /// + /// Some API's reuse response this is a hardcoded map of these cases + /// + private static Dictionary ResponseReroute = new Dictionary + { + {"UpdateByQueryRethrottleResponse", ("ListTasksResponse", "")}, + {"DeleteByQueryRethrottleResponse", ("ListTasksResponse", "")}, + {"MultiSearchTemplateResponse", ("MultiSearchResponse", "")}, + {"ScrollResponse", ("SearchResponse", "")}, + {"SearchTemplateResponse", ("SearchResponse", "")}, + + }; + + + /// Create a dictionary lookup of all responses and their generics + public static readonly SortedDictionary ResponseLookup = new SortedDictionary( + ( + // find all files in OSC ending with Request.cs + from f in new DirectoryInfo(GeneratorLocations.OpenSearchClientFolder).GetFiles("*Response.cs", SearchOption.AllDirectories) + from l in File.ReadLines(f.FullName) + // attempt to locate all Response class lines + where Regex.IsMatch(l, @"^.+public class [^ \r\n]+Response") + //grab the response name including any generics declared on it + let c = Regex.Replace(l, @"^.+public class ([^ \r\n]+Response(?:<[^>\r\n]+>)?[^ \r\n]*).*$", "$1", RegexOptions.Singleline) + where c.Contains("Response") + let response = Regex.Replace(c, "<.*$", "") + let generics = Regex.Replace(c, @"^.*?(?:(\<.+>).*?)?$", "$1") + select (response, (response, generics)) + ) + .Concat(ResponseReroute.Select(kv=>(kv.Key, (kv.Value.Item1, kv.Value.Item2)))) + .ToDictionary(t=>t.Item1, t=>t.Item2)); + + } +} diff --git a/src/ApiGenerator/Configuration/GeneratorLocations.cs b/src/ApiGenerator/Configuration/GeneratorLocations.cs new file mode 100644 index 0000000000..08467cb003 --- /dev/null +++ b/src/ApiGenerator/Configuration/GeneratorLocations.cs @@ -0,0 +1,69 @@ +/* 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.IO; +using System.Reflection; + +namespace ApiGenerator.Configuration +{ + public static class GeneratorLocations + { + // @formatter:off — disable formatter after this line + public static string OpenSearchNetFolder { get; } = $@"{Root}../../src/OpenSearch.Net/"; + public static string LastDownloadedRef { get; } = Path.Combine(Root, "last_downloaded_version.txt"); + + public static string OpenSearchClientFolder { get; } = $@"{Root}../../src/OpenSearch.Client/"; + public static string RestSpecificationFolder { get; } = $@"{Root}RestSpecification/"; + // @formatter:on — enable formatter after this line + + public static string HighLevel(params string[] paths) => OpenSearchClientFolder + string.Join("/", paths); + public static string LowLevel(params string[] paths) => OpenSearchNetFolder + string.Join("/", paths); + + public static readonly Assembly Assembly = typeof(Generator.ApiGenerator).Assembly; + + private static string _root; + public static string Root + { + get + { + if (_root != null) return _root; + + var directoryInfo = new DirectoryInfo(Directory.GetCurrentDirectory()); + + var dotnetRun = + directoryInfo.Name == "ApiGenerator" && + directoryInfo.Parent != null && + directoryInfo.Parent.Name == "src"; + + _root = dotnetRun ? "" : @"../../../"; + return _root; + } + } + + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/EndpointOverridesBase.cs b/src/ApiGenerator/Configuration/Overrides/EndpointOverridesBase.cs new file mode 100644 index 0000000000..d7066a7dc1 --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/EndpointOverridesBase.cs @@ -0,0 +1,44 @@ +/* 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; +using System.Linq; + +namespace ApiGenerator.Configuration.Overrides +{ + public abstract class EndpointOverridesBase : IEndpointOverrides + { + public virtual IDictionary ObsoleteQueryStringParams { get; set; } = new SortedDictionary(); + + public virtual IDictionary RenameQueryStringParams { get; } = new SortedDictionary(); + + public virtual IEnumerable RenderPartial { get; } = Enumerable.Empty(); + + public virtual IEnumerable SkipQueryStringParams { get; } = Enumerable.Empty(); + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/DeleteByQueryOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/DeleteByQueryOverrides.cs new file mode 100644 index 0000000000..a14ebe66e2 --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/DeleteByQueryOverrides.cs @@ -0,0 +1,37 @@ +/* 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 +{ + public class DeleteByQueryOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] { "max_docs", }; + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/FlushJobOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/FlushJobOverrides.cs new file mode 100644 index 0000000000..cca328708e --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/FlushJobOverrides.cs @@ -0,0 +1,43 @@ +/* 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 +{ + public class FlushJobOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "advance_time", + "end", + "start", + "calc_interim", + }; + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/ForecastJobOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/ForecastJobOverrides.cs new file mode 100644 index 0000000000..b557f41009 --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/ForecastJobOverrides.cs @@ -0,0 +1,41 @@ +/* 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 +{ + public class ForecastJobOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "duration", + "expires_in" + }; + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/GetAnomalyRecordsOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/GetAnomalyRecordsOverrides.cs new file mode 100644 index 0000000000..64e5023532 --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/GetAnomalyRecordsOverrides.cs @@ -0,0 +1,47 @@ +/* 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 +{ + public class GetAnomalyRecordsOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "exclude_interim", + "from", + "size", + "start", + "end", + "record_score", + "sort", + "desc" + }; + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/GetBucketsOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/GetBucketsOverrides.cs new file mode 100644 index 0000000000..9c57062f1e --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/GetBucketsOverrides.cs @@ -0,0 +1,49 @@ +/* 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 +{ + public class GetBucketsOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "expand", + "exclude_interim", + "from", + "size", + "start", + "timestamp", + "end", + "anomaly_score", + "sort", + "desc" + }; + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/GetCalendarEventsOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/GetCalendarEventsOverrides.cs new file mode 100644 index 0000000000..7087c15488 --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/GetCalendarEventsOverrides.cs @@ -0,0 +1,41 @@ +/* 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 +{ + public class GetCalendarEventsOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "from", + "size" + }; + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/GetCalendarsOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/GetCalendarsOverrides.cs new file mode 100644 index 0000000000..80b28d8a23 --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/GetCalendarsOverrides.cs @@ -0,0 +1,41 @@ +/* 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 +{ + public class GetCalendarsOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "from", + "size" + }; + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/GetCategoriesOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/GetCategoriesOverrides.cs new file mode 100644 index 0000000000..b753e6838a --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/GetCategoriesOverrides.cs @@ -0,0 +1,41 @@ +/* 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 +{ + public class GetCategoriesOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "from", + "size" + }; + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/GetInfluencersOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/GetInfluencersOverrides.cs new file mode 100644 index 0000000000..41e6e1b518 --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/GetInfluencersOverrides.cs @@ -0,0 +1,47 @@ +/* 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 +{ + public class GetInfluencersOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "exclude_interim", + "from", + "size", + "start", + "end", + "influencer_score", + "sort", + "desc" + }; + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/GetModelSnapshotsOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/GetModelSnapshotsOverrides.cs new file mode 100644 index 0000000000..5873a548f7 --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/GetModelSnapshotsOverrides.cs @@ -0,0 +1,45 @@ +/* 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 +{ + public class GetModelSnapshotsOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "from", + "size", + "start", + "end", + "sort", + "desc" + }; + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/GetOverallBucketsOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/GetOverallBucketsOverrides.cs new file mode 100644 index 0000000000..7dd3ccb5e6 --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/GetOverallBucketsOverrides.cs @@ -0,0 +1,46 @@ +/* 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 +{ + public class GetOverallBucketsOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "allow_no_jobs", + "bucket_span", + "end", + "exclude_interim", + "overall_score", + "start", + "top_n" + }; + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/IndicesStatsOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/IndicesStatsOverrides.cs new file mode 100644 index 0000000000..bb14a30b68 --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/IndicesStatsOverrides.cs @@ -0,0 +1,41 @@ +/* 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 IndicesStatsOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "types" + }; + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/MultiTermVectorsOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/MultiTermVectorsOverrides.cs new file mode 100644 index 0000000000..8e73e34373 --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/MultiTermVectorsOverrides.cs @@ -0,0 +1,41 @@ +/* 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 MultiTermVectorsOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "ids" + }; + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/NodesHotThreadsOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/NodesHotThreadsOverrides.cs new file mode 100644 index 0000000000..409876cf2d --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/NodesHotThreadsOverrides.cs @@ -0,0 +1,41 @@ +/* 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/Configuration/Overrides/Endpoints/PutIndexTemplateOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/PutIndexTemplateOverrides.cs new file mode 100644 index 0000000000..9bce58506e --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/PutIndexTemplateOverrides.cs @@ -0,0 +1,41 @@ +/* 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 PutIndexTemplateOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "order" + }; + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/ReindexOnServerOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/ReindexOnServerOverrides.cs new file mode 100644 index 0000000000..ebdffd7dc8 --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/ReindexOnServerOverrides.cs @@ -0,0 +1,37 @@ +/* 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 +{ + public class ReindexOnServerOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] { "max_docs", }; + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/RevertModelSnapshotOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/RevertModelSnapshotOverrides.cs new file mode 100644 index 0000000000..125fe24163 --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/RevertModelSnapshotOverrides.cs @@ -0,0 +1,40 @@ +/* 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 +{ + public class RevertModelSnapshotOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "delete_intervening_results" + }; + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/ScrollOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/ScrollOverrides.cs new file mode 100644 index 0000000000..274bc3d643 --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/ScrollOverrides.cs @@ -0,0 +1,41 @@ +/* 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 ScrollOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "scroll_id", "scroll" + }; + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/SearchOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/SearchOverrides.cs new file mode 100644 index 0000000000..2e728e4bfc --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/SearchOverrides.cs @@ -0,0 +1,56 @@ +/* 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 SearchOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "size", + "from", + "timeout", + "explain", + "version", + "sort", + "_source", + "_source_includes", + "_source_excludes", + "track_scores", + "terminate_after", + }; + + public override IEnumerable RenderPartial => new[] + { + "track_total_hits" + }; + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/UpdateByQueryOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/UpdateByQueryOverrides.cs new file mode 100644 index 0000000000..316231d1dd --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/UpdateByQueryOverrides.cs @@ -0,0 +1,37 @@ +/* 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 +{ + public class UpdateByQueryOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] { "max_docs", }; + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/Endpoints/UpdateOverrides.cs b/src/ApiGenerator/Configuration/Overrides/Endpoints/UpdateOverrides.cs new file mode 100644 index 0000000000..f7ca9fd10e --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/Endpoints/UpdateOverrides.cs @@ -0,0 +1,42 @@ +/* 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 UpdateOverrides : EndpointOverridesBase + { + public override IEnumerable SkipQueryStringParams => new[] + { + "fields", + "_source_includes", "_source_excludes" + }; + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/GlobalOverrides.cs b/src/ApiGenerator/Configuration/Overrides/GlobalOverrides.cs new file mode 100644 index 0000000000..9cda96e15d --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/GlobalOverrides.cs @@ -0,0 +1,76 @@ +/* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ +/* +* Modifications Copyright OpenSearch Contributors. See +* GitHub history for details. +* +* Licensed to Elasticsearch B.V. under one or more contributor +* license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright +* ownership. Elasticsearch B.V. licenses this file to you under +* the Apache License, Version 2.0 (the "License"); you may +* not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +using System.Collections.Generic; + +namespace ApiGenerator.Configuration.Overrides +{ + public class GlobalOverrides : EndpointOverridesBase + { + public IDictionary> ObsoleteEnumMembers { get; set; } = new Dictionary>() + { + { "VersionType", new Dictionary() { { "force", "Force is no longer accepted by the server as of 7.5.0 and will result in an error when used" } } } + }; + + public override IDictionary ObsoleteQueryStringParams { get; set; } = new Dictionary + { + { "copy_settings", "" } + }; + + public override IDictionary RenameQueryStringParams { get; } = new Dictionary + { + { "_source", "source_enabled" }, + { "_source_includes", "source_includes" }, + { "_source_excludes", "source_excludes" }, + { "rest_total_hits_as_int", "total_hits_as_integer" }, + { "docvalue_fields", "doc_value_fields" }, + { "q", "query_on_query_string" }, + //make cat parameters more descriptive + { "h", "Headers" }, + { "s", "sort_by_columns" }, + { "v", "verbose" }, + { "ts", "include_timestamp" }, + { "if_seq_no", "if_sequence_number" }, + { "seq_no_primary_term", "sequence_number_primary_term" }, + }; + + public override IEnumerable RenderPartial => new[] + { + "stored_fields", + "docvalue_fields" + }; + + public override IEnumerable SkipQueryStringParams { get; } = new[] + { + "copy_settings", //this still needs a PR? + "source", // allows the body to be specified as a request param, we do not want to advertise this with a strongly typed method + "timestamp", + "time" + }; + } +} diff --git a/src/ApiGenerator/Configuration/Overrides/IEndpointOverrides.cs b/src/ApiGenerator/Configuration/Overrides/IEndpointOverrides.cs new file mode 100644 index 0000000000..5c5838638a --- /dev/null +++ b/src/ApiGenerator/Configuration/Overrides/IEndpointOverrides.cs @@ -0,0 +1,60 @@ +/* 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 +{ + /// + /// Tweaks the generated descriptors + /// + public interface IEndpointOverrides + { + /// + /// A map of key -> obsolete message for properties in the spec that should not be used any longer + /// + IDictionary ObsoleteQueryStringParams { get; set; } + + /// + /// Override how the query param name is exposed to the client. + /// + IDictionary RenameQueryStringParams { get; } + + /// + /// Force these be rendered as interface properties only, so that they'd have to be implemented manually + /// and become part of the body. This only takes affect on requests that take a body (e.g not GET or HEAD). + /// + IEnumerable RenderPartial { get; } + + /// + /// Sometimes params can be defined on the body as well as on the querystring + /// We favor specifying params on the body so here we can specify params we don't want on the querystring. + /// + IEnumerable SkipQueryStringParams { get; } + } +} diff --git a/src/ApiGenerator/Configuration/ViewLocations.cs b/src/ApiGenerator/Configuration/ViewLocations.cs new file mode 100644 index 0000000000..5adfd3c46d --- /dev/null +++ b/src/ApiGenerator/Configuration/ViewLocations.cs @@ -0,0 +1,40 @@ +/* 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. +*/ + +namespace ApiGenerator.Configuration +{ + public static class ViewLocations + { + public static string Root { get; } = $@"{GeneratorLocations.Root}Views/"; + private static string HighLevelRoot { get; } = $@"{Root}/HighLevel/"; + public static string HighLevel(params string[] paths) => HighLevelRoot + string.Join("/", paths); + + private static string LowLevelRoot { get; } = $@"{Root}/LowLevel/"; + public static string LowLevel(params string[] paths) => LowLevelRoot + string.Join("/", paths); + } +} diff --git a/src/ApiGenerator/Domain/ApiQueryParametersPatcher.cs b/src/ApiGenerator/Domain/ApiQueryParametersPatcher.cs new file mode 100644 index 0000000000..6bb6663e8c --- /dev/null +++ b/src/ApiGenerator/Domain/ApiQueryParametersPatcher.cs @@ -0,0 +1,160 @@ +/* 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; +using System.Collections.Generic; +using System.Linq; +using ApiGenerator.Configuration.Overrides; +using ApiGenerator.Domain.Specification; + +namespace ApiGenerator.Domain +{ + public static class ApiQueryParametersPatcher + { + public static SortedDictionary Patch( + string endpointName, + IDictionary source, + IEndpointOverrides overrides, + bool checkCommon = true + ) + { + if (source == null) return null; + + var globalOverrides = new GlobalOverrides(); + var declaredKeys = source.Keys; + var skipList = CreateSkipList(globalOverrides, overrides, declaredKeys); + var partialList = CreatePartialList(globalOverrides, overrides, declaredKeys); + + var renameLookup = CreateRenameLookup(globalOverrides, overrides, declaredKeys); + var obsoleteLookup = CreateObsoleteLookup(globalOverrides, overrides, declaredKeys); + + var patchedParams = new SortedDictionary(); + var name = overrides?.GetType().Name ?? endpointName ?? "unknown"; + foreach (var kv in source) + { + var queryStringKey = kv.Key; + kv.Value.QueryStringKey = queryStringKey; + + if (checkCommon && RestApiSpec.CommonApiQueryParameters.Keys.Contains(queryStringKey)) + { + Generator.ApiGenerator.Warnings.Add($"key '{queryStringKey}' in {name} is already declared in _common.json"); + continue; + } + + if (!renameLookup.TryGetValue(queryStringKey, out var preferredName)) preferredName = kv.Key; + kv.Value.ClsName = CreateCSharpName(preferredName, endpointName); + + if (skipList.Contains(queryStringKey)) kv.Value.Skip = true; + + if (partialList.Contains(queryStringKey)) kv.Value.RenderPartial = true; + + if (obsoleteLookup.TryGetValue(queryStringKey, out var obsolete)) kv.Value.Obsolete = obsolete; + + //make sure source_enabled takes a boolean only + if (preferredName == "source_enabled") kv.Value.Type = "boolean"; + + + patchedParams[preferredName] = kv.Value; + } + + return patchedParams; + } + + private static string CreateCSharpName(string queryStringKey, string endpointName) + { + if (string.IsNullOrWhiteSpace(queryStringKey)) return "UNKNOWN"; + + if (queryStringKey == "format" && endpointName == "text_structure.find_structure") + return "TextStructureFindStructureFormat"; + + var cased = queryStringKey.ToPascalCase(); + switch (cased) + { + case "Type": + case "Index": + case "Source": + case "Script": + return cased + "QueryString"; + default: + return cased; + } + } + + private static IList CreateSkipList(IEndpointOverrides global, IEndpointOverrides local, ICollection declaredKeys) => + CreateList(global, local, "skip", e => e.SkipQueryStringParams, declaredKeys); + + private static IList CreatePartialList(IEndpointOverrides global, IEndpointOverrides local, ICollection declaredKeys) => + CreateList(global, local, "partial", e => e.RenderPartial, declaredKeys); + + private static IDictionary CreateLookup(IEndpointOverrides global, IEndpointOverrides local, string type, + Func> @from, ICollection declaredKeys + ) + { + var d = new SortedDictionary(); + foreach (var kv in from(global)) d[kv.Key] = kv.Value; + + if (local == null) return d; + + var localDictionary = from(local); + foreach (var kv in localDictionary) d[kv.Key] = kv.Value; + + var name = local.GetType().Name; + foreach (var p in localDictionary.Keys.Except(declaredKeys)) + Generator.ApiGenerator.Warnings.Add($"On {name} {type} key '{p}' is not found in spec"); + + return d; + } + + private static IList CreateList(IEndpointOverrides global, IEndpointOverrides local, string type, + Func> @from, ICollection declaredKeys + ) + { + var list = new List(); + if (global != null) list.AddRange(from(global)); + if (local != null) + { + var localList = from(local).ToList(); + list.AddRange(localList); + var name = local.GetType().Name; + foreach (var p in localList.Except(declaredKeys)) + Generator.ApiGenerator.Warnings.Add($"On {name} {type} key '{p}' is not found in spec"); + } + return list.Distinct().ToList(); + } + + private static IDictionary CreateRenameLookup(IEndpointOverrides global, IEndpointOverrides local, + ICollection declaredKeys + ) => + CreateLookup(global, local, "rename", e => e.RenameQueryStringParams, declaredKeys); + + private static IDictionary CreateObsoleteLookup(IEndpointOverrides global, IEndpointOverrides local, + ICollection declaredKeys + ) => + CreateLookup(global, local, "obsolete", e => e.ObsoleteQueryStringParams, declaredKeys); + } +} diff --git a/src/ApiGenerator/Domain/Code/CsharpNames.cs b/src/ApiGenerator/Domain/Code/CsharpNames.cs new file mode 100644 index 0000000000..c762abe066 --- /dev/null +++ b/src/ApiGenerator/Domain/Code/CsharpNames.cs @@ -0,0 +1,208 @@ +/* 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; +using System.Collections.Generic; +using System.Linq; +using ApiGenerator.Configuration; +using ApiGenerator.Generator; +using CsQuery.ExtensionMethods.Internal; + +namespace ApiGenerator.Domain.Code +{ + public class CsharpNames + { + public CsharpNames(string name, string endpointMethodName, string endpointNamespace) + { + RestSpecName = string.IsNullOrWhiteSpace(endpointNamespace) ? endpointMethodName : $"{endpointNamespace}.{endpointMethodName}"; + Namespace = CreateCSharpNamespace(endpointNamespace); + if (CodeConfiguration.ApiNameMapping.TryGetValue(name, out var mapsApiMethodName)) + ApiName = mapsApiMethodName; + else ApiName = endpointMethodName.ToPascalCase(); + + //if the api name starts with the namespace do not repeat it in the method name + string Replace(string original, string ns, string find, string replace, string[] exceptions) + { + if (ns != null && Namespace != ns) return original; + if (exceptions.Contains(original)) return original; + + var replaced = original.Replace(find, replace); + if (string.IsNullOrEmpty(replaced)) return original; + + return replaced; + } + + MethodName = Replace(ApiName, null, Namespace, "", new string[0]); + + var namespaceRenames = new Dictionary + { + { "Indices", (find: "Index", replace: "", exceptions: new [] { "SimulateIndexTemplate" }) }, + }; + foreach (var (ns, (find, replace, exceptions)) in namespaceRenames) + MethodName = Replace(MethodName, ns, find, replace, exceptions); + } + + /// Pascal cased version of the namespace from the specification + public string Namespace { get; } + + public string RestSpecName { get; } + + /// + /// The pascal cased method name as loaded by + ///
Uses  mapping of request implementations in the OSC code base
+ ///
+ public string MethodName { get; } + + public string ApiName { get; } + + public string RequestName => $"{ApiName}Request"; + + public string ResponseName + { + get + { + if (Namespace == "Cat") return $"CatResponse<{ApiName}Record>"; + else if (ApiName.EndsWith("Exists")) return $"ExistsResponse"; + + var generatedName = $"{ApiName}Response"; + var name = CodeConfiguration.ResponseLookup.TryGetValue(generatedName, out var lookup) ? lookup.Item1 : generatedName; + return name; + } + } + public string RequestInterfaceName => $"I{RequestName}"; + public string ParametersName => $"{RequestName}Parameters"; + public string DescriptorName => $"{ApiName}Descriptor"; + + public const string ApiNamespace = "Specification"; + public const string ApiNamespaceSuffix = "Api"; + public const string RootNamespace = "NoNamespace"; + public const string LowLevelClientNamespacePrefix = "LowLevel"; + public const string HighLevelClientNamespacePrefix = ""; + public const string ClientNamespaceSuffix = "Namespace"; + private static string CreateCSharpNamespace(string endpointNamespace) + { + switch (endpointNamespace) + { + case null: + case "": return RootNamespace; + default: return endpointNamespace.ToPascalCase(); + } + } + + public string PerPathMethodName(string path) + { + Func ms = s => Namespace != null && Namespace.StartsWith(s); + Func pc = path.Contains; + + var method = MethodName; + // This is temporary for transition period + // TODO: remove in branch once it in opensearch is scrubbed + if (path.Contains("{type}") && !method.Contains("Type")) method += "UsingType"; + + if (ms("Indices") && !pc("{index}")) + return (method + "ForAll").Replace("AsyncForAll", "ForAllAsync"); + + if (ms("Nodes") && !pc("{node_id}")) + return (method + "ForAll").Replace("AsyncForAll", "ForAllAsync"); + + return method; + } + + + public string GenericsDeclaredOnRequest => + CodeConfiguration.RequestInterfaceGenericsLookup.TryGetValue(RequestInterfaceName, out var requestGeneric) ? requestGeneric : null; + + public string GenericsDeclaredOnResponse => + CodeConfiguration.ResponseLookup.TryGetValue(ResponseName, out var requestGeneric) ? requestGeneric.Item2 : null; + + public string GenericsDeclaredOnDescriptor => + CodeConfiguration.DescriptorGenericsLookup.TryGetValue(DescriptorName, out var generic) ? generic : null; + + public List ResponseGenerics => + !CodeConfiguration.ResponseLookup.TryGetValue(ResponseName, out var responseGeneric) + || string.IsNullOrEmpty(responseGeneric.Item2) + ? new List() + : SplitGeneric(responseGeneric.Item2); + + public List DescriptorGenerics => + CodeConfiguration.DescriptorGenericsLookup.TryGetValue(DescriptorName, out var generic) ? SplitGeneric(generic) : new List(); + + public bool DescriptorBindsOverMultipleDocuments => + HighLevelDescriptorMethodGenerics.Count == 2 && HighLevelDescriptorMethodGenerics.All(g => g.Contains("Document")); + //&& ResponseGenerics.FirstOrDefault() == DescriptorBoundDocumentGeneric ; + + public string DescriptorBoundDocumentGeneric => + HighLevelDescriptorMethodGenerics.FirstOrDefault(g=>g == "TDocument") ?? HighLevelDescriptorMethodGenerics.Last(); + + public List HighLevelDescriptorMethodGenerics => DescriptorGenerics + .Concat(ResponseGenerics) + .Distinct() + .ToList(); + + public static List SplitGeneric(string generic) => (generic ?? string.Empty) + .Replace("<", "") + .Replace(">", "") + .Split(",") + .Where(g => !string.IsNullOrWhiteSpace(g)) + .Distinct() + .ToList(); + + + public bool DescriptorNotFoundInCodebase => !CodeConfiguration.DescriptorGenericsLookup.TryGetValue(DescriptorName, out _); + + public string GenericDescriptorName => GenericsDeclaredOnDescriptor.IsNullOrEmpty() ? null : $"{DescriptorName}{GenericsDeclaredOnDescriptor}"; + public string GenericRequestName => GenericsDeclaredOnRequest.IsNullOrEmpty() ? null : $"{RequestName}{GenericsDeclaredOnRequest}"; + public string GenericInterfaceName => GenericsDeclaredOnRequest.IsNullOrEmpty() ? null : $"I{GenericRequestName}"; + public string GenericResponseName => GenericsDeclaredOnResponse.IsNullOrEmpty() ? null : $"{ResponseName}{GenericsDeclaredOnResponse}"; + + public string GenericOrNonGenericDescriptorName => GenericDescriptorName ?? DescriptorName; + public string GenericOrNonGenericInterfaceName => GenericInterfaceName ?? RequestInterfaceName; + public string GenericOrNonGenericResponseName + { + get + { + var full = GenericResponseName ?? ResponseName; + if (full.StartsWith("SearchResponse<")) + full = "I" + full; + return full; + } + } + + /// If matching Request.cs only defined generic interface make the client method only accept said interface + public string GenericOrNonGenericInterfacePreference => CodeConfiguration.GenericOnlyInterfaces.Contains(RequestInterfaceName) + ? GenericInterfaceName + : RequestInterfaceName; + + /// If matching Request.cs only defined generic interface make the client method only accept said interface + public string GenericOrNonGenericRequestPreference => CodeConfiguration.GenericOnlyInterfaces.Contains(RequestInterfaceName) + ? GenericRequestName + : RequestName; + + public bool CustomResponseBuilderPerRequestOverride(out string call) => CodeConfiguration.ResponseBuilderInClientCalls.TryGetValue(RequestName, out call); + } +} diff --git a/src/ApiGenerator/Domain/Code/HighLevel/Methods/BoundFluentMethod.cs b/src/ApiGenerator/Domain/Code/HighLevel/Methods/BoundFluentMethod.cs new file mode 100644 index 0000000000..7e005f027f --- /dev/null +++ b/src/ApiGenerator/Domain/Code/HighLevel/Methods/BoundFluentMethod.cs @@ -0,0 +1,64 @@ +/* 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; +using System.Linq; +using ApiGenerator.Configuration; +using ApiGenerator.Domain.Specification; + +namespace ApiGenerator.Domain.Code.HighLevel.Methods +{ + public class BoundFluentMethod : FluentSyntaxBase + { + public BoundFluentMethod(CsharpNames names, IReadOnlyCollection parts, bool selectorIsOptional, string link, string summary) + : base(names, parts, selectorIsOptional, link, summary) { } + + private string DescriptorTypeParams => string.Join(", ", CsharpNames.DescriptorGenerics + .Select(e => CsharpNames.DescriptorBoundDocumentGeneric)); + + private string RequestTypeParams => string.Join(", ", CsharpNames.SplitGeneric(CsharpNames.GenericsDeclaredOnRequest) + .Select(e => CsharpNames.DescriptorBoundDocumentGeneric)); + + private string SelectorReturn => string.IsNullOrWhiteSpace(CsharpNames.GenericsDeclaredOnRequest) + || !CodeConfiguration.GenericOnlyInterfaces.Contains(CsharpNames.RequestInterfaceName) + ? CsharpNames.RequestInterfaceName + : $"{CsharpNames.RequestInterfaceName}<{RequestTypeParams}>"; + + public override string DescriptorName => $"{CsharpNames.DescriptorName}<{DescriptorTypeParams}>"; + public override string GenericWhereClause => $"where {CsharpNames.DescriptorBoundDocumentGeneric} : class"; + public override string MethodGenerics => $"<{CsharpNames.DescriptorBoundDocumentGeneric}>"; + + public override string RequestMethodGenerics => !string.IsNullOrWhiteSpace(RequestTypeParams) + ? $"<{RequestTypeParams}>" + : base.RequestMethodGenerics; + + public override string Selector => $"Func<{DescriptorName}, {SelectorReturn}>"; + + + } +} diff --git a/src/ApiGenerator/Domain/Code/HighLevel/Methods/FluentMethod.cs b/src/ApiGenerator/Domain/Code/HighLevel/Methods/FluentMethod.cs new file mode 100644 index 0000000000..07c5ccd5a9 --- /dev/null +++ b/src/ApiGenerator/Domain/Code/HighLevel/Methods/FluentMethod.cs @@ -0,0 +1,46 @@ +/* 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; +using System.Linq; +using ApiGenerator.Domain.Specification; + +namespace ApiGenerator.Domain.Code.HighLevel.Methods +{ + public class FluentMethod : FluentSyntaxBase + { + public FluentMethod(CsharpNames names, IReadOnlyCollection parts, bool selectorIsOptional, string link, string summary) + : base(names, parts, selectorIsOptional, link, summary) { } + + public override string GenericWhereClause => + string.Join(" ", CsharpNames.HighLevelDescriptorMethodGenerics + .Where(g => g.Contains("Document")) + .Select(g => $"where {g} : class") + ); + } +} diff --git a/src/ApiGenerator/Domain/Code/HighLevel/Methods/FluentSyntaxBase.cs b/src/ApiGenerator/Domain/Code/HighLevel/Methods/FluentSyntaxBase.cs new file mode 100644 index 0000000000..abff18c282 --- /dev/null +++ b/src/ApiGenerator/Domain/Code/HighLevel/Methods/FluentSyntaxBase.cs @@ -0,0 +1,165 @@ +/* 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; +using System.Linq; +using ApiGenerator.Configuration; +using ApiGenerator.Domain.Specification; + +namespace ApiGenerator.Domain.Code.HighLevel.Methods +{ + public abstract class FluentSyntaxBase : MethodSyntaxBase + { + private readonly bool _selectorIsOptional; + + protected FluentSyntaxBase(CsharpNames names, IReadOnlyCollection parts, bool selectorIsOptional, string link, string summary) + : base(names, link, summary) => + (UrlParts, _selectorIsOptional) = (CreateDescriptorArgs(parts), selectorIsOptional); + + private IReadOnlyCollection UrlParts { get; } + + /// + /// The selector is optional if so set by (has no or optional body) + /// Or if there is a custom constructor on the descriptor in which case we assume that constructor holds all the required + /// values + /// + private bool SelectorIsOptional => _selectorIsOptional || CodeConfiguration.DescriptorConstructors.ContainsKey(CsharpNames.DescriptorName); + + public string MethodName => CsharpNames.MethodName; + + public string OptionalSelectorSuffix => SelectorIsOptional ? " = null" : string.Empty; + + public virtual string DescriptorName => CsharpNames.GenericOrNonGenericDescriptorName; + public virtual string Selector => $"Func<{DescriptorName}, {CsharpNames.GenericOrNonGenericInterfacePreference}>"; + + public override string MethodGenerics => + CodeConfiguration.GenericOnlyInterfaces.Contains(CsharpNames.RequestInterfaceName) + ? CsharpNames.GenericsDeclaredOnRequest + : DescriptorGenerics; + + public virtual string RequestMethodGenerics => + CodeConfiguration.GenericOnlyInterfaces.Contains(CsharpNames.RequestInterfaceName) + ? CsharpNames.GenericsDeclaredOnRequest + : CsharpNames.GenericsDeclaredOnResponse; + + private string DescriptorGenerics => CsharpNames.HighLevelDescriptorMethodGenerics.Any() + ? $"<{string.Join(", ", CsharpNames.HighLevelDescriptorMethodGenerics)}>" + : null; + + private List CreateDescriptorArgs(IReadOnlyCollection parts) + { + var requiredParts = parts.Where(p => p.Required).ToList(); + + //Many api's return ALOT of information by default e.g get_alias or get_mapping + //the client methods that take a descriptor default to forcing a choice on the user. + //except for cat api's where the amount of information returned is manageable + + var willInferFromDocument = CsharpNames.GenericsDeclaredOnDescriptor?.Contains("Document") ?? false; + if (!requiredParts.Any() && CsharpNames.Namespace != "Cat") + { + var candidates = new[] + { + //only make index part the first argument if the descriptor is not generic on T.*?Document + parts.FirstOrDefault(p => p.Type == "list" && (p.Name == "index" || p.Name == "indices") && !willInferFromDocument), + parts.FirstOrDefault(p => p.Name == "name"), + }; + requiredParts = candidates.Where(p=>p!= null).Take(1).ToList(); + } + if (!willInferFromDocument) return requiredParts; + + //if index, indices is required but the descriptor is generic these will be inferred so no need to pass explicitly + requiredParts = requiredParts.Where(p => p.Name != "index" && p.Name != "indices").ToList(); + var idPart = requiredParts.FirstOrDefault(i => i.Name == "id"); + if ((idPart != null && UrlInformation.IsADocumentRoute(parts)) || IsDocumentRequest) + { + if (requiredParts.Contains(idPart)) requiredParts.Remove(idPart); + var generic = GenericFirstArgument; + var typeName = IsDocumentRequest ? generic : $"DocumentPath<{generic}>"; + var arg = IsDocumentRequest ? "document" : idPart.Name; + requiredParts.Add(new UrlPart + { + Name = arg, + Required = true, + ClrTypeNameOverride = typeName + }); + } + + return requiredParts; + } + + private bool IsDocumentRequest => CodeConfiguration.DocumentRequests.Contains(CsharpNames.RequestInterfaceName); + private string GenericFirstArgument => + CsharpNames.GenericsDeclaredOnDescriptor.Replace("<", "").Replace(">", "").Split(",").First().Trim(); + + public string DescriptorArguments() + { + string codeArgs; + if (CodeConfiguration.DescriptorConstructors.TryGetValue(CsharpNames.DescriptorName, out codeArgs)) + codeArgs += ","; + + if (!UrlParts.Any()) return codeArgs; + + string Optional(UrlPart p) => !p.Required && SelectorIsOptional ? " = null" : string.Empty; + return codeArgs + string.Join(", ", UrlParts.Select(p => $"{p.HighLevelTypeName} {p.Name.ToCamelCase()}{Optional(p)}")) + ", "; + } + + public string SelectorArguments() + { + string codeArgs = null; + if (CodeConfiguration.DescriptorConstructors.TryGetValue(CsharpNames.DescriptorName, out codeArgs)) + { + codeArgs = string.Join(", ", codeArgs.Split(',').Select(a=>a.Split(' ').Last())); + return codeArgs; + } + + var parts = UrlParts.Where(p => p.Required).ToList(); + if (!parts.Any()) return null; + + string ToArg(UrlPart p) + { + if (IsDocumentRequest) return "documentWithId: document"; + + if (p.HighLevelTypeName.StartsWith("DocumentPath")) + return "documentWithId: id?.Document, index: id?.Self?.Index, id: id?.Self?.Id"; + + + return $"{p.Name.ToCamelCase()}: {p.Name.ToCamelCase()}"; + } + + return string.Join(", ", parts.Select(p => ToArg(p))); + } + + public string SelectorChainedDefaults() + { + var parts = UrlParts.Where(p => !p.Required).ToList(); + if (!parts.Any()) return null; + + return "." + string.Join(".", parts.Select(p => $"{p.Name.ToPascalCase()}({p.Name.ToCamelCase()}: {p.Name.ToCamelCase()})")); + } + } +} diff --git a/src/ApiGenerator/Domain/Code/HighLevel/Methods/FluentSyntaxView.cs b/src/ApiGenerator/Domain/Code/HighLevel/Methods/FluentSyntaxView.cs new file mode 100644 index 0000000000..8d25af9807 --- /dev/null +++ b/src/ApiGenerator/Domain/Code/HighLevel/Methods/FluentSyntaxView.cs @@ -0,0 +1,39 @@ +/* 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. +*/ + +namespace ApiGenerator.Domain.Code.HighLevel.Methods +{ + public class FluentSyntaxView + { + public FluentSyntaxView(FluentSyntaxBase syntax, bool async) => (Syntax , Async) = (syntax, async); + + public FluentSyntaxBase Syntax { get; } + + public bool Async { get; } + } +} diff --git a/src/ApiGenerator/Domain/Code/HighLevel/Methods/HighLevelModel.cs b/src/ApiGenerator/Domain/Code/HighLevel/Methods/HighLevelModel.cs new file mode 100644 index 0000000000..30693dbfd3 --- /dev/null +++ b/src/ApiGenerator/Domain/Code/HighLevel/Methods/HighLevelModel.cs @@ -0,0 +1,39 @@ +/* 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. +*/ + +namespace ApiGenerator.Domain.Code.HighLevel.Methods +{ + public class HighLevelModel + { + public CsharpNames CsharpNames { get; set; } + public FluentMethod Fluent { get; set; } + public BoundFluentMethod FluentBound { get; set; } + public InitializerMethod Initializer { get; set; } + + } +} diff --git a/src/ApiGenerator/Domain/Code/HighLevel/Methods/InitializerMethod.cs b/src/ApiGenerator/Domain/Code/HighLevel/Methods/InitializerMethod.cs new file mode 100644 index 0000000000..d47228b3ce --- /dev/null +++ b/src/ApiGenerator/Domain/Code/HighLevel/Methods/InitializerMethod.cs @@ -0,0 +1,73 @@ +/* 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.Linq; +using ApiGenerator.Configuration; + +namespace ApiGenerator.Domain.Code.HighLevel.Methods +{ + public class InitializerMethod : MethodSyntaxBase + { + public InitializerMethod(CsharpNames names, string link, string summary) : base(names, link, summary) { } + + public string MethodName => CsharpNames.MethodName; + + public string ArgumentType => CsharpNames.GenericOrNonGenericInterfacePreference; + + public override string MethodGenerics => + CodeConfiguration.GenericOnlyInterfaces.Contains(CsharpNames.RequestInterfaceName) + ? CsharpNames.GenericsDeclaredOnRequest + : CsharpNames.GenericsDeclaredOnResponse; + + public override string GenericWhereClause => + string.Join(" ", CsharpNames.SplitGeneric(MethodGenerics) + .Where(g=>g.Contains("Document")) + .Select(g=>$"where {g} : class") + ); + + private bool IsCatMethod => CsharpNames.Namespace == "Cat"; + + public string DispatchMethod => IsCatMethod ? "DoCat" : "DoRequest"; + + /// + /// Dispatch needs a class instance so if the response is an interface transform it to the concrete implementation + /// when calling into DoRequest + /// + private string DispatchResponseName => InterfaceResponse ? ResponseName.Substring(1, ResponseName.Length - 1) : ResponseName; + + public string DispatchGenerics => IsCatMethod + ? $"<{ArgumentType},{CsharpNames.ParametersName},{CsharpNames.RequestName.Replace("Request", "Record")}>" + : $"<{ArgumentType},{DispatchResponseName}>"; + + public string DispatchParameters => IsCatMethod + ? "request" + : CsharpNames.CustomResponseBuilderPerRequestOverride(out var builder) + ? $"request, ResponseBuilder(request.RequestParameters, {builder})" + : "request, request.RequestParameters"; + } +} diff --git a/src/ApiGenerator/Domain/Code/HighLevel/Methods/InitializerSyntaxView.cs b/src/ApiGenerator/Domain/Code/HighLevel/Methods/InitializerSyntaxView.cs new file mode 100644 index 0000000000..8469d23544 --- /dev/null +++ b/src/ApiGenerator/Domain/Code/HighLevel/Methods/InitializerSyntaxView.cs @@ -0,0 +1,40 @@ +/* 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. +*/ + +namespace ApiGenerator.Domain.Code.HighLevel.Methods +{ + public class InitializerSyntaxView + { + public InitializerSyntaxView(InitializerMethod syntax, bool async) => (Syntax , Async) = (syntax, async); + + public InitializerMethod Syntax { get; } + + public bool Async { get; } + } + +} diff --git a/src/ApiGenerator/Domain/Code/HighLevel/Methods/MethodSyntaxBase.cs b/src/ApiGenerator/Domain/Code/HighLevel/Methods/MethodSyntaxBase.cs new file mode 100644 index 0000000000..5e27c6d8e2 --- /dev/null +++ b/src/ApiGenerator/Domain/Code/HighLevel/Methods/MethodSyntaxBase.cs @@ -0,0 +1,52 @@ +/* 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. +*/ + +namespace ApiGenerator.Domain.Code.HighLevel.Methods +{ + public abstract class MethodSyntaxBase + { + protected MethodSyntaxBase(CsharpNames names, string link, string summary) => + (CsharpNames, DocumentationLink, XmlDocSummary) = (names, link, summary); + + public string DocumentationLink { get; } + + public string XmlDocSummary { get; } + + protected CsharpNames CsharpNames { get; } + + public bool InterfaceResponse => ResponseName.StartsWith("ISearchResponse<"); + + public string ResponseName => CsharpNames.GenericOrNonGenericResponseName; + + public string DocumentationCref => CsharpNames.GenericOrNonGenericInterfacePreference; + + public abstract string MethodGenerics { get; } + + public abstract string GenericWhereClause { get; } + } +} diff --git a/src/ApiGenerator/Domain/Code/HighLevel/Requests/Constructor.cs b/src/ApiGenerator/Domain/Code/HighLevel/Requests/Constructor.cs new file mode 100644 index 0000000000..a46a85660e --- /dev/null +++ b/src/ApiGenerator/Domain/Code/HighLevel/Requests/Constructor.cs @@ -0,0 +1,135 @@ +/* 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; +using System.Collections.Generic; +using System.Linq; +using ApiGenerator.Configuration; +using ApiGenerator.Domain.Specification; + +namespace ApiGenerator.Domain.Code.HighLevel.Requests +{ + public class Constructor + { + private static readonly string Indent = $"{Environment.NewLine}\t\t"; + public string AdditionalCode { get; set; } = string.Empty; + public bool Parameterless { get; set; } + public string Body { get; set; } + public string Description { get; set; } + public string Generated { get; set; } + + public static IEnumerable DescriptorConstructors(CsharpNames names, UrlInformation url) + { + var m = names.DescriptorName; + var generic = FirstGeneric(names.GenericsDeclaredOnDescriptor); + var generateGeneric = !string.IsNullOrEmpty(generic); + return GenerateConstructors(url, true, generateGeneric, m, generic); + } + + public static IEnumerable RequestConstructors(CsharpNames names, UrlInformation url, bool inheritsFromPlainRequestBase) + { + var generic = FirstGeneric(names.GenericsDeclaredOnRequest); + var generateGeneric = CodeConfiguration.GenericOnlyInterfaces.Contains(names.RequestInterfaceName) || !inheritsFromPlainRequestBase; + return GenerateConstructors(url, inheritsFromPlainRequestBase, generateGeneric, names.RequestName, generic); + } + + private static string FirstGeneric(string fullGenericString) => + fullGenericString?.Replace("<", "").Replace(">", "").Split(",").First().Trim(); + + private static IEnumerable GenerateConstructors( + UrlInformation url, + bool inheritsFromPlainRequestBase, + bool generateGeneric, + string typeName, + string generic + ) + { + var ctors = new List(); + + var paths = url.Paths.ToList(); + + if (url.IsPartless) return ctors; + + ctors.AddRange(from path in paths + let baseArgs = inheritsFromPlainRequestBase ? path.RequestBaseArguments : path.TypedSubClassBaseArguments + let constParams = path.ConstructorArguments + let generated = $"public {typeName}({constParams}) : base({baseArgs})" + select new Constructor + { + Parameterless = string.IsNullOrEmpty(constParams), + Generated = generated, + Description = path.GetXmlDocs(Indent), + //Body = isDocumentApi ? $" => Q(\"routing\", new Routing(() => AutoRouteDocument()));" : string.Empty + Body = string.Empty + }); + + if (generateGeneric && !string.IsNullOrWhiteSpace(generic)) + { + ctors.AddRange(from path in paths.Where(path => path.HasResolvableArguments) + let baseArgs = path.AutoResolveBaseArguments(generic) + let constructorArgs = path.AutoResolveConstructorArguments + let baseOrThis = inheritsFromPlainRequestBase + ? "this" + : "base" + let generated = $"public {typeName}({constructorArgs}) : {baseOrThis}({baseArgs})" + select new Constructor + { + Parameterless = string.IsNullOrEmpty(constructorArgs), + Generated = generated, + Description = path.GetXmlDocs(Indent, skipResolvable: true), + Body = string.Empty + }); + + if (url.TryGetDocumentApiPath(out var docPath)) + { + var docPathBaseArgs = docPath.DocumentPathBaseArgument(generic); + var docPathConstArgs = docPath.DocumentPathConstructorArgument(generic); + ctors.Add(new Constructor + { + Parameterless = string.IsNullOrEmpty(docPathConstArgs), + Generated = $"public {typeName}({docPathConstArgs}) : this({docPathBaseArgs})", + + AdditionalCode = $"partial void DocumentFromPath({generic} document);", + Description = docPath.GetXmlDocs(Indent, skipResolvable: true, documentConstructor: true), + Body = "=> DocumentFromPath(documentWithId);" + }); + } + } + var constructors = ctors.GroupBy(c => c.Generated.Split(new[] { ':' }, 2)[0]).Select(g => g.Last()).ToList(); + if (!constructors.Any(c=>c.Parameterless)) + constructors.Add(new Constructor + { + Parameterless = true, + Generated = $"protected {typeName}() : base()", + Description = + $"///Used for serialization purposes, making sure we have a parameterless constructor{Indent}[SerializationConstructor]", + }); + return constructors; + } + } +} diff --git a/src/ApiGenerator/Domain/Code/HighLevel/Requests/DescriptorPartialImplementation.cs b/src/ApiGenerator/Domain/Code/HighLevel/Requests/DescriptorPartialImplementation.cs new file mode 100644 index 0000000000..3039482559 --- /dev/null +++ b/src/ApiGenerator/Domain/Code/HighLevel/Requests/DescriptorPartialImplementation.cs @@ -0,0 +1,96 @@ +/* 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; +using System.Linq; +using ApiGenerator.Domain.Specification; + +namespace ApiGenerator.Domain.Code.HighLevel.Requests +{ + public class DescriptorPartialImplementation + { + public CsharpNames CsharpNames { get; set; } + public string OfficialDocumentationLink { get; set; } + public IReadOnlyCollection Constructors { get; set; } + public IReadOnlyCollection Parts { get; set; } + public IReadOnlyCollection Paths { get; set; } + public IReadOnlyCollection Params { get; set; } + public bool HasBody { get; set; } + + public IEnumerable GetFluentRouteSetters() + { + var setters = new List(); + if (!Parts.Any()) return setters; + + var alwaysGenerate = new[] { "index" }; + var parts = Parts + .Where(p => !p.Required || alwaysGenerate.Contains(p.Name)) + .Where(p => !string.IsNullOrEmpty(p.Name)) + .ToList(); + var returnType = CsharpNames.GenericOrNonGenericDescriptorName; + foreach (var part in parts) + { + var p = part; + var paramName = p.Name.ToPascalCase(); + if (paramName.Length > 1) + paramName = paramName.Substring(0, 1).ToLowerInvariant() + paramName.Substring(1); + else + paramName = paramName.ToLowerInvariant(); + + var routeValue = "v"; + var routeSetter = p.Required ? "Required" : "Optional"; + + var code = + $"public {returnType} {p.InterfaceName}({p.HighLevelTypeName} {paramName}) => Assign({paramName}, (a,v)=>a.RouteValues.{routeSetter}(\"{p.Name}\", {routeValue}));"; + var xmlDoc = $"///{p.Description}"; + setters.Add(new FluentRouteSetter { Code = code, XmlDoc = xmlDoc }); + if (paramName == "index") + { + code = $"public {returnType} {p.InterfaceName}() where TOther : class "; + code += $"=> Assign(typeof(TOther), (a,v)=>a.RouteValues.{routeSetter}(\"{p.Name}\", ({p.HighLevelTypeName})v));"; + xmlDoc = $"///a shortcut into calling {p.InterfaceName}(typeof(TOther))"; + setters.Add(new FluentRouteSetter { Code = code, XmlDoc = xmlDoc }); + } + if (paramName == "index" && p.Type == "list") + { + code = $"public {returnType} AllIndices() => Index(Indices.All);"; + xmlDoc = $"///A shortcut into calling Index(Indices.All)"; + setters.Add(new FluentRouteSetter { Code = code, XmlDoc = xmlDoc }); + } + if (paramName == "fields" && p.Type == "list") + { + code = $"public {returnType} Fields(params Expression>[] fields) "; + code += $"=> Assign(fields, (a,v)=>a.RouteValues.{routeSetter}(\"fields\", (Fields)v));"; + xmlDoc = $"///{p.Description}"; + setters.Add(new FluentRouteSetter { Code = code, XmlDoc = xmlDoc }); + } + } + return setters; + } + } +} diff --git a/src/ApiGenerator/Domain/Code/HighLevel/Requests/FluentRouteSetter.cs b/src/ApiGenerator/Domain/Code/HighLevel/Requests/FluentRouteSetter.cs new file mode 100644 index 0000000000..e696e61ad3 --- /dev/null +++ b/src/ApiGenerator/Domain/Code/HighLevel/Requests/FluentRouteSetter.cs @@ -0,0 +1,36 @@ +/* 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. +*/ + +namespace ApiGenerator.Domain.Code.HighLevel.Requests +{ + public class FluentRouteSetter + { + public string Code { get; set; } + public string XmlDoc { get; set; } + } +} diff --git a/src/ApiGenerator/Domain/Code/HighLevel/Requests/RequestInterface.cs b/src/ApiGenerator/Domain/Code/HighLevel/Requests/RequestInterface.cs new file mode 100644 index 0000000000..cd07352c91 --- /dev/null +++ b/src/ApiGenerator/Domain/Code/HighLevel/Requests/RequestInterface.cs @@ -0,0 +1,56 @@ +/* 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; +using ApiGenerator.Configuration; +using ApiGenerator.Domain.Specification; + +namespace ApiGenerator.Domain.Code.HighLevel.Requests +{ + public class RequestInterface + { + public IReadOnlyCollection UrlParts { get; set; } + + /// + /// Partial parameters are query string parameters we prefer to send over the body of a request. + /// We declare these on the generated interfaces so that we don't forget to implement them in our request + /// implementations + /// + public IReadOnlyCollection PartialParameters { get; set; } + + public string OfficialDocumentationLink { get; set; } + + public CsharpNames CsharpNames { get; set; } + + private bool GenerateOnlyGenericInterface => CodeConfiguration.GenericOnlyInterfaces.Contains(CsharpNames.RequestInterfaceName); + + public bool NeedsGenericInterface => !GenerateOnlyGenericInterface && !string.IsNullOrWhiteSpace(CsharpNames.GenericsDeclaredOnRequest); + + public string Name => CsharpNames.GenericOrNonGenericInterfacePreference; + } +} diff --git a/src/ApiGenerator/Domain/Code/HighLevel/Requests/RequestParameterImplementation.cs b/src/ApiGenerator/Domain/Code/HighLevel/Requests/RequestParameterImplementation.cs new file mode 100644 index 0000000000..e39ca7586d --- /dev/null +++ b/src/ApiGenerator/Domain/Code/HighLevel/Requests/RequestParameterImplementation.cs @@ -0,0 +1,41 @@ +/* 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; +using ApiGenerator.Domain.Specification; + +namespace ApiGenerator.Domain.Code.HighLevel.Requests +{ + public class RequestParameterImplementation + { + public CsharpNames CsharpNames { get; set; } + public string OfficialDocumentationLink { get; set; } + public IReadOnlyCollection Params { get; set; } + public string HttpMethod { get; set; } + } +} diff --git a/src/ApiGenerator/Domain/Code/HighLevel/Requests/RequestPartialImplementation.cs b/src/ApiGenerator/Domain/Code/HighLevel/Requests/RequestPartialImplementation.cs new file mode 100644 index 0000000000..ec38435a91 --- /dev/null +++ b/src/ApiGenerator/Domain/Code/HighLevel/Requests/RequestPartialImplementation.cs @@ -0,0 +1,55 @@ +/* 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; +using ApiGenerator.Configuration; +using ApiGenerator.Domain.Specification; + +namespace ApiGenerator.Domain.Code.HighLevel.Requests +{ + public class RequestPartialImplementation + { + public CsharpNames CsharpNames { get; set; } + public string OfficialDocumentationLink { get; set; } + public Stability Stability { get; set; } + public IReadOnlyCollection Parts { get; set; } + public IReadOnlyCollection Paths { get; set; } + public IReadOnlyCollection Params { get; set; } + public IReadOnlyCollection Constructors { get; set; } + public IReadOnlyCollection GenericConstructors { get; set; } + public bool HasBody { get; set; } + + private bool GenerateOnlyGenericInterface => CodeConfiguration.GenericOnlyInterfaces.Contains(CsharpNames.RequestInterfaceName); + + public bool NeedsGenericImplementation => !GenerateOnlyGenericInterface && !string.IsNullOrWhiteSpace(CsharpNames.GenericsDeclaredOnRequest); + + public string Name => CsharpNames.GenericOrNonGenericRequestPreference; + + public string InterfaceName => CsharpNames.GenericOrNonGenericInterfacePreference; + } +} diff --git a/src/ApiGenerator/Domain/Code/LowLevel/LowLevelClientMethod.cs b/src/ApiGenerator/Domain/Code/LowLevel/LowLevelClientMethod.cs new file mode 100644 index 0000000000..f00f74f9e5 --- /dev/null +++ b/src/ApiGenerator/Domain/Code/LowLevel/LowLevelClientMethod.cs @@ -0,0 +1,81 @@ +/* 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; +using System.Linq; +using System.Text.RegularExpressions; +using ApiGenerator.Domain.Specification; + +namespace ApiGenerator.Domain.Code.LowLevel +{ + public class LowLevelClientMethod + { + public CsharpNames CsharpNames { get; set; } + + public string Arguments { get; set; } + public string OfficialDocumentationLink { get; set; } + + public Stability Stability { get; set; } + public string PerPathMethodName { get; set; } + public string HttpMethod { get; set; } + + public DeprecatedPath DeprecatedPath { get; set; } + public UrlInformation Url { get; set; } + public bool HasBody { get; set; } + public IEnumerable Parts { get; set; } + public string Path { get; set; } + + + public string UrlInCode + { + get + { + string Evaluator(Match m) + { + + var arg = m.Groups[^1].Value.ToCamelCase(); + return $"{{{arg}:{arg}}}"; + } + + var url = Path.TrimStart('/'); + var options = Url.OriginalParts?.Select(p => p.Key) ?? Enumerable.Empty(); + + var pattern = string.Join("|", options); + var urlCode = $"\"{url}\""; + if (Path.Contains("{")) + { + var patchedUrl = Regex.Replace(url, "{(" + pattern + ")}", Evaluator); + urlCode = $"Url($\"{patchedUrl}\")"; + } + return urlCode; + } + } + + public string MapsApiArguments { get; set; } + } +} diff --git a/src/ApiGenerator/Domain/RestApiSpec.cs b/src/ApiGenerator/Domain/RestApiSpec.cs new file mode 100644 index 0000000000..b9b70fb0d7 --- /dev/null +++ b/src/ApiGenerator/Domain/RestApiSpec.cs @@ -0,0 +1,127 @@ +/* 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; +using System.Collections.Immutable; +using System.Collections.ObjectModel; +using System.Linq; +using ApiGenerator.Configuration; +using ApiGenerator.Domain.Specification; + +namespace ApiGenerator.Domain +{ + public class EnumDescription + { + public string Name { get; set; } + public IEnumerable Options { get; set; } + } + + public class RestApiSpec + { + public string Commit { get; set; } + + public static SortedDictionary CommonApiQueryParameters { get; set; } + + public IDictionary Endpoints { get; set; } + + public ImmutableSortedDictionary> EndpointsPerNamespaceLowLevel => + Endpoints.Values.GroupBy(e=>e.CsharpNames.Namespace) + .ToImmutableSortedDictionary(kv => kv.Key, kv => kv.ToList().AsReadOnly()); + + public ImmutableSortedDictionary> EndpointsPerNamespaceHighLevel => + Endpoints.Values + .Where(v => !CodeConfiguration.IgnoreHighLevelApi(v.FileName)) + .GroupBy(e => e.CsharpNames.Namespace) + .ToImmutableSortedDictionary(kv => kv.Key, kv => kv.ToList().AsReadOnly()); + + + private IEnumerable _enumDescriptions; + public IEnumerable EnumsInTheSpec + { + get + { + 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; + } + + 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(); + + _enumDescriptions = urlPartEnums + .Concat(urlParameterEnums) + .DistinctBy(e => e.Name) + .ToList(); + + //TODO can be removed in 8.x + var versionType = _enumDescriptions.FirstOrDefault(f => f.Name == "VersionType"); + if (versionType != null) + { + var options = new List(versionType.Options); + options.Add("force"); + versionType.Options = options; + } + + return _enumDescriptions; + } + } + } +} diff --git a/src/ApiGenerator/Domain/Specification/ApiEndpoint.cs b/src/ApiGenerator/Domain/Specification/ApiEndpoint.cs new file mode 100644 index 0000000000..159b02fdf0 --- /dev/null +++ b/src/ApiGenerator/Domain/Specification/ApiEndpoint.cs @@ -0,0 +1,208 @@ +/* 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; +using System.Linq; +using ApiGenerator.Configuration.Overrides; +using ApiGenerator.Domain.Code; +using ApiGenerator.Domain.Code.HighLevel.Methods; +using ApiGenerator.Domain.Code.HighLevel.Requests; +using ApiGenerator.Domain.Code.LowLevel; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace ApiGenerator.Domain.Specification +{ + public class ApiEndpoint + { + /// The filename of the spec describing the api endpoint + public string FileName { get; set; } + + /// The original name as declared in the spec + public string Name { get; set; } + + /// The original namespace as declared in the spec + public string Namespace { get; set; } + + /// The original method name as declared in the spec + public string MethodName { get; set; } + + /// Computed Csharp identifier names + public CsharpNames CsharpNames { get; set; } + + [JsonConverter(typeof(StringEnumConverter))] + [JsonProperty("stability")] + public Stability Stability { get; set; } + + [JsonProperty("documentation")] + public Documentation OfficialDocumentationLink { get; set; } + + public UrlInformation Url { get; set; } + + public Body Body { get; set; } + + [JsonProperty("methods")] + public IReadOnlyCollection HttpMethods { get; set; } + + public IEndpointOverrides Overrides { get; internal set; } + + public RequestInterface RequestInterface => new RequestInterface + { + CsharpNames = CsharpNames, + UrlParts = Url.Parts, + PartialParameters = + Body == null ? Enumerable.Empty().ToList() : Url.Params.Values.Where(p => p.RenderPartial && !p.Skip).ToList(), + OfficialDocumentationLink = OfficialDocumentationLink?.Url + }; + + public RequestPartialImplementation RequestPartialImplementation => new RequestPartialImplementation + { + CsharpNames = CsharpNames, + OfficialDocumentationLink = OfficialDocumentationLink?.Url, + Stability = Stability, + Paths = Url.Paths, + Parts = Url.Parts, + Params = Url.Params.Values.Where(p => !p.Skip).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 + { + 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(), + HasBody = Body != null, + }; + + public RequestParameterImplementation RequestParameterImplementation => new RequestParameterImplementation + { + CsharpNames = CsharpNames, + OfficialDocumentationLink = OfficialDocumentationLink?.Url, + Params = Url.Params.Values.Where(p => !p.Skip).ToList(), + HttpMethod = PreferredHttpMethod + }; + + public string PreferredHttpMethod + { + get + { + var first = HttpMethods.First(); + if (HttpMethods.Count > 1 && first.ToUpperInvariant() == "GET") + return HttpMethods.Last(); + + return first; + } + } + + public string HighLevelMethodXmlDocDescription => + $"{PreferredHttpMethod} request to the {Name} API, read more about this API online:"; + + public HighLevelModel HighLevelModel => new HighLevelModel + { + CsharpNames = CsharpNames, + Fluent = new FluentMethod(CsharpNames, Url.Parts, + selectorIsOptional: Body == null || !Body.Required || HttpMethods.Contains("GET"), + link: OfficialDocumentationLink?.Url, + summary: HighLevelMethodXmlDocDescription + ), + FluentBound = !CsharpNames.DescriptorBindsOverMultipleDocuments + ? null + : new BoundFluentMethod(CsharpNames, Url.Parts, + selectorIsOptional: Body == null || !Body.Required || HttpMethods.Contains("GET"), + link: OfficialDocumentationLink?.Url, + summary: HighLevelMethodXmlDocDescription + ), + Initializer = new InitializerMethod(CsharpNames, + link: OfficialDocumentationLink?.Url, + summary: HighLevelMethodXmlDocDescription + ) + }; + + private List _lowLevelClientMethods; + + public IReadOnlyCollection LowLevelClientMethods + { + get + { + if (_lowLevelClientMethods != null && _lowLevelClientMethods.Count > 0) return _lowLevelClientMethods; + + // enumerate once and cache + _lowLevelClientMethods = new List(); + + if (OfficialDocumentationLink == null) + Generator.ApiGenerator.Warnings.Add($"API '{Name}' has no documentation"); + + var httpMethod = PreferredHttpMethod; + foreach (var path in Url.PathsWithDeprecations) + { + var methodName = CsharpNames.PerPathMethodName(path.Path); + var parts = new List(path.Parts); + var mapsApiArgumentHints = parts.Select(p => p.Name).ToList(); + // TODO This is hack until we stop transforming the new spec format into the old + if (Name == "index" && !mapsApiArgumentHints.Contains("id")) + httpMethod = "POST"; + else if (Name == "index") httpMethod = PreferredHttpMethod; + + if (Body != null) + { + parts.Add(new UrlPart { Name = "body", Type = "PostData", Description = Body.Description }); + mapsApiArgumentHints.Add("body"); + } + + var args = parts + .Select(p => p.Argument) + .Concat(new[] { CsharpNames.ParametersName + " requestParameters = null" }) + .ToList(); + + var apiMethod = new LowLevelClientMethod + { + Arguments = string.Join(", ", args), + MapsApiArguments = string.Join(", ", mapsApiArgumentHints), + CsharpNames = CsharpNames, + PerPathMethodName = methodName, + HttpMethod = httpMethod, + OfficialDocumentationLink = OfficialDocumentationLink?.Url, + Stability = Stability, + DeprecatedPath = path.Deprecation, + Path = path.Path, + Parts = parts, + Url = Url, + HasBody = Body != null + }; + _lowLevelClientMethods.Add(apiMethod); + } + return _lowLevelClientMethods; + } + } + } +} diff --git a/src/ApiGenerator/Domain/Specification/Body.cs b/src/ApiGenerator/Domain/Specification/Body.cs new file mode 100644 index 0000000000..02ed3081c3 --- /dev/null +++ b/src/ApiGenerator/Domain/Specification/Body.cs @@ -0,0 +1,36 @@ +/* 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. +*/ + +namespace ApiGenerator.Domain.Specification +{ + public class Body + { + public string Description { get; set; } + public bool Required { get; set; } + } +} diff --git a/src/ApiGenerator/Domain/Specification/Documentation.cs b/src/ApiGenerator/Domain/Specification/Documentation.cs new file mode 100644 index 0000000000..7f0cad59f5 --- /dev/null +++ b/src/ApiGenerator/Domain/Specification/Documentation.cs @@ -0,0 +1,87 @@ +/* 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; +using Newtonsoft.Json; + +namespace ApiGenerator.Domain.Specification +{ + [JsonConverter(typeof(DocumentationConverter))] + public class Documentation + { + public string Description { get; set; } + + private string _url; + public string Url + { + get => _url; + set => _url = value?.Replace("http://", "https://"); + } + } + + public class DocumentationConverter : JsonConverter + { + public override bool CanWrite { get; } = false; + + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) => throw new NotSupportedException(); + + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + + var documentation = new Documentation(); + + if (reader.TokenType == JsonToken.String) + { + documentation.Url = (string)reader.Value; + return documentation; + } + + while (reader.Read()) + { + if (reader.TokenType == JsonToken.EndObject) + break; + + var prop = (string)reader.Value; + switch (prop) + { + case "url": + documentation.Url = reader.ReadAsString(); + break; + case "description": + documentation.Description = reader.ReadAsString(); + break; + default: + throw new Exception($"Property '{prop}' unexpected in documentation object"); + } + } + return documentation; + } + + public override bool CanConvert(Type objectType) => true; + } +} diff --git a/src/ApiGenerator/Domain/Specification/QueryParameters.cs b/src/ApiGenerator/Domain/Specification/QueryParameters.cs new file mode 100644 index 0000000000..cd8de8801d --- /dev/null +++ b/src/ApiGenerator/Domain/Specification/QueryParameters.cs @@ -0,0 +1,222 @@ +/* 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; +using System.Collections.Generic; +using System.Linq; +using ApiGenerator.Generator; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace ApiGenerator.Domain.Specification +{ + public class QueryParameters + { + private static readonly string[] FieldsParams = { "fields", "_source_includes", "_source_excludes", }; + + public bool Skip { get; set; } + + public string ClsArgumentName => ClsName.ToCamelCase(); + + public string ClsName { get; set; } + + public string Description { get; set; } + + public IEnumerable DescriptionHighLevel + { + get + { + switch (QueryStringKey) + { + case "routing": + yield return "A document is routed to a particular shard in an index using the following formula"; + yield return " shard_num = hash(_routing) % num_primary_shards"; + yield return "OpenSearch will use the document id if not provided. "; + yield return "For requests that are constructed from/for a document OpenSearch.Client will automatically infer the routing key"; + yield return + "if that document has a or a routing mapping on for its type exists on "; + + yield break; + case "_source": + yield return "Whether the _source should be included in the response."; + + yield break; + case "filter_path": + yield return Description; + yield return "Use of response filtering can result in a response from OpenSearch "; + yield return "that cannot be correctly deserialized to the respective response type for the request. "; + yield return "In such situations, use the low level client to issue the request and handle response deserialization"; + + yield break; + default: + yield return Description ?? "TODO"; + + yield break; + } + } + } + + public bool IsArray => Type == "list" && TypeHighLevel.EndsWith("[]"); + + public string DescriptorArgumentType => IsArray ? "params " + TypeHighLevel : TypeHighLevel; + + public string DescriptorEnumerableArgumentType => + IsArray + ? $"IEnumerable<{TypeHighLevel.TrimEnd('[', ']')}>" + : throw new InvalidOperationException("Only array arguments have IEnumerable overload"); + + public Func FluentGenerator { get; set; } + public bool IsFieldParam => TypeHighLevel == "Field"; + + public bool IsFieldsParam => TypeHighLevel == "Fields"; + + public string Obsolete + { + get + { + if (!string.IsNullOrEmpty(_obsolete)) return _obsolete; + if (Deprecated != null) + { + if (!string.IsNullOrEmpty(Deprecated.Version) && !string.IsNullOrEmpty(Deprecated.Description)) + return $"Deprecated as of: {Deprecated.Version}, reason: {Deprecated.Description}"; + if (!string.IsNullOrEmpty(Deprecated.Version)) + return $"Deprecated as of: {Deprecated.Version}"; + if (!string.IsNullOrEmpty(Deprecated.Description)) + return $"reason: {Deprecated.Description}"; + + return "deprecated"; + } + + return null; + } + set => _obsolete = value; + } + + public QueryParameterDeprecation Deprecated { get; set; } + + public IEnumerable Options { get; set; } + public string QueryStringKey { get; set; } + + public bool RenderPartial { get; set; } + public string SetterHighLevel => "value"; + + public string SetterLowLevel => "value"; + + private string _type; + private string _obsolete; + + public string Type + { + // TODO support unions + get => !_type.Contains("|") + ? _type + : _type.Split('|', StringSplitOptions.RemoveEmptyEntries).First().Trim(); + set => _type = value; + } + + public string TypeHighLevel + { + get + { + if (QueryStringKey == "routing") return "Routing"; + + var isFields = FieldsParams.Contains(QueryStringKey) || QueryStringKey.EndsWith("_fields"); + + var csharpType = TypeLowLevel; + switch (csharpType) + { + case "TimeSpan": return "Time"; + } + + switch (Type) + { + case "list" when isFields: + case "string" when isFields: return "Fields"; + case "string" when QueryStringKey.Contains("field"): return "Field"; + default: + return csharpType; + } + } + } + + public string TypeLowLevel + { + get + { + switch (Type) + { + case "boolean": return "bool?"; + case "list": return "string[]"; + case "int": return "int?"; + case "date": return "DateTimeOffset?"; + case "enum": return $"{ClsName}?"; + case "number": + return new[] { "boost", "percen", "score" }.Any(s => QueryStringKey.ToLowerInvariant().Contains(s)) + ? "double?" + : "long?"; + case "duration": + case "time": + return "TimeSpan"; + case "text": + case "": + case null: + return "string"; + default: + return Type; + } + } + } + + + public string InitializerGenerator(string @namespace, string type, string name, string key, string setter, params string[] doc) => + CodeGenerator.Property(@namespace, type, name, key, setter, Obsolete, doc); + } + + public class QueryParameterDeprecation + { + public string Version { get; set; } + + public string Description { get; set; } + } + + internal class QueryParameterDeprecationConverter : JsonConverter + { + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) => throw new NotImplementedException(); + + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Boolean) + return new QueryParameterDeprecation(); + + var jObject = JObject.Load(reader); + return jObject.ToObject(JsonSerializer.CreateDefault()); + } + + public override bool CanConvert(Type objectType) => typeof(QueryParameterDeprecation).IsAssignableFrom(objectType); + } +} diff --git a/src/ApiGenerator/Domain/Specification/Stability.cs b/src/ApiGenerator/Domain/Specification/Stability.cs new file mode 100644 index 0000000000..5283854e3c --- /dev/null +++ b/src/ApiGenerator/Domain/Specification/Stability.cs @@ -0,0 +1,53 @@ +/* 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.Runtime.Serialization; + +namespace ApiGenerator.Domain.Specification +{ + public enum Stability + { + /// + /// Highly likely to break in the near future (minor/path), no BWC guarantees. Possibly removed in the future. + /// + [EnumMember(Value = "experimental")] + Experimental, + + /// + /// Less likely to break or be removed but still reserve the right to do so. + /// + [EnumMember(Value = "beta")] + Beta, + + /// + /// No backwards breaking changes in a minor. + /// + [EnumMember(Value = "stable")] + Stable + } +} diff --git a/src/ApiGenerator/Domain/Specification/UrlInformation.cs b/src/ApiGenerator/Domain/Specification/UrlInformation.cs new file mode 100644 index 0000000000..1c58c9e92e --- /dev/null +++ b/src/ApiGenerator/Domain/Specification/UrlInformation.cs @@ -0,0 +1,144 @@ +/* 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; +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json; + +namespace ApiGenerator.Domain.Specification +{ + + // ReSharper disable once ClassNeverInstantiated.Global + public class UrlInformation + { + public IDictionary Params { get; set; } = new SortedDictionary(); + + [JsonProperty("paths")] + private IReadOnlyCollection OriginalPaths { get; set; } + + [JsonProperty("parts")] + public IDictionary OriginalParts { get; set; } + + [JsonProperty("deprecated_paths")] + private IReadOnlyCollection DeprecatedPaths { get; set; } + + private List _paths; + public IReadOnlyCollection Paths + { + get + { + if (_paths != null && _paths.Count > 0) return _paths; + + _paths = OriginalPaths.Select(p => new UrlPath(p, OriginalParts)).ToList(); + return _paths; + } + } + + private List _pathsWithDeprecation; + public IReadOnlyCollection PathsWithDeprecations + { + get + { + if (_pathsWithDeprecation != null && _pathsWithDeprecation.Count > 0) return _pathsWithDeprecation; + + var paths = Paths ?? new UrlPath[] {}; + if (DeprecatedPaths == null || DeprecatedPaths.Count == 0) return Paths; + if (OriginalParts == null) return Paths; + + //some deprecated paths describe aliases to the canonical using the same path e.g + // PUT /{index}/_mapping/{type} + // PUT /{index}/{type}/_mappings + // + //The following routine dedups these occasions and prefers either the canonical path + //or the first duplicate deprecated path + + var canonicalPartNameLookup = paths.Select(path => new HashSet(path.Parts.Select(p => p.Name))).ToList(); + var withoutDeprecatedAliases = DeprecatedPaths + .Select(deprecatedPath => new + { + deprecatedPath, + parts = new HashSet(OriginalParts.Keys.Where(k => deprecatedPath.Path.Contains($"{{{k}}}"))) + }) + .GroupBy(t => t.parts, HashSet.CreateSetComparer()) + .Where(grouped => !canonicalPartNameLookup.Any(set => set.SetEquals(grouped.Key))) + .Select(grouped => grouped.First().deprecatedPath); + + _pathsWithDeprecation = paths + .Concat(withoutDeprecatedAliases.Select(p => new UrlPath(p, OriginalParts, Paths))) + .ToList(); + + // now, check for and prefer deprecated URLs + + var finalPathsWithDeprecations = new List(_pathsWithDeprecation.Count); + + foreach (var path in _pathsWithDeprecation) + { + if (path.Deprecation is null && + DeprecatedPaths.SingleOrDefault(p => p.Path.Equals(path.Path, StringComparison.OrdinalIgnoreCase)) is { } match) + { + finalPathsWithDeprecations.Add(new UrlPath(match, OriginalParts, Paths)); + } + else + { + finalPathsWithDeprecations.Add(path); + } + } + + _pathsWithDeprecation = finalPathsWithDeprecations; + + return _pathsWithDeprecation; + } + } + + + public IReadOnlyCollection Parts => Paths.SelectMany(p => p.Parts).DistinctBy(p => p.Name).ToList(); + + public bool IsPartless => !Parts.Any(); + + private static readonly string[] DocumentApiParts = { "index", "id" }; + + public bool IsDocumentApi => IsADocumentRoute(Parts); + + public static bool IsADocumentRoute(IReadOnlyCollection parts) => + parts.Count() == DocumentApiParts.Length + && parts.All(p => DocumentApiParts.Contains(p.Name)); + + + public bool TryGetDocumentApiPath(out UrlPath path) + { + path = null; + if (!IsDocumentApi) return false; + + var mostVerbosePath = _paths.OrderByDescending(p => p.Parts.Count()).First(); + path = new UrlPath(mostVerbosePath.Path, OriginalParts, mostVerbosePath.Parts); + return true; + } + + } +} diff --git a/src/ApiGenerator/Domain/Specification/UrlPart.cs b/src/ApiGenerator/Domain/Specification/UrlPart.cs new file mode 100644 index 0000000000..f0f0c27bbb --- /dev/null +++ b/src/ApiGenerator/Domain/Specification/UrlPart.cs @@ -0,0 +1,175 @@ +/* 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.Domain.Specification +{ + + // Rename this type to Deprecation and remove Path duplication + public class DeprecatedPath + { + public string Version { get; set; } + public string Path { get; set; } + public string Description { get; set; } + } + + + public class UrlPart + { + private string _description; + + public string Argument => $"{LowLevelTypeName} {NameAsArgument}"; + + public string LowLevelTypeName + { + get + { + //TODO treat list with fixed options as Flags Enum + switch (Type) + { + case "int": //does not occur on part + case "number": //does not occur on part + case "string": + return Type; + case "list": + return "string"; + case "enum": + return Name.ToPascalCase(); + default: + return Type; + } + } + } + + public string HighLevelTypeName + { + get + { + if (ClrTypeNameOverride != null) return ClrTypeNameOverride; + + switch (Name) + { + case "category_id": return "LongId"; + case "timestamp": return "Timestamp"; + case "index_metric": return "IndexMetrics"; + case "metric": return "Metrics"; + + case "node_id" when Type == "list": + return "NodeIds"; + + case "fields" when Type == "list": + return "Fields"; + + case "parent_task_id": + case "task_id": + return "TaskId"; + + case "forecast_id": + case "action_id": + case "ids" when Type == "list": + return "Ids"; + + case "index": + case "new_index": + case "target": + return Type == "string" ? "IndexName" : "Indices"; + + case "job_id": + case "calendar_id": + case "event_id": + case "snapshot_id": + case "filter_id": + case "model_id": + case "id": + return "Id"; + + case "policy_id": + return Type == "string" ? "Id" : "Ids"; + + case "application": + case "repository": + case "snapshot": + case "target_snapshot": + case "user": + case "username": + case "realms": + case "alias": + case "context": + case "name": + case "thread_pool_patterns": + case "type": + return Type == "string" ? "Name" : "Names"; + + case "block": + return "IndexBlock"; + + case "index_uuid": + return "IndexUuid"; + + //This forces a compilation error post code generation as intended + default: return Type + "_"; + } + } + } + + public string ClrTypeNameOverride { get; set; } + + public string Description + { + get => _description; + set => _description = CleanUpDescription(value); + } + + public string InterfaceName + { + get + { + switch (Name) + { + case "repository": return "RepositoryName"; + default: return Name.ToPascalCase(); + } + } + } + + public string Name { get; set; } + public string NameAsArgument => Name.ToCamelCase(); + public IEnumerable Options { get; set; } + public bool Required { get; set; } + public bool Deprecated { get; set; } + public string Type { get; set; } + + private string CleanUpDescription(string value) + { + if (string.IsNullOrWhiteSpace(value)) return value; + + return value.Replace("use `_all` or empty string", "use the special string `_all` or Indices.All"); + } + } +} diff --git a/src/ApiGenerator/Domain/Specification/UrlPath.cs b/src/ApiGenerator/Domain/Specification/UrlPath.cs new file mode 100644 index 0000000000..b1546f4f6e --- /dev/null +++ b/src/ApiGenerator/Domain/Specification/UrlPath.cs @@ -0,0 +1,119 @@ +/* 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; +using System.Collections.Generic; +using System.Linq; + +namespace ApiGenerator.Domain.Specification +{ + public class UrlPath + { + private readonly List _additionalPartsForConstructor; + public string Path { get; } + public DeprecatedPath Deprecation { get; } + + + public List Parts { get; } + + //TODO mark the parts that are deprecated + public UrlPath(DeprecatedPath path, IDictionary originalParts, IReadOnlyCollection allNonDeprecatedPaths) + : this(path.Path, originalParts) + { + Deprecation = path; + foreach (var part in Parts) + { + if (!part.Deprecated && !allNonDeprecatedPaths.Any(p => p.Path.Contains($"{{{part.Name}}}"))) + part.Deprecated = true; + } + } + public UrlPath(string path, IDictionary allParts, List additionalPartsForConstructor = null) + { + _additionalPartsForConstructor = additionalPartsForConstructor ?? new List(); + Path = LeadingBackslash(path); + if (allParts == null) + { + Parts = new List(); + return; + } + var parts = + from p in allParts + //so deliciously side effect-y but at least its more isolated then in ApiEndpoint.CsharpMethods + let name = p.Value.Name = p.Key + where path.Contains($"{{{name}}}") + orderby path.IndexOf($"{{{name}}}", StringComparison.Ordinal) + select p.Value; + Parts = parts.ToList(); + } + + public string ConstructorArguments => string.Join(", ", Parts.Select(p => $"{p.HighLevelTypeName} {p.NameAsArgument}")); + public string RequestBaseArguments => + !Parts.Any() ? string.Empty + : "r => r." + string.Join(".", Parts.Select(p => $"{(p.Required ? "Required" : "Optional")}(\"{p.Name}\", {p.NameAsArgument})")); + + public string TypedSubClassBaseArguments => string.Join(", ", Parts.Select(p => p.NameAsArgument)); + + private static string[] ResolvabeFromT = { "index"}; + + + public bool HasResolvableArguments => Parts.Any(p => ResolvabeFromT.Contains(p.Name)); + public string AutoResolveConstructorArguments => string.Join(", ", Parts.Where(p => !ResolvabeFromT.Contains(p.Name)).Select(p => $"{p.HighLevelTypeName} {p.NameAsArgument}")); + + public string AutoResolveBaseArguments(string generic) => string.Join(", ", Parts.Select(p => !ResolvabeFromT.Contains(p.Name) ? p.Name : $"typeof({generic})")); + + public string DocumentPathBaseArgument(string generic) => string.Join(", ", + _additionalPartsForConstructor.Select(p => p.Name =="id" ? $"id ?? OpenSearch.Client.Id.From(documentWithId)" + : ResolvabeFromT.Contains(p.Name) ? $"{p.Name} ?? typeof({generic})" : p.Name)); + + public string DocumentPathConstructorArgument(string generic) => string.Join(", ", + new [] { $"{generic} documentWithId" }.Concat(_additionalPartsForConstructor.Select(p => $"{p.HighLevelTypeName} {p.NameAsArgument} = null"))); + + public string GetXmlDocs(string indent, bool skipResolvable = false, bool documentConstructor = false) + { + var doc = $@"///{Path}"; + var parts = Parts.Where(p => !skipResolvable || !ResolvabeFromT.Contains(p.Name)).ToList(); + if (!parts.Any()) return doc; + + doc += indent; + doc += string.Join(indent, parts.Select(ParamDoc)); + return doc; + + string ParamDoc(UrlPart p) => P(p.NameAsArgument, GetDescription(p)); + + string GetDescription(UrlPart p) + { + if (documentConstructor) return "The document used to resolve the path from"; + return p.Required ? "this parameter is required" : "Optional, accepts null"; + } + } + + private string P(string name, string description) => $"///{description}"; + + private string LeadingBackslash(string p) => p.StartsWith("/") ? p : $"/{p}"; + } +} diff --git a/src/ApiGenerator/Extensions.cs b/src/ApiGenerator/Extensions.cs new file mode 100644 index 0000000000..dd4251bd3b --- /dev/null +++ b/src/ApiGenerator/Extensions.cs @@ -0,0 +1,73 @@ +/* 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; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text.RegularExpressions; +using CsQuery.ExtensionMethods.Internal; + +namespace ApiGenerator +{ + public static class Extensions + { + /// + /// Removes _ . but not an underscore at the start of the string, unless the string is _all or removeLeadingUnderscore == true. + /// + private static readonly Regex RemovePunctuationExceptFirstUnderScore = new Regex(@"(?!^_(?!All$))[_\.]"); + + public static IEnumerable DistinctBy(this IEnumerable items, Func property) => + items.GroupBy(property).Select(x => x.First()); + + public static string ToPascalCase(this string s, bool removeLeadingUnderscore = false) + { + if (string.IsNullOrEmpty(s)) return s; + + var textInfo = new CultureInfo("en-US").TextInfo; + var titleCased = textInfo.ToTitleCase(s.ToLowerInvariant()); + var result = RemovePunctuationExceptFirstUnderScore.Replace(titleCased, ""); + if (removeLeadingUnderscore) + result = result.TrimStart('_'); + return result; + } + + public static string ToCamelCase(this string s) + { + if (string.IsNullOrEmpty(s)) return s; + + var pascal = s.ToPascalCase(true); + if (pascal.Length <= 1) return pascal; + + return pascal[0].ToLower() + pascal.Substring(1); + } + + public static string SplitPascalCase(this string s) => + Regex.Replace(s, "([A-Z]+[a-z]*)", " $1").Trim(); + } +} diff --git a/src/ApiGenerator/Generator/ApiEndpointFactory.cs b/src/ApiGenerator/Generator/ApiEndpointFactory.cs new file mode 100644 index 0000000000..8669d731db --- /dev/null +++ b/src/ApiGenerator/Generator/ApiEndpointFactory.cs @@ -0,0 +1,229 @@ +/* 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; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using ApiGenerator.Configuration; +using ApiGenerator.Configuration.Overrides; +using ApiGenerator.Domain; +using ApiGenerator.Domain.Code; +using ApiGenerator.Domain.Specification; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace ApiGenerator.Generator +{ + public static class ApiEndpointFactory + { + private static readonly JsonSerializer Serializer = JsonSerializer.Create( + new JsonSerializerSettings { Converters = new List { new QueryParameterDeprecationConverter() } }); + + public static ApiEndpoint FromFile(string jsonFile) + { + var officialJsonSpec = JObject.Parse(File.ReadAllText(jsonFile)); + TransformNewSpecStructureToOld(officialJsonSpec); + PatchOfficialSpec(officialJsonSpec, jsonFile); + var (name, endpoint) = officialJsonSpec.ToObject>(Serializer).First(); + + endpoint.FileName = Path.GetFileName(jsonFile); + endpoint.Name = name; + var tokens = name.Split("."); + + endpoint.MethodName = tokens.Last(); + if (tokens.Length > 1) + endpoint.Namespace = tokens[0]; + //todo side effect + endpoint.CsharpNames = new CsharpNames(name, endpoint.MethodName, endpoint.Namespace); + + LoadOverridesOnEndpoint(endpoint); + PatchRequestParameters(endpoint); + + EnforceRequiredOnParts(jsonFile, endpoint.Url); + return endpoint; + } + + /// + /// This makes sure required is configured correctly by inspecting the paths. + /// Will emit a warning if the spec file got this wrong + /// + private static void EnforceRequiredOnParts(string jsonFile, UrlInformation url) + { + if (url.IsPartless) return; + foreach (var part in url.Parts) + { + var required = url.Paths.All(p => p.Path.Contains($"{{{part.Name}}}")); + if (part.Required != required) + { + var message = required + ? "is [b green] required [/] but appears in spec as [b red] optional [/]" + : "is [b green] optional [/] but marked as [b red] required [/] "; + // TODO submit PR to fix these, too noisy for now + //ApiGenerator.Warnings.Add($"[grey]{jsonFile}[/] part [b white] {part.Name} [/] {message}"); + } + part.Required = required; + } + } + + private static void LoadOverridesOnEndpoint(ApiEndpoint endpoint) + { + var method = endpoint.CsharpNames.MethodName; + if (CodeConfiguration.ApiNameMapping.TryGetValue(endpoint.Name, out var mapsApiMethodName)) + method = mapsApiMethodName; + + var namespacePrefix = typeof(GlobalOverrides).Namespace + ".Endpoints."; + var typeName = namespacePrefix + method + "Overrides"; + var type = GeneratorLocations.Assembly.GetType(typeName); + if (type != null && Activator.CreateInstance(type) is IEndpointOverrides overrides) + endpoint.Overrides = overrides; + } + + private static void PatchRequestParameters(ApiEndpoint endpoint) + { + var newParams = ApiQueryParametersPatcher.Patch(endpoint.Name, endpoint.Url.Params, endpoint.Overrides); + endpoint.Url.Params = newParams; + } + + /// + /// Finds a patch file in patches and union merges this with the official spec. + /// This allows us to check in tweaks should breaking changes occur in the spec before we catch them + /// + private static void PatchOfficialSpec(JObject original, string jsonFile) + { + var directory = Path.GetDirectoryName(jsonFile); + var patchFile = Path.Combine(directory!,"..", "_Patches", Path.GetFileNameWithoutExtension(jsonFile)) + ".patch.json"; + if (!File.Exists(patchFile)) return; + + var patchedJson = JObject.Parse(File.ReadAllText(patchFile)); + + var pathsOverride = patchedJson.SelectToken("*.url.paths"); + + original.Merge(patchedJson, new JsonMergeSettings + { + MergeArrayHandling = MergeArrayHandling.Union + }); + + if (pathsOverride != null) original.SelectToken("*.url.paths").Replace(pathsOverride); + + var methodsOverride = patchedJson.SelectToken("*.methods"); + if (methodsOverride != null) + original.SelectToken("*.methods").Replace(methodsOverride); + + var paramsOverride = patchedJson.SelectToken("*.params"); + var originalParams = original.SelectToken("*.url.params") as JObject; + originalParams?.Merge(paramsOverride, new JsonMergeSettings + { + MergeArrayHandling = MergeArrayHandling.Union + }); + + if (paramsOverride != null) originalParams?.Replace(originalParams); + + void ReplaceOptions(string path) + { + var optionsOverrides = patchedJson.SelectToken(path); + if (optionsOverrides != null) + original.SelectToken(path).Replace(optionsOverrides); + } + + ReplaceOptions("*.url.parts.metric.options"); + ReplaceOptions("*.url.parts.index_metric.options"); + } + + /// + /// Changes the structure of new REST API spec in 7.4.0 to one that matches prior spec structure. + /// + private static void TransformNewSpecStructureToOld(JObject original) + { + var name = (JProperty)original.First; + var spec = (JObject)name.Value; + + // old spec structure, nothing to change + if (spec.ContainsKey("methods")) + return; + + var methods = new HashSet(StringComparer.InvariantCultureIgnoreCase); + JObject parts = null; + var paths = new List(); + var deprecatedPaths = new List(); + + foreach (var path in spec["url"]["paths"].Cast()) + { + if (path.ContainsKey("deprecated")) + { + var deprecated = new JObject + { + ["version"] = path["deprecated"]["version"].Value(), + ["path"] = path["path"].Value(), + ["description"] = path["deprecated"]["description"].Value() + }; + + deprecatedPaths.Add(deprecated); + } + else + paths.Add(path["path"].Value()); + + if (path.ContainsKey("parts")) + { + if (parts == null) + parts = path["parts"].Value(); + else + parts.Merge(path["parts"].Value(), new JsonMergeSettings + { + MergeArrayHandling = MergeArrayHandling.Union + }); + } + + foreach (var method in path["methods"].Cast()) + methods.Add(method.Value()); + } + + + + var newUrl = new JObject + { + ["paths"] = new JArray(paths.Cast().ToArray()), + }; + + if (spec.ContainsKey("params")) + { + newUrl["params"] = spec["params"]; + spec.Remove("params"); + } + + if (parts != null) + newUrl["parts"] = parts; + + if (deprecatedPaths.Any()) + newUrl["deprecated_paths"] = new JArray(deprecatedPaths.Cast().ToArray()); + + spec["url"] = newUrl; + spec["methods"] = new JArray(methods.Cast().ToArray()); + } + } +} diff --git a/src/ApiGenerator/Generator/ApiGenerator.cs b/src/ApiGenerator/Generator/ApiGenerator.cs new file mode 100644 index 0000000000..f4c522ec00 --- /dev/null +++ b/src/ApiGenerator/Generator/ApiGenerator.cs @@ -0,0 +1,153 @@ +/* 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; +using System.Collections.Generic; +using System.IO; +using System.Linq; + using System.Threading; + using System.Threading.Tasks; +using ApiGenerator.Configuration; +using ApiGenerator.Domain; +using ApiGenerator.Domain.Specification; +using ApiGenerator.Generator.Razor; +using Newtonsoft.Json.Linq; +using ShellProgressBar; + +namespace ApiGenerator.Generator +{ + public class ApiGenerator + { + public static List Warnings { get; private set; } = new List(); + + public static async Task Generate(string downloadBranch, bool lowLevelOnly, RestApiSpec spec, CancellationToken token) + { + static async Task DoGenerate(ICollection generators, RestApiSpec restApiSpec, bool highLevel, CancellationToken token) + { + var pbarOpts = new ProgressBarOptions { ProgressCharacter = '─', BackgroundColor = ConsoleColor.Yellow }; + var message = $"Generating {(highLevel ? "high" : "low")} level code"; + using var pbar = new ProgressBar(generators.Count, message, pbarOpts); + foreach (var generator in generators) + { + pbar.Message = "Generating " + generator.Title; + await generator.Generate(restApiSpec, pbar, token); + pbar.Tick("Generated " + generator.Title); + } + } + + + var lowLevelGenerators = new List + { + //low level client + new LowLevelClientInterfaceGenerator(), + new LowLevelClientImplementationGenerator(), + new RequestParametersGenerator(), + new EnumsGenerator(), + new ApiUrlsLookupsGenerator(), + }; + + var highLevelGenerators = new List + { + //high level client + new HighLevelClientInterfaceGenerator(), + new HighLevelClientImplementationGenerator(), + new DescriptorsGenerator(), + new RequestsGenerator(), + }; + + await DoGenerate(lowLevelGenerators, spec, highLevel: false, token); + if (!lowLevelOnly) + await DoGenerate(highLevelGenerators, spec, highLevel: true, token); + + } + + public static RestApiSpec CreateRestApiSpecModel(string downloadBranch, params string[] folders) + { + var directories = Directory.GetDirectories(GeneratorLocations.RestSpecificationFolder, "*", SearchOption.AllDirectories) + .Where(f => folders == null || folders.Length == 0 || folders.Contains(new DirectoryInfo(f).Name)) + .OrderBy(f => new FileInfo(f).Name) + .ToList(); + + var endpoints = new SortedDictionary(); + var seenFiles = new HashSet(); + using (var pbar = new ProgressBar(directories.Count, $"Listing {directories.Count} directories", + new ProgressBarOptions { ProgressCharacter = '─', BackgroundColor = ConsoleColor.DarkGray, CollapseWhenFinished = false })) + { + var folderFiles = directories.Select(dir => + Directory.GetFiles(dir) + .Where(f => f.EndsWith(".json") && !CodeConfiguration.IgnoredApis.Contains(new FileInfo(f).Name)) + .ToList() + ); + var commonFile = Path.Combine(GeneratorLocations.RestSpecificationFolder, "Core", "_common.json"); + if (!File.Exists(commonFile)) throw new Exception($"Expected to find {commonFile}"); + + RestApiSpec.CommonApiQueryParameters = CreateCommonApiQueryParameters(commonFile); + + foreach (var jsonFiles in folderFiles) + { + using (var fileProgress = pbar.Spawn(jsonFiles.Count, $"Listing {jsonFiles.Count} files", + new ProgressBarOptions { ProgressCharacter = '─', BackgroundColor = ConsoleColor.DarkGray })) + { + foreach (var file in jsonFiles) + { + if (file.EndsWith("_common.json")) continue; + else if (file.EndsWith(".patch.json")) continue; + else + { + var endpoint = ApiEndpointFactory.FromFile(file); + seenFiles.Add(Path.GetFileNameWithoutExtension(file)); + endpoints.Add(endpoint.Name, endpoint); + } + + fileProgress.Tick(); + } + } + pbar.Tick(); + } + } + var wrongMapsApi = CodeConfiguration.ApiNameMapping.Where(k => !string.IsNullOrWhiteSpace(k.Key) && !seenFiles.Contains(k.Key)); + foreach (var (key, value) in wrongMapsApi) + { + var isIgnored = CodeConfiguration.IgnoredApis.Contains($"{value}.json"); + if (isIgnored) + Warnings.Add($"{value} uses MapsApi: {key} ignored in ${nameof(CodeConfiguration)}.{nameof(CodeConfiguration.IgnoredApis)}"); + else Warnings.Add($"{value} uses MapsApi: {key} which does not exist"); + } + + return new RestApiSpec { Endpoints = endpoints, Commit = downloadBranch }; + } + + private static SortedDictionary CreateCommonApiQueryParameters(string jsonFile) + { + var json = File.ReadAllText(jsonFile); + var jobject = JObject.Parse(json); + var commonParameters = jobject.Property("params").Value.ToObject>(); + return ApiQueryParametersPatcher.Patch(null, commonParameters, null, false); + } + } +} diff --git a/src/ApiGenerator/Generator/CodeGenerator.cs b/src/ApiGenerator/Generator/CodeGenerator.cs new file mode 100644 index 0000000000..b7e201e64a --- /dev/null +++ b/src/ApiGenerator/Generator/CodeGenerator.cs @@ -0,0 +1,121 @@ +/* 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; +using System.Collections.Generic; +using System.Linq; +using ApiGenerator.Domain.Code.HighLevel.Requests; +using CsQuery.ExtensionMethods.Internal; + +namespace ApiGenerator.Generator +{ + //TODO this should be in views and models + public static class CodeGenerator + { + public static string CatFormatPropertyGenerator(string type, string name, string key, string setter) => + $"public {type} {name} {{ " + + $" get => Q<{type}>(\"{key}\");" + + $" set {{ Q(\"{key}\", {setter}); SetAcceptHeader({setter}); }}" + + $"}}"; + + public static string PropertyGenerator(string type, string name, string key, string setter) => + $"public {type} {name} {{ get => Q<{type}>(\"{key}\"); set => Q(\"{key}\", {setter}); }}"; + + public static string Property(string @namespace, string type, string name, string key, string setter, string obsolete, params string[] doc) + { + var components = new List(); + foreach (var d in RenderDocumentation(doc)) A(d); + if (!string.IsNullOrWhiteSpace(obsolete)) A($"[Obsolete(\"Scheduled to be removed in 8.0, {obsolete}\")]"); + + var generated = @namespace != null && @namespace == "Cat" && name == "Format" + ? CatFormatPropertyGenerator(type, name, key, setter) + : PropertyGenerator(type, name, key, setter); + + A(generated); + return string.Join($"{Environment.NewLine}\t\t", components); + + void A(string s) + { + components.Add(s); + } + } + + public static string Constructor(Constructor c) + { + var components = new List(); + if (!c.Description.IsNullOrEmpty()) A(c.Description); + var generated = c.Generated; + if (c.Body.IsNullOrEmpty()) generated += "{}"; + A(generated); + if (!c.Body.IsNullOrEmpty()) A(c.Body); + if (!c.AdditionalCode.IsNullOrEmpty()) A(c.AdditionalCode); + return string.Join($"{Environment.NewLine}\t\t", components); + + void A(string s) + { + components.Add(s); + } + } + + private static IEnumerable RenderDocumentation(params string[] doc) + { + doc = (doc?.SelectMany(WrapDocumentation) ?? Enumerable.Empty()).ToArray(); + switch (doc.Length) + { + case 0: yield break; + case 1: + yield return $"///{doc[0]}"; + + yield break; + default: + yield return "///"; + + foreach (var d in doc) yield return $"/// {d}"; + + yield return "///"; + + yield break; + } + } + + private static string[] WrapDocumentation(string documentation) + { + if (string.IsNullOrWhiteSpace(documentation)) return Array.Empty(); + const int max = 140; + var lines = documentation.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); + var charCount = 0; + return lines.GroupBy(Wrap).Select(l => string.Join(" ", l.ToArray())).ToArray(); + + int Wrap(string w) + { + var increase = charCount % max + w.Length + 1 >= max ? max - charCount % max : 0; + return (charCount += increase + w.Length + 1) / max; + } + } + } +} diff --git a/src/ApiGenerator/Generator/Razor/ApiUrlsLookupsGenerator.cs b/src/ApiGenerator/Generator/Razor/ApiUrlsLookupsGenerator.cs new file mode 100644 index 0000000000..35189de048 --- /dev/null +++ b/src/ApiGenerator/Generator/Razor/ApiUrlsLookupsGenerator.cs @@ -0,0 +1,49 @@ +/* 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.Threading; +using System.Threading.Tasks; +using ApiGenerator.Configuration; +using ApiGenerator.Domain; +using ShellProgressBar; + +namespace ApiGenerator.Generator.Razor +{ + public class ApiUrlsLookupsGenerator : RazorGeneratorBase + { + public override string Title => "OpenSearch.Client static url lookups"; + + public override async Task Generate(RestApiSpec spec, ProgressBar progressBar, CancellationToken token) + { + var view = ViewLocations.HighLevel("Requests", "ApiUrlsLookup.cshtml"); + var target = GeneratorLocations.HighLevel("_Generated", "ApiUrlsLookup.generated.cs"); + + await DoRazor(spec, view, target, null, token); + } + } +} diff --git a/src/ApiGenerator/Generator/Razor/DescriptorsGenerator.cs b/src/ApiGenerator/Generator/Razor/DescriptorsGenerator.cs new file mode 100644 index 0000000000..fa9e3f7ff8 --- /dev/null +++ b/src/ApiGenerator/Generator/Razor/DescriptorsGenerator.cs @@ -0,0 +1,59 @@ +/* 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.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using ApiGenerator.Configuration; +using ApiGenerator.Domain; +using ShellProgressBar; + +namespace ApiGenerator.Generator.Razor +{ + public class DescriptorsGenerator : RazorGeneratorBase + { + public override string Title => "OpenSearch.Client descriptors"; + + public override async Task Generate(RestApiSpec spec, ProgressBar progressBar, CancellationToken token) + { + // Delete existing files + foreach (var file in Directory.GetFiles(GeneratorLocations.OpenSearchClientFolder, "Descriptors.*.cs")) + File.Delete(file); + + var view = ViewLocations.HighLevel("Descriptors", "RequestDescriptorBase.cshtml"); + var target = GeneratorLocations.HighLevel("Descriptors.cs"); + await DoRazor(spec, view, target, null, token); + + var dependantView = ViewLocations.HighLevel("Descriptors", "Descriptors.cshtml"); + string Target(string id) => GeneratorLocations.HighLevel($"Descriptors.{id}.cs"); + var namespaced = spec.EndpointsPerNamespaceHighLevel.ToList(); + await DoRazorDependantFiles(progressBar, namespaced, dependantView, kv => kv.Key, id => Target(id), token); + } + } +} diff --git a/src/ApiGenerator/Generator/Razor/EnumsGenerator.cs b/src/ApiGenerator/Generator/Razor/EnumsGenerator.cs new file mode 100644 index 0000000000..3708c5051a --- /dev/null +++ b/src/ApiGenerator/Generator/Razor/EnumsGenerator.cs @@ -0,0 +1,49 @@ +/* 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.Threading; +using System.Threading.Tasks; +using ApiGenerator.Configuration; +using ApiGenerator.Domain; +using ShellProgressBar; + +namespace ApiGenerator.Generator.Razor +{ + public class EnumsGenerator : RazorGeneratorBase + { + public override string Title => "OpenSearch.Net enums"; + + public override async Task Generate(RestApiSpec spec, ProgressBar progressBar, CancellationToken token) + { + var view = ViewLocations.LowLevel("Enums.Generated.cshtml"); + var target = GeneratorLocations.LowLevel("Api", "Enums.Generated.cs"); + + await DoRazor(spec, view, target, null, token); + } + } +} diff --git a/src/ApiGenerator/Generator/Razor/HighLevelClientImplementationGenerator.cs b/src/ApiGenerator/Generator/Razor/HighLevelClientImplementationGenerator.cs new file mode 100644 index 0000000000..a37dc00761 --- /dev/null +++ b/src/ApiGenerator/Generator/Razor/HighLevelClientImplementationGenerator.cs @@ -0,0 +1,62 @@ +/* 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.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using ApiGenerator.Configuration; +using ApiGenerator.Domain; +using ApiGenerator.Domain.Code; +using ShellProgressBar; + +namespace ApiGenerator.Generator.Razor +{ + public class HighLevelClientImplementationGenerator : RazorGeneratorBase + { + public override string Title => "OpenSearch.Client client implementation"; + + public override async Task Generate(RestApiSpec spec, ProgressBar progressBar, CancellationToken token) + { + // Delete existing files + foreach (var file in Directory.GetFiles(GeneratorLocations.OpenSearchClientFolder, "OpenSearchClient.*.cs")) + File.Delete(file); + + var view = ViewLocations.HighLevel("Client", "Implementation", "OpenSearchClient.cshtml"); + var target = GeneratorLocations.HighLevel($"OpenSearchClient.{CsharpNames.RootNamespace}.cs"); + await DoRazor(spec, view, target, null, token); + + string Target(string id) => GeneratorLocations.HighLevel($"OpenSearchClient.{id}.cs"); + + var namespaced = spec.EndpointsPerNamespaceHighLevel.Where(kv => kv.Key != CsharpNames.RootNamespace).ToList(); + var dependantView = ViewLocations.HighLevel("Client", "Implementation", "OpenSearchClient.Namespace.cshtml"); + await DoRazorDependantFiles(progressBar, namespaced, dependantView, kv => kv.Key, id => Target(id), token); + + } + } +} diff --git a/src/ApiGenerator/Generator/Razor/HighLevelClientInterfaceGenerator.cs b/src/ApiGenerator/Generator/Razor/HighLevelClientInterfaceGenerator.cs new file mode 100644 index 0000000000..9b35b9a919 --- /dev/null +++ b/src/ApiGenerator/Generator/Razor/HighLevelClientInterfaceGenerator.cs @@ -0,0 +1,49 @@ +/* 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.Threading; +using System.Threading.Tasks; +using ApiGenerator.Configuration; +using ApiGenerator.Domain; +using ShellProgressBar; + +namespace ApiGenerator.Generator.Razor +{ + public class HighLevelClientInterfaceGenerator : RazorGeneratorBase + { + public override string Title => "OpenSearch.Client client interface"; + + public override async Task Generate(RestApiSpec spec, ProgressBar progressBar, CancellationToken token) + { + var view = ViewLocations.HighLevel("Client", "Interface", "IOpenSearchClient.cshtml"); + var target = GeneratorLocations.HighLevel("IOpenSearchClient.Generated.cs"); + + await DoRazor(spec, view, target, null, token); + } + } +} diff --git a/src/ApiGenerator/Generator/Razor/LowLevelClientImplementationGenerator.cs b/src/ApiGenerator/Generator/Razor/LowLevelClientImplementationGenerator.cs new file mode 100644 index 0000000000..bd41fac4b8 --- /dev/null +++ b/src/ApiGenerator/Generator/Razor/LowLevelClientImplementationGenerator.cs @@ -0,0 +1,60 @@ +/* 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.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using ApiGenerator.Configuration; +using ApiGenerator.Domain; +using ApiGenerator.Domain.Code; +using ShellProgressBar; + +namespace ApiGenerator.Generator.Razor +{ + public class LowLevelClientImplementationGenerator : RazorGeneratorBase + { + public override string Title { get; } = "OpenSearch.Net client implementation"; + + public override async Task Generate(RestApiSpec spec, ProgressBar progressBar, CancellationToken token) + { + // Delete existing files + foreach (var file in Directory.GetFiles(GeneratorLocations.OpenSearchNetFolder, "OpenSearchLowLevelClient.*.cs")) + File.Delete(file); + + var view = ViewLocations.LowLevel("Client", "Implementation", "OpenSearchLowLevelClient.cshtml"); + var target = GeneratorLocations.LowLevel($"OpenSearchLowLevelClient.{CsharpNames.RootNamespace}.cs"); + await DoRazor(spec, view, target, null, token); + + var namespaced = spec.EndpointsPerNamespaceLowLevel.Where(kv => kv.Key != CsharpNames.RootNamespace).ToList(); + var namespacedView = ViewLocations.LowLevel("Client", "Implementation", "OpenSearchLowLevelClient.Namespace.cshtml"); + await DoRazorDependantFiles(progressBar, namespaced, namespacedView, kv => kv.Key, + id => GeneratorLocations.LowLevel($"OpenSearchLowLevelClient.{id}.cs"), token); + } + } +} diff --git a/src/ApiGenerator/Generator/Razor/LowLevelClientInterfaceGenerator.cs b/src/ApiGenerator/Generator/Razor/LowLevelClientInterfaceGenerator.cs new file mode 100644 index 0000000000..f1d31074ce --- /dev/null +++ b/src/ApiGenerator/Generator/Razor/LowLevelClientInterfaceGenerator.cs @@ -0,0 +1,49 @@ +/* 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.Threading; +using System.Threading.Tasks; +using ApiGenerator.Configuration; +using ApiGenerator.Domain; +using ShellProgressBar; + +namespace ApiGenerator.Generator.Razor +{ + public class LowLevelClientInterfaceGenerator : RazorGeneratorBase + { + public override string Title { get; } = "OpenSearch.Net client interface"; + + public override async Task Generate(RestApiSpec spec, ProgressBar progressBar, CancellationToken token) + { + var view = ViewLocations.LowLevel("Client", "Interface", "IOpenSearchLowLevelClient.cshtml"); + var target = GeneratorLocations.LowLevel("IOpenSearchLowLevelClient.Generated.cs"); + + await DoRazor(spec, view, target, null, token); + } + } +} diff --git a/src/ApiGenerator/Generator/Razor/RazorGeneratorBase.cs b/src/ApiGenerator/Generator/Razor/RazorGeneratorBase.cs new file mode 100644 index 0000000000..e24e7803ad --- /dev/null +++ b/src/ApiGenerator/Generator/Razor/RazorGeneratorBase.cs @@ -0,0 +1,102 @@ +/* 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; +using System.Collections.Generic; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using ApiGenerator.Configuration; +using ApiGenerator.Domain; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using RazorLight; +using RazorLight.Generation; +using RazorLight.Razor; +using ShellProgressBar; + +namespace ApiGenerator.Generator.Razor +{ + public abstract class RazorGeneratorBase + { + private static readonly RazorLightEngine Engine = new RazorLightEngineBuilder() + .UseProject(new FileSystemRazorProject(Path.GetFullPath(ViewLocations.Root))) + .UseMemoryCachingProvider() + .Build(); + + protected async Task DoRazor(TModel model, string viewLocation, string targetLocation, string cacheNameSuffix, CancellationToken token) + { + try + { + var name = GetType().Name + cacheNameSuffix; + var sourceFileContents = await File.ReadAllTextAsync(viewLocation, token); + token.ThrowIfCancellationRequested(); + var generated = await Engine.CompileRenderStringAsync(name, sourceFileContents, model); + WriteFormattedCsharpFile(targetLocation, generated); + } + catch (TemplateGenerationException e) + { + foreach (var d in e.Diagnostics) Console.WriteLine(d.GetMessage()); + throw; + } + } + + protected async Task DoRazorDependantFiles( + ProgressBar pbar, IReadOnlyCollection items, string viewLocation, + Func identifier, Func target, + CancellationToken token + ) + { + using (var c = pbar.Spawn(items.Count, "Generating namespaces", new ProgressBarOptions + { + ProgressCharacter = '─', + ForegroundColor = ConsoleColor.Yellow + })) + { + foreach (var item in items) + { + var id = identifier(item); + var targetLocation = target(id); + await DoRazor(item, viewLocation, targetLocation, id, token); + c.Tick($"{Title}: {id}"); + } + } + } + + protected static void WriteFormattedCsharpFile(string path, string contents) + { + var tree = CSharpSyntaxTree.ParseText(contents); + var root = tree.GetRoot().NormalizeWhitespace(indentation:"\t", "\n"); + contents = root.ToFullString(); + File.WriteAllText(path, contents); + } + + public abstract string Title { get; } + public abstract Task Generate(RestApiSpec spec, ProgressBar progressBar, CancellationToken token); + } +} diff --git a/src/ApiGenerator/Generator/Razor/RequestParametersGenerator.cs b/src/ApiGenerator/Generator/Razor/RequestParametersGenerator.cs new file mode 100644 index 0000000000..05d3609acc --- /dev/null +++ b/src/ApiGenerator/Generator/Razor/RequestParametersGenerator.cs @@ -0,0 +1,56 @@ +/* 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.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using ApiGenerator.Configuration; +using ApiGenerator.Domain; +using ShellProgressBar; + +namespace ApiGenerator.Generator.Razor +{ + public class RequestParametersGenerator : RazorGeneratorBase + { + public override string Title { get; } = "OpenSearch.Net request parameters"; + + public override async Task Generate(RestApiSpec spec, ProgressBar progressBar, CancellationToken token) + { + // Delete existing files + foreach (var file in Directory.GetFiles(GeneratorLocations.OpenSearchNetFolder, "RequestParameters.*.cs")) + File.Delete(file); + + var view = ViewLocations.LowLevel("RequestParameters", "RequestParameters.cshtml"); + string Target(string id) => GeneratorLocations.LowLevel("Api", "RequestParameters", $"RequestParameters.{id}.cs"); + + var namespaced = spec.EndpointsPerNamespaceLowLevel.ToList(); + await DoRazorDependantFiles(progressBar, namespaced, view, kv => kv.Key, id => Target(id), token); + } + } +} diff --git a/src/ApiGenerator/Generator/Razor/RequestsGenerator.cs b/src/ApiGenerator/Generator/Razor/RequestsGenerator.cs new file mode 100644 index 0000000000..c7aa78b624 --- /dev/null +++ b/src/ApiGenerator/Generator/Razor/RequestsGenerator.cs @@ -0,0 +1,59 @@ +/* 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.IO; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using ApiGenerator.Configuration; +using ApiGenerator.Domain; +using ShellProgressBar; + +namespace ApiGenerator.Generator.Razor +{ + public class RequestsGenerator : RazorGeneratorBase + { + public override string Title => "OpenSearch.Client requests"; + + public override async Task Generate(RestApiSpec spec, ProgressBar progressBar, CancellationToken token) + { + // Delete existing files + foreach (var file in Directory.GetFiles(GeneratorLocations.OpenSearchClientFolder, "Requests.*.cs")) + File.Delete(file); + + var view = ViewLocations.HighLevel("Requests", "PlainRequestBase.cshtml"); + var target = GeneratorLocations.HighLevel("Requests.cs"); + await DoRazor(spec, view, target, null, token); + + var dependantView = ViewLocations.HighLevel("Requests", "Requests.cshtml"); + string Target(string id) => GeneratorLocations.HighLevel($"Requests.{id}.cs"); + var namespaced = spec.EndpointsPerNamespaceHighLevel.ToList(); + await DoRazorDependantFiles(progressBar, namespaced, dependantView, kv => kv.Key, id => Target(id), token); + } + } +} diff --git a/src/ApiGenerator/Program.cs b/src/ApiGenerator/Program.cs new file mode 100644 index 0000000000..2adb8d357b --- /dev/null +++ b/src/ApiGenerator/Program.cs @@ -0,0 +1,187 @@ +/* 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; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using ApiGenerator.Configuration; +using Spectre.Console; + +#pragma warning disable 162 + +namespace ApiGenerator +{ + public static class Program + { + private static bool Interactive { get; set; } = false; + + /// + /// A main function can also take which is hooked up to support termination (e.g CTRL+C) + /// + /// The stack's branch we are targeting the generation for + /// Run the generation interactively, this will ignore all flags + /// Whether to download the specs or use an already downloaded copy + /// Also generate the high level client (OpenSearch.Client) + /// Only download the specs, skip all code generation + /// + /// + private static async Task Main( + string branch, bool interactive = false, bool download = false, bool includeHighLevel = false, bool skipGenerate = false + , CancellationToken token = default) + { + Interactive = interactive; + try + { + if (string.IsNullOrEmpty(branch)) + { + + throw new ArgumentException("--branch can not be null"); + } + await Generate(download, branch, includeHighLevel, skipGenerate, token); + } + catch (OperationCanceledException) + { + AnsiConsole.WriteLine(); + AnsiConsole.Render(new Rule("[b white on orange4_1] Cancelled [/]").LeftAligned()); + AnsiConsole.WriteLine(); + return 1; + } + catch (Exception ex) + { + AnsiConsole.WriteLine(); + AnsiConsole.Render(new Rule("[b white on darkred] Exception [/]") + { + Alignment = Justify.Left, + }); + AnsiConsole.WriteLine(); + AnsiConsole.WriteException(ex); + return 1; + } + return 0; + } + + private static async Task Generate(bool download, string branch, bool includeHighLevel, bool skipGenerate, CancellationToken token = default) + { + var redownloadCoreSpecification = Ask("Download online rest specifications?", download); + + var downloadBranch = branch; + if (Interactive && redownloadCoreSpecification) + { + Console.Write($"Branch to download specification from (default {downloadBranch}): "); + var readBranch = Console.ReadLine()?.Trim(); + if (!string.IsNullOrEmpty(readBranch)) + downloadBranch = readBranch; + } + + if (string.IsNullOrEmpty(downloadBranch)) + throw new Exception($"Branch to download from is null or empty"); + + var generateCode = Ask("Generate code from the specification files on disk?", !skipGenerate); + var lowLevelOnly = generateCode && Ask("Generate low level client only?", !includeHighLevel); + + static string YesNo(bool value) => value ? "[bold green]Yes[/]" : "[grey]No[/]"; + var grid = new Grid() + .AddColumn(new GridColumn().PadRight(4)) + .AddColumn() + .AddRow("[b]Download specification[/]", $"{YesNo(download)}") + .AddRow("[b]Download branch[/]", $"{downloadBranch}") + .AddRow("[b]Generate code from specification[/]", $"{YesNo(generateCode)}") + .AddRow("[b]Include high level client[/]", $"{YesNo(!lowLevelOnly)}"); + + Console.WriteLine(); + AnsiConsole.Render( + new Panel(grid) + .Header(new PanelHeader("[b white on chartreuse4] OpenSearch .NET client API generator [/]", Justify.Left)) + ); + Console.WriteLine(); + + if (redownloadCoreSpecification) + { + Console.WriteLine(); + AnsiConsole.Render(new Rule("[b white on chartreuse4] Downloading specification [/]").LeftAligned()); + Console.WriteLine(); + await RestSpecDownloader.DownloadAsync(downloadBranch, token); + } + + if (!generateCode) return 0; + + Console.WriteLine(); + AnsiConsole.Render(new Rule("[b white on chartreuse4] Loading specification [/]").LeftAligned()); + Console.WriteLine(); + + var spec = Generator.ApiGenerator.CreateRestApiSpecModel(downloadBranch, "Core"); + if (!lowLevelOnly) + { + foreach (var endpoint in spec.Endpoints.Select(e => e.Value.FileName)) + { + if (CodeConfiguration.IsNewHighLevelApi(endpoint) + && Ask($"Generate highlevel code for new api {endpoint}", false)) + CodeConfiguration.EnableHighLevelCodeGen.Add(endpoint); + + } + } + + Console.WriteLine(); + AnsiConsole.Render(new Rule("[b white on chartreuse4] Generating code [/]").LeftAligned()); + Console.WriteLine(); + + await Generator.ApiGenerator.Generate(downloadBranch, lowLevelOnly, spec, token); + + var warnings = Generator.ApiGenerator.Warnings; + if (warnings.Count > 0) + { + Console.WriteLine(); + AnsiConsole.Render(new Rule("[b black on yellow] Specification warnings [/]").LeftAligned()); + Console.WriteLine(); + + foreach (var warning in warnings.Distinct().OrderBy(w => w)) + AnsiConsole.MarkupLine(" {0} [yellow] {1} [/] ", Emoji.Known.Warning, warning); + } + + return 0; + } + + private static bool Ask(string question, bool defaultAnswer = true) + { + if (!Interactive) return defaultAnswer; + + var answer = "invalid"; + var defaultResponse = defaultAnswer ? "y" : "n"; + + while (answer != "y" && answer != "n" && answer != "") + { + Console.Write($"{question}[y/N] (default {defaultResponse}): "); + answer = Console.ReadLine()?.Trim().ToLowerInvariant(); + if (string.IsNullOrWhiteSpace(answer)) answer = defaultResponse; + defaultAnswer = answer == "y"; + } + return defaultAnswer; + } + } +} diff --git a/src/ApiGenerator/RestSpecDownloader.cs b/src/ApiGenerator/RestSpecDownloader.cs new file mode 100644 index 0000000000..86ef8e2dc5 --- /dev/null +++ b/src/ApiGenerator/RestSpecDownloader.cs @@ -0,0 +1,172 @@ +/* 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; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using ApiGenerator.Configuration; +using CsQuery; +using ShellProgressBar; + +namespace ApiGenerator +{ + public class RestSpecDownloader + { + private readonly string _branch; + private static readonly ProgressBarOptions MainProgressBarOptions = new ProgressBarOptions + { + BackgroundColor = ConsoleColor.DarkGray, + ProgressCharacter = '─', + }; + + private static string CommitsUrl = "https://github.com/opensearch-project/opensearch-net/commits/{branch}"; + private static readonly Dictionary OnlineSpecifications = new Dictionary + { + { "Core", "https://github.com/opensearch-project/opensearch-net/tree/{ref}/rest-api-spec/src/main/resources/rest-api-spec/api" }, + }; + + private static readonly ProgressBarOptions SubProgressBarOptions = new ProgressBarOptions + { + ForegroundColor = ConsoleColor.Cyan, + ForegroundColorDone = ConsoleColor.DarkGreen, + ProgressCharacter = '─', + BackgroundColor = ConsoleColor.DarkGray, + }; + + private RestSpecDownloader(string branch) => _branch = branch; + + private async Task DownloadAsync(CancellationToken token) + { + var @ref = await ResolveLastRef(_branch, token); + + var specifications = + (from kv in OnlineSpecifications + let url = kv.Value.Replace("{ref}", @ref) + select new Specification { FolderOnDisk = kv.Key, Branch = _branch, Ref = @ref, GithubListingUrl = url }).ToList(); + + using (var pbar = new ProgressBar(specifications.Count, "Downloading specifications", MainProgressBarOptions)) + { + foreach (var spec in specifications) + { + var specFolderOnDisk = Path.Combine(GeneratorLocations.RestSpecificationFolder, spec.FolderOnDisk); + if (Directory.Exists(specFolderOnDisk)) + { + Directory.Delete(specFolderOnDisk, true); + pbar.WriteLine($"Deleted target spec folder, before downloading new copy: {specFolderOnDisk}"); + } + pbar.Message = $"Downloading rest-api-spec to {spec.FolderOnDisk} for branch {_branch}"; + await DownloadJsonDefinitions(spec, pbar, token); + pbar.Tick($"Downloaded rest-api-spec to {spec.FolderOnDisk} for branch {_branch}"); + } + } + + await File.WriteAllTextAsync(GeneratorLocations.LastDownloadedRef, @ref, token); + + } + + public static Task DownloadAsync(string branch, CancellationToken token = default) => new RestSpecDownloader(branch).DownloadAsync(token); + + private static async Task ResolveLastRef(string branch, CancellationToken token) + { + var response = await Http.GetAsync(CommitsUrl.Replace("{branch}", branch), token); + var html = await response.Content.ReadAsStringAsync(); + var dom = CQ.Create(html); + + var prefix = "/opensearch-project/opensearch-net/commit/"; + var commit = dom["a.text-mono"] + .Select(s => s.GetAttribute("href")) + .Where(a => a.StartsWith(prefix)) + .Select(a => a.Replace(prefix, "")) + .FirstOrDefault() + ?? throw new Exception($"Can not locate the latest commit on branch: {branch}"); + return commit; + } + + private static readonly HttpClient Http = new HttpClient(); + private static async Task DownloadJsonDefinitions(Specification spec, IProgressBar pbar, CancellationToken token) + { + var response = await Http.GetAsync(spec.GithubListingUrl, token); + var html = await response.Content.ReadAsStringAsync(); + + await FindJsonFilesOnListing(spec, html, pbar, token); + } + + private static async Task FindJsonFilesOnListing(Specification spec, string html, IProgressBar pbar, CancellationToken token) + { + if (!Directory.Exists(GeneratorLocations.RestSpecificationFolder)) + Directory.CreateDirectory(GeneratorLocations.RestSpecificationFolder); + + var dom = CQ.Create(html); + + var endpoints = dom[".js-navigation-open"] + .Select(s => s.InnerText) + .Where(s => !string.IsNullOrEmpty(s) && s.EndsWith(".json")) + .ToList(); + + using var subBar = pbar.Spawn(endpoints.Count, "fetching individual json files", SubProgressBarOptions); + foreach (var e in endpoints) + await WriteEndpointFile(spec, e, subBar, token); + } + + private static async Task WriteEndpointFile(Specification spec, string s, IProgressBar pbar, CancellationToken token) + { + var rawFile = spec.GithubDownloadUrl(s); + var fileName = rawFile.Split('/').Last(); + + var response = await Http.GetAsync(rawFile, token); + var json = await response.Content.ReadAsStringAsync(); + await WriteToEndpointsFolder(spec.FolderOnDisk, fileName, json, token); + pbar.Tick($"Downloading {fileName}"); + } + + private static async Task WriteToEndpointsFolder(string folder, string filename, string contents, CancellationToken token) + { + var f = Path.Combine(GeneratorLocations.RestSpecificationFolder, folder); + if (!Directory.Exists(f)) Directory.CreateDirectory(f); + var target = Path.Combine(f, filename); + await File.WriteAllTextAsync(target, contents, token); + } + + private class Specification + { + // ReSharper disable once UnusedAutoPropertyAccessor.Local + public string Branch { get; set; } + public string Ref { get; set; } + public string FolderOnDisk { get; set; } + public string GithubListingUrl { get; set; } + + public string GithubDownloadUrl(string file) => + GithubListingUrl.Replace("github.com", "raw.githubusercontent.com").Replace("tree/", "") + "/" + file; + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/_common.json b/src/ApiGenerator/RestSpecification/Core/_common.json new file mode 100644 index 0000000000..afb0f75de6 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/_common.json @@ -0,0 +1,31 @@ +{ + "documentation" : { + "description": "Parameters that are accepted by all API endpoints.", + "url": "https://opensearch.org/docs/latest/opensearch/common-parameters/" + }, + "params": { + "pretty": { + "type": "boolean", + "description": "Pretty format the returned JSON response.", + "default": false + }, + "human": { + "type": "boolean", + "description": "Return human readable values for statistics.", + "default": true + }, + "error_trace": { + "type": "boolean", + "description": "Include the stack trace of returned errors.", + "default": false + }, + "source": { + "type": "string", + "description": "The URL-encoded request definition. Useful for libraries that do not accept a request body for non-POST requests." + }, + "filter_path": { + "type": "list", + "description": "A comma-separated list of filters used to reduce the response." + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/bulk.json b/src/ApiGenerator/RestSpecification/Core/bulk.json new file mode 100644 index 0000000000..c4b2f102a9 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/bulk.json @@ -0,0 +1,107 @@ +{ + "bulk":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/bulk/", + "description":"Allows to perform multiple index/update/delete operations in a single request." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/x-ndjson"] + }, + "url":{ + "paths":[ + { + "path":"/_bulk", + "methods":[ + "POST", + "PUT" + ] + }, + { + "path":"/{index}/_bulk", + "methods":[ + "POST", + "PUT" + ], + "parts":{ + "index":{ + "type":"string", + "description":"Default index for items which don't provide one" + } + } + }, + { + "path":"/{index}/{type}/_bulk", + "methods":[ + "POST", + "PUT" + ], + "parts":{ + "index":{ + "type":"string", + "description":"Default index for items which don't provide one" + }, + "type":{ + "type":"string", + "description":"Default document type for items which don't provide one" + } + } + } + ] + }, + "params":{ + "wait_for_active_shards":{ + "type":"string", + "description":"Sets the number of shard copies that must be active before proceeding with the bulk operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)" + }, + "refresh":{ + "type":"enum", + "options":[ + "true", + "false", + "wait_for" + ], + "description":"If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes." + }, + "routing":{ + "type":"string", + "description":"Specific routing value" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "type":{ + "type":"string", + "description":"Default document type for items which don't provide one" + }, + "_source":{ + "type":"list", + "description":"True or false to return the _source field or not, or default list of fields to return, can be overridden on each sub-request" + }, + "_source_excludes":{ + "type":"list", + "description":"Default list of fields to exclude from the returned _source field, can be overridden on each sub-request" + }, + "_source_includes":{ + "type":"list", + "description":"Default list of fields to extract and return from the _source field, can be overridden on each sub-request" + }, + "pipeline":{ + "type":"string", + "description":"The pipeline id to preprocess incoming documents with" + }, + "require_alias": { + "type": "boolean", + "description": "Sets require_alias for all incoming documents. Defaults to unset (false)" + } + }, + "body":{ + "description":"The operation definition and data (action-data pairs), separated by newlines", + "required":true, + "serialize":"bulk" + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cat.aliases.json b/src/ApiGenerator/RestSpecification/Core/cat.aliases.json new file mode 100644 index 0000000000..5790819539 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cat.aliases.json @@ -0,0 +1,75 @@ +{ + "cat.aliases":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-aliases/", + "description":"Shows information about currently configured aliases to indices including filter and routing infos." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cat/aliases", + "methods":[ + "GET" + ] + }, + { + "path":"/_cat/aliases/{name}", + "methods":[ + "GET" + ], + "parts":{ + "name":{ + "type":"list", + "description":"A comma-separated list of alias names to return" + } + } + } + ] + }, + "params":{ + "format":{ + "type":"string", + "description":"a short version of the Accept header, e.g. json, yaml" + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + }, + "h":{ + "type":"list", + "description":"Comma-separated list of column names to display" + }, + "help":{ + "type":"boolean", + "description":"Return help information", + "default":false + }, + "s":{ + "type":"list", + "description":"Comma-separated list of column names or column aliases to sort by" + }, + "v":{ + "type":"boolean", + "description":"Verbose mode. Display column headers", + "default":false + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default": "all", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cat.allocation.json b/src/ApiGenerator/RestSpecification/Core/cat.allocation.json new file mode 100644 index 0000000000..6616747970 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cat.allocation.json @@ -0,0 +1,88 @@ +{ + "cat.allocation":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-allocation/", + "description":"Provides a snapshot of how many shards are allocated to each data node and how much disk space they are using." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cat/allocation", + "methods":[ + "GET" + ] + }, + { + "path":"/_cat/allocation/{node_id}", + "methods":[ + "GET" + ], + "parts":{ + "node_id":{ + "type":"list", + "description":"A comma-separated list of node IDs or names to limit the returned information" + } + } + } + ] + }, + "params":{ + "format":{ + "type":"string", + "description":"a short version of the Accept header, e.g. json, yaml" + }, + "bytes":{ + "type":"enum", + "description":"The unit in which to display byte values", + "options":[ + "b", + "k", + "kb", + "m", + "mb", + "g", + "gb", + "t", + "tb", + "p", + "pb" + ] + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "h":{ + "type":"list", + "description":"Comma-separated list of column names to display" + }, + "help":{ + "type":"boolean", + "description":"Return help information", + "default":false + }, + "s":{ + "type":"list", + "description":"Comma-separated list of column names or column aliases to sort by" + }, + "v":{ + "type":"boolean", + "description":"Verbose mode. Display column headers", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cat.cluster_manager.json b/src/ApiGenerator/RestSpecification/Core/cat.cluster_manager.json new file mode 100644 index 0000000000..5056437c26 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cat.cluster_manager.json @@ -0,0 +1,73 @@ +{ + "cat.cluster_manager":{ + "documentation":{ + "url":"https://opensearch.org/docs/2.0/opensearch/rest-api/cat/cat-cluster_manager/", + "description":"Returns information about the cluster_manager node. Introduced in OpenSearch 2.0 instead of cat-master." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cat/cluster_manager", + "methods":[ + "GET" + ] + }, + { + "path":"/_cat/master", + "methods":[ + "GET" + ], + "deprecated":{ + "version":"2.0.0", + "description":"To promote inclusive language, please use '/_cat/cluster_manager' instead." + } + } + ] + }, + "params":{ + "format":{ + "type":"string", + "description":"a short version of the Accept header, e.g. json, yaml" + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from cluster-manager node (default: false)" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node", + "deprecated":{ + "version":"2.0.0", + "description":"To promote inclusive language, use 'cluster_manager_timeout' instead." + } + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager node" + }, + "h":{ + "type":"list", + "description":"Comma-separated list of column names to display" + }, + "help":{ + "type":"boolean", + "description":"Return help information", + "default":false + }, + "s":{ + "type":"list", + "description":"Comma-separated list of column names or column aliases to sort by" + }, + "v":{ + "type":"boolean", + "description":"Verbose mode. Display column headers", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cat.count.json b/src/ApiGenerator/RestSpecification/Core/cat.count.json new file mode 100644 index 0000000000..3b1213eecc --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cat.count.json @@ -0,0 +1,59 @@ +{ + "cat.count":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-count/", + "description":"Provides quick access to the document count of the entire cluster, or individual indices." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cat/count", + "methods":[ + "GET" + ] + }, + { + "path":"/_cat/count/{index}", + "methods":[ + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names to limit the returned information" + } + } + } + ] + }, + "params":{ + "format":{ + "type":"string", + "description":"a short version of the Accept header, e.g. json, yaml" + }, + "h":{ + "type":"list", + "description":"Comma-separated list of column names to display" + }, + "help":{ + "type":"boolean", + "description":"Return help information", + "default":false + }, + "s":{ + "type":"list", + "description":"Comma-separated list of column names or column aliases to sort by" + }, + "v":{ + "type":"boolean", + "description":"Verbose mode. Display column headers", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cat.fielddata.json b/src/ApiGenerator/RestSpecification/Core/cat.fielddata.json new file mode 100644 index 0000000000..6d418a9547 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cat.fielddata.json @@ -0,0 +1,80 @@ +{ + "cat.fielddata":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-field-data/", + "description":"Shows how much heap memory is currently being used by fielddata on every data node in the cluster." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cat/fielddata", + "methods":[ + "GET" + ] + }, + { + "path":"/_cat/fielddata/{fields}", + "methods":[ + "GET" + ], + "parts":{ + "fields":{ + "type":"list", + "description":"A comma-separated list of fields to return the fielddata size" + } + } + } + ] + }, + "params":{ + "format":{ + "type":"string", + "description":"a short version of the Accept header, e.g. json, yaml" + }, + "bytes":{ + "type":"enum", + "description":"The unit in which to display byte values", + "options":[ + "b", + "k", + "kb", + "m", + "mb", + "g", + "gb", + "t", + "tb", + "p", + "pb" + ] + }, + "h":{ + "type":"list", + "description":"Comma-separated list of column names to display" + }, + "help":{ + "type":"boolean", + "description":"Return help information", + "default":false + }, + "s":{ + "type":"list", + "description":"Comma-separated list of column names or column aliases to sort by" + }, + "v":{ + "type":"boolean", + "description":"Verbose mode. Display column headers", + "default":false + }, + "fields":{ + "type":"list", + "description":"A comma-separated list of fields to return in the output" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cat.health.json b/src/ApiGenerator/RestSpecification/Core/cat.health.json new file mode 100644 index 0000000000..0a3cc9be1f --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cat.health.json @@ -0,0 +1,65 @@ +{ + "cat.health":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-health/", + "description":"Returns a concise representation of the cluster health." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cat/health", + "methods":[ + "GET" + ] + } + ] + }, + "params":{ + "format":{ + "type":"string", + "description":"a short version of the Accept header, e.g. json, yaml" + }, + "h":{ + "type":"list", + "description":"Comma-separated list of column names to display" + }, + "help":{ + "type":"boolean", + "description":"Return help information", + "default":false + }, + "s":{ + "type":"list", + "description":"Comma-separated list of column names or column aliases to sort by" + }, + "time":{ + "type":"enum", + "description":"The unit in which to display time values", + "options":[ + "d", + "h", + "m", + "s", + "ms", + "micros", + "nanos" + ] + }, + "ts":{ + "type":"boolean", + "description":"Set to false to disable timestamping", + "default":true + }, + "v":{ + "type":"boolean", + "description":"Verbose mode. Display column headers", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cat.help.json b/src/ApiGenerator/RestSpecification/Core/cat.help.json new file mode 100644 index 0000000000..21c9e63b79 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cat.help.json @@ -0,0 +1,34 @@ +{ + "cat.help":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-health/", + "description":"Returns help for the Cat APIs." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain" ] + }, + "url":{ + "paths":[ + { + "path":"/_cat", + "methods":[ + "GET" + ] + } + ] + }, + "params":{ + "help":{ + "type":"boolean", + "description":"Return help information", + "default":false + }, + "s":{ + "type":"list", + "description":"Comma-separated list of column names or column aliases to sort by" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cat.indices.json b/src/ApiGenerator/RestSpecification/Core/cat.indices.json new file mode 100644 index 0000000000..1f6ad64e01 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cat.indices.json @@ -0,0 +1,132 @@ +{ + "cat.indices":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-indices/", + "description":"Returns information about indices: number of primaries and replicas, document counts, disk size, ..." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cat/indices", + "methods":[ + "GET" + ] + }, + { + "path":"/_cat/indices/{index}", + "methods":[ + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names to limit the returned information" + } + } + } + ] + }, + "params":{ + "format":{ + "type":"string", + "description":"a short version of the Accept header, e.g. json, yaml" + }, + "bytes":{ + "type":"enum", + "description":"The unit in which to display byte values", + "options":[ + "b", + "k", + "kb", + "m", + "mb", + "g", + "gb", + "t", + "tb", + "p", + "pb" + ] + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)", + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "h":{ + "type":"list", + "description":"Comma-separated list of column names to display" + }, + "health":{ + "type":"enum", + "options":[ + "green", + "yellow", + "red" + ], + "description":"A health status (\"green\", \"yellow\", or \"red\" to filter only indices matching the specified health status" + }, + "help":{ + "type":"boolean", + "description":"Return help information", + "default":false + }, + "pri":{ + "type":"boolean", + "description":"Set to true to return stats only for primary shards", + "default":false + }, + "s":{ + "type":"list", + "description":"Comma-separated list of column names or column aliases to sort by" + }, + "time":{ + "type":"enum", + "description":"The unit in which to display time values", + "options":[ + "d", + "h", + "m", + "s", + "ms", + "micros", + "nanos" + ] + }, + "v":{ + "type":"boolean", + "description":"Verbose mode. Display column headers", + "default":false + }, + "include_unloaded_segments":{ + "type":"boolean", + "description":"If set to true segment stats will include stats for segments that are not currently loaded into memory", + "default":false + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default": "all", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cat.master.json b/src/ApiGenerator/RestSpecification/Core/cat.master.json new file mode 100644 index 0000000000..26e0d29110 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cat.master.json @@ -0,0 +1,55 @@ +{ + "cat.master":{ + "documentation":{ + "url":"https://opensearch.org/docs/1.2/opensearch/rest-api/cat/cat-master/", + "description":"Returns information about the master node. Deprecated as of OpenSearch 2.0, use cat-cluster_manager instead." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cat/master", + "methods":[ + "GET" + ] + } + ] + }, + "params":{ + "format":{ + "type":"string", + "description":"a short version of the Accept header, e.g. json, yaml" + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "h":{ + "type":"list", + "description":"Comma-separated list of column names to display" + }, + "help":{ + "type":"boolean", + "description":"Return help information", + "default":false + }, + "s":{ + "type":"list", + "description":"Comma-separated list of column names or column aliases to sort by" + }, + "v":{ + "type":"boolean", + "description":"Verbose mode. Display column headers", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cat.nodeattrs.json b/src/ApiGenerator/RestSpecification/Core/cat.nodeattrs.json new file mode 100644 index 0000000000..61aa48cd6e --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cat.nodeattrs.json @@ -0,0 +1,59 @@ +{ + "cat.nodeattrs":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-nodeattrs/", + "description":"Returns information about custom node attributes." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cat/nodeattrs", + "methods":[ + "GET" + ] + } + ] + }, + "params":{ + "format":{ + "type":"string", + "description":"a short version of the Accept header, e.g. json, yaml" + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "h":{ + "type":"list", + "description":"Comma-separated list of column names to display" + }, + "help":{ + "type":"boolean", + "description":"Return help information", + "default":false + }, + "s":{ + "type":"list", + "description":"Comma-separated list of column names or column aliases to sort by" + }, + "v":{ + "type":"boolean", + "description":"Verbose mode. Display column headers", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cat.nodes.json b/src/ApiGenerator/RestSpecification/Core/cat.nodes.json new file mode 100644 index 0000000000..3e6d9e1f2e --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cat.nodes.json @@ -0,0 +1,89 @@ +{ + "cat.nodes":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-nodes/", + "description":"Returns basic statistics about performance of cluster nodes." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cat/nodes", + "methods":[ + "GET" + ] + } + ] + }, + "params":{ + "bytes":{ + "type":"enum", + "description":"The unit in which to display byte values", + "options":[ + "b", + "k", + "kb", + "m", + "mb", + "g", + "gb", + "t", + "tb", + "p", + "pb" + ] + }, + "format":{ + "type":"string", + "description":"a short version of the Accept header, e.g. json, yaml" + }, + "full_id":{ + "type":"boolean", + "description":"Return the full node ID instead of the shortened version (default: false)" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "h":{ + "type":"list", + "description":"Comma-separated list of column names to display" + }, + "help":{ + "type":"boolean", + "description":"Return help information", + "default":false + }, + "s":{ + "type":"list", + "description":"Comma-separated list of column names or column aliases to sort by" + }, + "time":{ + "type":"enum", + "description":"The unit in which to display time values", + "options":[ + "d", + "h", + "m", + "s", + "ms", + "micros", + "nanos" + ] + }, + "v":{ + "type":"boolean", + "description":"Verbose mode. Display column headers", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cat.pending_tasks.json b/src/ApiGenerator/RestSpecification/Core/cat.pending_tasks.json new file mode 100644 index 0000000000..8164f6c004 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cat.pending_tasks.json @@ -0,0 +1,72 @@ +{ + "cat.pending_tasks":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-pending-tasks/", + "description":"Returns a concise representation of the cluster pending tasks." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cat/pending_tasks", + "methods":[ + "GET" + ] + } + ] + }, + "params":{ + "format":{ + "type":"string", + "description":"a short version of the Accept header, e.g. json, yaml" + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "h":{ + "type":"list", + "description":"Comma-separated list of column names to display" + }, + "help":{ + "type":"boolean", + "description":"Return help information", + "default":false + }, + "s":{ + "type":"list", + "description":"Comma-separated list of column names or column aliases to sort by" + }, + "time":{ + "type":"enum", + "description":"The unit in which to display time values", + "options":[ + "d", + "h", + "m", + "s", + "ms", + "micros", + "nanos" + ] + }, + "v":{ + "type":"boolean", + "description":"Verbose mode. Display column headers", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cat.plugins.json b/src/ApiGenerator/RestSpecification/Core/cat.plugins.json new file mode 100644 index 0000000000..fd25b004c8 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cat.plugins.json @@ -0,0 +1,64 @@ +{ + "cat.plugins":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-plugins/", + "description":"Returns information about installed plugins across nodes node." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cat/plugins", + "methods":[ + "GET" + ] + } + ] + }, + "params":{ + "format":{ + "type":"string", + "description":"a short version of the Accept header, e.g. json, yaml" + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "h":{ + "type":"list", + "description":"Comma-separated list of column names to display" + }, + "help":{ + "type":"boolean", + "description":"Return help information", + "default":false + }, + "include_bootstrap":{ + "type":"boolean", + "description":"Include bootstrap plugins in the response", + "default":false + }, + "s":{ + "type":"list", + "description":"Comma-separated list of column names or column aliases to sort by" + }, + "v":{ + "type":"boolean", + "description":"Verbose mode. Display column headers", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cat.recovery.json b/src/ApiGenerator/RestSpecification/Core/cat.recovery.json new file mode 100644 index 0000000000..c1e9d1c844 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cat.recovery.json @@ -0,0 +1,103 @@ +{ + "cat.recovery":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-recovery/", + "description":"Returns information about index shard recoveries, both on-going completed." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cat/recovery", + "methods":[ + "GET" + ] + }, + { + "path":"/_cat/recovery/{index}", + "methods":[ + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"Comma-separated list or wildcard expression of index names to limit the returned information" + } + } + } + ] + }, + "params":{ + "format":{ + "type":"string", + "description":"a short version of the Accept header, e.g. json, yaml" + }, + "active_only":{ + "type":"boolean", + "description":"If `true`, the response only includes ongoing shard recoveries", + "default":false + }, + "bytes":{ + "type":"enum", + "description":"The unit in which to display byte values", + "options":[ + "b", + "k", + "kb", + "m", + "mb", + "g", + "gb", + "t", + "tb", + "p", + "pb" + ] + }, + "detailed":{ + "type":"boolean", + "description":"If `true`, the response includes detailed information about shard recoveries", + "default":false + }, + "h":{ + "type":"list", + "description":"Comma-separated list of column names to display" + }, + "help":{ + "type":"boolean", + "description":"Return help information", + "default":false + }, + "index":{ + "type":"list", + "description":"Comma-separated list or wildcard expression of index names to limit the returned information" + }, + "s":{ + "type":"list", + "description":"Comma-separated list of column names or column aliases to sort by" + }, + "time":{ + "type":"enum", + "description":"The unit in which to display time values", + "options":[ + "d", + "h", + "m", + "s", + "ms", + "micros", + "nanos" + ] + }, + "v":{ + "type":"boolean", + "description":"Verbose mode. Display column headers", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cat.repositories.json b/src/ApiGenerator/RestSpecification/Core/cat.repositories.json new file mode 100644 index 0000000000..294bedc001 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cat.repositories.json @@ -0,0 +1,60 @@ +{ + "cat.repositories":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-repositories/", + "description":"Returns information about snapshot repositories registered in the cluster." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cat/repositories", + "methods":[ + "GET" + ] + } + ] + }, + "params":{ + "format":{ + "type":"string", + "description":"a short version of the Accept header, e.g. json, yaml" + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node", + "default":false + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "h":{ + "type":"list", + "description":"Comma-separated list of column names to display" + }, + "help":{ + "type":"boolean", + "description":"Return help information", + "default":false + }, + "s":{ + "type":"list", + "description":"Comma-separated list of column names or column aliases to sort by" + }, + "v":{ + "type":"boolean", + "description":"Verbose mode. Display column headers", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cat.segments.json b/src/ApiGenerator/RestSpecification/Core/cat.segments.json new file mode 100644 index 0000000000..24a28410e5 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cat.segments.json @@ -0,0 +1,76 @@ +{ + "cat.segments":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-segments/", + "description":"Provides low-level information about the segments in the shards of an index." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cat/segments", + "methods":[ + "GET" + ] + }, + { + "path":"/_cat/segments/{index}", + "methods":[ + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names to limit the returned information" + } + } + } + ] + }, + "params":{ + "format":{ + "type":"string", + "description":"a short version of the Accept header, e.g. json, yaml" + }, + "bytes":{ + "type":"enum", + "description":"The unit in which to display byte values", + "options":[ + "b", + "k", + "kb", + "m", + "mb", + "g", + "gb", + "t", + "tb", + "p", + "pb" + ] + }, + "h":{ + "type":"list", + "description":"Comma-separated list of column names to display" + }, + "help":{ + "type":"boolean", + "description":"Return help information", + "default":false + }, + "s":{ + "type":"list", + "description":"Comma-separated list of column names or column aliases to sort by" + }, + "v":{ + "type":"boolean", + "description":"Verbose mode. Display column headers", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cat.shards.json b/src/ApiGenerator/RestSpecification/Core/cat.shards.json new file mode 100644 index 0000000000..7241591b38 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cat.shards.json @@ -0,0 +1,101 @@ +{ + "cat.shards":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-shards/", + "description":"Provides a detailed view of shard allocation on nodes." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cat/shards", + "methods":[ + "GET" + ] + }, + { + "path":"/_cat/shards/{index}", + "methods":[ + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names to limit the returned information" + } + } + } + ] + }, + "params":{ + "format":{ + "type":"string", + "description":"a short version of the Accept header, e.g. json, yaml" + }, + "bytes":{ + "type":"enum", + "description":"The unit in which to display byte values", + "options":[ + "b", + "k", + "kb", + "m", + "mb", + "g", + "gb", + "t", + "tb", + "p", + "pb" + ] + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)", + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "h":{ + "type":"list", + "description":"Comma-separated list of column names to display" + }, + "help":{ + "type":"boolean", + "description":"Return help information", + "default":false + }, + "s":{ + "type":"list", + "description":"Comma-separated list of column names or column aliases to sort by" + }, + "time":{ + "type":"enum", + "description":"The unit in which to display time values", + "options":[ + "d", + "h", + "m", + "s", + "ms", + "micros", + "nanos" + ] + }, + "v":{ + "type":"boolean", + "description":"Verbose mode. Display column headers", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cat.snapshots.json b/src/ApiGenerator/RestSpecification/Core/cat.snapshots.json new file mode 100644 index 0000000000..ce8e73d29e --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cat.snapshots.json @@ -0,0 +1,85 @@ +{ + "cat.snapshots":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-snapshots/", + "description":"Returns all snapshots in a specific repository." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cat/snapshots", + "methods":[ + "GET" + ] + }, + { + "path":"/_cat/snapshots/{repository}", + "methods":[ + "GET" + ], + "parts":{ + "repository":{ + "type":"list", + "description":"Name of repository from which to fetch the snapshot information" + } + } + } + ] + }, + "params":{ + "format":{ + "type":"string", + "description":"a short version of the Accept header, e.g. json, yaml" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Set to true to ignore unavailable snapshots", + "default":false + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "h":{ + "type":"list", + "description":"Comma-separated list of column names to display" + }, + "help":{ + "type":"boolean", + "description":"Return help information", + "default":false + }, + "s":{ + "type":"list", + "description":"Comma-separated list of column names or column aliases to sort by" + }, + "time":{ + "type":"enum", + "description":"The unit in which to display time values", + "options":[ + "d", + "h", + "m", + "s", + "ms", + "micros", + "nanos" + ] + }, + "v":{ + "type":"boolean", + "description":"Verbose mode. Display column headers", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cat.tasks.json b/src/ApiGenerator/RestSpecification/Core/cat.tasks.json new file mode 100644 index 0000000000..0a2bad4bbe --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cat.tasks.json @@ -0,0 +1,76 @@ +{ + "cat.tasks":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-tasks/", + "description":"Returns information about the tasks currently executing on one or more nodes in the cluster." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cat/tasks", + "methods":[ + "GET" + ] + } + ] + }, + "params":{ + "format":{ + "type":"string", + "description":"a short version of the Accept header, e.g. json, yaml" + }, + "nodes":{ + "type":"list", + "description":"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" + }, + "actions":{ + "type":"list", + "description":"A comma-separated list of actions that should be returned. Leave empty to return all." + }, + "detailed":{ + "type":"boolean", + "description":"Return detailed task information (default: false)" + }, + "parent_task_id":{ + "type":"string", + "description":"Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all." + }, + "h":{ + "type":"list", + "description":"Comma-separated list of column names to display" + }, + "help":{ + "type":"boolean", + "description":"Return help information", + "default":false + }, + "s":{ + "type":"list", + "description":"Comma-separated list of column names or column aliases to sort by" + }, + "time":{ + "type":"enum", + "description":"The unit in which to display time values", + "options":[ + "d", + "h", + "m", + "s", + "ms", + "micros", + "nanos" + ] + }, + "v":{ + "type":"boolean", + "description":"Verbose mode. Display column headers", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cat.templates.json b/src/ApiGenerator/RestSpecification/Core/cat.templates.json new file mode 100644 index 0000000000..d1dfdb95df --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cat.templates.json @@ -0,0 +1,71 @@ +{ + "cat.templates":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-templates/", + "description":"Returns information about existing templates." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cat/templates", + "methods":[ + "GET" + ] + }, + { + "path":"/_cat/templates/{name}", + "methods":[ + "GET" + ], + "parts":{ + "name":{ + "type":"string", + "description":"A pattern that returned template names must match" + } + } + } + ] + }, + "params":{ + "format":{ + "type":"string", + "description":"a short version of the Accept header, e.g. json, yaml" + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "h":{ + "type":"list", + "description":"Comma-separated list of column names to display" + }, + "help":{ + "type":"boolean", + "description":"Return help information", + "default":false + }, + "s":{ + "type":"list", + "description":"Comma-separated list of column names or column aliases to sort by" + }, + "v":{ + "type":"boolean", + "description":"Verbose mode. Display column headers", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cat.thread_pool.json b/src/ApiGenerator/RestSpecification/Core/cat.thread_pool.json new file mode 100644 index 0000000000..8279f0b7bc --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cat.thread_pool.json @@ -0,0 +1,71 @@ +{ + "cat.thread_pool":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-thread-pool/", + "description":"Returns cluster-wide thread pool statistics per node.\nBy default the active, queue and rejected statistics are returned for all thread pools." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain", "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cat/thread_pool", + "methods":[ + "GET" + ] + }, + { + "path":"/_cat/thread_pool/{thread_pool_patterns}", + "methods":[ + "GET" + ], + "parts":{ + "thread_pool_patterns":{ + "type":"list", + "description":"A comma-separated list of regular-expressions to filter the thread pools in the output" + } + } + } + ] + }, + "params":{ + "format":{ + "type":"string", + "description":"a short version of the Accept header, e.g. json, yaml" + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "h":{ + "type":"list", + "description":"Comma-separated list of column names to display" + }, + "help":{ + "type":"boolean", + "description":"Return help information", + "default":false + }, + "s":{ + "type":"list", + "description":"Comma-separated list of column names or column aliases to sort by" + }, + "v":{ + "type":"boolean", + "description":"Verbose mode. Display column headers", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/clear_scroll.json b/src/ApiGenerator/RestSpecification/Core/clear_scroll.json new file mode 100644 index 0000000000..f352a421a2 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/clear_scroll.json @@ -0,0 +1,28 @@ +{ + "clear_scroll":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/scroll/", + "description":"Explicitly clears the search context for a scroll." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json","text/plain"] + }, + "url":{ + "paths":[ + { + "path":"/_search/scroll", + "methods":[ + "DELETE" + ] + } + ] + }, + "params":{}, + "body":{ + "description":"A comma-separated list of scroll IDs to clear if none was specified via the scroll_id parameter" + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cluster.allocation_explain.json b/src/ApiGenerator/RestSpecification/Core/cluster.allocation_explain.json new file mode 100644 index 0000000000..b14bd18a45 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cluster.allocation_explain.json @@ -0,0 +1,38 @@ +{ + "cluster.allocation_explain":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cluster-allocation/", + "description":"Provides explanations for shard allocations in the cluster." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cluster/allocation/explain", + "methods":[ + "GET", + "POST" + ] + } + ] + }, + "params":{ + "include_yes_decisions":{ + "type":"boolean", + "description":"Return 'YES' decisions in explanation (default: false)" + }, + "include_disk_info":{ + "type":"boolean", + "description":"Return information about disk usage and shard sizes (default: false)" + } + }, + "body":{ + "description":"The index, shard, and primary flag to explain. Empty means 'explain the first unassigned shard'" + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cluster.delete_component_template.json b/src/ApiGenerator/RestSpecification/Core/cluster.delete_component_template.json new file mode 100644 index 0000000000..b4ee56dab7 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cluster.delete_component_template.json @@ -0,0 +1,43 @@ +{ + "cluster.delete_component_template":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/index-templates/", + "description":"Deletes a component template" + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_component_template/{name}", + "methods":[ + "DELETE" + ], + "parts":{ + "name":{ + "type":"string", + "description":"The name of the template" + } + } + } + ] + }, + "params":{ + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cluster.delete_voting_config_exclusions.json b/src/ApiGenerator/RestSpecification/Core/cluster.delete_voting_config_exclusions.json new file mode 100644 index 0000000000..d32583908f --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cluster.delete_voting_config_exclusions.json @@ -0,0 +1,30 @@ +{ + "cluster.delete_voting_config_exclusions":{ + "documentation":{ + "url":"", + "description":"Clears cluster voting config exclusions." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cluster/voting_config_exclusions", + "methods":[ + "DELETE" + ] + } + ] + }, + "params":{ + "wait_for_removal": { + "type":"boolean", + "description":"Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions list.", + "default":true + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cluster.exists_component_template.json b/src/ApiGenerator/RestSpecification/Core/cluster.exists_component_template.json new file mode 100644 index 0000000000..64679d2e6b --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cluster.exists_component_template.json @@ -0,0 +1,43 @@ +{ + "cluster.exists_component_template":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/index-templates/", + "description":"Returns information about whether a particular component template exist" + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_component_template/{name}", + "methods":[ + "HEAD" + ], + "parts":{ + "name":{ + "type":"string", + "description":"The name of the template" + } + } + } + ] + }, + "params":{ + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cluster.get_component_template.json b/src/ApiGenerator/RestSpecification/Core/cluster.get_component_template.json new file mode 100644 index 0000000000..6e3329031a --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cluster.get_component_template.json @@ -0,0 +1,49 @@ +{ + "cluster.get_component_template":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/index-templates/", + "description":"Returns one or more component templates" + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_component_template", + "methods":[ + "GET" + ] + }, + { + "path":"/_component_template/{name}", + "methods":[ + "GET" + ], + "parts":{ + "name":{ + "type":"list", + "description":"The comma separated names of the component templates" + } + } + } + ] + }, + "params":{ + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cluster.get_settings.json b/src/ApiGenerator/RestSpecification/Core/cluster.get_settings.json new file mode 100644 index 0000000000..d329a8df2b --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cluster.get_settings.json @@ -0,0 +1,46 @@ +{ + "cluster.get_settings":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/", + "description":"Returns cluster settings." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cluster/settings", + "methods":[ + "GET" + ] + } + ] + }, + "params":{ + "flat_settings":{ + "type":"boolean", + "description":"Return settings in flat format (default: false)" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "include_defaults":{ + "type":"boolean", + "description":"Whether to return all default clusters setting.", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cluster.health.json b/src/ApiGenerator/RestSpecification/Core/cluster.health.json new file mode 100644 index 0000000000..4aefa8d302 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cluster.health.json @@ -0,0 +1,112 @@ +{ + "cluster.health":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cluster-health/", + "description":"Returns basic information about the health of the cluster." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cluster/health", + "methods":[ + "GET" + ] + }, + { + "path":"/_cluster/health/{index}", + "methods":[ + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"Limit the information returned to a specific index" + } + } + } + ] + }, + "params":{ + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"all", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "level":{ + "type":"enum", + "options":[ + "cluster", + "indices", + "shards" + ], + "default":"cluster", + "description":"Specify the level of detail for returned information" + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "wait_for_active_shards":{ + "type":"string", + "description":"Wait until the specified number of shards is active" + }, + "wait_for_nodes":{ + "type":"string", + "description":"Wait until the specified number of nodes is available" + }, + "wait_for_events":{ + "type":"enum", + "options":[ + "immediate", + "urgent", + "high", + "normal", + "low", + "languid" + ], + "description":"Wait until all currently queued events with the given priority are processed" + }, + "wait_for_no_relocating_shards":{ + "type":"boolean", + "description":"Whether to wait until there are no relocating shards in the cluster" + }, + "wait_for_no_initializing_shards":{ + "type":"boolean", + "description":"Whether to wait until there are no initializing shards in the cluster" + }, + "wait_for_status":{ + "type":"enum", + "options":[ + "green", + "yellow", + "red" + ], + "description":"Wait until cluster is in a specific state" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cluster.pending_tasks.json b/src/ApiGenerator/RestSpecification/Core/cluster.pending_tasks.json new file mode 100644 index 0000000000..176385d912 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cluster.pending_tasks.json @@ -0,0 +1,37 @@ +{ + "cluster.pending_tasks":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-pending-tasks/", + "description":"Returns a list of any cluster-level changes (e.g. create index, update mapping,\nallocate or fail shard) which have not yet been executed." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cluster/pending_tasks", + "methods":[ + "GET" + ] + } + ] + }, + "params":{ + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cluster.post_voting_config_exclusions.json b/src/ApiGenerator/RestSpecification/Core/cluster.post_voting_config_exclusions.json new file mode 100644 index 0000000000..d15970dbfb --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cluster.post_voting_config_exclusions.json @@ -0,0 +1,38 @@ +{ + "cluster.post_voting_config_exclusions":{ + "documentation":{ + "url":"", + "description":"Updates the cluster voting config exclusions by node ids or node names." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cluster/voting_config_exclusions", + "methods":[ + "POST" + ] + } + ] + }, + "params":{ + "node_ids":{ + "type":"string", + "description":"A comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_names." + }, + "node_names":{ + "type":"string", + "description":"A comma-separated list of the names of the nodes to exclude from the voting configuration. If specified, you may not also specify ?node_ids." + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout", + "default":"30s" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cluster.put_component_template.json b/src/ApiGenerator/RestSpecification/Core/cluster.put_component_template.json new file mode 100644 index 0000000000..50eed63d39 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cluster.put_component_template.json @@ -0,0 +1,54 @@ +{ + "cluster.put_component_template":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/index-templates/", + "description":"Creates or updates a component template" + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_component_template/{name}", + "methods":[ + "PUT", + "POST" + ], + "parts":{ + "name":{ + "type":"string", + "description":"The name of the template" + } + } + } + ] + }, + "params":{ + "create":{ + "type":"boolean", + "description":"Whether the index template should only be added if new or can also replace an existing one", + "default":false + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + } + }, + "body":{ + "description":"The template definition", + "required":true + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cluster.put_settings.json b/src/ApiGenerator/RestSpecification/Core/cluster.put_settings.json new file mode 100644 index 0000000000..32ae4c3ac2 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cluster.put_settings.json @@ -0,0 +1,46 @@ +{ + "cluster.put_settings":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cluster-settings/", + "description":"Updates the cluster settings." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cluster/settings", + "methods":[ + "PUT" + ] + } + ] + }, + "params":{ + "flat_settings":{ + "type":"boolean", + "description":"Return settings in flat format (default: false)" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + } + }, + "body":{ + "description":"The settings to be updated. Can be either `transient` or `persistent` (survives cluster restart).", + "required":true + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cluster.remote_info.json b/src/ApiGenerator/RestSpecification/Core/cluster.remote_info.json new file mode 100644 index 0000000000..d0ba3c375a --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cluster.remote_info.json @@ -0,0 +1,24 @@ +{ + "cluster.remote_info":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/remote-info/", + "description":"Returns the information about configured remote clusters." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_remote/info", + "methods":[ + "GET" + ] + } + ] + }, + "params":{} + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cluster.reroute.json b/src/ApiGenerator/RestSpecification/Core/cluster.reroute.json new file mode 100644 index 0000000000..14b75a551a --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cluster.reroute.json @@ -0,0 +1,66 @@ +{ + "cluster.reroute":{ + "documentation":{ + "url":"", + "description":"Allows to manually change the allocation of individual shards in the cluster." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cluster/reroute", + "methods":[ + "POST" + ] + } + ] + }, + "params":{ + "dry_run":{ + "type":"boolean", + "description":"Simulate the operation only and return the resulting state" + }, + "explain":{ + "type":"boolean", + "description":"Return an explanation of why the commands can or cannot be executed" + }, + "retry_failed":{ + "type":"boolean", + "description":"Retries allocation of shards that are blocked due to too many subsequent allocation failures" + }, + "metric":{ + "type":"list", + "options":[ + "_all", + "blocks", + "metadata", + "nodes", + "routing_table", + "master_node", + "version" + ], + "description":"Limit the information returned to the specified metrics. Defaults to all but metadata" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + } + }, + "body":{ + "description":"The definition of `commands` to perform (`move`, `cancel`, `allocate`)" + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cluster.state.json b/src/ApiGenerator/RestSpecification/Core/cluster.state.json new file mode 100644 index 0000000000..89767d4dc8 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cluster.state.json @@ -0,0 +1,117 @@ +{ + "cluster.state":{ + "documentation":{ + "url":"", + "description":"Returns a comprehensive information about the state of the cluster." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cluster/state", + "methods":[ + "GET" + ] + }, + { + "path":"/_cluster/state/{metric}", + "methods":[ + "GET" + ], + "parts":{ + "metric":{ + "type":"list", + "options":[ + "_all", + "blocks", + "metadata", + "nodes", + "routing_table", + "routing_nodes", + "master_node", + "version" + ], + "description":"Limit the information returned to the specified metrics" + } + } + }, + { + "path":"/_cluster/state/{metric}/{index}", + "methods":[ + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices" + }, + "metric":{ + "type":"list", + "options":[ + "_all", + "blocks", + "metadata", + "nodes", + "routing_table", + "routing_nodes", + "master_node", + "version" + ], + "description":"Limit the information returned to the specified metrics" + } + } + } + ] + }, + "params":{ + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "flat_settings":{ + "type":"boolean", + "description":"Return settings in flat format (default: false)" + }, + "wait_for_metadata_version":{ + "type":"number", + "description":"Wait for the metadata version to be equal or greater than the specified metadata version" + }, + "wait_for_timeout":{ + "type":"time", + "description":"The maximum time to wait for wait_for_metadata_version before timing out" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/cluster.stats.json b/src/ApiGenerator/RestSpecification/Core/cluster.stats.json new file mode 100644 index 0000000000..7545f6ba99 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/cluster.stats.json @@ -0,0 +1,45 @@ +{ + "cluster.stats":{ + "documentation":{ + "url":"", + "description":"Returns high-level overview of cluster statistics." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cluster/stats", + "methods":[ + "GET" + ] + }, + { + "path":"/_cluster/stats/nodes/{node_id}", + "methods":[ + "GET" + ], + "parts":{ + "node_id":{ + "type":"list", + "description":"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" + } + } + } + ] + }, + "params":{ + "flat_settings":{ + "type":"boolean", + "description":"Return settings in flat format (default: false)" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/count.json b/src/ApiGenerator/RestSpecification/Core/count.json new file mode 100644 index 0000000000..53aad4dde3 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/count.json @@ -0,0 +1,113 @@ +{ + "count":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/count/", + "description":"Returns number of documents matching a query." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_count", + "methods":[ + "POST", + "GET" + ] + + }, + { + "path":"/{index}/_count", + "methods":[ + "POST", + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of indices to restrict the results" + } + } + } + ] + }, + "params":{ + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "ignore_throttled":{ + "type":"boolean", + "description":"Whether specified concrete, expanded or aliased indices should be ignored when throttled" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "min_score":{ + "type":"number", + "description":"Include only documents with a specific `_score` value in the result" + }, + "preference":{ + "type":"string", + "description":"Specify the node or shard the operation should be performed on (default: random)" + }, + "routing":{ + "type":"list", + "description":"A comma-separated list of specific routing values" + }, + "q":{ + "type":"string", + "description":"Query in the Lucene query string syntax" + }, + "analyzer":{ + "type":"string", + "description":"The analyzer to use for the query string" + }, + "analyze_wildcard":{ + "type":"boolean", + "description":"Specify whether wildcard and prefix queries should be analyzed (default: false)" + }, + "default_operator":{ + "type":"enum", + "options":[ + "AND", + "OR" + ], + "default":"OR", + "description":"The default operator for query string query (AND or OR)" + }, + "df":{ + "type":"string", + "description":"The field to use as default where no field prefix is given in the query string" + }, + "lenient":{ + "type":"boolean", + "description":"Specify whether format-based query failures (such as providing text to a numeric field) should be ignored" + }, + "terminate_after":{ + "type":"number", + "description":"The maximum count for each shard, upon reaching which the query execution will terminate early" + } + }, + "body":{ + "description":"A query to restrict the results specified with the Query DSL (optional)" + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/create.json b/src/ApiGenerator/RestSpecification/Core/create.json new file mode 100644 index 0000000000..a0932b971a --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/create.json @@ -0,0 +1,79 @@ +{ + "create":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/index-document/", + "description":"Creates a new document in the index.\n\nReturns a 409 response when a document with a same ID already exists in the index." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}/_create/{id}", + "methods":[ + "PUT", + "POST" + ], + "parts":{ + "id":{ + "type":"string", + "description":"Document ID" + }, + "index":{ + "type":"string", + "description":"The name of the index" + } + } + } + ] + }, + "params":{ + "wait_for_active_shards":{ + "type":"string", + "description":"Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)" + }, + "refresh":{ + "type":"enum", + "options":[ + "true", + "false", + "wait_for" + ], + "description":"If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes." + }, + "routing":{ + "type":"string", + "description":"Specific routing value" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "version":{ + "type":"number", + "description":"Explicit version number for concurrency control" + }, + "version_type":{ + "type":"enum", + "options":[ + "internal", + "external", + "external_gte" + ], + "description":"Specific version type" + }, + "pipeline":{ + "type":"string", + "description":"The pipeline id to preprocess incoming documents with" + } + }, + "body":{ + "description":"The document", + "required":true + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/dangling_indices.delete_dangling_index.json b/src/ApiGenerator/RestSpecification/Core/dangling_indices.delete_dangling_index.json new file mode 100644 index 0000000000..13670576c3 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/dangling_indices.delete_dangling_index.json @@ -0,0 +1,47 @@ +{ + "dangling_indices.delete_dangling_index": { + "documentation": { + "url": "", + "description": "Deletes the specified dangling index" + }, + "stability": "stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url": { + "paths": [ + { + "path": "/_dangling/{index_uuid}", + "methods": [ + "DELETE" + ], + "parts": { + "index_uuid": { + "type": "string", + "description": "The UUID of the dangling index" + } + } + } + ] + }, + "params": { + "accept_data_loss": { + "type": "boolean", + "description": "Must be set to true in order to delete the dangling index" + }, + "timeout": { + "type": "time", + "description": "Explicit operation timeout" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/dangling_indices.import_dangling_index.json b/src/ApiGenerator/RestSpecification/Core/dangling_indices.import_dangling_index.json new file mode 100644 index 0000000000..64c0568eb7 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/dangling_indices.import_dangling_index.json @@ -0,0 +1,47 @@ +{ + "dangling_indices.import_dangling_index": { + "documentation": { + "url": "", + "description": "Imports the specified dangling index" + }, + "stability": "stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url": { + "paths": [ + { + "path": "/_dangling/{index_uuid}", + "methods": [ + "POST" + ], + "parts": { + "index_uuid": { + "type": "string", + "description": "The UUID of the dangling index" + } + } + } + ] + }, + "params": { + "accept_data_loss": { + "type": "boolean", + "description": "Must be set to true in order to import the dangling index" + }, + "timeout": { + "type": "time", + "description": "Explicit operation timeout" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/dangling_indices.list_dangling_indices.json b/src/ApiGenerator/RestSpecification/Core/dangling_indices.list_dangling_indices.json new file mode 100644 index 0000000000..0cab5e272d --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/dangling_indices.list_dangling_indices.json @@ -0,0 +1,24 @@ +{ + "dangling_indices.list_dangling_indices": { + "documentation": { + "url": "", + "description": "Returns all dangling indices." + }, + "stability": "stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url": { + "paths": [ + { + "path": "/_dangling", + "methods": [ + "GET" + ] + } + ] + }, + "params": {} + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/delete.json b/src/ApiGenerator/RestSpecification/Core/delete.json new file mode 100644 index 0000000000..2bbbe5114f --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/delete.json @@ -0,0 +1,78 @@ +{ + "delete":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/delete-document/", + "description":"Removes a document from the index." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}/_doc/{id}", + "methods":[ + "DELETE" + ], + "parts":{ + "id":{ + "type":"string", + "description":"The document ID" + }, + "index":{ + "type":"string", + "description":"The name of the index" + } + } + } + ] + }, + "params":{ + "wait_for_active_shards":{ + "type":"string", + "description":"Sets the number of shard copies that must be active before proceeding with the delete operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)" + }, + "refresh":{ + "type":"enum", + "options":[ + "true", + "false", + "wait_for" + ], + "description":"If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes." + }, + "routing":{ + "type":"string", + "description":"Specific routing value" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "if_seq_no":{ + "type":"number", + "description":"only perform the delete operation if the last operation that has changed the document has the specified sequence number" + }, + "if_primary_term":{ + "type":"number", + "description":"only perform the delete operation if the last operation that has changed the document has the specified primary term" + }, + "version":{ + "type":"number", + "description":"Explicit version number for concurrency control" + }, + "version_type":{ + "type":"enum", + "options":[ + "internal", + "external", + "external_gte", + "force" + ], + "description":"Specific version type" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/delete_by_query.json b/src/ApiGenerator/RestSpecification/Core/delete_by_query.json new file mode 100644 index 0000000000..c9a8e45fba --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/delete_by_query.json @@ -0,0 +1,185 @@ +{ + "delete_by_query":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/delete-by-query/", + "description":"Deletes documents matching the provided query." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}/_delete_by_query", + "methods":[ + "POST" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices" + } + } + } + ] + }, + "params":{ + "analyzer": { + "type" : "string", + "description" : "The analyzer to use for the query string" + }, + "analyze_wildcard": { + "type" : "boolean", + "description" : "Specify whether wildcard and prefix queries should be analyzed (default: false)" + }, + "default_operator": { + "type" : "enum", + "options" : ["AND","OR"], + "default" : "OR", + "description" : "The default operator for query string query (AND or OR)" + }, + "df": { + "type" : "string", + "description" : "The field to use as default where no field prefix is given in the query string" + }, + "from": { + "type" : "number", + "description" : "Starting offset (default: 0)" + }, + "ignore_unavailable": { + "type" : "boolean", + "description" : "Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices": { + "type" : "boolean", + "description" : "Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "conflicts":{ + "type":"enum", + "options":[ + "abort", + "proceed" + ], + "default":"abort", + "description":"What to do when the delete by query hits version conflicts?" + }, + "expand_wildcards": { + "type" : "enum", + "options" : [ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default" : "open", + "description" :"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "lenient": { + "type" : "boolean", + "description" : "Specify whether format-based query failures (such as providing text to a numeric field) should be ignored" + }, + "preference": { + "type" : "string", + "description" : "Specify the node or shard the operation should be performed on (default: random)" + }, + "q": { + "type" : "string", + "description" : "Query in the Lucene query string syntax" + }, + "routing": { + "type" : "list", + "description" : "A comma-separated list of specific routing values" + }, + "scroll": { + "type" : "time", + "description" : "Specify how long a consistent view of the index should be maintained for scrolled search" + }, + "search_type": { + "type" : "enum", + "options" : ["query_then_fetch", "dfs_query_then_fetch"], + "description" : "Search operation type" + }, + "search_timeout": { + "type" : "time", + "description" : "Explicit timeout for each search request. Defaults to no timeout." + }, + "max_docs": { + "type" : "number", + "description" : "Maximum number of documents to process (default: all documents)" + }, + "sort": { + "type" : "list", + "description" : "A comma-separated list of : pairs" + }, + "_source": { + "type" : "list", + "description" : "True or false to return the _source field or not, or a list of fields to return" + }, + "_source_excludes": { + "type" : "list", + "description" : "A list of fields to exclude from the returned _source field" + }, + "_source_includes": { + "type" : "list", + "description" : "A list of fields to extract and return from the _source field" + }, + "terminate_after": { + "type" : "number", + "description" : "The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early." + }, + "stats": { + "type" : "list", + "description" : "Specific 'tag' of the request for logging and statistical purposes" + }, + "version": { + "type" : "boolean", + "description" : "Specify whether to return document version as part of a hit" + }, + "request_cache": { + "type" : "boolean", + "description" : "Specify if request cache should be used for this request or not, defaults to index level setting" + }, + "refresh": { + "type" : "boolean", + "description" : "Should the effected indexes be refreshed?" + }, + "timeout": { + "type" : "time", + "default": "1m", + "description" : "Time each individual bulk request should wait for shards that are unavailable." + }, + "wait_for_active_shards": { + "type" : "string", + "description" : "Sets the number of shard copies that must be active before proceeding with the delete by query operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)" + }, + "scroll_size":{ + "type":"number", + "default":100, + "description":"Size on the scroll request powering the delete by query" + }, + "wait_for_completion": { + "type" : "boolean", + "default": true, + "description" : "Should the request should block until the delete by query is complete." + }, + "requests_per_second": { + "type": "number", + "default": 0, + "description": "The throttle for this request in sub-requests per second. -1 means no throttle." + }, + "slices": { + "type": "number|string", + "default": 1, + "description": "The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`." + } + }, + "body":{ + "description":"The search definition using the Query DSL", + "required":true + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/delete_by_query_rethrottle.json b/src/ApiGenerator/RestSpecification/Core/delete_by_query_rethrottle.json new file mode 100644 index 0000000000..39ff524319 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/delete_by_query_rethrottle.json @@ -0,0 +1,36 @@ +{ + "delete_by_query_rethrottle":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/delete-by-query/", + "description":"Changes the number of requests per second for a particular Delete By Query operation." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_delete_by_query/{task_id}/_rethrottle", + "methods":[ + "POST" + ], + "parts":{ + "task_id":{ + "type":"string", + "description":"The task id to rethrottle" + } + } + } + ] + }, + "params":{ + "requests_per_second":{ + "type":"number", + "required":true, + "description":"The throttle to set on this request in floating sub-requests per second. -1 means set no throttle." + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/delete_script.json b/src/ApiGenerator/RestSpecification/Core/delete_script.json new file mode 100644 index 0000000000..36b76fb222 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/delete_script.json @@ -0,0 +1,43 @@ +{ + "delete_script":{ + "documentation":{ + "url":"", + "description":"Deletes a script." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_scripts/{id}", + "methods":[ + "DELETE" + ], + "parts":{ + "id":{ + "type":"string", + "description":"Script ID" + } + } + } + ] + }, + "params":{ + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/exists.json b/src/ApiGenerator/RestSpecification/Core/exists.json new file mode 100644 index 0000000000..c0f131064d --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/exists.json @@ -0,0 +1,81 @@ +{ + "exists":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/get-documents/", + "description":"Returns information about whether a document exists in an index." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}/_doc/{id}", + "methods":[ + "HEAD" + ], + "parts":{ + "id":{ + "type":"string", + "description":"The document ID" + }, + "index":{ + "type":"string", + "description":"The name of the index" + } + } + } + ] + }, + "params":{ + "stored_fields":{ + "type":"list", + "description":"A comma-separated list of stored fields to return in the response" + }, + "preference":{ + "type":"string", + "description":"Specify the node or shard the operation should be performed on (default: random)" + }, + "realtime":{ + "type":"boolean", + "description":"Specify whether to perform the operation in realtime or search mode" + }, + "refresh":{ + "type":"boolean", + "description":"Refresh the shard containing the document before performing the operation" + }, + "routing":{ + "type":"string", + "description":"Specific routing value" + }, + "_source":{ + "type":"list", + "description":"True or false to return the _source field or not, or a list of fields to return" + }, + "_source_excludes":{ + "type":"list", + "description":"A list of fields to exclude from the returned _source field" + }, + "_source_includes":{ + "type":"list", + "description":"A list of fields to extract and return from the _source field" + }, + "version":{ + "type":"number", + "description":"Explicit version number for concurrency control" + }, + "version_type":{ + "type":"enum", + "options":[ + "internal", + "external", + "external_gte", + "force" + ], + "description":"Specific version type" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/exists_source.json b/src/ApiGenerator/RestSpecification/Core/exists_source.json new file mode 100644 index 0000000000..0f498b7c04 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/exists_source.json @@ -0,0 +1,77 @@ +{ + "exists_source":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/get-documents/", + "description":"Returns information about whether a document source exists in an index." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}/_source/{id}", + "methods":[ + "HEAD" + ], + "parts":{ + "id":{ + "type":"string", + "description":"The document ID" + }, + "index":{ + "type":"string", + "description":"The name of the index" + } + } + } + ] + }, + "params":{ + "preference":{ + "type":"string", + "description":"Specify the node or shard the operation should be performed on (default: random)" + }, + "realtime":{ + "type":"boolean", + "description":"Specify whether to perform the operation in realtime or search mode" + }, + "refresh":{ + "type":"boolean", + "description":"Refresh the shard containing the document before performing the operation" + }, + "routing":{ + "type":"string", + "description":"Specific routing value" + }, + "_source":{ + "type":"list", + "description":"True or false to return the _source field or not, or a list of fields to return" + }, + "_source_excludes":{ + "type":"list", + "description":"A list of fields to exclude from the returned _source field" + }, + "_source_includes":{ + "type":"list", + "description":"A list of fields to extract and return from the _source field" + }, + "version":{ + "type":"number", + "description":"Explicit version number for concurrency control" + }, + "version_type":{ + "type":"enum", + "options":[ + "internal", + "external", + "external_gte", + "force" + ], + "description":"Specific version type" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/explain.json b/src/ApiGenerator/RestSpecification/Core/explain.json new file mode 100644 index 0000000000..6ae2f8a08a --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/explain.json @@ -0,0 +1,93 @@ +{ + "explain":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/explain/", + "description":"Returns information about why a specific matches (or doesn't match) a query." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}/_explain/{id}", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "id":{ + "type":"string", + "description":"The document ID" + }, + "index":{ + "type":"string", + "description":"The name of the index" + } + } + } + ] + }, + "params":{ + "analyze_wildcard":{ + "type":"boolean", + "description":"Specify whether wildcards and prefix queries in the query string query should be analyzed (default: false)" + }, + "analyzer":{ + "type":"string", + "description":"The analyzer for the query string query" + }, + "default_operator":{ + "type":"enum", + "options":[ + "AND", + "OR" + ], + "default":"OR", + "description":"The default operator for query string query (AND or OR)" + }, + "df":{ + "type":"string", + "description":"The default field for query string query (default: _all)" + }, + "stored_fields":{ + "type":"list", + "description":"A comma-separated list of stored fields to return in the response" + }, + "lenient":{ + "type":"boolean", + "description":"Specify whether format-based query failures (such as providing text to a numeric field) should be ignored" + }, + "preference":{ + "type":"string", + "description":"Specify the node or shard the operation should be performed on (default: random)" + }, + "q":{ + "type":"string", + "description":"Query in the Lucene query string syntax" + }, + "routing":{ + "type":"string", + "description":"Specific routing value" + }, + "_source":{ + "type":"list", + "description":"True or false to return the _source field or not, or a list of fields to return" + }, + "_source_excludes":{ + "type":"list", + "description":"A list of fields to exclude from the returned _source field" + }, + "_source_includes":{ + "type":"list", + "description":"A list of fields to extract and return from the _source field" + } + }, + "body":{ + "description":"The query definition using the Query DSL" + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/features.get_features.json b/src/ApiGenerator/RestSpecification/Core/features.get_features.json new file mode 100644 index 0000000000..3ad4adc3a9 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/features.get_features.json @@ -0,0 +1,33 @@ +{ + "features.get_features":{ + "documentation":{ + "url":"h", + "description":"Gets a list of features which can be included in snapshots using the feature_states field when creating a snapshot" + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_features", + "methods":[ + "GET" + ] + } + ] + }, + "params":{ + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/field_caps.json b/src/ApiGenerator/RestSpecification/Core/field_caps.json new file mode 100644 index 0000000000..63382c4c22 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/field_caps.json @@ -0,0 +1,71 @@ +{ + "field_caps":{ + "documentation":{ + "url":"", + "description":"Returns the information about the capabilities of fields among multiple indices." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_field_caps", + "methods":[ + "GET", + "POST" + ] + }, + { + "path":"/{index}/_field_caps", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices" + } + } + } + ] + }, + "params":{ + "fields":{ + "type":"list", + "description":"A comma-separated list of field names" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "include_unmapped":{ + "type":"boolean", + "default":false, + "description":"Indicates whether unmapped fields should be included in the response." + } + }, + "body":{ + "description":"An index filter specified with the Query DSL" + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/get.json b/src/ApiGenerator/RestSpecification/Core/get.json new file mode 100644 index 0000000000..cc07436a83 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/get.json @@ -0,0 +1,81 @@ +{ + "get":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/get-documents/", + "description":"Returns a document." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}/_doc/{id}", + "methods":[ + "GET" + ], + "parts":{ + "id":{ + "type":"string", + "description":"The document ID" + }, + "index":{ + "type":"string", + "description":"The name of the index" + } + } + } + ] + }, + "params":{ + "stored_fields":{ + "type":"list", + "description":"A comma-separated list of stored fields to return in the response" + }, + "preference":{ + "type":"string", + "description":"Specify the node or shard the operation should be performed on (default: random)" + }, + "realtime":{ + "type":"boolean", + "description":"Specify whether to perform the operation in realtime or search mode" + }, + "refresh":{ + "type":"boolean", + "description":"Refresh the shard containing the document before performing the operation" + }, + "routing":{ + "type":"string", + "description":"Specific routing value" + }, + "_source":{ + "type":"list", + "description":"True or false to return the _source field or not, or a list of fields to return" + }, + "_source_excludes":{ + "type":"list", + "description":"A list of fields to exclude from the returned _source field" + }, + "_source_includes":{ + "type":"list", + "description":"A list of fields to extract and return from the _source field" + }, + "version":{ + "type":"number", + "description":"Explicit version number for concurrency control" + }, + "version_type":{ + "type":"enum", + "options":[ + "internal", + "external", + "external_gte", + "force" + ], + "description":"Specific version type" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/get_script.json b/src/ApiGenerator/RestSpecification/Core/get_script.json new file mode 100644 index 0000000000..b99b5d3cf1 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/get_script.json @@ -0,0 +1,39 @@ +{ + "get_script":{ + "documentation":{ + "url":"", + "description":"Returns a script." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_scripts/{id}", + "methods":[ + "GET" + ], + "parts":{ + "id":{ + "type":"string", + "description":"Script ID" + } + } + } + ] + }, + "params":{ + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager node" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/get_script_context.json b/src/ApiGenerator/RestSpecification/Core/get_script_context.json new file mode 100644 index 0000000000..a8150af421 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/get_script_context.json @@ -0,0 +1,24 @@ +{ + "get_script_context":{ + "documentation":{ + "url": "", + "description":"Returns all script contexts." + }, + "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_script_context", + "methods":[ + "GET" + ] + } + ] + }, + "params":{} + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/get_script_languages.json b/src/ApiGenerator/RestSpecification/Core/get_script_languages.json new file mode 100644 index 0000000000..2bf532fa14 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/get_script_languages.json @@ -0,0 +1,24 @@ +{ + "get_script_languages":{ + "documentation":{ + "url": "", + "description":"Returns available script types, languages and contexts" + }, + "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_script_language", + "methods":[ + "GET" + ] + } + ] + }, + "params":{} + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/get_source.json b/src/ApiGenerator/RestSpecification/Core/get_source.json new file mode 100644 index 0000000000..02db4c2902 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/get_source.json @@ -0,0 +1,77 @@ +{ + "get_source":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/get-documents/", + "description":"Returns the source of a document." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}/_source/{id}", + "methods":[ + "GET" + ], + "parts":{ + "id":{ + "type":"string", + "description":"The document ID" + }, + "index":{ + "type":"string", + "description":"The name of the index" + } + } + } + ] + }, + "params":{ + "preference":{ + "type":"string", + "description":"Specify the node or shard the operation should be performed on (default: random)" + }, + "realtime":{ + "type":"boolean", + "description":"Specify whether to perform the operation in realtime or search mode" + }, + "refresh":{ + "type":"boolean", + "description":"Refresh the shard containing the document before performing the operation" + }, + "routing":{ + "type":"string", + "description":"Specific routing value" + }, + "_source":{ + "type":"list", + "description":"True or false to return the _source field or not, or a list of fields to return" + }, + "_source_excludes":{ + "type":"list", + "description":"A list of fields to exclude from the returned _source field" + }, + "_source_includes":{ + "type":"list", + "description":"A list of fields to extract and return from the _source field" + }, + "version":{ + "type":"number", + "description":"Explicit version number for concurrency control" + }, + "version_type":{ + "type":"enum", + "options":[ + "internal", + "external", + "external_gte", + "force" + ], + "description":"Specific version type" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/index.json b/src/ApiGenerator/RestSpecification/Core/index.json new file mode 100644 index 0000000000..609204b3cb --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/index.json @@ -0,0 +1,111 @@ +{ + "index":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/index-document/", + "description":"Creates or updates a document in an index." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}/_doc/{id}", + "methods":[ + "PUT", + "POST" + ], + "parts":{ + "id":{ + "type":"string", + "description":"Document ID" + }, + "index":{ + "type":"string", + "description":"The name of the index" + } + } + }, + { + "path":"/{index}/_doc", + "methods":[ + "POST" + ], + "parts":{ + "index":{ + "type":"string", + "description":"The name of the index" + } + } + } + ] + }, + "params":{ + "wait_for_active_shards":{ + "type":"string", + "description":"Sets the number of shard copies that must be active before proceeding with the index operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)" + }, + "op_type":{ + "type":"enum", + "options":[ + "index", + "create" + ], + "description":"Explicit operation type. Defaults to `index` for requests with an explicit document ID, and to `create`for requests without an explicit document ID" + }, + "refresh":{ + "type":"enum", + "options":[ + "true", + "false", + "wait_for" + ], + "description":"If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes." + }, + "routing":{ + "type":"string", + "description":"Specific routing value" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "version":{ + "type":"number", + "description":"Explicit version number for concurrency control" + }, + "version_type":{ + "type":"enum", + "options":[ + "internal", + "external", + "external_gte" + ], + "description":"Specific version type" + }, + "if_seq_no":{ + "type":"number", + "description":"only perform the index operation if the last operation that has changed the document has the specified sequence number" + }, + "if_primary_term":{ + "type":"number", + "description":"only perform the index operation if the last operation that has changed the document has the specified primary term" + }, + "pipeline":{ + "type":"string", + "description":"The pipeline id to preprocess incoming documents with" + }, + "require_alias": { + "type": "boolean", + "description": "When true, requires destination to be an alias. Default is false" + } + }, + "body":{ + "description":"The document", + "required":true + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.add_block.json b/src/ApiGenerator/RestSpecification/Core/indices.add_block.json new file mode 100644 index 0000000000..f63cfab61e --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.add_block.json @@ -0,0 +1,67 @@ +{ + "indices.add_block":{ + "documentation":{ + "url":"", + "description":"Adds a block to an index." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}/_block/{block}", + "methods":[ + "PUT" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma separated list of indices to add a block to" + }, + "block":{ + "type":"string", + "description":"The block to add (one of read, write, read_only or metadata)" + } + } + } + ] + }, + "params":{ + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.analyze.json b/src/ApiGenerator/RestSpecification/Core/indices.analyze.json new file mode 100644 index 0000000000..2f8cd48257 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.analyze.json @@ -0,0 +1,47 @@ +{ + "indices.analyze":{ + "documentation":{ + "url":"", + "description":"Performs the analysis process on a text and return the tokens breakdown of the text." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_analyze", + "methods":[ + "GET", + "POST" + ] + }, + { + "path":"/{index}/_analyze", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "index":{ + "type":"string", + "description":"The name of the index to scope the operation" + } + } + } + ] + }, + "params":{ + "index":{ + "type":"string", + "description":"The name of the index to scope the operation" + } + }, + "body":{ + "description":"Define analyzer/tokenizer parameters and the text on which the analysis should be performed" + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.clear_cache.json b/src/ApiGenerator/RestSpecification/Core/indices.clear_cache.json new file mode 100644 index 0000000000..7f325513ee --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.clear_cache.json @@ -0,0 +1,77 @@ +{ + "indices.clear_cache":{ + "documentation":{ + "url":"", + "description":"Clears all or specific caches for one or more indices." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_cache/clear", + "methods":[ + "POST" + ] + }, + { + "path":"/{index}/_cache/clear", + "methods":[ + "POST" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index name to limit the operation" + } + } + } + ] + }, + "params":{ + "fielddata":{ + "type":"boolean", + "description":"Clear field data" + }, + "fields":{ + "type":"list", + "description":"A comma-separated list of fields to clear when using the `fielddata` parameter (default: all)" + }, + "query":{ + "type":"boolean", + "description":"Clear query caches" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "index":{ + "type":"list", + "description":"A comma-separated list of index name to limit the operation" + }, + "request":{ + "type":"boolean", + "description":"Clear request cache" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.clone.json b/src/ApiGenerator/RestSpecification/Core/indices.clone.json new file mode 100644 index 0000000000..d200c10b85 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.clone.json @@ -0,0 +1,56 @@ +{ + "indices.clone": { + "documentation": { + "url": "https://opensearch.org/docs/latest/opensearch/rest-api/index-apis/clone/", + "description": "Clones an index" + }, + "stability": "stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url": { + "paths": [ + { + "path": "/{index}/_clone/{target}", + "methods": [ + "PUT", + "POST" + ], + "parts": { + "index": { + "type": "string", + "description": "The name of the source index to clone" + }, + "target": { + "type": "string", + "description": "The name of the target index to clone into" + } + } + } + ] + }, + "params": { + "timeout": { + "type" : "time", + "description" : "Explicit operation timeout" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "wait_for_active_shards": { + "type" : "string", + "description" : "Set the number of active shards to wait for on the cloned index before the operation returns." + } + }, + "body": { + "description" : "The configuration for the target index (`settings` and `aliases`)" + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.close.json b/src/ApiGenerator/RestSpecification/Core/indices.close.json new file mode 100644 index 0000000000..75ac41325e --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.close.json @@ -0,0 +1,67 @@ +{ + "indices.close":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/index-apis/close-index/", + "description":"Closes an index." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}/_close", + "methods":[ + "POST" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma separated list of indices to close" + } + } + } + ] + }, + "params":{ + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "wait_for_active_shards":{ + "type":"string", + "description":"Sets the number of active shards to wait for before the operation returns. Set to `index-setting` to wait according to the index setting `index.write.wait_for_active_shards`, or `all` to wait for all shards, or an integer. Defaults to `0`." + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.create.json b/src/ApiGenerator/RestSpecification/Core/indices.create.json new file mode 100644 index 0000000000..02ddc9c760 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.create.json @@ -0,0 +1,55 @@ +{ + "indices.create":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/index-apis/create-index/", + "description":"Creates an index with optional settings and mappings." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}", + "methods":[ + "PUT" + ], + "parts":{ + "index":{ + "type":"string", + "description":"The name of the index" + } + } + } + ] + }, + "params":{ + "include_type_name":{ + "type":"boolean", + "description":"Whether a type should be expected in the body of the mappings." + }, + "wait_for_active_shards":{ + "type":"string", + "description":"Set the number of active shards to wait for before the operation returns." + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + } + }, + "body":{ + "description":"The configuration for the index (`settings` and `mappings`)" + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.delete.json b/src/ApiGenerator/RestSpecification/Core/indices.delete.json new file mode 100644 index 0000000000..2ba5dda8c3 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.delete.json @@ -0,0 +1,63 @@ +{ + "indices.delete":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/index-apis/delete-index/", + "description":"Deletes an index." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}", + "methods":[ + "DELETE" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of indices to delete; use `_all` or `*` string to delete all indices" + } + } + } + ] + }, + "params":{ + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Ignore unavailable indexes (default: false)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Ignore if a wildcard expression resolves to no concrete indices (default: false)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether wildcard expressions should get expanded to open or closed indices (default: open)" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.delete_alias.json b/src/ApiGenerator/RestSpecification/Core/indices.delete_alias.json new file mode 100644 index 0000000000..6b3a133166 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.delete_alias.json @@ -0,0 +1,63 @@ +{ + "indices.delete_alias":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/alias/", + "description":"Deletes an alias." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}/_alias/{name}", + "methods":[ + "DELETE" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names (supports wildcards); use `_all` for all indices" + }, + "name":{ + "type":"list", + "description":"A comma-separated list of aliases to delete (supports wildcards); use `_all` to delete all aliases for the specified indices." + } + } + }, + { + "path":"/{index}/_aliases/{name}", + "methods":[ + "DELETE" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names (supports wildcards); use `_all` for all indices" + }, + "name":{ + "type":"list", + "description":"A comma-separated list of aliases to delete (supports wildcards); use `_all` to delete all aliases for the specified indices." + } + } + } + ] + }, + "params":{ + "timeout":{ + "type":"time", + "description":"Explicit timestamp for the document" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.delete_index_template.json b/src/ApiGenerator/RestSpecification/Core/indices.delete_index_template.json new file mode 100644 index 0000000000..3fd849a339 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.delete_index_template.json @@ -0,0 +1,43 @@ +{ + "indices.delete_index_template":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-templates/", + "description":"Deletes an index template." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_index_template/{name}", + "methods":[ + "DELETE" + ], + "parts":{ + "name":{ + "type":"string", + "description":"The name of the template" + } + } + } + ] + }, + "params":{ + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.delete_template.json b/src/ApiGenerator/RestSpecification/Core/indices.delete_template.json new file mode 100644 index 0000000000..f16a62f6cb --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.delete_template.json @@ -0,0 +1,43 @@ +{ + "indices.delete_template":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-templates/", + "description":"Deletes an index template." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_template/{name}", + "methods":[ + "DELETE" + ], + "parts":{ + "name":{ + "type":"string", + "description":"The name of the template" + } + } + } + ] + }, + "params":{ + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.exists.json b/src/ApiGenerator/RestSpecification/Core/indices.exists.json new file mode 100644 index 0000000000..8847793949 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.exists.json @@ -0,0 +1,64 @@ +{ + "indices.exists":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/index-apis/exists/", + "description":"Returns information about whether a particular index exists." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}", + "methods":[ + "HEAD" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names" + } + } + } + ] + }, + "params":{ + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Ignore unavailable indexes (default: false)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Ignore if a wildcard expression resolves to no concrete indices (default: false)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether wildcard expressions should get expanded to open or closed indices (default: open)" + }, + "flat_settings":{ + "type":"boolean", + "description":"Return settings in flat format (default: false)" + }, + "include_defaults":{ + "type":"boolean", + "description":"Whether to return all default setting for each of the indices.", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.exists_alias.json b/src/ApiGenerator/RestSpecification/Core/indices.exists_alias.json new file mode 100644 index 0000000000..6782ae4422 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.exists_alias.json @@ -0,0 +1,71 @@ +{ + "indices.exists_alias":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/alias/", + "description":"Returns information about whether a particular alias exists." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_alias/{name}", + "methods":[ + "HEAD" + ], + "parts":{ + "name":{ + "type":"list", + "description":"A comma-separated list of alias names to return" + } + } + }, + { + "path":"/{index}/_alias/{name}", + "methods":[ + "HEAD" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names to filter aliases" + }, + "name":{ + "type":"list", + "description":"A comma-separated list of alias names to return" + } + } + } + ] + }, + "params":{ + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"all", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.exists_index_template.json b/src/ApiGenerator/RestSpecification/Core/indices.exists_index_template.json new file mode 100644 index 0000000000..762477a23f --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.exists_index_template.json @@ -0,0 +1,47 @@ +{ + "indices.exists_index_template":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-templates/", + "description":"Returns information about whether a particular index template exists." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_index_template/{name}", + "methods":[ + "HEAD" + ], + "parts":{ + "name":{ + "type":"string", + "description":"The name of the template" + } + } + } + ] + }, + "params":{ + "flat_settings":{ + "type":"boolean", + "description":"Return settings in flat format (default: false)" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.exists_template.json b/src/ApiGenerator/RestSpecification/Core/indices.exists_template.json new file mode 100644 index 0000000000..d04305300c --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.exists_template.json @@ -0,0 +1,47 @@ +{ + "indices.exists_template":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-templates/", + "description":"Returns information about whether a particular index template exists." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_template/{name}", + "methods":[ + "HEAD" + ], + "parts":{ + "name":{ + "type":"list", + "description":"The comma separated names of the index templates" + } + } + } + ] + }, + "params":{ + "flat_settings":{ + "type":"boolean", + "description":"Return settings in flat format (default: false)" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.exists_type.json b/src/ApiGenerator/RestSpecification/Core/indices.exists_type.json new file mode 100644 index 0000000000..c1d763c453 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.exists_type.json @@ -0,0 +1,59 @@ +{ + "indices.exists_type":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/index-apis/exists/", + "description":"Returns information about whether a particular document type exists." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}/_mapping/{type}", + "methods":[ + "HEAD" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names; use `_all` to check the types across all indices" + }, + "type":{ + "type":"list", + "description":"A comma-separated list of document types to check" + } + } + } + ] + }, + "params":{ + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.flush.json b/src/ApiGenerator/RestSpecification/Core/indices.flush.json new file mode 100644 index 0000000000..ce8053844c --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.flush.json @@ -0,0 +1,67 @@ +{ + "indices.flush":{ + "documentation":{ + "url":"", + "description":"Performs the flush operation on one or more indices." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_flush", + "methods":[ + "POST", + "GET" + ] + }, + { + "path":"/{index}/_flush", + "methods":[ + "POST", + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names; use `_all` or empty string for all indices" + } + } + } + ] + }, + "params":{ + "force":{ + "type":"boolean", + "description":"Whether a flush should be forced even if it is not necessarily needed ie. if no changes will be committed to the index. This is useful if transaction log IDs should be incremented even if no uncommitted changes are present. (This setting can be considered as internal)" + }, + "wait_if_ongoing":{ + "type":"boolean", + "description":"If set to true the flush operation will block until the flush can be executed if another flush operation is already executing. The default is true. If set to false the flush will be skipped iff if another flush operation is already running." + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.forcemerge.json b/src/ApiGenerator/RestSpecification/Core/indices.forcemerge.json new file mode 100644 index 0000000000..893b0bb2e3 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.forcemerge.json @@ -0,0 +1,69 @@ +{ + "indices.forcemerge":{ + "documentation":{ + "url":"", + "description":"Performs the force merge operation on one or more indices." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_forcemerge", + "methods":[ + "POST" + ] + }, + { + "path":"/{index}/_forcemerge", + "methods":[ + "POST" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices" + } + } + } + ] + }, + "params":{ + "flush":{ + "type":"boolean", + "description":"Specify whether the index should be flushed after performing the operation (default: true)" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "max_num_segments":{ + "type":"number", + "description":"The number of segments the index should be merged into (default: dynamic)" + }, + "only_expunge_deletes":{ + "type":"boolean", + "description":"Specify whether the operation should only expunge deleted documents" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.get.json b/src/ApiGenerator/RestSpecification/Core/indices.get.json new file mode 100644 index 0000000000..ad98d5b660 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.get.json @@ -0,0 +1,76 @@ +{ + "indices.get":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/index-apis/get-index/", + "description":"Returns information about one or more indices." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}", + "methods":[ + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names" + } + } + } + ] + }, + "params":{ + "include_type_name":{ + "type":"boolean", + "description":"Whether to add the type name to the response (default: false)" + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Ignore unavailable indexes (default: false)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Ignore if a wildcard expression resolves to no concrete indices (default: false)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether wildcard expressions should get expanded to open or closed indices (default: open)" + }, + "flat_settings":{ + "type":"boolean", + "description":"Return settings in flat format (default: false)" + }, + "include_defaults":{ + "type":"boolean", + "description":"Whether to return all default setting for each of the indices.", + "default":false + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.get_alias.json b/src/ApiGenerator/RestSpecification/Core/indices.get_alias.json new file mode 100644 index 0000000000..502e22265f --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.get_alias.json @@ -0,0 +1,89 @@ +{ + "indices.get_alias":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/alias/", + "description":"Returns an alias." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_alias", + "methods":[ + "GET" + ] + }, + { + "path":"/_alias/{name}", + "methods":[ + "GET" + ], + "parts":{ + "name":{ + "type":"list", + "description":"A comma-separated list of alias names to return" + } + } + }, + { + "path":"/{index}/_alias/{name}", + "methods":[ + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names to filter aliases" + }, + "name":{ + "type":"list", + "description":"A comma-separated list of alias names to return" + } + } + }, + { + "path":"/{index}/_alias", + "methods":[ + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names to filter aliases" + } + } + } + ] + }, + "params":{ + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default": "all", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.get_field_mapping.json b/src/ApiGenerator/RestSpecification/Core/indices.get_field_mapping.json new file mode 100644 index 0000000000..42983da2b8 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.get_field_mapping.json @@ -0,0 +1,79 @@ +{ + "indices.get_field_mapping":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/update-mapping/", + "description":"Returns mapping for one or more fields." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_mapping/field/{fields}", + "methods":[ + "GET" + ], + "parts":{ + "fields":{ + "type":"list", + "description":"A comma-separated list of fields" + } + } + }, + { + "path":"/{index}/_mapping/field/{fields}", + "methods":[ + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names" + }, + "fields":{ + "type":"list", + "description":"A comma-separated list of fields" + } + } + } + ] + }, + "params":{ + "include_type_name":{ + "type":"boolean", + "description":"Whether a type should be returned in the body of the mappings." + }, + "include_defaults":{ + "type":"boolean", + "description":"Whether the default mapping values should be returned as well" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.get_index_template.json b/src/ApiGenerator/RestSpecification/Core/indices.get_index_template.json new file mode 100644 index 0000000000..a8392a1d8a --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.get_index_template.json @@ -0,0 +1,53 @@ +{ + "indices.get_index_template":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-templates/", + "description":"Returns an index template." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_index_template", + "methods":[ + "GET" + ] + }, + { + "path":"/_index_template/{name}", + "methods":[ + "GET" + ], + "parts":{ + "name":{ + "type":"list", + "description":"The comma separated names of the index templates" + } + } + } + ] + }, + "params":{ + "flat_settings":{ + "type":"boolean", + "description":"Return settings in flat format (default: false)" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.get_mapping.json b/src/ApiGenerator/RestSpecification/Core/indices.get_mapping.json new file mode 100644 index 0000000000..7e29e1d29d --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.get_mapping.json @@ -0,0 +1,69 @@ +{ + "indices.get_mapping":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/update-mapping/", + "description":"Returns mappings for one or more indices." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_mapping", + "methods":[ + "GET" + ] + }, + { + "path":"/{index}/_mapping", + "methods":[ + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names" + } + } + } + ] + }, + "params":{ + "include_type_name":{ + "type":"boolean", + "description":"Whether to add the type name to the response (default: false)" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.get_settings.json b/src/ApiGenerator/RestSpecification/Core/indices.get_settings.json new file mode 100644 index 0000000000..39fb4847f3 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.get_settings.json @@ -0,0 +1,106 @@ +{ + "indices.get_settings":{ + "documentation":{ + "url":"", + "description":"Returns settings for one or more indices." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_settings", + "methods":[ + "GET" + ] + }, + { + "path":"/{index}/_settings", + "methods":[ + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices" + } + } + }, + { + "path":"/{index}/_settings/{name}", + "methods":[ + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices" + }, + "name":{ + "type":"list", + "description":"The name of the settings that should be included" + } + } + }, + { + "path":"/_settings/{name}", + "methods":[ + "GET" + ], + "parts":{ + "name":{ + "type":"list", + "description":"The name of the settings that should be included" + } + } + } + ] + }, + "params":{ + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default": "all", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "flat_settings":{ + "type":"boolean", + "description":"Return settings in flat format (default: false)" + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + }, + "include_defaults":{ + "type":"boolean", + "description":"Whether to return all default setting for each of the indices.", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.get_template.json b/src/ApiGenerator/RestSpecification/Core/indices.get_template.json new file mode 100644 index 0000000000..66cb7a73ff --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.get_template.json @@ -0,0 +1,57 @@ +{ + "indices.get_template":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-templates/", + "description":"Returns an index template." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_template", + "methods":[ + "GET" + ] + }, + { + "path":"/_template/{name}", + "methods":[ + "GET" + ], + "parts":{ + "name":{ + "type":"list", + "description":"The comma separated names of the index templates" + } + } + } + ] + }, + "params":{ + "include_type_name":{ + "type":"boolean", + "description":"Whether a type should be returned in the body of the mappings." + }, + "flat_settings":{ + "type":"boolean", + "description":"Return settings in flat format (default: false)" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.open.json b/src/ApiGenerator/RestSpecification/Core/indices.open.json new file mode 100644 index 0000000000..3c094844af --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.open.json @@ -0,0 +1,67 @@ +{ + "indices.open":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/index-apis/close-index/", + "description":"Opens an index." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}/_open", + "methods":[ + "POST" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma separated list of indices to open" + } + } + } + ] + }, + "params":{ + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"closed", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "wait_for_active_shards":{ + "type":"string", + "description":"Sets the number of active shards to wait for before the operation returns." + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.put_alias.json b/src/ApiGenerator/RestSpecification/Core/indices.put_alias.json new file mode 100644 index 0000000000..c45f0aa36f --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.put_alias.json @@ -0,0 +1,70 @@ +{ + "indices.put_alias":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/alias/", + "description":"Creates or updates an alias." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}/_alias/{name}", + "methods":[ + "PUT", + "POST" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names the alias should point to (supports wildcards); use `_all` to perform the operation on all indices." + }, + "name":{ + "type":"string", + "description":"The name of the alias to be created or updated" + } + } + }, + { + "path":"/{index}/_aliases/{name}", + "methods":[ + "PUT", + "POST" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names the alias should point to (supports wildcards); use `_all` to perform the operation on all indices." + }, + "name":{ + "type":"string", + "description":"The name of the alias to be created or updated" + } + } + } + ] + }, + "params":{ + "timeout":{ + "type":"time", + "description":"Explicit timestamp for the document" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + } + }, + "body":{ + "description":"The settings for the alias, such as `routing` or `filter`", + "required":false + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.put_index_template.json b/src/ApiGenerator/RestSpecification/Core/indices.put_index_template.json new file mode 100644 index 0000000000..4963df1614 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.put_index_template.json @@ -0,0 +1,55 @@ +{ + "indices.put_index_template":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-templates/", + "description":"Creates or updates an index template." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_index_template/{name}", + "methods":[ + "PUT", + "POST" + ], + "parts":{ + "name":{ + "type":"string", + "description":"The name of the template" + } + } + } + ] + }, + "params":{ + "create":{ + "type":"boolean", + "description":"Whether the index template should only be added if new or can also replace an existing one", + "default":false + }, + "cause":{ + "type":"string", + "description":"User defined reason for creating/updating the index template", + "default":false + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + } + }, + "body":{ + "description":"The template definition", + "required":true + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.put_mapping.json b/src/ApiGenerator/RestSpecification/Core/indices.put_mapping.json new file mode 100644 index 0000000000..7bc6e47cd4 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.put_mapping.json @@ -0,0 +1,95 @@ +{ + "indices.put_mapping":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/update-mapping/", + "description":"Updates the index mappings." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}/_mapping", + "methods":[ + "PUT", + "POST" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices." + } + } + }, + { + "path":"/{index}/_mappings", + "methods":[ + "PUT", + "POST" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names the mapping should be added to (supports wildcards); use `_all` or omit to add the mapping on all indices." + } + }, + "deprecated":{ + "version":"1.0.0", + "description":"The plural mappings is accepted but only /_mapping is documented" + } + } + ] + }, + "params":{ + "include_type_name":{ + "type":"boolean", + "description":"Whether a type should be expected in the body of the mappings." + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "write_index_only":{ + "type":"boolean", + "default":false, + "description":"When true, applies mappings only to the write index of an alias or data stream" + } + }, + "body":{ + "description":"The mapping definition", + "required":true + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.put_settings.json b/src/ApiGenerator/RestSpecification/Core/indices.put_settings.json new file mode 100644 index 0000000000..09be5ce207 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.put_settings.json @@ -0,0 +1,82 @@ +{ + "indices.put_settings":{ + "documentation":{ + "url":"", + "description":"Updates the index settings." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_settings", + "methods":[ + "PUT" + ] + }, + { + "path":"/{index}/_settings", + "methods":[ + "PUT" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices" + } + } + } + ] + }, + "params":{ + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "preserve_existing":{ + "type":"boolean", + "description":"Whether to update existing settings. If set to `true` existing settings on an index remain unchanged, the default is `false`" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "flat_settings":{ + "type":"boolean", + "description":"Return settings in flat format (default: false)" + } + }, + "body":{ + "description":"The index settings to be updated", + "required":true + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.put_template.json b/src/ApiGenerator/RestSpecification/Core/indices.put_template.json new file mode 100644 index 0000000000..50d0034a75 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.put_template.json @@ -0,0 +1,58 @@ +{ + "indices.put_template":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-templates/", + "description":"Creates or updates an index template." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_template/{name}", + "methods":[ + "PUT", + "POST" + ], + "parts":{ + "name":{ + "type":"string", + "description":"The name of the template" + } + } + } + ] + }, + "params":{ + "include_type_name":{ + "type":"boolean", + "description":"Whether a type should be returned in the body of the mappings." + }, + "order":{ + "type":"number", + "description":"The order for this template when merging multiple matching ones (higher numbers are merged later, overriding the lower numbers)" + }, + "create":{ + "type":"boolean", + "description":"Whether the index template should only be added if new or can also replace an existing one", + "default":false + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + } + }, + "body":{ + "description":"The template definition", + "required":true + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.recovery.json b/src/ApiGenerator/RestSpecification/Core/indices.recovery.json new file mode 100644 index 0000000000..24d96f2e1d --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.recovery.json @@ -0,0 +1,47 @@ +{ + "indices.recovery":{ + "documentation":{ + "url":"", + "description":"Returns information about ongoing index shard recoveries." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_recovery", + "methods":[ + "GET" + ] + }, + { + "path":"/{index}/_recovery", + "methods":[ + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices" + } + } + } + ] + }, + "params":{ + "detailed":{ + "type":"boolean", + "description":"Whether to display detailed information about shard recovery", + "default":false + }, + "active_only":{ + "type":"boolean", + "description":"Display only those recoveries that are currently on-going", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.refresh.json b/src/ApiGenerator/RestSpecification/Core/indices.refresh.json new file mode 100644 index 0000000000..10d63e8eaa --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.refresh.json @@ -0,0 +1,59 @@ +{ + "indices.refresh":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/get-documents/", + "description":"Performs the refresh operation in one or more indices." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_refresh", + "methods":[ + "POST", + "GET" + ] + }, + { + "path":"/{index}/_refresh", + "methods":[ + "POST", + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices" + } + } + } + ] + }, + "params":{ + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.resolve_index.json b/src/ApiGenerator/RestSpecification/Core/indices.resolve_index.json new file mode 100644 index 0000000000..21264ead72 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.resolve_index.json @@ -0,0 +1,43 @@ +{ + "indices.resolve_index":{ + "documentation":{ + "url":"", + "description":"Returns information about any matching indices, aliases, and data streams" + }, + "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_resolve/index/{name}", + "methods":[ + "GET" + ], + "parts":{ + "name":{ + "type":"list", + "description":"A comma-separated list of names or wildcard expressions" + } + } + } + ] + }, + "params":{ + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether wildcard expressions should get expanded to open or closed indices (default: open)" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.rollover.json b/src/ApiGenerator/RestSpecification/Core/indices.rollover.json new file mode 100644 index 0000000000..9d43a18fd6 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.rollover.json @@ -0,0 +1,75 @@ +{ + "indices.rollover":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/data-streams/#step-5-rollover-a-data-stream", + "description":"Updates an alias to point to a new index when the existing index\nis considered to be too large or too old." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{alias}/_rollover", + "methods":[ + "POST" + ], + "parts":{ + "alias":{ + "type":"string", + "description":"The name of the alias to rollover" + } + } + }, + { + "path":"/{alias}/_rollover/{new_index}", + "methods":[ + "POST" + ], + "parts":{ + "alias":{ + "type":"string", + "description":"The name of the alias to rollover" + }, + "new_index":{ + "type":"string", + "description":"The name of the rollover index" + } + } + } + ] + }, + "params":{ + "include_type_name":{ + "type":"boolean", + "description":"Whether a type should be included in the body of the mappings." + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "dry_run":{ + "type":"boolean", + "description":"If set to true the rollover action will only be validated but not actually performed even if a condition matches. The default is false" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "wait_for_active_shards":{ + "type":"string", + "description":"Set the number of active shards to wait for on the newly created rollover index before the operation returns." + } + }, + "body":{ + "description":"The conditions that needs to be met for executing rollover" + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.segments.json b/src/ApiGenerator/RestSpecification/Core/indices.segments.json new file mode 100644 index 0000000000..fe44a81bfd --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.segments.json @@ -0,0 +1,62 @@ +{ + "indices.segments":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-segments/", + "description":"Provides low-level information about segments in a Lucene index." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_segments", + "methods":[ + "GET" + ] + }, + { + "path":"/{index}/_segments", + "methods":[ + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices" + } + } + } + ] + }, + "params":{ + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "verbose":{ + "type":"boolean", + "description":"Includes detailed memory usage by Lucene.", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.shard_stores.json b/src/ApiGenerator/RestSpecification/Core/indices.shard_stores.json new file mode 100644 index 0000000000..c241aeab89 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.shard_stores.json @@ -0,0 +1,67 @@ +{ + "indices.shard_stores":{ + "documentation":{ + "url":"", + "description":"Provides store information for shard copies of indices." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_shard_stores", + "methods":[ + "GET" + ] + }, + { + "path":"/{index}/_shard_stores", + "methods":[ + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices" + } + } + } + ] + }, + "params":{ + "status":{ + "type":"list", + "options":[ + "green", + "yellow", + "red", + "all" + ], + "description":"A comma-separated list of statuses used to filter on shards to get store information for" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.shrink.json b/src/ApiGenerator/RestSpecification/Core/indices.shrink.json new file mode 100644 index 0000000000..16a781df6a --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.shrink.json @@ -0,0 +1,60 @@ +{ + "indices.shrink":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/index-apis/shrink-index/", + "description":"Allow to shrink an existing index into a new index with fewer primary shards." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}/_shrink/{target}", + "methods":[ + "PUT", + "POST" + ], + "parts":{ + "index":{ + "type":"string", + "description":"The name of the source index to shrink" + }, + "target":{ + "type":"string", + "description":"The name of the target index to shrink into" + } + } + } + ] + }, + "params":{ + "copy_settings": { + "type" : "boolean", + "description" : "whether or not to copy settings from the source index (defaults to false)" + }, + "timeout": { + "type" : "time", + "description" : "Explicit operation timeout" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "wait_for_active_shards": { + "type" : "string", + "description" : "Set the number of active shards to wait for on the shrunken index before the operation returns." + } + }, + "body":{ + "description":"The configuration for the target index (`settings` and `aliases`)" + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.simulate_index_template.json b/src/ApiGenerator/RestSpecification/Core/indices.simulate_index_template.json new file mode 100644 index 0000000000..295a457442 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.simulate_index_template.json @@ -0,0 +1,54 @@ +{ + "indices.simulate_index_template":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-templates/", + "description": "Simulate matching the given index name against the index templates in the system" + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_index_template/_simulate_index/{name}", + "methods":[ + "POST" + ], + "parts":{ + "name":{ + "type":"string", + "description":"The name of the index (it must be a concrete index name)" + } + } + } + ] + }, + "params":{ + "create":{ + "type":"boolean", + "description":"Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one", + "default":false + }, + "cause":{ + "type":"string", + "description":"User defined reason for dry-run creating the new template for simulation purposes", + "default":false + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + } + }, + "body":{ + "description":"New index template definition, which will be included in the simulation, as if it already exists in the system", + "required":false + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.simulate_template.json b/src/ApiGenerator/RestSpecification/Core/indices.simulate_template.json new file mode 100644 index 0000000000..a6a8a23dd7 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.simulate_template.json @@ -0,0 +1,60 @@ +{ + "indices.simulate_template":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-templates/", + "description": "Simulate resolving the given template name or body" + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_index_template/_simulate", + "methods":[ + "POST" + ] + }, + { + "path":"/_index_template/_simulate/{name}", + "methods":[ + "POST" + ], + "parts":{ + "name":{ + "type":"string", + "description":"The name of the index template" + } + } + } + ] + }, + "params":{ + "create":{ + "type":"boolean", + "description":"Whether the index template we optionally defined in the body should only be dry-run added if new or can also replace an existing one", + "default":false + }, + "cause":{ + "type":"string", + "description":"User defined reason for dry-run creating the new template for simulation purposes", + "default":false + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + } + }, + "body":{ + "description":"New index template definition to be simulated, if no index template name is specified", + "required":false + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.split.json b/src/ApiGenerator/RestSpecification/Core/indices.split.json new file mode 100644 index 0000000000..cc56dff46c --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.split.json @@ -0,0 +1,60 @@ +{ + "indices.split":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/index-apis/split/", + "description":"Allows you to split an existing index into a new index with more primary shards." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}/_split/{target}", + "methods":[ + "PUT", + "POST" + ], + "parts":{ + "index":{ + "type":"string", + "description":"The name of the source index to split" + }, + "target":{ + "type":"string", + "description":"The name of the target index to split into" + } + } + } + ] + }, + "params": { + "copy_settings": { + "type" : "boolean", + "description" : "whether or not to copy settings from the source index (defaults to false)" + }, + "timeout": { + "type" : "time", + "description" : "Explicit operation timeout" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "wait_for_active_shards": { + "type" : "string", + "description" : "Set the number of active shards to wait for on the shrunken index before the operation returns." + } + }, + "body":{ + "description":"The configuration for the target index (`settings` and `aliases`)" + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.stats.json b/src/ApiGenerator/RestSpecification/Core/indices.stats.json new file mode 100644 index 0000000000..ac0221cafd --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.stats.json @@ -0,0 +1,158 @@ +{ + "indices.stats":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/stats-api/", + "description":"Provides statistics on operations happening in an index." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_stats", + "methods":[ + "GET" + ] + }, + { + "path":"/_stats/{metric}", + "methods":[ + "GET" + ], + "parts":{ + "metric":{ + "type":"list", + "options":[ + "_all", + "completion", + "docs", + "fielddata", + "query_cache", + "flush", + "get", + "indexing", + "merge", + "request_cache", + "refresh", + "search", + "segments", + "store", + "warmer", + "suggest" + ], + "description":"Limit the information returned the specific metrics." + } + } + }, + { + "path":"/{index}/_stats", + "methods":[ + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices" + } + } + }, + { + "path":"/{index}/_stats/{metric}", + "methods":[ + "GET" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names; use `_all` or empty string to perform the operation on all indices" + }, + "metric":{ + "type":"list", + "options":[ + "_all", + "completion", + "docs", + "fielddata", + "query_cache", + "flush", + "get", + "indexing", + "merge", + "request_cache", + "refresh", + "search", + "segments", + "store", + "warmer", + "suggest" + ], + "description":"Limit the information returned the specific metrics." + } + } + } + ] + }, + "params":{ + "completion_fields":{ + "type":"list", + "description":"A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards)" + }, + "fielddata_fields":{ + "type":"list", + "description":"A comma-separated list of fields for `fielddata` index metric (supports wildcards)" + }, + "fields":{ + "type":"list", + "description":"A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards)" + }, + "groups":{ + "type":"list", + "description":"A comma-separated list of search groups for `search` index metric" + }, + "level":{ + "type":"enum", + "description":"Return stats aggregated at cluster, index or shard level", + "options":[ + "cluster", + "indices", + "shards" + ], + "default":"indices" + }, + "types":{ + "type":"list", + "description":"A comma-separated list of document types for the `indexing` index metric" + }, + "include_segment_file_sizes":{ + "type":"boolean", + "description":"Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested)", + "default":false + }, + "include_unloaded_segments":{ + "type":"boolean", + "description":"If set to true segment stats will include stats for segments that are not currently loaded into memory", + "default":false + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "forbid_closed_indices":{ + "type":"boolean", + "description":"If set to false stats will also collected from closed indices if explicitly specified or if expand_wildcards expands to closed indices", + "default":true + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.update_aliases.json b/src/ApiGenerator/RestSpecification/Core/indices.update_aliases.json new file mode 100644 index 0000000000..7ef9f4a9e3 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.update_aliases.json @@ -0,0 +1,42 @@ +{ + "indices.update_aliases":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/alias/", + "description":"Updates index aliases." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_aliases", + "methods":[ + "POST" + ] + } + ] + }, + "params":{ + "timeout":{ + "type":"time", + "description":"Request timeout" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + } + }, + "body":{ + "description":"The definition of `actions` to perform", + "required":true + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/indices.validate_query.json b/src/ApiGenerator/RestSpecification/Core/indices.validate_query.json new file mode 100644 index 0000000000..4132f1a9eb --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/indices.validate_query.json @@ -0,0 +1,104 @@ +{ + "indices.validate_query":{ + "documentation":{ + "url":"", + "description":"Allows a user to validate a potentially expensive query without executing it." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_validate/query", + "methods":[ + "GET", + "POST" + ] + }, + { + "path":"/{index}/_validate/query", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names to restrict the operation; use `_all` or empty string to perform the operation on all indices" + } + } + } + ] + }, + "params":{ + "explain":{ + "type":"boolean", + "description":"Return detailed information about the error" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "q":{ + "type":"string", + "description":"Query in the Lucene query string syntax" + }, + "analyzer":{ + "type":"string", + "description":"The analyzer to use for the query string" + }, + "analyze_wildcard":{ + "type":"boolean", + "description":"Specify whether wildcard and prefix queries should be analyzed (default: false)" + }, + "default_operator":{ + "type":"enum", + "options":[ + "AND", + "OR" + ], + "default":"OR", + "description":"The default operator for query string query (AND or OR)" + }, + "df":{ + "type":"string", + "description":"The field to use as default where no field prefix is given in the query string" + }, + "lenient":{ + "type":"boolean", + "description":"Specify whether format-based query failures (such as providing text to a numeric field) should be ignored" + }, + "rewrite":{ + "type":"boolean", + "description":"Provide a more detailed explanation showing the actual Lucene query that will be executed." + }, + "all_shards":{ + "type":"boolean", + "description":"Execute validation on all shards instead of one random shard per index" + } + }, + "body":{ + "description":"The query definition specified with the Query DSL" + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/info.json b/src/ApiGenerator/RestSpecification/Core/info.json new file mode 100644 index 0000000000..c07c5c760c --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/info.json @@ -0,0 +1,24 @@ +{ + "info":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/index/", + "description":"Returns basic information about the cluster." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/", + "methods":[ + "GET" + ] + } + ] + }, + "params":{} + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/ingest.delete_pipeline.json b/src/ApiGenerator/RestSpecification/Core/ingest.delete_pipeline.json new file mode 100644 index 0000000000..b67eb57c3f --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/ingest.delete_pipeline.json @@ -0,0 +1,43 @@ +{ + "ingest.delete_pipeline":{ + "documentation":{ + "url":"", + "description":"Deletes a pipeline." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_ingest/pipeline/{id}", + "methods":[ + "DELETE" + ], + "parts":{ + "id":{ + "type":"string", + "description":"Pipeline ID" + } + } + } + ] + }, + "params":{ + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/ingest.get_pipeline.json b/src/ApiGenerator/RestSpecification/Core/ingest.get_pipeline.json new file mode 100644 index 0000000000..0c1d15854b --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/ingest.get_pipeline.json @@ -0,0 +1,45 @@ +{ + "ingest.get_pipeline":{ + "documentation":{ + "url":"", + "description":"Returns a pipeline." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_ingest/pipeline", + "methods":[ + "GET" + ] + }, + { + "path":"/_ingest/pipeline/{id}", + "methods":[ + "GET" + ], + "parts":{ + "id":{ + "type":"string", + "description":"Comma separated list of pipeline ids. Wildcards supported" + } + } + } + ] + }, + "params":{ + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/ingest.processor_grok.json b/src/ApiGenerator/RestSpecification/Core/ingest.processor_grok.json new file mode 100644 index 0000000000..8449ea41b9 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/ingest.processor_grok.json @@ -0,0 +1,24 @@ +{ + "ingest.processor_grok":{ + "documentation":{ + "url":"", + "description":"Returns a list of the built-in patterns." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_ingest/processor/grok", + "methods":[ + "GET" + ] + } + ] + }, + "params":{} + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/ingest.put_pipeline.json b/src/ApiGenerator/RestSpecification/Core/ingest.put_pipeline.json new file mode 100644 index 0000000000..c01fb37d24 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/ingest.put_pipeline.json @@ -0,0 +1,48 @@ +{ + "ingest.put_pipeline":{ + "documentation":{ + "url":"", + "description":"Creates or updates a pipeline." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_ingest/pipeline/{id}", + "methods":[ + "PUT" + ], + "parts":{ + "id":{ + "type":"string", + "description":"Pipeline ID" + } + } + } + ] + }, + "params":{ + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + } + }, + "body":{ + "description":"The ingest definition", + "required":true + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/ingest.simulate.json b/src/ApiGenerator/RestSpecification/Core/ingest.simulate.json new file mode 100644 index 0000000000..538931232e --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/ingest.simulate.json @@ -0,0 +1,49 @@ +{ + "ingest.simulate":{ + "documentation":{ + "url":"", + "description":"Allows to simulate a pipeline with example documents." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_ingest/pipeline/_simulate", + "methods":[ + "GET", + "POST" + ] + }, + { + "path":"/_ingest/pipeline/{id}/_simulate", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "id":{ + "type":"string", + "description":"Pipeline ID" + } + } + } + ] + }, + "params":{ + "verbose":{ + "type":"boolean", + "description":"Verbose mode. Display data output for each processor in executed pipeline", + "default":false + } + }, + "body":{ + "description":"The simulate definition", + "required":true + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/mget.json b/src/ApiGenerator/RestSpecification/Core/mget.json new file mode 100644 index 0000000000..31261b97ba --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/mget.json @@ -0,0 +1,76 @@ +{ + "mget":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/multi-get/", + "description":"Allows to get multiple documents in one request." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_mget", + "methods":[ + "GET", + "POST" + ] + }, + { + "path":"/{index}/_mget", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "index":{ + "type":"string", + "description":"The name of the index" + } + } + } + ] + }, + "params":{ + "stored_fields":{ + "type":"list", + "description":"A comma-separated list of stored fields to return in the response" + }, + "preference":{ + "type":"string", + "description":"Specify the node or shard the operation should be performed on (default: random)" + }, + "realtime":{ + "type":"boolean", + "description":"Specify whether to perform the operation in realtime or search mode" + }, + "refresh":{ + "type":"boolean", + "description":"Refresh the shard containing the document before performing the operation" + }, + "routing":{ + "type":"string", + "description":"Specific routing value" + }, + "_source":{ + "type":"list", + "description":"True or false to return the _source field or not, or a list of fields to return" + }, + "_source_excludes":{ + "type":"list", + "description":"A list of fields to exclude from the returned _source field" + }, + "_source_includes":{ + "type":"list", + "description":"A list of fields to extract and return from the _source field" + } + }, + "body":{ + "description":"Document identifiers; can be either `docs` (containing full document information) or `ids` (when index and type is provided in the URL.", + "required":true + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/msearch.json b/src/ApiGenerator/RestSpecification/Core/msearch.json new file mode 100644 index 0000000000..706e1ba9a4 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/msearch.json @@ -0,0 +1,82 @@ +{ + "msearch":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/multi-search/", + "description":"Allows to execute several search operations in one request." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/x-ndjson"] + }, + "url":{ + "paths":[ + { + "path":"/_msearch", + "methods":[ + "GET", + "POST" + ] + }, + { + "path":"/{index}/_msearch", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names to use as default" + } + } + } + ] + }, + "params": { + "search_type":{ + "type":"enum", + "options":[ + "query_then_fetch", + "query_and_fetch", + "dfs_query_then_fetch", + "dfs_query_and_fetch" + ], + "description":"Search operation type" + }, + "max_concurrent_searches" : { + "type" : "number", + "description" : "Controls the maximum number of concurrent searches the multi search api will execute" + }, + "typed_keys": { + "type" : "boolean", + "description" : "Specify whether aggregation and suggester names should be prefixed by their respective types in the response" + }, + "pre_filter_shard_size":{ + "type":"number", + "description" : "A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint." + }, + "max_concurrent_shard_requests" : { + "type" : "number", + "description" : "The number of concurrent shard requests each sub search executes concurrently per node. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests", + "default" : 5 + }, + "rest_total_hits_as_int" : { + "type": "boolean", + "description": "Indicates whether hits.total should be rendered as an integer or an object in the rest search response", + "default": false + }, + "ccs_minimize_roundtrips":{ + "type":"boolean", + "description":"Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution", + "default":"true" + } + }, + "body":{ + "description":"The request definitions (metadata-search request definition pairs), separated by newlines", + "required":true, + "serialize":"bulk" + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/msearch_template.json b/src/ApiGenerator/RestSpecification/Core/msearch_template.json new file mode 100644 index 0000000000..39a2b2985b --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/msearch_template.json @@ -0,0 +1,73 @@ +{ + "msearch_template":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/multi-search/", + "description":"Allows to execute several search template operations in one request." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/x-ndjson"] + }, + "url":{ + "paths":[ + { + "path":"/_msearch/template", + "methods":[ + "GET", + "POST" + ] + }, + { + "path":"/{index}/_msearch/template", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names to use as default" + } + } + } + ] + }, + "params": { + "search_type":{ + "type":"enum", + "options":[ + "query_then_fetch", + "query_and_fetch", + "dfs_query_then_fetch", + "dfs_query_and_fetch" + ], + "description":"Search operation type" + }, + "typed_keys": { + "type" : "boolean", + "description" : "Specify whether aggregation and suggester names should be prefixed by their respective types in the response" + }, + "max_concurrent_searches" : { + "type" : "number", + "description" : "Controls the maximum number of concurrent searches the multi search api will execute" + }, + "rest_total_hits_as_int" : { + "type" : "boolean", + "description" : "Indicates whether hits.total should be rendered as an integer or an object in the rest search response", + "default" : false + }, + "ccs_minimize_roundtrips": { + "type" : "boolean", + "description" : "Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution", + "default" : "true" + } + }, + "body":{ + "description":"The request definitions (metadata-search request definition pairs), separated by newlines", + "required":true, + "serialize":"bulk" + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/mtermvectors.json b/src/ApiGenerator/RestSpecification/Core/mtermvectors.json new file mode 100644 index 0000000000..156a410e21 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/mtermvectors.json @@ -0,0 +1,103 @@ +{ + "mtermvectors":{ + "documentation":{ + "url":"", + "description":"Returns multiple termvectors in one request." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_mtermvectors", + "methods":[ + "GET", + "POST" + ] + }, + { + "path":"/{index}/_mtermvectors", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "index":{ + "type":"string", + "description":"The index in which the document resides." + } + } + } + ] + }, + "params":{ + "ids":{ + "type":"list", + "description":"A comma-separated list of documents ids. You must define ids as parameter or set \"ids\" or \"docs\" in the request body" + }, + "term_statistics":{ + "type":"boolean", + "description":"Specifies if total term frequency and document frequency should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\".", + "default":false + }, + "field_statistics":{ + "type":"boolean", + "description":"Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\".", + "default":true + }, + "fields":{ + "type":"list", + "description":"A comma-separated list of fields to return. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"." + }, + "offsets":{ + "type":"boolean", + "description":"Specifies if term offsets should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\".", + "default":true + }, + "positions":{ + "type":"boolean", + "description":"Specifies if term positions should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\".", + "default":true + }, + "payloads":{ + "type":"boolean", + "description":"Specifies if term payloads should be returned. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\".", + "default":true + }, + "preference":{ + "type":"string", + "description":"Specify the node or shard the operation should be performed on (default: random) .Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"." + }, + "routing":{ + "type":"string", + "description":"Specific routing value. Applies to all returned documents unless otherwise specified in body \"params\" or \"docs\"." + }, + "realtime":{ + "type":"boolean", + "description":"Specifies if requests are real-time as opposed to near-real-time (default: true)." + }, + "version":{ + "type":"number", + "description":"Explicit version number for concurrency control" + }, + "version_type":{ + "type":"enum", + "options":[ + "internal", + "external", + "external_gte", + "force" + ], + "description":"Specific version type" + } + }, + "body":{ + "description":"Define ids, documents, parameters or a list of parameters per document here. You must at least provide a list of document ids. See documentation.", + "required":false + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/nodes.hot_threads.json b/src/ApiGenerator/RestSpecification/Core/nodes.hot_threads.json new file mode 100644 index 0000000000..c31e997965 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/nodes.hot_threads.json @@ -0,0 +1,147 @@ +{ + "nodes.hot_threads":{ + "documentation":{ + "url":"", + "description":"Returns information about hot threads on each node in the cluster." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "text/plain"] + }, + "url":{ + "paths":[ + { + "path":"/_nodes/hot_threads", + "methods":[ + "GET" + ] + }, + { + "path":"/_nodes/{node_id}/hot_threads", + "methods":[ + "GET" + ], + "parts":{ + "node_id":{ + "type":"list", + "description":"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" + } + } + }, + { + "path":"/_cluster/nodes/hotthreads", + "methods":[ + "GET" + ], + "parts":{}, + "deprecated":{ + "version":"1.0.0", + "description":"The hot threads API accepts `hotthreads` but only `hot_threads` is documented" + } + }, + { + "path":"/_cluster/nodes/{node_id}/hotthreads", + "methods":[ + "GET" + ], + "parts":{ + "node_id":{ + "type":"list", + "description":"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" + } + }, + "deprecated":{ + "version":"1.0.0", + "description":"The hot threads API accepts `hotthreads` but only `hot_threads` is documented" + } + }, + { + "path":"/_nodes/hotthreads", + "methods":[ + "GET" + ], + "parts":{}, + "deprecated":{ + "version":"1.0.0", + "description":"The hot threads API accepts `hotthreads` but only `hot_threads` is documented" + } + }, + { + "path":"/_nodes/{node_id}/hotthreads", + "methods":[ + "GET" + ], + "parts":{ + "node_id":{ + "type":"list", + "description":"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" + } + }, + "deprecated":{ + "version":"1.0.0", + "description":"The hot threads API accepts `hotthreads` but only `hot_threads` is documented" + } + }, + { + "path":"/_cluster/nodes/hot_threads", + "methods":[ + "GET" + ], + "parts":{}, + "deprecated":{ + "version":"1.0.0", + "description":"The hot accepts /_cluster/nodes as prefix for backwards compatibility reasons" + } + }, + { + "path":"/_cluster/nodes/{node_id}/hot_threads", + "methods":[ + "GET" + ], + "parts":{ + "node_id":{ + "type":"list", + "description":"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" + } + }, + "deprecated":{ + "version":"1.0.0", + "description":"The hot accepts /_cluster/nodes as prefix for backwards compatibility reasons" + } + } + ] + }, + "params":{ + "interval":{ + "type":"time", + "description":"The interval for the second sampling of threads" + }, + "snapshots":{ + "type":"number", + "description":"Number of samples of thread stacktrace (default: 10)" + }, + "threads":{ + "type":"number", + "description":"Specify the number of threads to provide information for (default: 3)" + }, + "ignore_idle_threads":{ + "type":"boolean", + "description":"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)" + }, + "type":{ + "type":"enum", + "options":[ + "cpu", + "wait", + "block" + ], + "description":"The type to sample (default: cpu)" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/nodes.info.json b/src/ApiGenerator/RestSpecification/Core/nodes.info.json new file mode 100644 index 0000000000..3333df769d --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/nodes.info.json @@ -0,0 +1,95 @@ +{ + "nodes.info":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-nodes/", + "description":"Returns information about nodes in the cluster." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_nodes", + "methods":[ + "GET" + ] + }, + { + "path":"/_nodes/{node_id}", + "methods":[ + "GET" + ], + "parts":{ + "node_id":{ + "type":"list", + "description":"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" + } + } + }, + { + "path":"/_nodes/{metric}", + "methods":[ + "GET" + ], + "parts":{ + "metric":{ + "type":"list", + "options":[ + "settings", + "os", + "process", + "jvm", + "thread_pool", + "transport", + "http", + "plugins", + "ingest" + ], + "description":"A comma-separated list of metrics you wish returned. Leave empty to return all." + } + } + }, + { + "path":"/_nodes/{node_id}/{metric}", + "methods":[ + "GET" + ], + "parts":{ + "node_id":{ + "type":"list", + "description":"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" + }, + "metric":{ + "type":"list", + "options":[ + "settings", + "os", + "process", + "jvm", + "thread_pool", + "transport", + "http", + "plugins", + "ingest" + ], + "description":"A comma-separated list of metrics you wish returned. Leave empty to return all." + } + } + } + ] + }, + "params":{ + "flat_settings":{ + "type":"boolean", + "description":"Return settings in flat format (default: false)" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/nodes.reload_secure_settings.json b/src/ApiGenerator/RestSpecification/Core/nodes.reload_secure_settings.json new file mode 100644 index 0000000000..4ca0f27cd9 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/nodes.reload_secure_settings.json @@ -0,0 +1,46 @@ +{ + "nodes.reload_secure_settings":{ + "documentation":{ + "url":"", + "description":"Reloads secure settings." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": [ "application/json" ] + }, + "url":{ + "paths":[ + { + "path":"/_nodes/reload_secure_settings", + "methods":[ + "POST" + ] + }, + { + "path":"/_nodes/{node_id}/reload_secure_settings", + "methods":[ + "POST" + ], + "parts":{ + "node_id":{ + "type":"list", + "description":"A comma-separated list of node IDs to span the reload/reinit call. Should stay empty because reloading usually involves all cluster nodes." + } + } + } + ] + }, + "params": { + "timeout": { + "type": "time", + "description": "Explicit operation timeout" + } + }, + "body": { + "description": "An object containing the password for the opensearch keystore", + "required": false + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/nodes.stats.json b/src/ApiGenerator/RestSpecification/Core/nodes.stats.json new file mode 100644 index 0000000000..a6d2ad1442 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/nodes.stats.json @@ -0,0 +1,232 @@ +{ + "nodes.stats":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/stats-api/", + "description":"Returns statistical information about nodes in the cluster." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_nodes/stats", + "methods":[ + "GET" + ] + }, + { + "path":"/_nodes/{node_id}/stats", + "methods":[ + "GET" + ], + "parts":{ + "node_id":{ + "type":"list", + "description":"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" + } + } + }, + { + "path":"/_nodes/stats/{metric}", + "methods":[ + "GET" + ], + "parts":{ + "metric":{ + "type":"list", + "options":[ + "_all", + "breaker", + "fs", + "http", + "indices", + "jvm", + "os", + "process", + "thread_pool", + "transport", + "discovery", + "indexing_pressure" + ], + "description":"Limit the information returned to the specified metrics" + } + } + }, + { + "path":"/_nodes/{node_id}/stats/{metric}", + "methods":[ + "GET" + ], + "parts":{ + "metric":{ + "type":"list", + "options":[ + "_all", + "breaker", + "fs", + "http", + "indices", + "jvm", + "os", + "process", + "thread_pool", + "transport", + "discovery", + "indexing_pressure" + ], + "description":"Limit the information returned to the specified metrics" + }, + "node_id":{ + "type":"list", + "description":"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" + } + } + }, + { + "path":"/_nodes/stats/{metric}/{index_metric}", + "methods":[ + "GET" + ], + "parts":{ + "metric":{ + "type":"list", + "options":[ + "_all", + "breaker", + "fs", + "http", + "indices", + "jvm", + "os", + "process", + "thread_pool", + "transport", + "discovery", + "indexing_pressure" + ], + "description":"Limit the information returned to the specified metrics" + }, + "index_metric":{ + "type":"list", + "options":[ + "_all", + "completion", + "docs", + "fielddata", + "query_cache", + "flush", + "get", + "indexing", + "merge", + "request_cache", + "refresh", + "search", + "segments", + "store", + "warmer", + "suggest" + ], + "description":"Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified." + } + } + }, + { + "path":"/_nodes/{node_id}/stats/{metric}/{index_metric}", + "methods":[ + "GET" + ], + "parts":{ + "metric":{ + "type":"list", + "options":[ + "_all", + "breaker", + "fs", + "http", + "indices", + "jvm", + "os", + "process", + "thread_pool", + "transport", + "discovery", + "indexing_pressure" + ], + "description":"Limit the information returned to the specified metrics" + }, + "index_metric":{ + "type":"list", + "options":[ + "_all", + "completion", + "docs", + "fielddata", + "query_cache", + "flush", + "get", + "indexing", + "merge", + "request_cache", + "refresh", + "search", + "segments", + "store", + "warmer", + "suggest" + ], + "description":"Limit the information returned for `indices` metric to the specific index metrics. Isn't used if `indices` (or `all`) metric isn't specified." + }, + "node_id":{ + "type":"list", + "description":"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" + } + } + } + ] + }, + "params":{ + "completion_fields":{ + "type":"list", + "description":"A comma-separated list of fields for `fielddata` and `suggest` index metric (supports wildcards)" + }, + "fielddata_fields":{ + "type":"list", + "description":"A comma-separated list of fields for `fielddata` index metric (supports wildcards)" + }, + "fields":{ + "type":"list", + "description":"A comma-separated list of fields for `fielddata` and `completion` index metric (supports wildcards)" + }, + "groups":{ + "type":"boolean", + "description":"A comma-separated list of search groups for `search` index metric" + }, + "level":{ + "type":"enum", + "description":"Return indices stats aggregated at index, node or shard level", + "options":[ + "indices", + "node", + "shards" + ], + "default":"node" + }, + "types":{ + "type":"list", + "description":"A comma-separated list of document types for the `indexing` index metric" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "include_segment_file_sizes":{ + "type":"boolean", + "description":"Whether to report the aggregated disk usage of each one of the Lucene index files (only applies if segment stats are requested)", + "default":false + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/nodes.usage.json b/src/ApiGenerator/RestSpecification/Core/nodes.usage.json new file mode 100644 index 0000000000..ce7c0d9137 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/nodes.usage.json @@ -0,0 +1,77 @@ +{ + "nodes.usage":{ + "documentation":{ + "url":"", + "description":"Returns low-level information about REST actions usage on nodes." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_nodes/usage", + "methods":[ + "GET" + ] + }, + { + "path":"/_nodes/{node_id}/usage", + "methods":[ + "GET" + ], + "parts":{ + "node_id":{ + "type":"list", + "description":"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" + } + } + }, + { + "path":"/_nodes/usage/{metric}", + "methods":[ + "GET" + ], + "parts":{ + "metric":{ + "type":"list", + "options":[ + "_all", + "rest_actions" + ], + "description":"Limit the information returned to the specified metrics" + } + } + }, + { + "path":"/_nodes/{node_id}/usage/{metric}", + "methods":[ + "GET" + ], + "parts":{ + "metric":{ + "type":"list", + "options":[ + "_all", + "rest_actions" + ], + "description":"Limit the information returned to the specified metrics" + }, + "node_id":{ + "type":"list", + "description":"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" + } + } + } + ] + }, + "params":{ + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/ping.json b/src/ApiGenerator/RestSpecification/Core/ping.json new file mode 100644 index 0000000000..87226096fd --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/ping.json @@ -0,0 +1,24 @@ +{ + "ping":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/index/", + "description":"Returns whether the cluster is running." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/", + "methods":[ + "HEAD" + ] + } + ] + }, + "params":{} + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/put_script.json b/src/ApiGenerator/RestSpecification/Core/put_script.json new file mode 100644 index 0000000000..de125549c8 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/put_script.json @@ -0,0 +1,70 @@ +{ + "put_script":{ + "documentation":{ + "url":"", + "description":"Creates or updates a script." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_scripts/{id}", + "methods":[ + "PUT", + "POST" + ], + "parts":{ + "id":{ + "type":"string", + "description":"Script ID" + } + } + }, + { + "path":"/_scripts/{id}/{context}", + "methods":[ + "PUT", + "POST" + ], + "parts":{ + "id":{ + "type":"string", + "description":"Script ID" + }, + "context":{ + "type":"string", + "description":"Script context" + } + } + } + ] + }, + "params":{ + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "context":{ + "type":"string", + "description":"Context name to compile script against" + } + }, + "body":{ + "description":"The document", + "required":true + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/rank_eval.json b/src/ApiGenerator/RestSpecification/Core/rank_eval.json new file mode 100644 index 0000000000..91bd3121aa --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/rank_eval.json @@ -0,0 +1,72 @@ +{ + "rank_eval":{ + "documentation":{ + "url":"", + "description":"Allows to evaluate the quality of ranked search results over a set of typical search queries" + }, + "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_rank_eval", + "methods":[ + "GET", + "POST" + ] + }, + { + "path":"/{index}/_rank_eval", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices" + } + } + } + ] + }, + "params":{ + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "search_type":{ + "type":"enum", + "options":[ + "query_then_fetch", + "dfs_query_then_fetch" + ], + "description":"Search operation type" + } + }, + "body":{ + "description":"The ranking evaluation search definition, including search requests, document ratings and ranking metric definition.", + "required":true + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/reindex.json b/src/ApiGenerator/RestSpecification/Core/reindex.json new file mode 100644 index 0000000000..8ed380265f --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/reindex.json @@ -0,0 +1,67 @@ +{ + "reindex":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/reindex/", + "description":"Allows to copy documents from one index to another, optionally filtering the source\ndocuments by a query, changing the destination index settings, or fetching the\ndocuments from a remote cluster." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_reindex", + "methods":[ + "POST" + ] + } + ] + }, + "params":{ + "refresh":{ + "type":"boolean", + "description":"Should the affected indexes be refreshed?" + }, + "timeout":{ + "type":"time", + "default":"1m", + "description":"Time each individual bulk request should wait for shards that are unavailable." + }, + "wait_for_active_shards":{ + "type":"string", + "description":"Sets the number of shard copies that must be active before proceeding with the reindex operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)" + }, + "wait_for_completion":{ + "type":"boolean", + "default":true, + "description":"Should the request should block until the reindex is complete." + }, + "requests_per_second":{ + "type":"number", + "default":0, + "description":"The throttle to set on this request in sub-requests per second. -1 means no throttle." + }, + "scroll":{ + "type":"time", + "description":"Control how long to keep the search context alive", + "default":"5m" + }, + "slices":{ + "type":"number|string", + "default":1, + "description":"The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`." + }, + "max_docs":{ + "type":"number", + "description":"Maximum number of documents to process (default: all documents)" + } + }, + "body":{ + "description":"The search definition using the Query DSL and the prototype for the index request.", + "required":true + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/reindex_rethrottle.json b/src/ApiGenerator/RestSpecification/Core/reindex_rethrottle.json new file mode 100644 index 0000000000..548f02c1f8 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/reindex_rethrottle.json @@ -0,0 +1,36 @@ +{ + "reindex_rethrottle":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/reindex/", + "description":"Changes the number of requests per second for a particular Reindex operation." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_reindex/{task_id}/_rethrottle", + "methods":[ + "POST" + ], + "parts":{ + "task_id":{ + "type":"string", + "description":"The task id to rethrottle" + } + } + } + ] + }, + "params":{ + "requests_per_second":{ + "type":"number", + "required":true, + "description":"The throttle to set on this request in floating sub-requests per second. -1 means set no throttle." + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/render_search_template.json b/src/ApiGenerator/RestSpecification/Core/render_search_template.json new file mode 100644 index 0000000000..de148aec03 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/render_search_template.json @@ -0,0 +1,41 @@ +{ + "render_search_template":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/search-template/", + "description":"Allows to use the Mustache language to pre-render a search definition." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_render/template", + "methods":[ + "GET", + "POST" + ] + }, + { + "path":"/_render/template/{id}", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "id":{ + "type":"string", + "description":"The id of the stored search template" + } + } + } + ] + }, + "body":{ + "description":"The search definition template and its params" + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/scripts_painless_execute.json b/src/ApiGenerator/RestSpecification/Core/scripts_painless_execute.json new file mode 100644 index 0000000000..c27d25bf03 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/scripts_painless_execute.json @@ -0,0 +1,29 @@ +{ + "scripts_painless_execute":{ + "documentation":{ + "url":"", + "description":"Allows an arbitrary script to be executed and a result to be returned" + }, + "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_scripts/painless/_execute", + "methods":[ + "GET", + "POST" + ] + } + ] + }, + "params":{}, + "body":{ + "description":"The script to execute" + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/scroll.json b/src/ApiGenerator/RestSpecification/Core/scroll.json new file mode 100644 index 0000000000..42dda8508d --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/scroll.json @@ -0,0 +1,43 @@ +{ + "scroll":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/search/#request-body", + "description":"Allows to retrieve a large numbers of results from a single search request." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_search/scroll", + "methods":[ + "GET", + "POST" + ] + } + ] + }, + "params":{ + "scroll":{ + "type":"time", + "description":"Specify how long a consistent view of the index should be maintained for scrolled search" + }, + "scroll_id":{ + "type":"string", + "description":"The scroll ID for scrolled search" + }, + "rest_total_hits_as_int":{ + "type":"boolean", + "description":"Indicates whether hits.total should be rendered as an integer or an object in the rest search response", + "default":false + } + }, + "body":{ + "description":"The scroll ID if not passed by URL or query parameter." + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/search.json b/src/ApiGenerator/RestSpecification/Core/search.json new file mode 100644 index 0000000000..6651077680 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/search.json @@ -0,0 +1,243 @@ +{ + "search":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/search/", + "description":"Returns results matching a query." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_search", + "methods":[ + "GET", + "POST" + ] + }, + { + "path":"/{index}/_search", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices" + } + } + } + ] + }, + "params":{ + "analyzer":{ + "type":"string", + "description":"The analyzer to use for the query string" + }, + "analyze_wildcard":{ + "type":"boolean", + "description":"Specify whether wildcard and prefix queries should be analyzed (default: false)" + }, + "ccs_minimize_roundtrips":{ + "type":"boolean", + "description":"Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution", + "default":"true" + }, + "default_operator":{ + "type":"enum", + "options":[ + "AND", + "OR" + ], + "default":"OR", + "description":"The default operator for query string query (AND or OR)" + }, + "df":{ + "type":"string", + "description":"The field to use as default where no field prefix is given in the query string" + }, + "explain":{ + "type":"boolean", + "description":"Specify whether to return detailed information about score computation as part of a hit" + }, + "stored_fields":{ + "type":"list", + "description":"A comma-separated list of stored fields to return as part of a hit" + }, + "docvalue_fields":{ + "type":"list", + "description":"A comma-separated list of fields to return as the docvalue representation of a field for each hit" + }, + "from":{ + "type":"number", + "description":"Starting offset (default: 0)" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "ignore_throttled":{ + "type":"boolean", + "description":"Whether specified concrete, expanded or aliased indices should be ignored when throttled" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "lenient":{ + "type":"boolean", + "description":"Specify whether format-based query failures (such as providing text to a numeric field) should be ignored" + }, + "preference":{ + "type":"string", + "description":"Specify the node or shard the operation should be performed on (default: random)" + }, + "q":{ + "type":"string", + "description":"Query in the Lucene query string syntax" + }, + "routing":{ + "type":"list", + "description":"A comma-separated list of specific routing values" + }, + "scroll":{ + "type":"time", + "description":"Specify how long a consistent view of the index should be maintained for scrolled search" + }, + "search_type":{ + "type":"enum", + "options":[ + "query_then_fetch", + "dfs_query_then_fetch" + ], + "description":"Search operation type" + }, + "size":{ + "type":"number", + "description":"Number of hits to return (default: 10)" + }, + "sort":{ + "type":"list", + "description":"A comma-separated list of : pairs" + }, + "_source":{ + "type":"list", + "description":"True or false to return the _source field or not, or a list of fields to return" + }, + "_source_excludes":{ + "type":"list", + "description":"A list of fields to exclude from the returned _source field" + }, + "_source_includes":{ + "type":"list", + "description":"A list of fields to extract and return from the _source field" + }, + "terminate_after":{ + "type":"number", + "description":"The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early." + }, + "stats":{ + "type":"list", + "description":"Specific 'tag' of the request for logging and statistical purposes" + }, + "suggest_field":{ + "type":"string", + "description":"Specify which field to use for suggestions" + }, + "suggest_mode":{ + "type":"enum", + "options":[ + "missing", + "popular", + "always" + ], + "default":"missing", + "description":"Specify suggest mode" + }, + "suggest_size":{ + "type":"number", + "description":"How many suggestions to return in response" + }, + "suggest_text":{ + "type":"string", + "description":"The source text for which the suggestions should be returned" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "track_scores":{ + "type":"boolean", + "description":"Whether to calculate and return scores even if they are not used for sorting" + }, + "track_total_hits":{ + "type":"boolean", + "description":"Indicate if the number of documents that match the query should be tracked" + }, + "allow_partial_search_results":{ + "type":"boolean", + "default":true, + "description":"Indicate if an error should be returned if there is a partial search failure or timeout" + }, + "typed_keys":{ + "type":"boolean", + "description":"Specify whether aggregation and suggester names should be prefixed by their respective types in the response" + }, + "version":{ + "type":"boolean", + "description":"Specify whether to return document version as part of a hit" + }, + "seq_no_primary_term":{ + "type":"boolean", + "description":"Specify whether to return sequence number and primary term of the last modification of each hit" + }, + "request_cache":{ + "type":"boolean", + "description":"Specify if request cache should be used for this request or not, defaults to index level setting" + }, + "batched_reduce_size":{ + "type":"number", + "description":"The number of shard results that should be reduced at once on the coordinating node. This value should be used as a protection mechanism to reduce the memory overhead per search request if the potential number of shards in the request can be large.", + "default":512 + }, + "max_concurrent_shard_requests":{ + "type":"number", + "description":"The number of concurrent shard requests per node this search executes concurrently. This value should be used to limit the impact of the search on the cluster in order to limit the number of concurrent shard requests", + "default":5 + }, + "pre_filter_shard_size":{ + "type":"number", + "description":"A threshold that enforces a pre-filter roundtrip to prefilter search shards based on query rewriting if the number of shards the search request expands to exceeds the threshold. This filter roundtrip can limit the number of shards significantly if for instance a shard can not match any documents based on its rewrite method ie. if date filters are mandatory to match but the shard bounds and the query are disjoint." + }, + "rest_total_hits_as_int":{ + "type":"boolean", + "description":"Indicates whether hits.total should be rendered as an integer or an object in the rest search response", + "default":false + }, + "min_compatible_shard_node":{ + "type":"string", + "description":"The minimum compatible version that all shards involved in search should have for this request to be successful" + } + }, + "body":{ + "description":"The search definition using the Query DSL" + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/search_shards.json b/src/ApiGenerator/RestSpecification/Core/search_shards.json new file mode 100644 index 0000000000..c013caeaa3 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/search_shards.json @@ -0,0 +1,71 @@ +{ + "search_shards":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/security-plugin/access-control/cross-cluster-search/", + "description":"Returns information about the indices and shards that a search request would be executed against." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_search_shards", + "methods":[ + "GET", + "POST" + ] + }, + { + "path":"/{index}/_search_shards", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices" + } + } + } + ] + }, + "params":{ + "preference":{ + "type":"string", + "description":"Specify the node or shard the operation should be performed on (default: random)" + }, + "routing":{ + "type":"string", + "description":"Specific routing value" + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/search_template.json b/src/ApiGenerator/RestSpecification/Core/search_template.json new file mode 100644 index 0000000000..b6a2adbeb9 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/search_template.json @@ -0,0 +1,112 @@ +{ + "search_template":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/search-template/", + "description":"Allows to use the Mustache language to pre-render a search definition." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_search/template", + "methods":[ + "GET", + "POST" + ] + }, + { + "path":"/{index}/_search/template", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices" + } + } + } + ] + }, + "params":{ + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "ignore_throttled":{ + "type":"boolean", + "description":"Whether specified concrete, expanded or aliased indices should be ignored when throttled" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "preference":{ + "type":"string", + "description":"Specify the node or shard the operation should be performed on (default: random)" + }, + "routing":{ + "type":"list", + "description":"A comma-separated list of specific routing values" + }, + "scroll":{ + "type":"time", + "description":"Specify how long a consistent view of the index should be maintained for scrolled search" + }, + "search_type":{ + "type":"enum", + "options":[ + "query_then_fetch", + "query_and_fetch", + "dfs_query_then_fetch", + "dfs_query_and_fetch" + ], + "description":"Search operation type" + }, + "explain":{ + "type":"boolean", + "description":"Specify whether to return detailed information about score computation as part of a hit" + }, + "profile":{ + "type":"boolean", + "description":"Specify whether to profile the query execution" + }, + "typed_keys":{ + "type":"boolean", + "description":"Specify whether aggregation and suggester names should be prefixed by their respective types in the response" + }, + "rest_total_hits_as_int":{ + "type":"boolean", + "description":"Indicates whether hits.total should be rendered as an integer or an object in the rest search response", + "default":false + }, + "ccs_minimize_roundtrips": { + "type" : "boolean", + "description" : "Indicates whether network round-trips should be minimized as part of cross-cluster search requests execution", + "default" : "true" + } + }, + "body":{ + "description":"The search definition template and its params", + "required":true + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/snapshot.cleanup_repository.json b/src/ApiGenerator/RestSpecification/Core/snapshot.cleanup_repository.json new file mode 100644 index 0000000000..9783af5d07 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/snapshot.cleanup_repository.json @@ -0,0 +1,43 @@ +{ + "snapshot.cleanup_repository": { + "documentation": { + "url": "", + "description": "Removes stale data from repository." + }, + "stability": "stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url": { + "paths": [ + { + "path": "/_snapshot/{repository}/_cleanup", + "methods": [ + "POST" + ], + "parts": { + "repository": { + "type": "string", + "description": "A repository name" + } + } + } + ] + }, + "params": { + "master_timeout": { + "type": "time", + "description": "Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout": { + "type": "time", + "description": "Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "timeout": { + "type": "time", + "description": "Explicit operation timeout" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/snapshot.clone.json b/src/ApiGenerator/RestSpecification/Core/snapshot.clone.json new file mode 100644 index 0000000000..c069bdcd5a --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/snapshot.clone.json @@ -0,0 +1,52 @@ +{ + "snapshot.clone":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-snapshots/", + "description":"Clones indices from one snapshot into another snapshot in the same repository." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_snapshot/{repository}/{snapshot}/_clone/{target_snapshot}", + "methods":[ + "PUT" + ], + "parts":{ + "repository":{ + "type":"string", + "description":"A repository name" + }, + "snapshot":{ + "type":"string", + "description":"The name of the snapshot to clone from" + }, + "target_snapshot":{ + "type":"string", + "description":"The name of the cloned snapshot to create" + } + } + } + ] + }, + "params":{ + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + }, + "body":{ + "description":"The snapshot clone definition", + "required":true + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/snapshot.create.json b/src/ApiGenerator/RestSpecification/Core/snapshot.create.json new file mode 100644 index 0000000000..c05e4d650c --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/snapshot.create.json @@ -0,0 +1,54 @@ +{ + "snapshot.create":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-snapshots/", + "description":"Creates a snapshot in a repository." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_snapshot/{repository}/{snapshot}", + "methods":[ + "PUT", + "POST" + ], + "parts":{ + "repository":{ + "type":"string", + "description":"A repository name" + }, + "snapshot":{ + "type":"string", + "description":"A snapshot name" + } + } + } + ] + }, + "params":{ + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "wait_for_completion":{ + "type":"boolean", + "description":"Should this request wait until the operation has completed before returning", + "default":false + } + }, + "body":{ + "description":"The snapshot definition", + "required":false + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/snapshot.create_repository.json b/src/ApiGenerator/RestSpecification/Core/snapshot.create_repository.json new file mode 100644 index 0000000000..b5d89f5282 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/snapshot.create_repository.json @@ -0,0 +1,53 @@ +{ + "snapshot.create_repository":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-snapshots/", + "description":"Creates a repository." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_snapshot/{repository}", + "methods":[ + "PUT", + "POST" + ], + "parts":{ + "repository":{ + "type":"string", + "description":"A repository name" + } + } + } + ] + }, + "params":{ + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "verify":{ + "type":"boolean", + "description":"Whether to verify the repository after creation" + } + }, + "body":{ + "description":"The repository definition", + "required":true + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/snapshot.delete.json b/src/ApiGenerator/RestSpecification/Core/snapshot.delete.json new file mode 100644 index 0000000000..227d3aec7c --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/snapshot.delete.json @@ -0,0 +1,43 @@ +{ + "snapshot.delete":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-snapshots/", + "description":"Deletes a snapshot." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_snapshot/{repository}/{snapshot}", + "methods":[ + "DELETE" + ], + "parts":{ + "repository":{ + "type":"string", + "description":"A repository name" + }, + "snapshot":{ + "type":"string", + "description":"A snapshot name" + } + } + } + ] + }, + "params":{ + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/snapshot.delete_repository.json b/src/ApiGenerator/RestSpecification/Core/snapshot.delete_repository.json new file mode 100644 index 0000000000..4cbf5b31f5 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/snapshot.delete_repository.json @@ -0,0 +1,43 @@ +{ + "snapshot.delete_repository":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-snapshots/", + "description":"Deletes a repository." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_snapshot/{repository}", + "methods":[ + "DELETE" + ], + "parts":{ + "repository":{ + "type":"list", + "description":"Name of the snapshot repository to unregister. Wildcard (`*`) patterns are supported." + } + } + } + ] + }, + "params":{ + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/snapshot.get.json b/src/ApiGenerator/RestSpecification/Core/snapshot.get.json new file mode 100644 index 0000000000..7d526adcbc --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/snapshot.get.json @@ -0,0 +1,51 @@ +{ + "snapshot.get":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-snapshots/", + "description":"Returns information about a snapshot." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_snapshot/{repository}/{snapshot}", + "methods":[ + "GET" + ], + "parts":{ + "repository":{ + "type":"string", + "description":"A repository name" + }, + "snapshot":{ + "type":"list", + "description":"A comma-separated list of snapshot names" + } + } + } + ] + }, + "params":{ + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown" + }, + "verbose":{ + "type":"boolean", + "description":"Whether to show verbose snapshot info or only show the basic info found in the repository index blob" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/snapshot.get_repository.json b/src/ApiGenerator/RestSpecification/Core/snapshot.get_repository.json new file mode 100644 index 0000000000..3a03941ed3 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/snapshot.get_repository.json @@ -0,0 +1,49 @@ +{ + "snapshot.get_repository":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-snapshots/", + "description":"Returns information about a repository." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_snapshot", + "methods":[ + "GET" + ] + }, + { + "path":"/_snapshot/{repository}", + "methods":[ + "GET" + ], + "parts":{ + "repository":{ + "type":"list", + "description":"A comma-separated list of repository names" + } + } + } + ] + }, + "params":{ + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "local":{ + "type":"boolean", + "description":"Return local information, do not retrieve the state from master node (default: false)" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/snapshot.restore.json b/src/ApiGenerator/RestSpecification/Core/snapshot.restore.json new file mode 100644 index 0000000000..630381ede2 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/snapshot.restore.json @@ -0,0 +1,53 @@ +{ + "snapshot.restore":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-snapshots/", + "description":"Restores a snapshot." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_snapshot/{repository}/{snapshot}/_restore", + "methods":[ + "POST" + ], + "parts":{ + "repository":{ + "type":"string", + "description":"A repository name" + }, + "snapshot":{ + "type":"string", + "description":"A snapshot name" + } + } + } + ] + }, + "params":{ + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "wait_for_completion":{ + "type":"boolean", + "description":"Should this request wait until the operation has completed before returning", + "default":false + } + }, + "body":{ + "description":"Details of what to restore", + "required":false + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/snapshot.status.json b/src/ApiGenerator/RestSpecification/Core/snapshot.status.json new file mode 100644 index 0000000000..40acfc5521 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/snapshot.status.json @@ -0,0 +1,65 @@ +{ + "snapshot.status":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-snapshots/", + "description":"Returns information about the status of a snapshot." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_snapshot/_status", + "methods":[ + "GET" + ] + }, + { + "path":"/_snapshot/{repository}/_status", + "methods":[ + "GET" + ], + "parts":{ + "repository":{ + "type":"string", + "description":"A repository name" + } + } + }, + { + "path":"/_snapshot/{repository}/{snapshot}/_status", + "methods":[ + "GET" + ], + "parts":{ + "repository":{ + "type":"string", + "description":"A repository name" + }, + "snapshot":{ + "type":"list", + "description":"A comma-separated list of snapshot names" + } + } + } + ] + }, + "params":{ + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether to ignore unavailable snapshots, defaults to false which means a SnapshotMissingException is thrown" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/snapshot.verify_repository.json b/src/ApiGenerator/RestSpecification/Core/snapshot.verify_repository.json new file mode 100644 index 0000000000..b0d52a80ca --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/snapshot.verify_repository.json @@ -0,0 +1,43 @@ +{ + "snapshot.verify_repository":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-snapshots/", + "description":"Verifies a repository." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_snapshot/{repository}/_verify", + "methods":[ + "POST" + ], + "parts":{ + "repository":{ + "type":"string", + "description":"A repository name" + } + } + } + ] + }, + "params":{ + "master_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to master node" + }, + "cluster_manager_timeout":{ + "type":"time", + "description":"Explicit operation timeout for connection to cluster_manager_timeout node" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/tasks.cancel.json b/src/ApiGenerator/RestSpecification/Core/tasks.cancel.json new file mode 100644 index 0000000000..8a31e844a4 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/tasks.cancel.json @@ -0,0 +1,53 @@ +{ + "tasks.cancel":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-tasks/", + "description":"Cancels a task, if it can be cancelled through an API." + }, + "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_tasks/_cancel", + "methods":[ + "POST" + ] + }, + { + "path":"/_tasks/{task_id}/_cancel", + "methods":[ + "POST" + ], + "parts":{ + "task_id":{ + "type":"string", + "description":"Cancel the task with specified task id (node_id:task_number)" + } + } + } + ] + }, + "params":{ + "nodes":{ + "type":"list", + "description":"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" + }, + "actions":{ + "type":"list", + "description":"A comma-separated list of actions that should be cancelled. Leave empty to cancel all." + }, + "parent_task_id":{ + "type":"string", + "description":"Cancel tasks with specified parent task id (node_id:task_number). Set to -1 to cancel all." + }, + "wait_for_completion": { + "type":"boolean", + "description":"Should the request block until the cancellation of the task and its descendant tasks is completed. Defaults to false" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/tasks.get.json b/src/ApiGenerator/RestSpecification/Core/tasks.get.json new file mode 100644 index 0000000000..1d8d576111 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/tasks.get.json @@ -0,0 +1,39 @@ +{ + "tasks.get":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-tasks/", + "description":"Returns information about a task." + }, + "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_tasks/{task_id}", + "methods":[ + "GET" + ], + "parts":{ + "task_id":{ + "type":"string", + "description":"Return the task with specified id (node_id:task_number)" + } + } + } + ] + }, + "params":{ + "wait_for_completion":{ + "type":"boolean", + "description":"Wait for the matching tasks to complete (default: false)" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/tasks.list.json b/src/ApiGenerator/RestSpecification/Core/tasks.list.json new file mode 100644 index 0000000000..e669d8d66c --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/tasks.list.json @@ -0,0 +1,59 @@ +{ + "tasks.list":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/cat/cat-tasks/", + "description":"Returns a list of tasks." + }, + "stability":"experimental", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_tasks", + "methods":[ + "GET" + ] + } + ] + }, + "params":{ + "nodes":{ + "type":"list", + "description":"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" + }, + "actions":{ + "type":"list", + "description":"A comma-separated list of actions that should be returned. Leave empty to return all." + }, + "detailed":{ + "type":"boolean", + "description":"Return detailed task information (default: false)" + }, + "parent_task_id":{ + "type":"string", + "description":"Return tasks with specified parent task id (node_id:task_number). Set to -1 to return all." + }, + "wait_for_completion":{ + "type":"boolean", + "description":"Wait for the matching tasks to complete (default: false)" + }, + "group_by":{ + "type":"enum", + "description":"Group tasks by nodes or parent/child relationships", + "options":[ + "nodes", + "parents", + "none" + ], + "default":"nodes" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/termvectors.json b/src/ApiGenerator/RestSpecification/Core/termvectors.json new file mode 100644 index 0000000000..98fd8216ba --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/termvectors.json @@ -0,0 +1,109 @@ +{ + "termvectors":{ + "documentation":{ + "url":"", + "description":"Returns information and statistics about terms in the fields of a particular document." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}/_termvectors/{id}", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "index":{ + "type":"string", + "description":"The index in which the document resides." + }, + "id":{ + "type":"string", + "description":"The id of the document, when not specified a doc param should be supplied." + } + } + }, + { + "path":"/{index}/_termvectors", + "methods":[ + "GET", + "POST" + ], + "parts":{ + "index":{ + "type":"string", + "description":"The index in which the document resides." + } + } + } + ] + }, + "params":{ + "term_statistics":{ + "type":"boolean", + "description":"Specifies if total term frequency and document frequency should be returned.", + "default":false + }, + "field_statistics":{ + "type":"boolean", + "description":"Specifies if document count, sum of document frequencies and sum of total term frequencies should be returned.", + "default":true + }, + "fields":{ + "type":"list", + "description":"A comma-separated list of fields to return." + }, + "offsets":{ + "type":"boolean", + "description":"Specifies if term offsets should be returned.", + "default":true + }, + "positions":{ + "type":"boolean", + "description":"Specifies if term positions should be returned.", + "default":true + }, + "payloads":{ + "type":"boolean", + "description":"Specifies if term payloads should be returned.", + "default":true + }, + "preference":{ + "type":"string", + "description":"Specify the node or shard the operation should be performed on (default: random)." + }, + "routing":{ + "type":"string", + "description":"Specific routing value." + }, + "realtime":{ + "type":"boolean", + "description":"Specifies if request is real-time as opposed to near-real-time (default: true)." + }, + "version":{ + "type":"number", + "description":"Explicit version number for concurrency control" + }, + "version_type":{ + "type":"enum", + "options":[ + "internal", + "external", + "external_gte", + "force" + ], + "description":"Specific version type" + } + }, + "body":{ + "description":"Define parameters and or supply a document to get termvectors for. See documentation.", + "required":false + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/update.json b/src/ApiGenerator/RestSpecification/Core/update.json new file mode 100644 index 0000000000..800b9f1116 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/update.json @@ -0,0 +1,93 @@ +{ + "update":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/update-document/", + "description":"Updates a document with a script or partial document." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}/_update/{id}", + "methods":[ + "POST" + ], + "parts":{ + "id":{ + "type":"string", + "description":"Document ID" + }, + "index":{ + "type":"string", + "description":"The name of the index" + } + } + } + ] + }, + "params":{ + "wait_for_active_shards":{ + "type":"string", + "description":"Sets the number of shard copies that must be active before proceeding with the update operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)" + }, + "_source":{ + "type":"list", + "description":"True or false to return the _source field or not, or a list of fields to return" + }, + "_source_excludes":{ + "type":"list", + "description":"A list of fields to exclude from the returned _source field" + }, + "_source_includes":{ + "type":"list", + "description":"A list of fields to extract and return from the _source field" + }, + "lang":{ + "type":"string", + "description":"The script language (default: painless)" + }, + "refresh":{ + "type":"enum", + "options":[ + "true", + "false", + "wait_for" + ], + "description":"If `true` then refresh the affected shards to make this operation visible to search, if `wait_for` then wait for a refresh to make this operation visible to search, if `false` (the default) then do nothing with refreshes." + }, + "retry_on_conflict":{ + "type":"number", + "description":"Specify how many times should the operation be retried when a conflict occurs (default: 0)" + }, + "routing":{ + "type":"string", + "description":"Specific routing value" + }, + "timeout":{ + "type":"time", + "description":"Explicit operation timeout" + }, + "if_seq_no":{ + "type":"number", + "description":"only perform the update operation if the last operation that has changed the document has the specified sequence number" + }, + "if_primary_term":{ + "type":"number", + "description":"only perform the update operation if the last operation that has changed the document has the specified primary term" + }, + "require_alias": { + "type": "boolean", + "description": "When true, requires destination is an alias. Default is false" + } + }, + "body":{ + "description":"The request definition requires either `script` or partial `doc`", + "required":true + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/update_by_query.json b/src/ApiGenerator/RestSpecification/Core/update_by_query.json new file mode 100644 index 0000000000..0e83281217 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/update_by_query.json @@ -0,0 +1,198 @@ +{ + "update_by_query":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/update-by-query/", + "description":"Performs an update on every document in the index without changing the source,\nfor example to pick up a mapping change." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"], + "content_type": ["application/json"] + }, + "url":{ + "paths":[ + { + "path":"/{index}/_update_by_query", + "methods":[ + "POST" + ], + "parts":{ + "index":{ + "type":"list", + "description":"A comma-separated list of index names to search; use `_all` or empty string to perform the operation on all indices" + } + } + } + ] + }, + "params":{ + "analyzer":{ + "type":"string", + "description":"The analyzer to use for the query string" + }, + "analyze_wildcard":{ + "type":"boolean", + "description":"Specify whether wildcard and prefix queries should be analyzed (default: false)" + }, + "default_operator":{ + "type":"enum", + "options":[ + "AND", + "OR" + ], + "default":"OR", + "description":"The default operator for query string query (AND or OR)" + }, + "df":{ + "type":"string", + "description":"The field to use as default where no field prefix is given in the query string" + }, + "from":{ + "type":"number", + "description":"Starting offset (default: 0)" + }, + "ignore_unavailable":{ + "type":"boolean", + "description":"Whether specified concrete indices should be ignored when unavailable (missing or closed)" + }, + "allow_no_indices":{ + "type":"boolean", + "description":"Whether to ignore if a wildcard indices expression resolves into no concrete indices. (This includes `_all` string or when no indices have been specified)" + }, + "conflicts":{ + "type":"enum", + "options":[ + "abort", + "proceed" + ], + "default":"abort", + "description":"What to do when the update by query hits version conflicts?" + }, + "expand_wildcards":{ + "type":"enum", + "options":[ + "open", + "closed", + "hidden", + "none", + "all" + ], + "default":"open", + "description":"Whether to expand wildcard expression to concrete indices that are open, closed or both." + }, + "lenient":{ + "type":"boolean", + "description":"Specify whether format-based query failures (such as providing text to a numeric field) should be ignored" + }, + "pipeline":{ + "type":"string", + "description":"Ingest pipeline to set on index requests made by this action. (default: none)" + }, + "preference":{ + "type":"string", + "description":"Specify the node or shard the operation should be performed on (default: random)" + }, + "q":{ + "type":"string", + "description":"Query in the Lucene query string syntax" + }, + "routing":{ + "type":"list", + "description":"A comma-separated list of specific routing values" + }, + "scroll":{ + "type":"time", + "description":"Specify how long a consistent view of the index should be maintained for scrolled search" + }, + "search_type":{ + "type":"enum", + "options":[ + "query_then_fetch", + "dfs_query_then_fetch" + ], + "description":"Search operation type" + }, + "search_timeout":{ + "type":"time", + "description":"Explicit timeout for each search request. Defaults to no timeout." + }, + "max_docs":{ + "type":"number", + "description":"Maximum number of documents to process (default: all documents)" + }, + "sort":{ + "type":"list", + "description":"A comma-separated list of : pairs" + }, + "_source":{ + "type":"list", + "description":"True or false to return the _source field or not, or a list of fields to return" + }, + "_source_excludes":{ + "type":"list", + "description":"A list of fields to exclude from the returned _source field" + }, + "_source_includes":{ + "type":"list", + "description":"A list of fields to extract and return from the _source field" + }, + "terminate_after":{ + "type":"number", + "description":"The maximum number of documents to collect for each shard, upon reaching which the query execution will terminate early." + }, + "stats":{ + "type":"list", + "description":"Specific 'tag' of the request for logging and statistical purposes" + }, + "version":{ + "type":"boolean", + "description":"Specify whether to return document version as part of a hit" + }, + "version_type":{ + "type":"boolean", + "description":"Should the document increment the version number (internal) on hit or not (reindex)" + }, + "request_cache":{ + "type":"boolean", + "description":"Specify if request cache should be used for this request or not, defaults to index level setting" + }, + "refresh":{ + "type":"boolean", + "description":"Should the affected indexes be refreshed?" + }, + "timeout":{ + "type":"time", + "default":"1m", + "description":"Time each individual bulk request should wait for shards that are unavailable." + }, + "wait_for_active_shards":{ + "type":"string", + "description":"Sets the number of shard copies that must be active before proceeding with the update by query operation. Defaults to 1, meaning the primary shard only. Set to `all` for all shard copies, otherwise set to any non-negative value less than or equal to the total number of copies for the shard (number of replicas + 1)" + }, + "scroll_size":{ + "type":"number", + "default":100, + "description":"Size on the scroll request powering the update by query" + }, + "wait_for_completion":{ + "type":"boolean", + "default":true, + "description":"Should the request should block until the update by query operation is complete." + }, + "requests_per_second":{ + "type":"number", + "default":0, + "description":"The throttle to set on this request in sub-requests per second. -1 means no throttle." + }, + "slices":{ + "type":"number|string", + "default":1, + "description":"The number of slices this task should be divided into. Defaults to 1, meaning the task isn't sliced into subtasks. Can be set to `auto`." + } + }, + "body":{ + "description":"The search definition using the Query DSL" + } + } +} diff --git a/src/ApiGenerator/RestSpecification/Core/update_by_query_rethrottle.json b/src/ApiGenerator/RestSpecification/Core/update_by_query_rethrottle.json new file mode 100644 index 0000000000..ee11e0e927 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/Core/update_by_query_rethrottle.json @@ -0,0 +1,36 @@ +{ + "update_by_query_rethrottle":{ + "documentation":{ + "url":"https://opensearch.org/docs/latest/opensearch/rest-api/document-apis/update-by-query/", + "description":"Changes the number of requests per second for a particular Update By Query operation." + }, + "stability":"stable", + "visibility":"public", + "headers":{ + "accept": [ "application/json"] + }, + "url":{ + "paths":[ + { + "path":"/_update_by_query/{task_id}/_rethrottle", + "methods":[ + "POST" + ], + "parts":{ + "task_id":{ + "type":"string", + "description":"The task id to rethrottle" + } + } + } + ] + }, + "params":{ + "requests_per_second":{ + "type":"number", + "required":true, + "description":"The throttle to set on this request in floating sub-requests per second. -1 means set no throttle." + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/_Patches/cat.tasks.patch.json b/src/ApiGenerator/RestSpecification/_Patches/cat.tasks.patch.json new file mode 100644 index 0000000000..ca5a5100d9 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/_Patches/cat.tasks.patch.json @@ -0,0 +1,8 @@ +{ + "cat.tasks": { + "stability" : "experimental", + "url": { + "path": "/_cat/tasks" + } + } +} \ No newline at end of file diff --git a/src/ApiGenerator/RestSpecification/_Patches/indices.put_mapping.patch.json b/src/ApiGenerator/RestSpecification/_Patches/indices.put_mapping.patch.json new file mode 100644 index 0000000000..87be1e7c1c --- /dev/null +++ b/src/ApiGenerator/RestSpecification/_Patches/indices.put_mapping.patch.json @@ -0,0 +1,15 @@ +{ + "indices.put_mapping": { + "url": { + "path": "{index}/_mapping", + "paths": ["{index}/_mapping"], + "deprecated_paths" : [ + { + "version" : "1.0", + "path" : "{index}/_mappings", + "description" : "The plural mappings is accepted but only /_mapping is documented" + } + ] + } + } +} diff --git a/src/ApiGenerator/RestSpecification/_Patches/indices.stats.patch.json b/src/ApiGenerator/RestSpecification/_Patches/indices.stats.patch.json new file mode 100644 index 0000000000..9a805273b9 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/_Patches/indices.stats.patch.json @@ -0,0 +1,11 @@ +{ + "indices.stats": { + "url": { + "parts": { + "metric" : { + "options": [ "_all", "store", "indexing", "get", "search", "merge", "flush", "refresh", "query_cache", "fielddata", "docs", "warmer", "completion", "segments", "translog", "request_cache", "recovery" ] + } + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/_Patches/nodes.hot_threads.patch.json b/src/ApiGenerator/RestSpecification/_Patches/nodes.hot_threads.patch.json new file mode 100644 index 0000000000..c895018667 --- /dev/null +++ b/src/ApiGenerator/RestSpecification/_Patches/nodes.hot_threads.patch.json @@ -0,0 +1,40 @@ +{ + "nodes.hot_threads": { + "url": { + "path": "/_nodes/hot_threads", + "paths": [ "/_nodes/hot_threads", "/_nodes/{node_id}/hot_threads" ], + "deprecated_paths": [ + { + "version": "1.0", + "path": "/_cluster/nodes/hotthreads", + "description": "The hot threads API accepts `hotthreads` but only `hot_threads` is documented" + }, + { + "version": "1.0", + "path": "/_cluster/nodes/{node_id}/hotthreads", + "description": "The hot threads API accepts `hotthreads` but only `hot_threads` is documented" + }, + { + "version": "1.0", + "path": "/_nodes/hotthreads", + "description": "The hot threads API accepts `hotthreads` but only `hot_threads` is documented" + }, + { + "version": "1.0", + "path": "/_nodes/{node_id}/hotthreads", + "description": "The hot threads API accepts `hotthreads` but only `hot_threads` is documented" + }, + { + "version": "1.0", + "path": "/_cluster/nodes/hot_threads", + "description": "The hot accepts /_cluster/nodes as prefix for backwards compatibility reasons" + }, + { + "version": "1.0", + "path": "/_cluster/nodes/{node_id}/hot_threads", + "description": "The hot accepts /_cluster/nodes as prefix for backwards compatibility reasons" + } + ] + } + } +} diff --git a/src/ApiGenerator/RestSpecification/_Patches/nodes.stats.patch.json b/src/ApiGenerator/RestSpecification/_Patches/nodes.stats.patch.json new file mode 100644 index 0000000000..b43cb36f3c --- /dev/null +++ b/src/ApiGenerator/RestSpecification/_Patches/nodes.stats.patch.json @@ -0,0 +1,11 @@ +{ + "nodes.stats": { + "url": { + "parts": { + "index_metric" : { + "options": [ "_all", "store", "indexing", "get", "search", "merge", "flush", "refresh", "query_cache", "fielddata", "docs", "warmer", "completion", "segments", "translog", "request_cache", "recovery" ] + } + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/_Patches/reindex.patch.patch.json b/src/ApiGenerator/RestSpecification/_Patches/reindex.patch.patch.json new file mode 100644 index 0000000000..1c1240317d --- /dev/null +++ b/src/ApiGenerator/RestSpecification/_Patches/reindex.patch.patch.json @@ -0,0 +1,12 @@ +{ + "reindex": { + "url": { + "params": { + "scroll": { + "type" : "time", + "description" : "Specify how long a consistent view of the index should be maintained for scrolled search" + } + } + } + } +} diff --git a/src/ApiGenerator/RestSpecification/_Patches/snapshot.cleanup_repository.patch.json b/src/ApiGenerator/RestSpecification/_Patches/snapshot.cleanup_repository.patch.json new file mode 100644 index 0000000000..7c4a52b6af --- /dev/null +++ b/src/ApiGenerator/RestSpecification/_Patches/snapshot.cleanup_repository.patch.json @@ -0,0 +1,5 @@ +{ + "snapshot.cleanup_repository": { + "body": { } + } +} diff --git a/src/ApiGenerator/Views/GeneratorNotice.cshtml b/src/ApiGenerator/Views/GeneratorNotice.cshtml new file mode 100644 index 0000000000..fc624a8e9e --- /dev/null +++ b/src/ApiGenerator/Views/GeneratorNotice.cshtml @@ -0,0 +1,45 @@ +@using ApiGenerator +@inherits CodeTemplatePage +/* 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 +// +// ----------------------------------------------- diff --git a/src/ApiGenerator/Views/HighLevel/Client/FluentSyntax/FluentMethod.cshtml b/src/ApiGenerator/Views/HighLevel/Client/FluentSyntax/FluentMethod.cshtml new file mode 100644 index 0000000000..5847b6ee46 --- /dev/null +++ b/src/ApiGenerator/Views/HighLevel/Client/FluentSyntax/FluentMethod.cshtml @@ -0,0 +1,20 @@ +@using System +@using ApiGenerator.Domain.Code.HighLevel.Methods +@inherits ApiGenerator.CodeTemplatePage +@{ + FluentSyntaxBase syntax = Model.Syntax; + + var method = !Model.Async ? syntax.MethodName : string.Format("{0}Async", syntax.MethodName); + var asyncKeyword = Model.Syntax.InterfaceResponse && Model.Async ? "async " : String.Empty; + var awaitKeyWord = Model.Syntax.InterfaceResponse && Model.Async ? "await ": string.Empty; + var configureAwait = Model.Syntax.InterfaceResponse && Model.Async ? ".ConfigureAwait(false)" : String.Empty; + + var requestMethodGenerics = syntax.RequestMethodGenerics; + var descriptor = syntax.DescriptorName; + var selectorArgs = syntax.SelectorArguments(); + var selectorChained = syntax.SelectorChainedDefaults(); + var cancellationToken = !Model.Async ? string.Empty : ", ct"; +} +@{ await IncludeAsync("HighLevel/Client/MethodXmlDocs.cshtml", syntax); } +public @(asyncKeyword)@{ await IncludeAsync("HighLevel/Client/FluentSyntax/FluentMethodHeader.cshtml", Model);} @Raw("=>") + @(awaitKeyWord)@(method)@(Raw(requestMethodGenerics))(selector.InvokeOrDefault(new @(Raw(descriptor))(@Raw(selectorArgs))@(@selectorChained))@cancellationToken)@Raw(configureAwait); diff --git a/src/ApiGenerator/Views/HighLevel/Client/FluentSyntax/FluentMethodHeader.cshtml b/src/ApiGenerator/Views/HighLevel/Client/FluentSyntax/FluentMethodHeader.cshtml new file mode 100644 index 0000000000..547c087257 --- /dev/null +++ b/src/ApiGenerator/Views/HighLevel/Client/FluentSyntax/FluentMethodHeader.cshtml @@ -0,0 +1,16 @@ +@using ApiGenerator.Domain.Code.HighLevel.Methods +@inherits ApiGenerator.CodeTemplatePage +@{ + FluentSyntaxBase syntax = Model.Syntax; + + var response = !Model.Async ? syntax.ResponseName : string.Format("Task<{0}>", syntax.ResponseName); + var method = !Model.Async ? syntax.MethodName : string.Format("{0}Async", syntax.MethodName); + + var methodGenerics = syntax.MethodGenerics; + var descriptorArgs = syntax.DescriptorArguments(); + var selector = syntax.Selector; + var optionalSelector = syntax.OptionalSelectorSuffix; + var whereClause = syntax.GenericWhereClause; + var cancellationToken = !Model.Async ? string.Empty : ", CancellationToken ct = default"; +} +@Raw(response) @(method)@(Raw(methodGenerics))(@(Raw(descriptorArgs))@(Raw(selector)) selector@(optionalSelector)@(cancellationToken))@whereClause diff --git a/src/ApiGenerator/Views/HighLevel/Client/Implementation/MethodImplementation.cshtml b/src/ApiGenerator/Views/HighLevel/Client/Implementation/MethodImplementation.cshtml new file mode 100644 index 0000000000..978a9b2a3e --- /dev/null +++ b/src/ApiGenerator/Views/HighLevel/Client/Implementation/MethodImplementation.cshtml @@ -0,0 +1,20 @@ +@using ApiGenerator +@using ApiGenerator.Domain.Code.HighLevel.Methods +@using HighLevelModel = ApiGenerator.Domain.Code.HighLevel.Methods.HighLevelModel +@inherits CodeTemplatePage +@{ + HighLevelModel model = Model; + var fluentPath = "HighLevel/Client/FluentSyntax/FluentMethod.cshtml"; + var initializerPath = "HighLevel/Client/InitializerSyntax/InitializerMethod.cshtml"; +} +@{ await IncludeAsync(fluentPath, new FluentSyntaxView(model.Fluent, async: false)); } +@{ await IncludeAsync(fluentPath, new FluentSyntaxView(model.Fluent, async: true)); } +@if (model.FluentBound != null) +{ + + @{ await IncludeAsync(fluentPath, new FluentSyntaxView(model.FluentBound, async: false)); } + @{ await IncludeAsync(fluentPath, new FluentSyntaxView(model.FluentBound, async: true)); } + +} +@{ await IncludeAsync(initializerPath, new InitializerSyntaxView(model.Initializer, async: false)); } +@{ await IncludeAsync(initializerPath, new InitializerSyntaxView(model.Initializer, async: true)); } diff --git a/src/ApiGenerator/Views/HighLevel/Client/Implementation/OpenSearchClient.Namespace.cshtml b/src/ApiGenerator/Views/HighLevel/Client/Implementation/OpenSearchClient.Namespace.cshtml new file mode 100644 index 0000000000..31934d8da9 --- /dev/null +++ b/src/ApiGenerator/Views/HighLevel/Client/Implementation/OpenSearchClient.Namespace.cshtml @@ -0,0 +1,37 @@ +@using ApiGenerator +@using System.Collections.Generic +@using System.Collections.ObjectModel +@using ApiGenerator.Domain.Code +@using ApiGenerator.Domain.Specification +@inherits ApiGenerator.CodeTemplatePage>> +@{ + KeyValuePair> model = Model; + string ns = model.Key; + var endpoints = model.Value; +} +@{ await IncludeAsync("GeneratorNotice.cshtml", model); } +// ReSharper disable RedundantUsingDirective +using System; +using System.Threading; +using System.Threading.Tasks; +using OpenSearch.Net.@(CsharpNames.ApiNamespace).@(ns)@(CsharpNames.ApiNamespaceSuffix); + +// ReSharper disable once CheckNamespace +// ReSharper disable RedundantTypeArgumentsOfMethod +namespace OpenSearch.Client.@(CsharpNames.ApiNamespace).@(ns)@(CsharpNames.ApiNamespaceSuffix) +{ + /// + /// @(ns.SplitPascalCase()) APIs. + /// Not intended to be instantiated directly. Use the property + /// on . + /// + /// + public class @(CsharpNames.HighLevelClientNamespacePrefix)@(model.Key)@(CsharpNames.ClientNamespaceSuffix) : NamespacedClientProxy + { + internal @(CsharpNames.HighLevelClientNamespacePrefix)@(model.Key)@(CsharpNames.ClientNamespaceSuffix)(OpenSearchClient client) : base(client) {} + @foreach(var e in endpoints) + { + await IncludeAsync("HighLevel/Client/Implementation/MethodImplementation.cshtml", e.HighLevelModel); + } + } +} diff --git a/src/ApiGenerator/Views/HighLevel/Client/Implementation/OpenSearchClient.cshtml b/src/ApiGenerator/Views/HighLevel/Client/Implementation/OpenSearchClient.cshtml new file mode 100644 index 0000000000..1fa8f03b90 --- /dev/null +++ b/src/ApiGenerator/Views/HighLevel/Client/Implementation/OpenSearchClient.cshtml @@ -0,0 +1,64 @@ +@using System.Linq +@using ApiGenerator.Domain +@using ApiGenerator +@using ApiGenerator.Domain.Code +@inherits CodeTemplatePage +@{ await IncludeAsync("GeneratorNotice.cshtml", Model); } +// ReSharper disable RedundantUsingDirective +using System; +using System.Threading; +using System.Threading.Tasks; +using OpenSearch.Client; +@{ await IncludeAsync("HighLevel/Client/Usings.cshtml", Model);} + +@{ + RestApiSpec model = Model; + var namespaces = model.EndpointsPerNamespaceHighLevel.Keys.Where(k => k != CsharpNames.RootNamespace).ToList(); + +// ReSharper disable RedundantTypeArgumentsOfMethod +namespace OpenSearch.Client +{ + /// + ///OpenSearch high level client + /// + public partial class OpenSearchClient : IOpenSearchClient + { + + foreach (var ns in namespaces) + { + ///@(ns.SplitPascalCase()) APIs + public @CsharpNames.HighLevelClientNamespacePrefix@(ns)@CsharpNames.ClientNamespaceSuffix @ns { get; private set; } + + } + + partial void SetupNamespaces() + { + + foreach (var ns in namespaces) + { + @ns = new @(CsharpNames.HighLevelClientNamespacePrefix)@(ns)@(CsharpNames.ClientNamespaceSuffix)(this); + + } + + } + + + + foreach (var kv in model.EndpointsPerNamespaceHighLevel) + { + if (kv.Key != CsharpNames.RootNamespace) + { + continue; + } + var endpoints = kv.Value; + var models = endpoints.Select(e=>e.HighLevelModel).ToList(); + foreach (var m in models) + { + await IncludeAsync("HighLevel/Client/Implementation/MethodImplementation.cshtml", m); + } + } + + } + } + +} diff --git a/src/ApiGenerator/Views/HighLevel/Client/InitializerSyntax/InitializerMethod.cshtml b/src/ApiGenerator/Views/HighLevel/Client/InitializerSyntax/InitializerMethod.cshtml new file mode 100644 index 0000000000..ea70731bcc --- /dev/null +++ b/src/ApiGenerator/Views/HighLevel/Client/InitializerSyntax/InitializerMethod.cshtml @@ -0,0 +1,22 @@ +@using System +@using ApiGenerator.Domain.Code.HighLevel.Methods +@inherits ApiGenerator.CodeTemplatePage +@{ + InitializerMethod syntax = Model.Syntax; + + var dispatchMethod = !Model.Async ? syntax.DispatchMethod : string.Format("{0}Async", syntax.DispatchMethod); + var dispatchGenerics = syntax.DispatchGenerics; + var dispatchParameters = syntax.DispatchParameters; + var asyncKeyword = Model.Syntax.InterfaceResponse && Model.Async ? "async " : String.Empty; + var awaitKeyWord = Model.Syntax.InterfaceResponse && Model.Async ? "await ": string.Empty; + var configureAwait = Model.Syntax.InterfaceResponse && Model.Async ? ".ConfigureAwait(false)" : String.Empty; + if (Model.Async) + { + dispatchParameters += ", ct"; + } +} +@{ await IncludeAsync("HighLevel/Client/MethodXmlDocs.cshtml", syntax); } +public @Raw(asyncKeyword)@{ await IncludeAsync("HighLevel/Client/InitializerSyntax/InitializerMethodHeader.cshtml", Model); } @Raw("=>") + @(awaitKeyWord)@(dispatchMethod)@(Raw(dispatchGenerics))(@Raw(dispatchParameters))@Raw(configureAwait); + + diff --git a/src/ApiGenerator/Views/HighLevel/Client/InitializerSyntax/InitializerMethodHeader.cshtml b/src/ApiGenerator/Views/HighLevel/Client/InitializerSyntax/InitializerMethodHeader.cshtml new file mode 100644 index 0000000000..aaf70f0c83 --- /dev/null +++ b/src/ApiGenerator/Views/HighLevel/Client/InitializerSyntax/InitializerMethodHeader.cshtml @@ -0,0 +1,17 @@ +@using ApiGenerator.Domain.Code.HighLevel.Methods +@inherits ApiGenerator.CodeTemplatePage +@{ + InitializerMethod syntax = Model.Syntax; + + var response = !Model.Async ? syntax.ResponseName : string.Format("Task<{0}>", syntax.ResponseName); + var method = !Model.Async ? syntax.MethodName : string.Format("{0}Async", syntax.MethodName); + var requestMethodGenerics = syntax.MethodGenerics; + + var methodsArgs = string.Format("{0} request", syntax.ArgumentType); + if (Model.Async) + { + methodsArgs += ", CancellationToken ct = default"; + } + var whereClause = syntax.GenericWhereClause; +} +@Raw(response) @(method)@(Raw(requestMethodGenerics))(@Raw(methodsArgs))@whereClause diff --git a/src/ApiGenerator/Views/HighLevel/Client/Interface/IOpenSearchClient.cshtml b/src/ApiGenerator/Views/HighLevel/Client/Interface/IOpenSearchClient.cshtml new file mode 100644 index 0000000000..6b82e4375a --- /dev/null +++ b/src/ApiGenerator/Views/HighLevel/Client/Interface/IOpenSearchClient.cshtml @@ -0,0 +1,40 @@ +@using System.Linq +@using ApiGenerator +@using ApiGenerator.Domain +@using ApiGenerator.Domain.Code +@inherits ApiGenerator.CodeTemplatePage +@{ await IncludeAsync("GeneratorNotice.cshtml", Model); } +// ReSharper disable RedundantUsingDirective +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using System.Linq; +using OpenSearch.Client; +@{ await IncludeAsync("HighLevel/Client/Usings.cshtml", Model);} + +namespace OpenSearch.Client +{ + /// + ///OpenSearch high level client + /// + public partial interface IOpenSearchClient + { + @foreach(var kv in Model.EndpointsPerNamespaceHighLevel) + { + if (kv.Key != CsharpNames.RootNamespace) + { + ///@(kv.Key.SplitPascalCase()) APIs + @CsharpNames.HighLevelClientNamespacePrefix@(kv.Key)@CsharpNames.ClientNamespaceSuffix @kv.Key { get; } + + continue; + } + var endpoints = kv.Value; + var models = endpoints.Select(e=>e.HighLevelModel).ToList(); + foreach(var m in models) + { + await IncludeAsync("HighLevel/Client/Interface/MethodInterface.cshtml", m); + } + } + } +} diff --git a/src/ApiGenerator/Views/HighLevel/Client/Interface/MethodInterface.cshtml b/src/ApiGenerator/Views/HighLevel/Client/Interface/MethodInterface.cshtml new file mode 100644 index 0000000000..e0db8b1671 --- /dev/null +++ b/src/ApiGenerator/Views/HighLevel/Client/Interface/MethodInterface.cshtml @@ -0,0 +1,29 @@ +@using ApiGenerator +@using ApiGenerator.Domain.Code.HighLevel.Methods +@using HighLevelModel = ApiGenerator.Domain.Code.HighLevel.Methods.HighLevelModel +@inherits CodeTemplatePage +@{ + HighLevelModel model = Model; + var fluentPath = "HighLevel/Client/FluentSyntax/FluentMethodHeader.cshtml"; + var initializerPath = "HighLevel/Client/InitializerSyntax/InitializerMethodHeader.cshtml"; +} + +@{ await IncludeAsync("HighLevel/Client/MethodXmlDocs.cshtml", model.Fluent); } +@{ await IncludeAsync(fluentPath, new FluentSyntaxView(model.Fluent, async: false)); }; +@{ await IncludeAsync("HighLevel/Client/MethodXmlDocs.cshtml", model.Fluent); } +@{ await IncludeAsync(fluentPath, new FluentSyntaxView(model.Fluent, async: true)); }; + +@if (model.FluentBound != null) +{ + + @{ await IncludeAsync("HighLevel/Client/MethodXmlDocs.cshtml", model.FluentBound); } + @{ await IncludeAsync(fluentPath, new FluentSyntaxView(model.FluentBound, async: false)); }; + @{ await IncludeAsync("HighLevel/Client/MethodXmlDocs.cshtml", model.FluentBound); } + @{ await IncludeAsync(fluentPath, new FluentSyntaxView(model.FluentBound, async: true)); }; + +} +@{ await IncludeAsync("HighLevel/Client/MethodXmlDocs.cshtml", model.Initializer); } +@{ await IncludeAsync(initializerPath, new InitializerSyntaxView(model.Initializer, async: false)); }; +@{ await IncludeAsync("HighLevel/Client/MethodXmlDocs.cshtml", model.Initializer); } +@{ await IncludeAsync(initializerPath, new InitializerSyntaxView(model.Initializer, async: true)); }; + diff --git a/src/ApiGenerator/Views/HighLevel/Client/MethodXmlDocs.cshtml b/src/ApiGenerator/Views/HighLevel/Client/MethodXmlDocs.cshtml new file mode 100644 index 0000000000..e93b97856c --- /dev/null +++ b/src/ApiGenerator/Views/HighLevel/Client/MethodXmlDocs.cshtml @@ -0,0 +1,11 @@ +@using ApiGenerator +@using ApiGenerator.Domain.Code.HighLevel.Methods; +@inherits CodeTemplatePage +@{ + var syntax = Model; +} +/// +/// @Raw(syntax.XmlDocSummary) +/// @Raw("") +/// @syntax.DocumentationLink +/// diff --git a/src/ApiGenerator/Views/HighLevel/Client/Usings.cshtml b/src/ApiGenerator/Views/HighLevel/Client/Usings.cshtml new file mode 100644 index 0000000000..53dcab591c --- /dev/null +++ b/src/ApiGenerator/Views/HighLevel/Client/Usings.cshtml @@ -0,0 +1,11 @@ +@using ApiGenerator.Domain +@using ApiGenerator.Domain.Code +@inherits ApiGenerator.CodeTemplatePage +@foreach(var kv in Model.EndpointsPerNamespaceHighLevel) +{ + if (kv.Key != CsharpNames.RootNamespace) + { +using OpenSearch.Client.@(CsharpNames.ApiNamespace).@(kv.Key)@(CsharpNames.ApiNamespaceSuffix); + + } +} diff --git a/src/ApiGenerator/Views/HighLevel/Descriptors/Descriptor.cshtml b/src/ApiGenerator/Views/HighLevel/Descriptors/Descriptor.cshtml new file mode 100644 index 0000000000..244b56e9e1 --- /dev/null +++ b/src/ApiGenerator/Views/HighLevel/Descriptors/Descriptor.cshtml @@ -0,0 +1,90 @@ +@using System.Linq +@using ApiGenerator.Domain.Code.HighLevel.Requests +@using ApiGenerator.Domain.Specification +@using ApiGenerator.Generator +@using CsQuery.ExtensionMethods.Internal +@inherits global::ApiGenerator.CodeTemplatePage +@{ + DescriptorPartialImplementation d = Model; + var names = d.CsharpNames; + var type = names.GenericOrNonGenericDescriptorName; + var concreteInterface = names.GenericOrNonGenericInterfaceName; + var baseInterface = names.GenericOrNonGenericInterfacePreference; + var apiLookup = $"ApiUrlsLookups.{d.CsharpNames.Namespace}{d.CsharpNames.MethodName}"; +} + ///Descriptor for @names.MethodName@Raw(d.OfficialDocumentationLink.IsNullOrEmpty() ? "" : " " + d.OfficialDocumentationLink + "") + public partial class @Raw(type) @(Raw(string.Format(" : RequestDescriptorBase<{0},{1}, {2}>, {2}", type,names.ParametersName, concreteInterface))) + { + internal override ApiUrls ApiUrls => @apiLookup; +@foreach (Constructor c in d.Constructors) +{ + @(Raw(CodeGenerator.Constructor(c))) + +} + // values part of the url path +@foreach (UrlPart part in d.Parts) +{ + @(Raw(part.HighLevelTypeName)) @(Raw(baseInterface)).@(part.InterfaceName) => Self.RouteValues.Get@(Raw(string.Format("<{0}>",part.HighLevelTypeName)))("@(part.Name)"); + +} +@foreach (FluentRouteSetter c in d.GetFluentRouteSetters()) +{ + + @(Raw(c.XmlDoc)) + @(Raw(c.Code)) + +} + // Request parameters +@foreach (var param in d.Params) +{ + var original = param.QueryStringKey; + //skip parameters already part of the path portion of the url + if (d.Parts.Any(p=>p.Name == original)) + { + continue; + } + //we prefer this parameter to be explictly implemented on the request body + if (param.RenderPartial && (d.HasBody)) + { + continue; + } + var t = @param.TypeHighLevel; + var tSuffix = (t == "bool" || t == "bool?") ? " = true" : ""; + var typed = !string.IsNullOrEmpty(names.GenericsDeclaredOnDescriptor); + var g = typed ? names.GenericsDeclaredOnDescriptor.Replace("<", "").Replace(">", "") : "T"; + var desc = param.DescriptionHighLevel.ToList(); + + await IncludeAsync("HighLevel/Descriptors/XmlDocs.cshtml", desc); + if(!string.IsNullOrWhiteSpace(param.Obsolete)) + { + + [Obsolete("Scheduled to be removed in 8.0, @param.Obsolete")] + + } + + public @Raw(type) @(param.ClsName)(@param.DescriptorArgumentType @param.ClsArgumentName@tSuffix) => Qs("@original", @(param.ClsArgumentName)); + + if (param.IsFieldsParam) + { + + ///@param.Description + public @Raw(type) @param.ClsName@(Raw(typed ? "" : ""))(params @Raw("Expression>[]") fields) @Raw(typed ? "" : "where " + g + " : class") => Qs("@original", fields?@Raw(".Select(e=>(Field)e)")); + + } + else if (param.IsFieldParam) + { + + ///@param.Description + public @Raw(type) @param.ClsName@(Raw(typed ? "" : ""))(@Raw("Expression>") field) @Raw(typed ? "" : "where " + g + " : class") => Qs("@original", (Field)field); + + } +} + @if (names.DescriptorNotFoundInCodebase) + { + [Obsolete("Unmapped, blacklist this API in CodeConfiguration.cs or implement @names.DescriptorName and @names.RequestName in a file called @(names.RequestName).cs in OSC's codebase", true)] + public bool IsUnmapped => true; + public bool UseIsUnmapped => IsUnmapped; + + } + } + diff --git a/src/ApiGenerator/Views/HighLevel/Descriptors/Descriptors.cshtml b/src/ApiGenerator/Views/HighLevel/Descriptors/Descriptors.cshtml new file mode 100644 index 0000000000..51ee81f6e7 --- /dev/null +++ b/src/ApiGenerator/Views/HighLevel/Descriptors/Descriptors.cshtml @@ -0,0 +1,38 @@ +@using System.Collections.Generic +@using System.Collections.ObjectModel +@using ApiGenerator +@using ApiGenerator.Domain.Specification +@using ApiGenerator.Domain.Code +@inherits CodeTemplatePage>> +@{ + KeyValuePair> model = Model; + string ns = model.Key != CsharpNames.RootNamespace ? "."+CsharpNames.ApiNamespace+"." + model.Key + CsharpNames.ApiNamespaceSuffix : null; + var endpoints = model.Value; +} +@{ await IncludeAsync("GeneratorNotice.cshtml", Model); } +// 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; +@if (model.Key != CsharpNames.RootNamespace) +{ + using OpenSearch.Net@(ns); + +} + +// ReSharper disable RedundantBaseConstructorCall +// ReSharper disable UnusedTypeParameter +// ReSharper disable PartialMethodWithSinglePart +// ReSharper disable RedundantNameQualifier +namespace OpenSearch.Client +{ +@foreach (var endpoint in endpoints) +{ + await IncludeAsync("HighLevel/Descriptors/Descriptor.cshtml", endpoint.DescriptorPartialImplementation); +} +} \ No newline at end of file diff --git a/src/ApiGenerator/Views/HighLevel/Descriptors/RequestDescriptorBase.cshtml b/src/ApiGenerator/Views/HighLevel/Descriptors/RequestDescriptorBase.cshtml new file mode 100644 index 0000000000..281bf02f27 --- /dev/null +++ b/src/ApiGenerator/Views/HighLevel/Descriptors/RequestDescriptorBase.cshtml @@ -0,0 +1,26 @@ +@using ApiGenerator.Domain +@inherits ApiGenerator.CodeTemplatePage +using System.Collections.Generic; + +namespace OpenSearch.Client +{ + // ReSharper disable UnusedTypeParameter + public abstract partial class @Raw("RequestDescriptorBase") + { +@foreach (var common in RestApiSpec.CommonApiQueryParameters.Values) +{ + var original = common.QueryStringKey; + var t = @common.TypeHighLevel; + var tSuffix = (t == "bool" || t == "bool?") ? " = true" : ""; + ///@(Raw(string.Join("", common.DescriptionHighLevel))) + public TDescriptor @(common.ClsName)(@common.DescriptorArgumentType @common.ClsArgumentName@tSuffix) => Qs("@original", @(common.ClsArgumentName)); + + if (common.IsArray) + { + ///@(Raw(string.Join("", common.DescriptionHighLevel))) + public TDescriptor @(common.ClsName)(@Raw(common.DescriptorEnumerableArgumentType) @common.ClsArgumentName@tSuffix) => Qs("@original", @(common.ClsArgumentName)); + + } +} + } +} diff --git a/src/ApiGenerator/Views/HighLevel/Descriptors/XmlDocs.cshtml b/src/ApiGenerator/Views/HighLevel/Descriptors/XmlDocs.cshtml new file mode 100644 index 0000000000..ded98d8e91 --- /dev/null +++ b/src/ApiGenerator/Views/HighLevel/Descriptors/XmlDocs.cshtml @@ -0,0 +1,19 @@ +@using System +@using System.Linq +@using System.Collections.Generic +@inherits ApiGenerator.CodeTemplatePage> +@{ + List summary = Model; + var description = summary.Count == 1 ? summary.First() : string.Join($"{Environment.NewLine}\t\t", summary.Select(d => "/// " + d)); + if (summary.Count == 1) + { + ///@Raw(description) + } + else + { + /// + @Raw(description) + /// + + } +} diff --git a/src/ApiGenerator/Views/HighLevel/Requests/ApiUrlsLookup.cshtml b/src/ApiGenerator/Views/HighLevel/Requests/ApiUrlsLookup.cshtml new file mode 100644 index 0000000000..9f2e38ffc7 --- /dev/null +++ b/src/ApiGenerator/Views/HighLevel/Requests/ApiUrlsLookup.cshtml @@ -0,0 +1,27 @@ +@using System.Linq +@using ApiGenerator.Domain +@using ApiGenerator +@using ApiGenerator.Configuration +@inherits CodeTemplatePage +@{ + RestApiSpec m = Model; +} +@{ await IncludeAsync("GeneratorNotice.cshtml", m); } +namespace OpenSearch.Client +{ + internal static class ApiUrlsLookups + { +@foreach (var endpoint in m.Endpoints.Values) +{ + if (CodeConfiguration.IgnoreHighLevelApi(endpoint.Name)) + { + continue; + } + 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 ApiUrls(new [] {@Raw(string.Join(", ", paths.Select(p=>$"\"{p.Path.TrimStart('/')}\"")))}); + +} + } +} \ No newline at end of file diff --git a/src/ApiGenerator/Views/HighLevel/Requests/PlainRequestBase.cshtml b/src/ApiGenerator/Views/HighLevel/Requests/PlainRequestBase.cshtml new file mode 100644 index 0000000000..f9cadb9648 --- /dev/null +++ b/src/ApiGenerator/Views/HighLevel/Requests/PlainRequestBase.cshtml @@ -0,0 +1,27 @@ +@using System.Linq +@using ApiGenerator.Domain +@inherits ApiGenerator.CodeTemplatePage +@{ await IncludeAsync("GeneratorNotice.cshtml", Model); } +// 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; +@{ await IncludeAsync("LowLevel/Client/Usings.cshtml", Model);} + +// ReSharper disable UnusedTypeParameter +namespace OpenSearch.Client +{ + public abstract partial class @Raw("PlainRequestBase") + { +@foreach (var common in RestApiSpec.CommonApiQueryParameters.Values) +{ + @Raw(common.InitializerGenerator(null, common.TypeHighLevel, common.ClsName, common.QueryStringKey, "value", common.DescriptionHighLevel.ToArray())) + +} + } +} diff --git a/src/ApiGenerator/Views/HighLevel/Requests/RequestImplementations.cshtml b/src/ApiGenerator/Views/HighLevel/Requests/RequestImplementations.cshtml new file mode 100644 index 0000000000..a16e7cf4f1 --- /dev/null +++ b/src/ApiGenerator/Views/HighLevel/Requests/RequestImplementations.cshtml @@ -0,0 +1,86 @@ +@using System.Linq +@using ApiGenerator.Domain.Code +@using ApiGenerator.Domain.Code.HighLevel.Requests +@using ApiGenerator.Domain.Specification +@using ApiGenerator.Generator +@using CsQuery.ExtensionMethods.Internal +@inherits global::ApiGenerator.CodeTemplatePage +@{ + RequestPartialImplementation r = Model; + CsharpNames names = r.CsharpNames; + var apiLookup = $"ApiUrlsLookups.{r.CsharpNames.Namespace}{r.CsharpNames.MethodName}"; +} +///Request for @names.MethodName@Raw(r.OfficialDocumentationLink.IsNullOrEmpty() ? "" : " " + r.OfficialDocumentationLink + "") +@if (r.Stability != Stability.Stable) +{ + string warningMessage = ""; + switch (r.Stability) + { + case Stability.Experimental: + warningMessage = "this functionality is experimental and may be changed or removed completely in a future release. OpenSearch will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features."; + break; + case Stability.Beta: + warningMessage = "this functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features."; + break; + } + +///@Raw("Note: " + r.Stability + " within the OpenSearch server, " + warningMessage + "") + +} + public partial class @Raw(r.Name) @Raw(string.Format(": PlainRequestBase<{0}>, {1}", names.ParametersName, r.InterfaceName)) + { + protected @(Raw(r.InterfaceName)) Self => this; + internal override ApiUrls ApiUrls => @apiLookup; +@foreach (Constructor c in r.Constructors) +{ + @(Raw(CodeGenerator.Constructor(c))) + +} + // values part of the url path +@foreach (var part in r.Parts) +{ + [IgnoreDataMember] + @(Raw(part.HighLevelTypeName)) @(Raw(r.InterfaceName)).@(part.InterfaceName) => Self.RouteValues.Get@(Raw(string.Format("<{0}>", part.HighLevelTypeName)))("@(part.Name)"); + +} + + // Request parameters +@foreach (var param in r.Params) +{ + var original = param.QueryStringKey; + //skip parameters already part of the path portion of the url + if (r.Parts.Any(p=>p.Name == original)) + { + continue; + } + // We prefer to map these explicitly in our own hand written classes. + // The interface generation will generate properties for these so code won't compile until we do + if (param.RenderPartial && (r.HasBody)) + { + continue; + } + var doc = param.DescriptionHighLevel.ToArray(); + @Raw(param.InitializerGenerator(r.CsharpNames.Namespace, param.TypeHighLevel, param.ClsName, original, param.SetterHighLevel, doc)) + +} +@if (names.DescriptorNotFoundInCodebase) +{ + [Obsolete("Unmapped, blacklist this API in CodeConfiguration.cs or implement @names.DescriptorName and @names.RequestName in a file called @(names.RequestName).cs in OSC's codebase", true)] + public bool IsUnmapped => true; + public bool UseIsUnmapped => IsUnmapped; + +} + } +@if (r.NeedsGenericImplementation) + { + public partial class @Raw(names.GenericRequestName) @Raw(string.Format(": {0}, {1}", names.RequestName, names.GenericInterfaceName)) + { + protected @(Raw(names.GenericInterfaceName)) TypedSelf => this; +@foreach (Constructor c in r.GenericConstructors) +{ + @(Raw(CodeGenerator.Constructor(c))) + +} + } + +} diff --git a/src/ApiGenerator/Views/HighLevel/Requests/RequestInterface.cshtml b/src/ApiGenerator/Views/HighLevel/Requests/RequestInterface.cshtml new file mode 100644 index 0000000000..ad5642216b --- /dev/null +++ b/src/ApiGenerator/Views/HighLevel/Requests/RequestInterface.cshtml @@ -0,0 +1,27 @@ +@using ApiGenerator.Domain.Code.HighLevel.Requests +@using ApiGenerator.Domain.Specification +@inherits ApiGenerator.CodeTemplatePage +@{ + RequestInterface i = Model; + string name = i.CsharpNames.RequestInterfaceName; +} + [InterfaceDataContract] + public partial interface @(Raw(i.Name)) : IRequest@(Raw(string.Format("<{0}>", i.CsharpNames.ParametersName))) + { +@foreach (UrlPart part in i.UrlParts) +{ + [IgnoreDataMember] + @(Raw(part.HighLevelTypeName)) @(part.InterfaceName) { get; } + +} +@foreach (var partialParam in i.PartialParameters) +{ + [DataMember(Name = "@(partialParam.QueryStringKey)")] @(Raw(partialParam.TypeHighLevel)) @(partialParam.ClsName) { get; set; } +} + } +@if (i.NeedsGenericInterface) +{ + + public partial interface @(name)@(Raw(i.CsharpNames.GenericsDeclaredOnRequest)) : @(Raw(name)) { } + +} diff --git a/src/ApiGenerator/Views/HighLevel/Requests/Requests.cshtml b/src/ApiGenerator/Views/HighLevel/Requests/Requests.cshtml new file mode 100644 index 0000000000..e55ea5a1ee --- /dev/null +++ b/src/ApiGenerator/Views/HighLevel/Requests/Requests.cshtml @@ -0,0 +1,39 @@ +@using System.Collections.Generic +@using System.Collections.ObjectModel +@using ApiGenerator +@using ApiGenerator.Domain.Specification +@using ApiGenerator.Domain.Code +@inherits CodeTemplatePage>> +@{ + KeyValuePair> model = Model; + string ns = model.Key != CsharpNames.RootNamespace ? "."+CsharpNames.ApiNamespace+"." + model.Key + CsharpNames.ApiNamespaceSuffix : null; + var endpoints = model.Value; +} +@{ await IncludeAsync("GeneratorNotice.cshtml", Model); } +// 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; +@if (model.Key != CsharpNames.RootNamespace) +{ + using OpenSearch.Net@(ns); + +} + +// ReSharper disable RedundantBaseConstructorCall +// ReSharper disable UnusedTypeParameter +// ReSharper disable PartialMethodWithSinglePart +// ReSharper disable RedundantNameQualifier +namespace OpenSearch.Client +{ +@foreach (var endpoint in endpoints) +{ + await IncludeAsync("HighLevel/Requests/RequestInterface.cshtml", endpoint.RequestInterface); + await IncludeAsync("HighLevel/Requests/RequestImplementations.cshtml", endpoint.RequestPartialImplementation); +} +} \ No newline at end of file diff --git a/src/ApiGenerator/Views/LowLevel/Client/Implementation/OpenSearchLowLevelClient.Namespace.cshtml b/src/ApiGenerator/Views/LowLevel/Client/Implementation/OpenSearchLowLevelClient.Namespace.cshtml new file mode 100644 index 0000000000..9ec2f9c3a1 --- /dev/null +++ b/src/ApiGenerator/Views/LowLevel/Client/Implementation/OpenSearchLowLevelClient.Namespace.cshtml @@ -0,0 +1,52 @@ +@using System.Collections.Generic +@using System.Collections.ObjectModel +@using System.Linq +@using ApiGenerator +@using ApiGenerator.Domain.Code +@using ApiGenerator.Domain.Specification +@inherits CodeTemplatePage>> +@{ await IncludeAsync("GeneratorNotice.cshtml", Model); } +@{ + KeyValuePair> model = Model; + string ns = model.Key; + var endpoints = model.Value; +} +// 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.@(CsharpNames.ApiNamespace).@(ns)@(CsharpNames.ApiNamespaceSuffix) +{ + /// + /// @(ns.SplitPascalCase()) APIs. + /// Not intended to be instantiated directly. Use the property + /// on . + /// + /// + public partial class @(CsharpNames.LowLevelClientNamespacePrefix)@(model.Key)@(CsharpNames.ClientNamespaceSuffix) : NamespacedClientProxy + { + internal @(CsharpNames.LowLevelClientNamespacePrefix)@(model.Key)@(CsharpNames.ClientNamespaceSuffix)(OpenSearchLowLevelClient client) : base(client) {} +@if (ns == "Cat") +{ + protected override string ContentType { get; } = "text/plain"; +} + @{ + var methods = endpoints.SelectMany(e=>e.LowLevelClientMethods).ToList(); + foreach (var method in methods) + { + await IncludeAsync("LowLevel/Client/Methods/MethodImplementation.cshtml", method); + } + } + } +} diff --git a/src/ApiGenerator/Views/LowLevel/Client/Implementation/OpenSearchLowLevelClient.cshtml b/src/ApiGenerator/Views/LowLevel/Client/Implementation/OpenSearchLowLevelClient.cshtml new file mode 100644 index 0000000000..a4ce6b2159 --- /dev/null +++ b/src/ApiGenerator/Views/LowLevel/Client/Implementation/OpenSearchLowLevelClient.cshtml @@ -0,0 +1,69 @@ +@using System.Linq +@using ApiGenerator.Domain +@using ApiGenerator +@using ApiGenerator.Domain.Code +@inherits CodeTemplatePage +@{ await IncludeAsync("GeneratorNotice.cshtml", Model); } +// 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; +@{ await IncludeAsync("LowLevel/Client/Usings.cshtml", Model);} +using static OpenSearch.Net.HttpMethod; + +@{ + RestApiSpec model = Model; + var namespaces = model.EndpointsPerNamespaceLowLevel.Keys.Where(k => k != CsharpNames.RootNamespace).ToList(); + +// ReSharper disable InterpolatedStringExpressionIsNotIFormattable +// ReSharper disable RedundantExtendsListEntry +namespace OpenSearch.Net +{ + /// + ///OpenSearch low level client + /// + public partial class OpenSearchLowLevelClient : IOpenSearchLowLevelClient + { + + foreach (var ns in namespaces) + { + public @(CsharpNames.LowLevelClientNamespacePrefix)@(ns)@(CsharpNames.ClientNamespaceSuffix) @ns { get; private set; } + + } + + partial void SetupNamespaces() + { + + foreach (var ns in namespaces) + { + @ns = new @(CsharpNames.LowLevelClientNamespacePrefix)@(ns)@(CsharpNames.ClientNamespaceSuffix)(this); + + } + + } + + + + foreach (var kv in model.EndpointsPerNamespaceLowLevel) + { + if (kv.Key != CsharpNames.RootNamespace) + { + continue; + } + var endpoints = kv.Value; + var methods = endpoints.SelectMany(e=>e.LowLevelClientMethods).ToList(); + foreach (var method in methods) + { + await IncludeAsync("LowLevel/Client/Methods/MethodImplementation.cshtml", method); + } + } + + } + } + +} diff --git a/src/ApiGenerator/Views/LowLevel/Client/Interface/IOpenSearchLowLevelClient.cshtml b/src/ApiGenerator/Views/LowLevel/Client/Interface/IOpenSearchLowLevelClient.cshtml new file mode 100644 index 0000000000..beadac4ff0 --- /dev/null +++ b/src/ApiGenerator/Views/LowLevel/Client/Interface/IOpenSearchLowLevelClient.cshtml @@ -0,0 +1,43 @@ +@using System.Linq +@using ApiGenerator +@using ApiGenerator.Domain +@using ApiGenerator.Domain.Code +@inherits ApiGenerator.CodeTemplatePage +@{ await IncludeAsync("GeneratorNotice.cshtml", Model); } +// 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; +@{ await IncludeAsync("LowLevel/Client/Usings.cshtml", Model);} + +namespace OpenSearch.Net +{ + /// + ///OpenSearch low level client + /// + public partial interface IOpenSearchLowLevelClient + { + @foreach(var kv in Model.EndpointsPerNamespaceLowLevel) + { + if (kv.Key != CsharpNames.RootNamespace) + { + + ///@(kv.Key.SplitPascalCase()) APIs + @CsharpNames.LowLevelClientNamespacePrefix@(kv.Key)@CsharpNames.ClientNamespaceSuffix @kv.Key { get; } + + continue; + } + var endpoints = kv.Value; + var methods = endpoints.SelectMany(e=>e.LowLevelClientMethods).ToList(); + foreach(var method in methods) + { + await IncludeAsync("LowLevel/Client/Methods/MethodInterface.cshtml", method); + } + } + } +} diff --git a/src/ApiGenerator/Views/LowLevel/Client/Methods/MethodDocs.cshtml b/src/ApiGenerator/Views/LowLevel/Client/Methods/MethodDocs.cshtml new file mode 100644 index 0000000000..0ec26f8228 --- /dev/null +++ b/src/ApiGenerator/Views/LowLevel/Client/Methods/MethodDocs.cshtml @@ -0,0 +1,36 @@ +@using ApiGenerator.Domain.Code.LowLevel +@using ApiGenerator.Domain.Specification +@using CsQuery.ExtensionMethods.Internal +@inherits ApiGenerator.CodeTemplatePage +@{ + LowLevelClientMethod method = Model; +} + ///@method.HttpMethod on @method.Path@Raw(method.OfficialDocumentationLink.IsNullOrEmpty() ? "" : " " + method.OfficialDocumentationLink + "") +@foreach (var part in method.Parts) +{ + ///@Raw("")@part.Description@Raw("") + +} + ///@Raw(@"Request specific configuration such as querystring parameters & request specific connection settings.") + @if (method.Stability != Stability.Stable) + { + string warningMessage = ""; + switch (method.Stability) + { + case Stability.Experimental: + warningMessage = "this functionality is Experimental and may be changed or removed completely in a future release. OpenSearch will take a best effort approach to fix any issues, but experimental features are not subject to the support SLA of official GA features."; + break; + case Stability.Beta: + warningMessage = "this functionality is in Beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features."; + break; + } + + warningMessage += " This functionality is subject to potential breaking changes within a minor version, meaning that your referencing code may break when this library is upgraded."; + + ///@Raw("Note: " + method.Stability + " within the OpenSearch server, " + warningMessage + "") + + } + @if (method.DeprecatedPath != null) + { + [Obsolete("Deprecated in version @(method.DeprecatedPath.Version): @Raw(method.DeprecatedPath.Description)")] +} diff --git a/src/ApiGenerator/Views/LowLevel/Client/Methods/MethodImplementation.cshtml b/src/ApiGenerator/Views/LowLevel/Client/Methods/MethodImplementation.cshtml new file mode 100644 index 0000000000..211a1f5dc8 --- /dev/null +++ b/src/ApiGenerator/Views/LowLevel/Client/Methods/MethodImplementation.cshtml @@ -0,0 +1,14 @@ +@using ApiGenerator.Domain.Code.LowLevel +@inherits ApiGenerator.CodeTemplatePage +@{ + LowLevelClientMethod method = Model; + var contentType = method.CsharpNames.RestSpecName.Contains(".cat_") ? ", contentType: \"text/plain\"" : string.Empty; +} +@{await IncludeAsync("LowLevel/Client/Methods/MethodDocs.cshtml", method); } + public TResponse @(method.PerPathMethodName)@(Raw(""))(@Raw(method.Arguments)) + where TResponse : class, IOpenSearchResponse, new() => DoRequest@(Raw(""))(@method.HttpMethod, @Raw(method.UrlInCode), @(method.HasBody ? "body" : "null"), RequestParams(requestParameters@(Raw(contentType)))); + +@{await IncludeAsync("LowLevel/Client/Methods/MethodDocs.cshtml", method); } + [MapsApi("@(method.CsharpNames.RestSpecName)", "@(method.MapsApiArguments)")] + public Task@(Raw("")) @(method.PerPathMethodName)Async@(Raw(""))(@Raw(method.Arguments), CancellationToken ctx = default) + where TResponse : class, IOpenSearchResponse, new() => DoRequestAsync@(Raw(""))(@method.HttpMethod, @Raw(method.UrlInCode), ctx, @(method.HasBody ? "body" : "null"), RequestParams(requestParameters@(Raw(contentType)))); diff --git a/src/ApiGenerator/Views/LowLevel/Client/Methods/MethodInterface.cshtml b/src/ApiGenerator/Views/LowLevel/Client/Methods/MethodInterface.cshtml new file mode 100644 index 0000000000..be8bef61ae --- /dev/null +++ b/src/ApiGenerator/Views/LowLevel/Client/Methods/MethodInterface.cshtml @@ -0,0 +1,10 @@ +@using ApiGenerator.Domain.Code.LowLevel +@inherits ApiGenerator.CodeTemplatePage +@{ + LowLevelClientMethod method = Model; +} +@{await IncludeAsync("LowLevel/Client/Methods/MethodDocs.cshtml", method); } + TResponse @(method.PerPathMethodName)@(Raw(""))(@Raw(method.Arguments)) where TResponse : class, IOpenSearchResponse, new(); + +@{await IncludeAsync("LowLevel/Client/Methods/MethodDocs.cshtml", method); } + Task@(Raw("")) @(method.PerPathMethodName)Async@(Raw(""))(@Raw(method.Arguments), CancellationToken ctx = default) where TResponse : class, IOpenSearchResponse, new(); diff --git a/src/ApiGenerator/Views/LowLevel/Client/Usings.cshtml b/src/ApiGenerator/Views/LowLevel/Client/Usings.cshtml new file mode 100644 index 0000000000..3222da33a8 --- /dev/null +++ b/src/ApiGenerator/Views/LowLevel/Client/Usings.cshtml @@ -0,0 +1,11 @@ +@using ApiGenerator.Domain +@using ApiGenerator.Domain.Code +@inherits ApiGenerator.CodeTemplatePage +@foreach(var kv in Model.EndpointsPerNamespaceLowLevel) +{ + if (kv.Key != CsharpNames.RootNamespace) + { +using OpenSearch.Net.@(CsharpNames.ApiNamespace).@(kv.Key)@(CsharpNames.ApiNamespaceSuffix); + + } +} diff --git a/src/ApiGenerator/Views/LowLevel/Enums.Generated.cshtml b/src/ApiGenerator/Views/LowLevel/Enums.Generated.cshtml new file mode 100644 index 0000000000..d669011d30 --- /dev/null +++ b/src/ApiGenerator/Views/LowLevel/Enums.Generated.cshtml @@ -0,0 +1,173 @@ +@using System +@using System.Linq +@using System.Text +@using ApiGenerator.Domain +@using ApiGenerator +@using ApiGenerator.Configuration.Overrides +@inherits CodeTemplatePage +@{ await IncludeAsync("GeneratorNotice.cshtml", Model); } +@functions { + private const string RawSize = "Raw"; + private const string SizeEnum = "Size"; + private static GlobalOverrides GlobalOverrides = new GlobalOverrides(); + + private string CreateEnum(string enumName, string value, int? i) + { + var enumValue = (enumName == SizeEnum && value == string.Empty) ? RawSize : value.ToPascalCase(true); + var enumCsharp = string.Format("[EnumMember(Value = \"{0}\")] {1}{2}", value, enumValue, i.HasValue ? " = 1 << " + i.Value : null); + if (GlobalOverrides.ObsoleteEnumMembers.TryGetValue(enumName, out var d) && d.TryGetValue(value, out var obsolete)) + { + return string.Format("[Obsolete(\"{0}\")]{2}\t\t{1}", obsolete, enumCsharp, Environment.NewLine); + } + return enumCsharp; + } + private string CreateCase(string e, string o) + { + var enumValue = GetEnumValue(e, o); + var isObsolete = GlobalOverrides.ObsoleteEnumMembers.TryGetValue(e, out var d) && d.TryGetValue(o, out _); + var sb = new StringBuilder(); + if (isObsolete) sb.AppendLine("#pragma warning disable 618"); + sb.Append(string.Format("case {0}.{1}: return \"{2}\";", e, enumValue, o)); + if (isObsolete) sb.AppendLine(Environment.NewLine + "#pragma warning disable 618"); + return sb.ToString(); + } + private bool IsFlag(string name) + { + return name.EndsWith("Metric") || name.EndsWith("Feature"); + } + + private string GetEnumValue(string enumName, string value) + { + return enumName == SizeEnum && value == string.Empty + ? RawSize + : value.ToPascalCase(true); + } +} +// ReSharper disable RedundantUsingDirective +using System; +using System.Collections.Generic; +using System.Collections.Concurrent; +using System.Linq; +using System.Text; +using System.Reflection; +using System.Runtime.Serialization; + +namespace OpenSearch.Net +{ +@foreach (EnumDescription e in Model.EnumsInTheSpec) +{ + var isFlag = IsFlag(e.Name); + + @(isFlag ? "[Flags, StringEnum]" : "[StringEnum]")public enum @e.Name + { + @Raw(string.Join(","+ Environment.NewLine + "\t\t", e.Options.OrderBy(s => s == "_all" ? 1 : 0).Select((s, i) => CreateEnum(e.Name, s, isFlag ? (int?)i : null)))) + } +} + + public static class KnownEnums + { + private static readonly @(Raw("ConcurrentDictionary>")) EnumStringResolvers = new @(Raw("ConcurrentDictionary>"))(); + + static KnownEnums() + { + @foreach (EnumDescription e in Model.EnumsInTheSpec) + { + EnumStringResolvers.TryAdd(typeof(@(e.Name)), (e) => GetStringValue((@(e.Name))e)); + + } + } + + private class EnumDictionary : @(Raw("Dictionary")) + { + public EnumDictionary(int capacity) : base(capacity) {} + public @(Raw("Func")) Resolver { get; set; } + } + + @foreach (EnumDescription e in Model.EnumsInTheSpec) + { + var isFlag = IsFlag(e.Name); + + public static string GetStringValue(this @(e.Name) enumValue) + { + + if (isFlag) + { + var allOption = e.Options.FirstOrDefault(o => o == "_all"); + if (allOption != null) + { + if ((enumValue & @(e.Name).All) != 0) return "_all"; + + } + var list = new @(Raw("List()")); + + var g = GlobalOverrides.ObsoleteEnumMembers.TryGetValue(e.Name, out var d); + foreach (var option in e.Options.Where(o => o != "_all")) + { + var value = GetEnumValue(e.Name, option); + if (g && d.TryGetValue(option, out var _)) { +#pragma warning disable 618 + if ((enumValue & @(e.Name).@(value)) != 0) list.Add("@(option)"); +#pragma warning restore 618 + + } + else { + if ((enumValue & @(e.Name).@(value)) != 0) list.Add("@(option)"); + + } + } + return string.Join(",", list); + } + } + else + { + switch (enumValue) + { + @Raw(string.Join(Environment.NewLine + "\t\t\t\t", e.Options.Select(o => CreateCase(e.Name, o)))) + } + throw new ArgumentException($"'{enumValue.ToString()}' is not a valid value for enum '@(e.Name)'"); + } + } + } + + public static string GetStringValue(this Enum e) + { + var type = e.GetType(); + var resolver = EnumStringResolvers.GetOrAdd(type, GetEnumStringResolver); + return resolver(e); + } + + private static @Raw("Func") GetEnumStringResolver(Type type) + { + var values = Enum.GetValues(type); + var dictionary = new EnumDictionary(values.Length); + + for (int index = 0; index < values.Length; index++) + { + var value = values.GetValue(index); + var info = type.GetField(value.ToString()); + var da = (EnumMemberAttribute[])info.GetCustomAttributes(typeof(EnumMemberAttribute), false); + var stringValue = da.Length > 0 ? da[0].Value : Enum.GetName(type, value); + dictionary.Add((Enum)value, stringValue); + } + + var isFlag = type.GetCustomAttributes(typeof(FlagsAttribute), false).Length > 0; + + return (e) => + { + if (isFlag) + { + var list = new @(Raw("List()")); + foreach(var kv in dictionary) + { + if (e.HasFlag(kv.Key)) list.Add(kv.Value); + } + return string.Join(",", list); + } + else + { + return dictionary[e]; + } + }; + } + } +} \ No newline at end of file diff --git a/src/ApiGenerator/Views/LowLevel/RequestParameters/RequestParameters.cshtml b/src/ApiGenerator/Views/LowLevel/RequestParameters/RequestParameters.cshtml new file mode 100644 index 0000000000..2e54e83140 --- /dev/null +++ b/src/ApiGenerator/Views/LowLevel/RequestParameters/RequestParameters.cshtml @@ -0,0 +1,43 @@ +@using System.Collections.Generic +@using System.Collections.ObjectModel +@using ApiGenerator +@using ApiGenerator.Domain.Code +@using ApiGenerator.Domain.Specification +@using CsQuery.ExtensionMethods.Internal +@inherits CodeTemplatePage>> +@{ await IncludeAsync("GeneratorNotice.cshtml", Model); } +@{ + KeyValuePair> model = Model; + string ns = model.Key != CsharpNames.RootNamespace ? "."+CsharpNames.ApiNamespace+"." + model.Key + CsharpNames.ApiNamespaceSuffix : null; + var endpoints = model.Value; +} + +// ReSharper disable RedundantUsingDirective +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Linq.Expressions; + +// ReSharper disable once CheckNamespace +namespace OpenSearch.Net@(ns) +{ + @foreach (var endpoint in endpoints) + { + var r = endpoint.RequestParameterImplementation; + var supportsBody = endpoint.Body != null; + var names = r.CsharpNames; + + ///Request options for @names.MethodName@Raw(r.OfficialDocumentationLink.IsNullOrEmpty() ? "" : " " + r.OfficialDocumentationLink + "") + public class @names.ParametersName : RequestParameters<@names.ParametersName> + { + public override HttpMethod DefaultHttpMethod => HttpMethod.@r.HttpMethod; + public override bool SupportsBody => @(supportsBody ? "true" : "false"); + @foreach (var param in r.Params) + { + @Raw(param.InitializerGenerator(r.CsharpNames.Namespace, param.TypeLowLevel, param.ClsName, param.QueryStringKey, param.SetterLowLevel, param.Description)) + + } + } + } +} \ No newline at end of file diff --git a/src/ApiGenerator/packages.lock.json b/src/ApiGenerator/packages.lock.json new file mode 100644 index 0000000000..623306d514 --- /dev/null +++ b/src/ApiGenerator/packages.lock.json @@ -0,0 +1,470 @@ +{ + "version": 1, + "dependencies": { + "net6.0": { + "CsQuery.Core": { + "type": "Direct", + "requested": "[2.0.1, )", + "resolved": "2.0.1", + "contentHash": "JQvgD0jBnO6M3r7SGrDfdpCak6E9ZP1hQb3T8iegkXiCs3A1JawE5TWD6q49MPY4arqVegtsB3th6J+lOXZkxA==", + "dependencies": { + "Microsoft.CSharp": "4.4.1", + "Newtonsoft.Json": "11.0.2" + } + }, + "Microsoft.CodeAnalysis.CSharp": { + "type": "Direct", + "requested": "[4.2.0, )", + "resolved": "4.2.0", + "contentHash": "5IDwr8zGNBmDpxtzxxZj9IHwoA6HJ1/WWT/JacqPQJ4Vz/oZXaHNlzcBPVCZRGWUw+QvVdAhCKwEyJyuAuH/wg==", + "dependencies": { + "Microsoft.CodeAnalysis.Common": "[4.2.0]" + } + }, + "Microsoft.NETFramework.ReferenceAssemblies": { + "type": "Direct", + "requested": "[1.0.3, )", + "resolved": "1.0.3", + "contentHash": "vUc9Npcs14QsyOD01tnv/m8sQUnGTGOw1BCmKcv77LBJY7OxhJ+zJF7UD/sCL3lYNFuqmQEVlkfS4Quif6FyYg==", + "dependencies": { + "Microsoft.NETFramework.ReferenceAssemblies.net461": "1.0.3" + } + }, + "Newtonsoft.Json": { + "type": "Direct", + "requested": "[13.0.1, )", + "resolved": "13.0.1", + "contentHash": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==" + }, + "RazorLight": { + "type": "Direct", + "requested": "[2.1.0, )", + "resolved": "2.1.0", + "contentHash": "WUJUsOJXUXrRpMrlWunn2QsOigF07S+lP2QxuOEBlfswDtuO4SAGaL97tOn0Hq24lMNqR4SWepOMj4Rlx+OfsQ==", + "dependencies": { + "Microsoft.AspNetCore.Mvc.Razor.Extensions": "6.0.0", + "Microsoft.CodeAnalysis.Razor": "6.0.0", + "Microsoft.Extensions.Caching.Abstractions": "6.0.0", + "Microsoft.Extensions.Caching.Memory": "6.0.0", + "Microsoft.Extensions.DependencyInjection": "6.0.0", + "Microsoft.Extensions.DependencyModel": "6.0.0", + "Microsoft.Extensions.FileProviders.Physical": "6.0.0", + "Microsoft.Extensions.Primitives": "6.0.0", + "System.Buffers": "4.5.1" + } + }, + "ShellProgressBar": { + "type": "Direct", + "requested": "[5.2.0, )", + "resolved": "5.2.0", + "contentHash": "XwR9OG00J837mtAXlHIeaJX93di6ZqPUwQLRXTLxyjDiAsytuZDKWELjeDXpWTQCzKsq+oZVhIeK8SN3ubYTwg==", + "dependencies": { + "System.Runtime.InteropServices.RuntimeInformation": "4.3.0", + "System.Text.Encoding.CodePages": "4.0.1" + } + }, + "Spectre.Console": { + "type": "Direct", + "requested": "[0.30.0, )", + "resolved": "0.30.0", + "contentHash": "7UG9p43sEJ2IjPuzkFNCE8zWmV1OOE0Kwh1jlJXv8/dzEADmWImzt9q868FCQ1ny5mDhNIkrZ3mfy2zxMSDagQ==", + "dependencies": { + "Wcwidth": "0.2.0" + } + }, + "System.CommandLine.DragonFruit": { + "type": "Direct", + "requested": "[0.3.0-alpha.20371.2, )", + "resolved": "0.3.0-alpha.20371.2", + "contentHash": "qLGFosjzbv/jzc3AnN5EgI88ODGGgGzcDQ5H9mt8j+boIVk+Sd9QwkGYw017A0lVT6pEgPXq3j/sLg5HmbtdeA==", + "dependencies": { + "System.CommandLine": "2.0.0-beta1.20371.2", + "System.CommandLine.Rendering": "0.3.0-alpha.20371.2" + } + }, + "System.Text.Encodings.Web": { + "type": "Direct", + "requested": "[7.0.0, )", + "resolved": "7.0.0", + "contentHash": "OP6umVGxc0Z0MvZQBVigj4/U31Pw72ITihDWP9WiWDm+q5aoe0GaJivsfYGq53o6dxH7DcXWiCTl7+0o2CGdmg==", + "dependencies": { + "System.Runtime.CompilerServices.Unsafe": "6.0.0" + } + }, + "Microsoft.AspNetCore.Mvc.Razor.Extensions": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "M0h+ChPgydX2xY17agiphnAVa/Qh05RAP8eeuqGGhQKT10claRBlLNO6d2/oSV8zy0RLHzwLnNZm5xuC/gckGA==", + "dependencies": { + "Microsoft.AspNetCore.Razor.Language": "6.0.0", + "Microsoft.CodeAnalysis.Razor": "6.0.0" + } + }, + "Microsoft.AspNetCore.Razor.Language": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "yCtBr1GSGzJrrp1NJUb4ltwFYMKHw/tJLnIDvg9g/FnkGIEzmE19tbCQqXARIJv5kdtBgsoVIdGLL+zmjxvM/A==" + }, + "Microsoft.CodeAnalysis.Analyzers": { + "type": "Transitive", + "resolved": "3.3.3", + "contentHash": "j/rOZtLMVJjrfLRlAMckJLPW/1rze9MT1yfWqSIbUPGRu1m1P0fuo9PmqapwsmePfGB5PJrudQLvmUOAMF0DqQ==" + }, + "Microsoft.CodeAnalysis.Common": { + "type": "Transitive", + "resolved": "4.2.0", + "contentHash": "lbusGcuE7D8FtZawQ4G++UFsRQArPzZN1GGXjPQwu3gvCbw7FXDcBq1zDZrZN1vRzPTVe1qyZMvfGhVUzs1TDg==", + "dependencies": { + "Microsoft.CodeAnalysis.Analyzers": "3.3.3", + "System.Collections.Immutable": "5.0.0", + "System.Memory": "4.5.4", + "System.Reflection.Metadata": "5.0.0", + "System.Runtime.CompilerServices.Unsafe": "6.0.0", + "System.Text.Encoding.CodePages": "6.0.0", + "System.Threading.Tasks.Extensions": "4.5.4" + } + }, + "Microsoft.CodeAnalysis.Razor": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "uqdzuQXxD7XrJCbIbbwpI/LOv0PBJ9VIR0gdvANTHOfK5pjTaCir+XcwvYvBZ5BIzd0KGzyiamzlEWw1cK1q0w==", + "dependencies": { + "Microsoft.AspNetCore.Razor.Language": "6.0.0", + "Microsoft.CodeAnalysis.CSharp": "4.0.0", + "Microsoft.CodeAnalysis.Common": "4.0.0" + } + }, + "Microsoft.CSharp": { + "type": "Transitive", + "resolved": "4.4.1", + "contentHash": "A5hI3gk6WpcBI0QGZY6/d5CCaYUxJgi7iENn1uYEng+Olo8RfI5ReGVkjXjeu3VR3srLvVYREATXa2M0X7FYJA==" + }, + "Microsoft.Extensions.Caching.Abstractions": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "bcz5sSFJbganH0+YrfvIjJDIcKNW7TL07C4d1eTmXy/wOt52iz4LVogJb6pazs7W0+74j0YpXFErvp++Aq5Bsw==", + "dependencies": { + "Microsoft.Extensions.Primitives": "6.0.0" + } + }, + "Microsoft.Extensions.Caching.Memory": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "Ve3BlCzhAlVp5IgO3+8dacAhZk1A0GlIlFNkAcfR2TfAibLKWIt5DhVJZfu4YtW+XZ89OjYf/agMcgjDtPxdGA==", + "dependencies": { + "Microsoft.Extensions.Caching.Abstractions": "6.0.0", + "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", + "Microsoft.Extensions.Logging.Abstractions": "6.0.0", + "Microsoft.Extensions.Options": "6.0.0", + "Microsoft.Extensions.Primitives": "6.0.0" + } + }, + "Microsoft.Extensions.DependencyInjection": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "k6PWQMuoBDGGHOQTtyois2u4AwyVcIwL2LaSLlTZQm2CYcJ1pxbt6jfAnpWmzENA/wfrYRI/X9DTLoUkE4AsLw==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", + "System.Runtime.CompilerServices.Unsafe": "6.0.0" + } + }, + "Microsoft.Extensions.DependencyInjection.Abstractions": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "xlzi2IYREJH3/m6+lUrQlujzX8wDitm4QGnUu6kUXTQAWPuZY8i+ticFJbzfqaetLA6KR/rO6Ew/HuYD+bxifg==" + }, + "Microsoft.Extensions.DependencyModel": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "TD5QHg98m3+QhgEV1YVoNMl5KtBw/4rjfxLHO0e/YV9bPUBDKntApP4xdrVtGgCeQZHVfC2EXIGsdpRNrr87Pg==", + "dependencies": { + "System.Buffers": "4.5.1", + "System.Memory": "4.5.4", + "System.Runtime.CompilerServices.Unsafe": "6.0.0", + "System.Text.Encodings.Web": "6.0.0", + "System.Text.Json": "6.0.0" + } + }, + "Microsoft.Extensions.FileProviders.Abstractions": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "0pd4/fho0gC12rQswaGQxbU34jOS1TPS8lZPpkFCH68ppQjHNHYle9iRuHeev1LhrJ94YPvzcRd8UmIuFk23Qw==", + "dependencies": { + "Microsoft.Extensions.Primitives": "6.0.0" + } + }, + "Microsoft.Extensions.FileProviders.Physical": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "QvkL7l0nM8udt3gfyu0Vw8bbCXblxaKOl7c2oBfgGy4LCURRaL9XWZX1FWJrQc43oMokVneVxH38iz+bY1sbhg==", + "dependencies": { + "Microsoft.Extensions.FileProviders.Abstractions": "6.0.0", + "Microsoft.Extensions.FileSystemGlobbing": "6.0.0", + "Microsoft.Extensions.Primitives": "6.0.0" + } + }, + "Microsoft.Extensions.FileSystemGlobbing": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "ip8jnL1aPiaPeKINCqaTEbvBFDmVx9dXQEBZ2HOBRXPD1eabGNqP/bKlsIcp7U2lGxiXd5xIhoFcmY8nM4Hdiw==" + }, + "Microsoft.Extensions.Logging.Abstractions": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "/HggWBbTwy8TgebGSX5DBZ24ndhzi93sHUBDvP1IxbZD7FDokYzdAr6+vbWGjw2XAfR2EJ1sfKUotpjHnFWPxA==" + }, + "Microsoft.Extensions.Options": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "dzXN0+V1AyjOe2xcJ86Qbo233KHuLEY0njf/P2Kw8SfJU+d45HNS2ctJdnEnrWbM9Ye2eFgaC5Mj9otRMU6IsQ==", + "dependencies": { + "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", + "Microsoft.Extensions.Primitives": "6.0.0" + } + }, + "Microsoft.Extensions.Primitives": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "9+PnzmQFfEFNR9J2aDTfJGGupShHjOuGw4VUv+JB044biSHrnmCIMD+mJHmb2H7YryrfBEXDurxQ47gJZdCKNQ==", + "dependencies": { + "System.Runtime.CompilerServices.Unsafe": "6.0.0" + } + }, + "Microsoft.NETCore.Platforms": { + "type": "Transitive", + "resolved": "1.1.0", + "contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==" + }, + "Microsoft.NETCore.Targets": { + "type": "Transitive", + "resolved": "1.1.0", + "contentHash": "aOZA3BWfz9RXjpzt0sRJJMjAscAUm3Hoa4UWAfceV9UTYxgwZ1lZt5nO2myFf+/jetYQo4uTP7zS8sJY67BBxg==" + }, + "Microsoft.NETFramework.ReferenceAssemblies.net461": { + "type": "Transitive", + "resolved": "1.0.3", + "contentHash": "AmOJZwCqnOCNp6PPcf9joyogScWLtwy0M1WkqfEQ0M9nYwyDD7EX9ZjscKS5iYnyvteX7kzSKFCKt9I9dXA6mA==" + }, + "runtime.native.System": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "c/qWt2LieNZIj1jGnVNsE2Kl23Ya2aSTBuXMD6V7k9KWr6l16Tqdwq+hJScEpWER9753NWC8h96PaVNY5Ld7Jw==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0" + } + }, + "System.Buffers": { + "type": "Transitive", + "resolved": "4.5.1", + "contentHash": "Rw7ijyl1qqRS0YQD/WycNst8hUUMgrMH4FCn1nNm27M4VxchZ1js3fVjQaANHO5f3sN4isvP4a+Met9Y4YomAg==" + }, + "System.Collections.Immutable": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "FXkLXiK0sVVewcso0imKQoOxjoPAj42R8HtjjbSjVPAzwDfzoyoznWxgA3c38LDbN9SJux1xXoXYAhz98j7r2g==" + }, + "System.CommandLine": { + "type": "Transitive", + "resolved": "2.0.0-beta1.20371.2", + "contentHash": "L6cnw4QgaLAOpUPSW1TjYGJGKsUvyDYvdQ/Gqv0/EnOSzByEf+IlAK1sRu+bcAhBrdws+eNPcOarg1Qj33oNDA==", + "dependencies": { + "Microsoft.CSharp": "4.4.1", + "system.memory": "4.5.4" + } + }, + "System.CommandLine.Rendering": { + "type": "Transitive", + "resolved": "0.3.0-alpha.20371.2", + "contentHash": "Giz/HUeNkosCnf1vkqHSTlbKGXIpthihn1ZDh2ZbwM3AOYGwv+ZOrgy/z9y3NNh3TCNyutHRf+c2Awg5TO27pA==", + "dependencies": { + "System.CommandLine": "2.0.0-beta1.20371.2" + } + }, + "System.Globalization": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "kYdVd2f2PAdFGblzFswE4hkNANJBKRmsfa2X5LG2AcWE1c7/4t0pYae1L8vfZ5xvE2nK/R9JprtToA61OSHWIg==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.IO": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "3qjaHvxQPDpSOYICjUoTsmoq5u6QJAFRUITgeT/4gqkF1bajbSmb1kwSxEA8AHlofqgcKJcM8udgieRNhaJ5Cg==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0", + "System.Text.Encoding": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.Memory": { + "type": "Transitive", + "resolved": "4.5.4", + "contentHash": "1MbJTHS1lZ4bS4FmsJjnuGJOu88ZzTT2rLvrhW7Ygic+pC0NWA+3hgAen0HRdsocuQXCkUTdFn9yHJJhsijDXw==" + }, + "System.Reflection": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "KMiAFoW7MfJGa9nDFNcfu+FpEdiHpWgTcS2HdMpDvt9saK3y/G4GwprPyzqjFH9NTaGPQeWNHU+iDlDILj96aQ==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.IO": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.Extensions": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "rJkrJD3kBI5B712aRu4DpSIiHRtr6QlfZSQsb0hYHrDCZORXCFjQfoipo2LaMUHoT9i1B7j7MnfaEKWDFmFQNQ==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Reflection.Metadata": { + "type": "Transitive", + "resolved": "5.0.0", + "contentHash": "5NecZgXktdGg34rh1OenY1rFNDCI8xSjFr+Z4OU4cU06AQHUdRnIIEeWENu3Wl4YowbzkymAIMvi3WyK9U53pQ==" + }, + "System.Reflection.Primitives": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "5RXItQz5As4xN2/YUDxdpsEkMhvw3e6aNveFXUn4Hl/udNTCNhnKp8lT9fnc3MhvGKh1baak5CovpuQUXHAlIA==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Resources.ResourceManager": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "/zrcPkkWdZmI4F92gL/TPumP98AVDu/Wxr3CSJGQQ+XN6wbRZcyfSKVoPo17ilb3iOr0cCRqJInGwNMolqhS8A==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Globalization": "4.3.0", + "System.Reflection": "4.3.0", + "System.Runtime": "4.3.0" + } + }, + "System.Runtime": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "JufQi0vPQ0xGnAczR13AUFglDyVYt4Kqnz1AZaiKZ5+GICq0/1MH/mO/eAJHt/mHW1zjKBJd7kV26SrxddAhiw==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0" + } + }, + "System.Runtime.CompilerServices.Unsafe": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg==" + }, + "System.Runtime.Handles": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "OKiSUN7DmTWeYb3l51A7EYaeNMnvxwE249YtZz7yooT4gOZhmTjIn48KgSsw2k2lYdLgTKNJw/ZIfSElwDRVgg==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Runtime.InteropServices": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "uv1ynXqiMK8mp1GM3jDqPCFN66eJ5w5XNomaK2XD+TuCroNTLFGeZ+WCmBMcBDyTFKou3P6cR6J/QsaqDp7fGQ==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Reflection": "4.3.0", + "System.Reflection.Primitives": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.Handles": "4.3.0" + } + }, + "System.Runtime.InteropServices.RuntimeInformation": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "cbz4YJMqRDR7oLeMRbdYv7mYzc++17lNhScCX0goO2XpGWdvAt60CGN+FHdePUEHCe/Jy9jUlvNAiNdM+7jsOw==", + "dependencies": { + "System.Reflection": "4.3.0", + "System.Reflection.Extensions": "4.3.0", + "System.Resources.ResourceManager": "4.3.0", + "System.Runtime": "4.3.0", + "System.Runtime.InteropServices": "4.3.0", + "System.Threading": "4.3.0", + "runtime.native.System": "4.3.0" + } + }, + "System.Text.Encoding": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "BiIg+KWaSDOITze6jGQynxg64naAPtqGHBwDrLaCtixsa5bKiR8dpPOHA7ge3C0JJQizJE+sfkz1wV+BAKAYZw==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Text.Encoding.CodePages": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "ZFCILZuOvtKPauZ/j/swhvw68ZRi9ATCfvGbk1QfydmcXBkIWecWKn/250UH7rahZ5OoDBaiAudJtPvLwzw85A==", + "dependencies": { + "System.Runtime.CompilerServices.Unsafe": "6.0.0" + } + }, + "System.Text.Json": { + "type": "Transitive", + "resolved": "6.0.0", + "contentHash": "zaJsHfESQvJ11vbXnNlkrR46IaMULk/gHxYsJphzSF+07kTjPHv+Oc14w6QEOfo3Q4hqLJgStUaYB9DBl0TmWg==", + "dependencies": { + "System.Runtime.CompilerServices.Unsafe": "6.0.0", + "System.Text.Encodings.Web": "6.0.0" + } + }, + "System.Threading": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "VkUS0kOBcUf3Wwm0TSbrevDDZ6BlM+b/HRiapRFWjM5O0NS0LviG0glKmFK+hhPDd1XFeSdU1GmlLhb2CoVpIw==", + "dependencies": { + "System.Runtime": "4.3.0", + "System.Threading.Tasks": "4.3.0" + } + }, + "System.Threading.Tasks": { + "type": "Transitive", + "resolved": "4.3.0", + "contentHash": "LbSxKEdOUhVe8BezB/9uOGGppt+nZf6e1VFyw6v3DN6lqitm0OSn2uXMOdtP0M3W4iMcqcivm2J6UgqiwwnXiA==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0", + "Microsoft.NETCore.Targets": "1.1.0", + "System.Runtime": "4.3.0" + } + }, + "System.Threading.Tasks.Extensions": { + "type": "Transitive", + "resolved": "4.5.4", + "contentHash": "zteT+G8xuGu6mS+mzDzYXbzS7rd3K6Fjb9RiZlYlJPam2/hU7JCBZBVEcywNuR+oZ1ncTvc/cq0faRr3P01OVg==" + }, + "Wcwidth": { + "type": "Transitive", + "resolved": "0.2.0", + "contentHash": "H7no2W0vuLJTvSPanlrijtG3UdJNVoeWBOp2a5dJFVa2tqSQuP5GfbJw1xAtPG9agRW310nFTUUsyPz5tuVIxw==" + } + } + } +} \ No newline at end of file diff --git a/src/ApiGenerator/razormachine.readme.txt b/src/ApiGenerator/razormachine.readme.txt new file mode 100644 index 0000000000..ff71feef32 --- /dev/null +++ b/src/ApiGenerator/razormachine.readme.txt @@ -0,0 +1,20 @@ +Xipton.Razor v2.6.1 + +The web.config configuration file only is for activating Razor intellisense inside Razor templates, within non MVC projects. Note that for being able to use Razor intellisense MVC 3 or MVC 4 need to be installed on your system. MVC is not needed for compiling Xipton.Razor templates. + +You need to the web.config to your non MVC template project besides your default app.config. The configured MVC and Razor assemblies (here MVC version 3) need to be installed at your environment. Xipton.Razor uses Razor 2.0 (part of MVC 4), still you can use this configuration (MVC 3, Razor 1) as long as MVC 3 has been installed at your system as well. If you do not have MVC 3 installed on your system you need to configure the MVC version (and configuration) in accordance to the version that is on your system. + +Important: +If you reference Xipton.Razor as a dll (and not as a project) and you want to use intellisense you must install the signed Xipton.Razor.dll inside the GAC (this is required only for being able to use intellisense, not for deployment).In that case the @model directive does not work together with intellisense (the template will compile though). Therefore if referencing Xipton.Razor as a signed dll (that must have been installed inside the GAC) you need to use the @inherits directive for a working intellisense like "@inherits Xipton.Razor.TemplateBase". + +Within MVC projects: +If you work with Xipton.Razor together with MVC, then you use your MVC project's app.config. In that case you could install the Xipton.Razor.dll in the GAC as well. Inside the MVC app.config you add an assembly reference for the Xipton.Razor.dll like: + + + + + + + +Now inside your Xipton.Razor templates you need to use the directive @inherits, like "@inherits Xipton.Razor.TemplateBase", instead of the @model directive. + diff --git a/src/OpenSearch.Client/Descriptors.Cat.cs b/src/OpenSearch.Client/Descriptors.Cat.cs index ba78505a5a..a6e1d17a71 100644 --- a/src/OpenSearch.Client/Descriptors.Cat.cs +++ b/src/OpenSearch.Client/Descriptors.Cat.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/Descriptors.Cluster.cs b/src/OpenSearch.Client/Descriptors.Cluster.cs index b374b8fa41..ee2804640b 100644 --- a/src/OpenSearch.Client/Descriptors.Cluster.cs +++ b/src/OpenSearch.Client/Descriptors.Cluster.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/Descriptors.DanglingIndices.cs b/src/OpenSearch.Client/Descriptors.DanglingIndices.cs index 999379f4ea..580eba3931 100644 --- a/src/OpenSearch.Client/Descriptors.DanglingIndices.cs +++ b/src/OpenSearch.Client/Descriptors.DanglingIndices.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/Descriptors.Indices.cs b/src/OpenSearch.Client/Descriptors.Indices.cs index 6fb023a153..06751cde32 100644 --- a/src/OpenSearch.Client/Descriptors.Indices.cs +++ b/src/OpenSearch.Client/Descriptors.Indices.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/Descriptors.Ingest.cs b/src/OpenSearch.Client/Descriptors.Ingest.cs index 69408bc8f0..9b9739e9c7 100644 --- a/src/OpenSearch.Client/Descriptors.Ingest.cs +++ b/src/OpenSearch.Client/Descriptors.Ingest.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/Descriptors.NoNamespace.cs b/src/OpenSearch.Client/Descriptors.NoNamespace.cs index 2c7739be05..8dff1b32ed 100644 --- a/src/OpenSearch.Client/Descriptors.NoNamespace.cs +++ b/src/OpenSearch.Client/Descriptors.NoNamespace.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/Descriptors.Nodes.cs b/src/OpenSearch.Client/Descriptors.Nodes.cs index 83557fbe10..e7631f92e2 100644 --- a/src/OpenSearch.Client/Descriptors.Nodes.cs +++ b/src/OpenSearch.Client/Descriptors.Nodes.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/Descriptors.Snapshot.cs b/src/OpenSearch.Client/Descriptors.Snapshot.cs index 7ca6153729..3595358229 100644 --- a/src/OpenSearch.Client/Descriptors.Snapshot.cs +++ b/src/OpenSearch.Client/Descriptors.Snapshot.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/Descriptors.Tasks.cs b/src/OpenSearch.Client/Descriptors.Tasks.cs index e2081faba8..3c93a1bf95 100644 --- a/src/OpenSearch.Client/Descriptors.Tasks.cs +++ b/src/OpenSearch.Client/Descriptors.Tasks.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/IOpenSearchClient.Generated.cs b/src/OpenSearch.Client/IOpenSearchClient.Generated.cs index 0142ce0533..5a89dd0dae 100644 --- a/src/OpenSearch.Client/IOpenSearchClient.Generated.cs +++ b/src/OpenSearch.Client/IOpenSearchClient.Generated.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/OpenSearchClient.Cat.cs b/src/OpenSearch.Client/OpenSearchClient.Cat.cs index d08d8cd174..ebf3fa065d 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Cat.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Cat.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/OpenSearchClient.Cluster.cs b/src/OpenSearch.Client/OpenSearchClient.Cluster.cs index 61a88a1101..efb6503f7f 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Cluster.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Cluster.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/OpenSearchClient.DanglingIndices.cs b/src/OpenSearch.Client/OpenSearchClient.DanglingIndices.cs index 84edcecc1c..7e22eec68d 100644 --- a/src/OpenSearch.Client/OpenSearchClient.DanglingIndices.cs +++ b/src/OpenSearch.Client/OpenSearchClient.DanglingIndices.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/OpenSearchClient.Indices.cs b/src/OpenSearch.Client/OpenSearchClient.Indices.cs index 7aeb43f818..609d79d558 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Indices.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Indices.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/OpenSearchClient.Ingest.cs b/src/OpenSearch.Client/OpenSearchClient.Ingest.cs index 84d7d93a04..effd01fd11 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Ingest.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Ingest.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/OpenSearchClient.NoNamespace.cs b/src/OpenSearch.Client/OpenSearchClient.NoNamespace.cs index 65444cd29a..3339ea442c 100644 --- a/src/OpenSearch.Client/OpenSearchClient.NoNamespace.cs +++ b/src/OpenSearch.Client/OpenSearchClient.NoNamespace.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/OpenSearchClient.Nodes.cs b/src/OpenSearch.Client/OpenSearchClient.Nodes.cs index 5b6e3ec9d3..bf60517610 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Nodes.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Nodes.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/OpenSearchClient.Snapshot.cs b/src/OpenSearch.Client/OpenSearchClient.Snapshot.cs index 0d13b731bc..5468062cc8 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Snapshot.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Snapshot.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/OpenSearchClient.Tasks.cs b/src/OpenSearch.Client/OpenSearchClient.Tasks.cs index eedf71f56e..b92a7443c6 100644 --- a/src/OpenSearch.Client/OpenSearchClient.Tasks.cs +++ b/src/OpenSearch.Client/OpenSearchClient.Tasks.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/Requests.Cat.cs b/src/OpenSearch.Client/Requests.Cat.cs index 7e27522b07..8e5d18a6d8 100644 --- a/src/OpenSearch.Client/Requests.Cat.cs +++ b/src/OpenSearch.Client/Requests.Cat.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/Requests.Cluster.cs b/src/OpenSearch.Client/Requests.Cluster.cs index 3b9bfb35cd..ee4f102612 100644 --- a/src/OpenSearch.Client/Requests.Cluster.cs +++ b/src/OpenSearch.Client/Requests.Cluster.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/Requests.DanglingIndices.cs b/src/OpenSearch.Client/Requests.DanglingIndices.cs index 7b1c9ed183..c83ef859ad 100644 --- a/src/OpenSearch.Client/Requests.DanglingIndices.cs +++ b/src/OpenSearch.Client/Requests.DanglingIndices.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/Requests.Indices.cs b/src/OpenSearch.Client/Requests.Indices.cs index 397bbcb30c..7c48fe4f3a 100644 --- a/src/OpenSearch.Client/Requests.Indices.cs +++ b/src/OpenSearch.Client/Requests.Indices.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/Requests.Ingest.cs b/src/OpenSearch.Client/Requests.Ingest.cs index 84aa8f922e..1246736a54 100644 --- a/src/OpenSearch.Client/Requests.Ingest.cs +++ b/src/OpenSearch.Client/Requests.Ingest.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/Requests.NoNamespace.cs b/src/OpenSearch.Client/Requests.NoNamespace.cs index d4fe6c3400..517d0f5017 100644 --- a/src/OpenSearch.Client/Requests.NoNamespace.cs +++ b/src/OpenSearch.Client/Requests.NoNamespace.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/Requests.Nodes.cs b/src/OpenSearch.Client/Requests.Nodes.cs index 7fd4a7ee06..b4df515004 100644 --- a/src/OpenSearch.Client/Requests.Nodes.cs +++ b/src/OpenSearch.Client/Requests.Nodes.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/Requests.Snapshot.cs b/src/OpenSearch.Client/Requests.Snapshot.cs index f4f91e4eec..dd20ec50b5 100644 --- a/src/OpenSearch.Client/Requests.Snapshot.cs +++ b/src/OpenSearch.Client/Requests.Snapshot.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/Requests.Tasks.cs b/src/OpenSearch.Client/Requests.Tasks.cs index cd926bb1fd..0335882a3b 100644 --- a/src/OpenSearch.Client/Requests.Tasks.cs +++ b/src/OpenSearch.Client/Requests.Tasks.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/Requests.cs b/src/OpenSearch.Client/Requests.cs index ed850585f3..e538cb511f 100644 --- a/src/OpenSearch.Client/Requests.cs +++ b/src/OpenSearch.Client/Requests.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Client/_Generated/ApiUrlsLookup.generated.cs b/src/OpenSearch.Client/_Generated/ApiUrlsLookup.generated.cs index d6a9e31f3f..bce8678144 100644 --- a/src/OpenSearch.Client/_Generated/ApiUrlsLookup.generated.cs +++ b/src/OpenSearch.Client/_Generated/ApiUrlsLookup.generated.cs @@ -25,7 +25,22 @@ * 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 +// +// ----------------------------------------------- namespace OpenSearch.Client { internal static class ApiUrlsLookups diff --git a/src/OpenSearch.Net/Api/Enums.Generated.cs b/src/OpenSearch.Net/Api/Enums.Generated.cs index 84d7988f33..c201892ea6 100644 --- a/src/OpenSearch.Net/Api/Enums.Generated.cs +++ b/src/OpenSearch.Net/Api/Enums.Generated.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs index fdacadab07..4fe2bb04cf 100644 --- a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs +++ b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cat.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs index a2adc4d459..e1fa75c14c 100644 --- a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs +++ b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Cluster.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.DanglingIndices.cs b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.DanglingIndices.cs index f8410265ac..0845af7dfb 100644 --- a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.DanglingIndices.cs +++ b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.DanglingIndices.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Features.cs b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Features.cs index 5ab1f0e60f..e93e913bb1 100644 --- a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Features.cs +++ b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Features.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Indices.cs b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Indices.cs index c86e6628f2..0718d196e3 100644 --- a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Indices.cs +++ b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Indices.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Ingest.cs b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Ingest.cs index d8a632b041..648da0c9dc 100644 --- a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Ingest.cs +++ b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Ingest.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.NoNamespace.cs b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.NoNamespace.cs index 588b4839bf..1a52c7bcae 100644 --- a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.NoNamespace.cs +++ b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.NoNamespace.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Nodes.cs b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Nodes.cs index 3a52fbc350..3d20d5a688 100644 --- a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Nodes.cs +++ b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Nodes.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Snapshot.cs b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Snapshot.cs index 77bd94f90d..e4ae9b2211 100644 --- a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Snapshot.cs +++ b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Snapshot.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Tasks.cs b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Tasks.cs index b995bd6753..c3f935d96d 100644 --- a/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Tasks.cs +++ b/src/OpenSearch.Net/Api/RequestParameters/RequestParameters.Tasks.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Net/IOpenSearchLowLevelClient.Generated.cs b/src/OpenSearch.Net/IOpenSearchLowLevelClient.Generated.cs index ed64f0d171..98aa3942d2 100644 --- a/src/OpenSearch.Net/IOpenSearchLowLevelClient.Generated.cs +++ b/src/OpenSearch.Net/IOpenSearchLowLevelClient.Generated.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs index 4d4894fd0c..b5ef5081f2 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cat.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs index 6b3ac61b0e..f59fc6f431 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.Cluster.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.DanglingIndices.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.DanglingIndices.cs index f340c0264a..79486fcb8f 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.DanglingIndices.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.DanglingIndices.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.Features.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.Features.cs index a0ba52d4ff..e59a40647e 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.Features.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.Features.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.Indices.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.Indices.cs index fd2619228d..b7d783ad38 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.Indices.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.Indices.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.Ingest.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.Ingest.cs index dea71a7344..59718a1b9a 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.Ingest.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.Ingest.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.NoNamespace.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.NoNamespace.cs index 95d6b6701e..959c4d72f5 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.NoNamespace.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.NoNamespace.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.Nodes.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.Nodes.cs index 42919c64c6..c0bee78a17 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.Nodes.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.Nodes.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.Snapshot.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.Snapshot.cs index 6b1731055e..1b7ed55cc9 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.Snapshot.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.Snapshot.cs @@ -25,7 +25,22 @@ * 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; diff --git a/src/OpenSearch.Net/OpenSearchLowLevelClient.Tasks.cs b/src/OpenSearch.Net/OpenSearchLowLevelClient.Tasks.cs index f583bea58c..d167f13058 100644 --- a/src/OpenSearch.Net/OpenSearchLowLevelClient.Tasks.cs +++ b/src/OpenSearch.Net/OpenSearchLowLevelClient.Tasks.cs @@ -25,7 +25,22 @@ * 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;