From 65e350ce2b728b92af82c3f47c0596ce032f1b5f Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Fri, 13 Oct 2023 16:38:10 +1300 Subject: [PATCH 01/16] Add `CreatePit` & `DeletePit` methods Signed-off-by: Thomas Farr --- .../Configuration/CodeConfiguration.cs | 2 + src/ApiGenerator/OpenSearch.openapi.json | 115 +++++++++++--- .../HighLevel/Descriptors/Descriptors.cshtml | 2 +- .../Views/HighLevel/Requests/Requests.cshtml | 2 +- .../Search/PointInTime/CreatePitRequest.cs | 37 +++++ .../Search/PointInTime/CreatePitResponse.cs | 44 ++++++ .../Search/PointInTime/DeletePitRequest.cs | 61 ++++++++ .../Search/PointInTime/DeletePitResponse.cs | 49 ++++++ .../_Generated/ApiUrlsLookup.cs | 6 + .../_Generated/Descriptors.Cluster.cs | 5 - .../_Generated/Descriptors.NoNamespace.cs | 126 +++++++++++++++ .../_Generated/IOpenSearchClient.cs | 80 ++++++++++ .../_Generated/OpenSearchClient.cs | 94 +++++++++++ .../_Generated/Requests.Cluster.cs | 7 - .../_Generated/Requests.NoNamespace.cs | 147 ++++++++++++++++++ .../RequestParameters.Cluster.cs | 15 +- .../RequestParameters.NoNamespace.cs | 103 ++++++++++++ .../_Generated/IOpenSearchLowLevelClient.cs | 42 +++++ .../_Generated/OpenSearchLowLevelClient.cs | 70 +++++++++ 19 files changed, 961 insertions(+), 46 deletions(-) create mode 100644 src/OpenSearch.Client/Search/PointInTime/CreatePitRequest.cs create mode 100644 src/OpenSearch.Client/Search/PointInTime/CreatePitResponse.cs create mode 100644 src/OpenSearch.Client/Search/PointInTime/DeletePitRequest.cs create mode 100644 src/OpenSearch.Client/Search/PointInTime/DeletePitResponse.cs create mode 100644 src/OpenSearch.Client/_Generated/Descriptors.NoNamespace.cs create mode 100644 src/OpenSearch.Client/_Generated/Requests.NoNamespace.cs create mode 100644 src/OpenSearch.Net/_Generated/Api/RequestParameters/RequestParameters.NoNamespace.cs diff --git a/src/ApiGenerator/Configuration/CodeConfiguration.cs b/src/ApiGenerator/Configuration/CodeConfiguration.cs index 8e182c4d14..2f9aeccbff 100644 --- a/src/ApiGenerator/Configuration/CodeConfiguration.cs +++ b/src/ApiGenerator/Configuration/CodeConfiguration.cs @@ -39,6 +39,8 @@ public static class CodeConfiguration { private static readonly Glob[] OperationsToInclude = { + new("{create,delete}_pit"), + new("cluster.allocation_explain"), new("cluster.delete_component_template"), new("cluster.delete_voting_config_exclusions"), diff --git a/src/ApiGenerator/OpenSearch.openapi.json b/src/ApiGenerator/OpenSearch.openapi.json index a34c78380d..fe1126c5e3 100644 --- a/src/ApiGenerator/OpenSearch.openapi.json +++ b/src/ApiGenerator/OpenSearch.openapi.json @@ -5119,16 +5119,6 @@ "type": "string", "description": "The awareness attribute for which the health is required." } - }, - { - "name": "ensure_node_commissioned", - "in": "query", - "description": "Checks whether local node is commissioned or not. If set to true on a local call it will throw exception if node is decommissioned.", - "schema": { - "type": "boolean", - "default": false, - "description": "Checks whether local node is commissioned or not. If set to true on a local call it will throw exception if node is decommissioned." - } } ], "responses": { @@ -5280,16 +5270,6 @@ "type": "string", "description": "The awareness attribute for which the health is required." } - }, - { - "name": "ensure_node_commissioned", - "in": "query", - "description": "Checks whether local node is commissioned or not. If set to true on a local call it will throw exception if node is decommissioned.", - "schema": { - "type": "boolean", - "default": false, - "description": "Checks whether local node is commissioned or not. If set to true on a local call it will throw exception if node is decommissioned." - } } ], "responses": { @@ -6831,6 +6811,18 @@ "deprecated": true } }, + { + "name": "cluster_manager_timeout", + "in": "query", + "description": "Operation timeout for connection to cluster-manager node.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Operation timeout for connection to cluster-manager node.", + "x-version-added": "2.0.0", + "x-data-type": "time" + } + }, { "name": "local", "in": "query", @@ -8536,6 +8528,18 @@ "deprecated": true } }, + { + "name": "cluster_manager_timeout", + "in": "query", + "description": "Operation timeout for connection to cluster-manager node.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Operation timeout for connection to cluster-manager node.", + "x-version-added": "2.0.0", + "x-data-type": "time" + } + }, { "name": "local", "in": "query", @@ -18594,6 +18598,18 @@ "deprecated": true } }, + { + "name": "cluster_manager_timeout", + "in": "query", + "description": "Operation timeout for connection to cluster-manager node.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Operation timeout for connection to cluster-manager node.", + "x-version-added": "2.0.0", + "x-data-type": "time" + } + }, { "name": "local", "in": "query", @@ -19451,6 +19467,18 @@ "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)." } }, + { + "name": "cluster_manager_timeout", + "in": "query", + "description": "Operation timeout for connection to cluster-manager node.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Operation timeout for connection to cluster-manager node.", + "x-version-added": "2.0.0", + "x-data-type": "time" + } + }, { "name": "expand_wildcards", "in": "query", @@ -25302,6 +25330,18 @@ "$ref": "#/components/schemas/ExpandWildcards" } }, + { + "name": "cluster_manager_timeout", + "in": "query", + "description": "Operation timeout for connection to cluster-manager node.", + "schema": { + "type": "string", + "pattern": "^([0-9]+)(?:d|h|m|s|ms|micros|nanos)$", + "description": "Operation timeout for connection to cluster-manager node.", + "x-version-added": "2.0.0", + "x-data-type": "time" + } + }, { "name": "wait_for_active_shards", "in": "query", @@ -26631,7 +26671,8 @@ "description": "Specify the keep alive for point in time.", "schema": { "type": "string", - "description": "Specify the keep alive for point in time." + "description": "Specify the keep alive for point in time.", + "x-data-type": "time" } }, { @@ -30868,6 +30909,7 @@ }, "DeletePit_BodyParams": { "type": "object", + "description": "The point-in-time ids to be deleted", "properties": { "pit_id": { "type": "array", @@ -31170,6 +31212,9 @@ "type": "string" } }, + "dls": { + "type": "string" + }, "fls": { "type": "array", "items": { @@ -31885,19 +31930,22 @@ "description": { "type": "string" }, - "cluster_permission": { + "cluster_permissions": { "type": "array", "items": { "type": "string" } }, - "index_permission": { - "$ref": "#/components/schemas/IndexPermission" + "index_permissions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/IndexPermission" + } }, "tenant_permissions": { "type": "array", "items": { - "type": "string" + "$ref": "#/components/schemas/TenantPermission" } }, "static": { @@ -32220,6 +32268,23 @@ } } }, + "TenantPermission": { + "type": "object", + "properties": { + "tenant_patterns": { + "type": "array", + "items": { + "type": "string" + } + }, + "allowed_actions": { + "type": "array", + "items": { + "type": "string" + } + } + } + }, "TenantsMap": { "type": "object", "additionalProperties": { diff --git a/src/ApiGenerator/Views/HighLevel/Descriptors/Descriptors.cshtml b/src/ApiGenerator/Views/HighLevel/Descriptors/Descriptors.cshtml index ca37a794ec..edded9028a 100644 --- a/src/ApiGenerator/Views/HighLevel/Descriptors/Descriptors.cshtml +++ b/src/ApiGenerator/Views/HighLevel/Descriptors/Descriptors.cshtml @@ -17,7 +17,7 @@ using System.Linq.Expressions; using OpenSearch.Net; using OpenSearch.Net.Utf8Json; -@if (ns != CsharpNames.RootNamespace) +@if (ns != null) { using OpenSearch.Net@(ns); diff --git a/src/ApiGenerator/Views/HighLevel/Requests/Requests.cshtml b/src/ApiGenerator/Views/HighLevel/Requests/Requests.cshtml index ccf86d4973..b0eef938ac 100644 --- a/src/ApiGenerator/Views/HighLevel/Requests/Requests.cshtml +++ b/src/ApiGenerator/Views/HighLevel/Requests/Requests.cshtml @@ -17,7 +17,7 @@ using System.Linq.Expressions; using System.Runtime.Serialization; using OpenSearch.Net; using OpenSearch.Net.Utf8Json; -@if (ns != CsharpNames.RootNamespace) +@if (ns != null) { using OpenSearch.Net@(ns); diff --git a/src/OpenSearch.Client/Search/PointInTime/CreatePitRequest.cs b/src/OpenSearch.Client/Search/PointInTime/CreatePitRequest.cs new file mode 100644 index 0000000000..2cc5866d6b --- /dev/null +++ b/src/OpenSearch.Client/Search/PointInTime/CreatePitRequest.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. +*/ + +namespace OpenSearch.Client; + +[MapsApi("create_pit")] +[ReadAs(typeof(CreatePitRequest))] +public partial interface ICreatePitRequest { } + +public partial class CreatePitRequest { } + +public partial class CreatePitDescriptor { } diff --git a/src/OpenSearch.Client/Search/PointInTime/CreatePitResponse.cs b/src/OpenSearch.Client/Search/PointInTime/CreatePitResponse.cs new file mode 100644 index 0000000000..d0442bd1b6 --- /dev/null +++ b/src/OpenSearch.Client/Search/PointInTime/CreatePitResponse.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.Runtime.Serialization; + +namespace OpenSearch.Client; + +[DataContract] +public class CreatePitResponse : ResponseBase +{ + [DataMember(Name = "pit_id")] + public string PitId { get; internal set; } + + [DataMember(Name = "_shards")] + public ShardStatistics Shards { get; internal set; } + + [DataMember(Name = "creation_time")] + public long CreationTime { get; internal set; } +} diff --git a/src/OpenSearch.Client/Search/PointInTime/DeletePitRequest.cs b/src/OpenSearch.Client/Search/PointInTime/DeletePitRequest.cs new file mode 100644 index 0000000000..59255a254f --- /dev/null +++ b/src/OpenSearch.Client/Search/PointInTime/DeletePitRequest.cs @@ -0,0 +1,61 @@ +/* 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.Runtime.Serialization; + +namespace OpenSearch.Client; + +[MapsApi("delete_pit")] +[ReadAs(typeof(DeletePitRequest))] +public partial interface IDeletePitRequest +{ + [DataMember(Name = "pit_id")] + IEnumerable PitIds { get; set; } +} + +public partial class DeletePitRequest +{ + public DeletePitRequest(IEnumerable pitIds) : this(pitIds?.ToArray()) { } + + public DeletePitRequest(params string[] pitIds) => PitIds = pitIds; + + public IEnumerable PitIds { get; set; } +} + +public partial class DeletePitDescriptor +{ + IEnumerable IDeletePitRequest.PitIds { get; set; } + + public DeletePitDescriptor PitIds(IEnumerable pitIds) => + Assign(pitIds?.ToArray(), (r, v) => r.PitIds = v); + + public DeletePitDescriptor PitIds(params string[] pitIds) => + Assign(pitIds, (r, v) => r.PitIds = v); +} diff --git a/src/OpenSearch.Client/Search/PointInTime/DeletePitResponse.cs b/src/OpenSearch.Client/Search/PointInTime/DeletePitResponse.cs new file mode 100644 index 0000000000..b6c40f7652 --- /dev/null +++ b/src/OpenSearch.Client/Search/PointInTime/DeletePitResponse.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; +using System.Runtime.Serialization; + +namespace OpenSearch.Client; + +[DataContract] +public class DeletePitResponse : ResponseBase +{ + [DataMember(Name = "pits")] + public IReadOnlyCollection Pits { get; internal set; } +} + +[DataContract] +public class DeletedPit +{ + [DataMember(Name = "pit_id")] + public string PitId { get; set; } + + [DataMember(Name = "successful")] + public bool Successful { get; set; } +} diff --git a/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs b/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs index db47501d1f..77c9922293 100644 --- a/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs +++ b/src/OpenSearch.Client/_Generated/ApiUrlsLookup.cs @@ -59,6 +59,9 @@ internal static partial class ApiUrlsLookups internal static readonly ApiUrls ClusterPendingTasks = new(new[] { "_cluster/pending_tasks" }); + internal static readonly ApiUrls NoNamespaceCreatePit = + new(new[] { "{index}/_search/point_in_time" }); + internal static readonly ApiUrls DanglingIndicesDeleteDanglingIndex = new(new[] { "_dangling/{index_uuid}" }); @@ -67,6 +70,9 @@ internal static partial class ApiUrlsLookups internal static readonly ApiUrls DanglingIndicesList = new(new[] { "_dangling" }); + internal static readonly ApiUrls NoNamespaceDeletePit = + new(new[] { "_search/point_in_time" }); + internal static readonly ApiUrls IngestDeletePipeline = new(new[] { "_ingest/pipeline/{id}" }); diff --git a/src/OpenSearch.Client/_Generated/Descriptors.Cluster.cs b/src/OpenSearch.Client/_Generated/Descriptors.Cluster.cs index 234b1b72ae..2eb94a0396 100644 --- a/src/OpenSearch.Client/_Generated/Descriptors.Cluster.cs +++ b/src/OpenSearch.Client/_Generated/Descriptors.Cluster.cs @@ -185,11 +185,6 @@ public ClusterHealthDescriptor ClusterHealthLevel(ClusterHealthLevel? clusterhea public ClusterHealthDescriptor ClusterManagerTimeout(Time clustermanagertimeout) => Qs("cluster_manager_timeout", clustermanagertimeout); - /// Checks whether local node is commissioned or not. If set to true on a local call it will throw exception if node is decommissioned. - public ClusterHealthDescriptor EnsureNodeCommissioned( - bool? ensurenodecommissioned = true - ) => Qs("ensure_node_commissioned", ensurenodecommissioned); - /// Whether to expand wildcard expression to concrete indices that are open, closed or both. public ClusterHealthDescriptor ExpandWildcards(ExpandWildcards? expandwildcards) => Qs("expand_wildcards", expandwildcards); diff --git a/src/OpenSearch.Client/_Generated/Descriptors.NoNamespace.cs b/src/OpenSearch.Client/_Generated/Descriptors.NoNamespace.cs new file mode 100644 index 0000000000..4f67374362 --- /dev/null +++ b/src/OpenSearch.Client/_Generated/Descriptors.NoNamespace.cs @@ -0,0 +1,126 @@ +/* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ +/* +* Modifications Copyright OpenSearch Contributors. See +* GitHub history for details. +* +* Licensed to Elasticsearch B.V. under one or more contributor +* license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright +* ownership. Elasticsearch B.V. licenses this file to you under +* the Apache License, Version 2.0 (the "License"); you may +* not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ----------------------------------------------- +// +// This file is automatically generated +// Please do not edit these files manually +// Run the following in the root of the repos: +// +// *NIX : ./build.sh codegen +// Windows : build.bat codegen +// +// ----------------------------------------------- +// ReSharper disable RedundantUsingDirective +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Linq.Expressions; + +using OpenSearch.Net; +using OpenSearch.Net.Utf8Json; + +// ReSharper disable RedundantBaseConstructorCall +// ReSharper disable UnusedTypeParameter +// ReSharper disable PartialMethodWithSinglePart +// ReSharper disable RedundantNameQualifier +namespace OpenSearch.Client +{ + /// Descriptor for CreatePit https://opensearch.org/docs/latest/search-plugins/point-in-time-api/#create-a-pit + public partial class CreatePitDescriptor + : RequestDescriptorBase, + ICreatePitRequest + { + internal override ApiUrls ApiUrls => ApiUrlsLookups.NoNamespaceCreatePit; + + /// /{index}/_search/point_in_time + /// this parameter is required + public CreatePitDescriptor(Indices index) + : base(r => r.Required("index", index)) { } + + /// Used for serialization purposes, making sure we have a parameterless constructor + [SerializationConstructor] + protected CreatePitDescriptor() + : base() { } + + // values part of the url path + Indices ICreatePitRequest.Index => Self.RouteValues.Get("index"); + + /// Comma-separated list of indices; use the special string `_all` or Indices.All to perform the operation on all indices. + public CreatePitDescriptor Index(Indices index) => + Assign(index, (a, v) => a.RouteValues.Required("index", v)); + + /// a shortcut into calling Index(typeof(TOther)) + public CreatePitDescriptor Index() + where TOther : class => + Assign(typeof(TOther), (a, v) => a.RouteValues.Required("index", (Indices)v)); + + /// A shortcut into calling Index(Indices.All) + public CreatePitDescriptor AllIndices() => Index(Indices.All); + + // Request parameters + /// Allow if point in time can be created with partial failures. + public CreatePitDescriptor AllowPartialPitCreation(bool? allowpartialpitcreation = true) => + Qs("allow_partial_pit_creation", allowpartialpitcreation); + + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + public CreatePitDescriptor ExpandWildcards(ExpandWildcards? expandwildcards) => + Qs("expand_wildcards", expandwildcards); + + /// Specify the keep alive for point in time. + public CreatePitDescriptor KeepAlive(Time keepalive) => Qs("keep_alive", keepalive); + + /// Specify the node or shard the operation should be performed on. + public CreatePitDescriptor Preference(string preference) => Qs("preference", preference); + + /// + /// A document is routed to a particular shard in an index using the following formula + /// shard_num = hash(_routing) % num_primary_shards + /// OpenSearch will use the document id if not provided. + /// For requests that are constructed from/for a document OpenSearch.Client will automatically infer the routing key + /// if that document has a or a routing mapping on for its type exists on + /// + public CreatePitDescriptor Routing(Routing routing) => Qs("routing", routing); + } + + /// Descriptor for DeletePit https://opensearch.org/docs/latest/search-plugins/point-in-time-api/#delete-pits + public partial class DeletePitDescriptor + : RequestDescriptorBase, + IDeletePitRequest + { + internal override ApiUrls ApiUrls => ApiUrlsLookups.NoNamespaceDeletePit; + // values part of the url path + // Request parameters + } +} diff --git a/src/OpenSearch.Client/_Generated/IOpenSearchClient.cs b/src/OpenSearch.Client/_Generated/IOpenSearchClient.cs index a6fbe1df5b..55178e5041 100644 --- a/src/OpenSearch.Client/_Generated/IOpenSearchClient.cs +++ b/src/OpenSearch.Client/_Generated/IOpenSearchClient.cs @@ -74,6 +74,86 @@ public partial interface IOpenSearchClient /// Nodes APIs NodesNamespace Nodes { get; } + /// + /// POST request to the create_pit API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/#create-a-pit + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + CreatePitResponse CreatePit( + Indices index, + Func selector = null + ); + + /// + /// POST request to the create_pit API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/#create-a-pit + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + Task CreatePitAsync( + Indices index, + Func selector = null, + CancellationToken ct = default + ); + + /// + /// POST request to the create_pit API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/#create-a-pit + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + CreatePitResponse CreatePit(ICreatePitRequest request); + + /// + /// POST request to the create_pit API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/#create-a-pit + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + Task CreatePitAsync( + ICreatePitRequest request, + CancellationToken ct = default + ); + + /// + /// DELETE request to the delete_pit API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/#delete-pits + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + DeletePitResponse DeletePit(Func selector = null); + + /// + /// DELETE request to the delete_pit API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/#delete-pits + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + Task DeletePitAsync( + Func selector = null, + CancellationToken ct = default + ); + + /// + /// DELETE request to the delete_pit API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/#delete-pits + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + DeletePitResponse DeletePit(IDeletePitRequest request); + + /// + /// DELETE request to the delete_pit API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/#delete-pits + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + Task DeletePitAsync( + IDeletePitRequest request, + CancellationToken ct = default + ); + /// Snapshot APIs SnapshotNamespace Snapshot { get; } diff --git a/src/OpenSearch.Client/_Generated/OpenSearchClient.cs b/src/OpenSearch.Client/_Generated/OpenSearchClient.cs index fa5f242a9e..1b49777f5b 100644 --- a/src/OpenSearch.Client/_Generated/OpenSearchClient.cs +++ b/src/OpenSearch.Client/_Generated/OpenSearchClient.cs @@ -88,5 +88,99 @@ partial void SetupGeneratedNamespaces() Snapshot = new SnapshotNamespace(this); Tasks = new TasksNamespace(this); } + + /// + /// POST request to the create_pit API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/#create-a-pit + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + public CreatePitResponse CreatePit( + Indices index, + Func selector = null + ) => CreatePit(selector.InvokeOrDefault(new CreatePitDescriptor(index: index))); + + /// + /// POST request to the create_pit API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/#create-a-pit + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + public Task CreatePitAsync( + Indices index, + Func selector = null, + CancellationToken ct = default + ) => CreatePitAsync(selector.InvokeOrDefault(new CreatePitDescriptor(index: index)), ct); + + /// + /// POST request to the create_pit API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/#create-a-pit + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + public CreatePitResponse CreatePit(ICreatePitRequest request) => + DoRequest(request, request.RequestParameters); + + /// + /// POST request to the create_pit API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/#create-a-pit + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + public Task CreatePitAsync( + ICreatePitRequest request, + CancellationToken ct = default + ) => + DoRequestAsync( + request, + request.RequestParameters, + ct + ); + + /// + /// DELETE request to the delete_pit API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/#delete-pits + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + public DeletePitResponse DeletePit( + Func selector = null + ) => DeletePit(selector.InvokeOrDefault(new DeletePitDescriptor())); + + /// + /// DELETE request to the delete_pit API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/#delete-pits + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + public Task DeletePitAsync( + Func selector = null, + CancellationToken ct = default + ) => DeletePitAsync(selector.InvokeOrDefault(new DeletePitDescriptor()), ct); + + /// + /// DELETE request to the delete_pit API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/#delete-pits + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + public DeletePitResponse DeletePit(IDeletePitRequest request) => + DoRequest(request, request.RequestParameters); + + /// + /// DELETE request to the delete_pit API, read more about this API online: + /// + /// https://opensearch.org/docs/latest/search-plugins/point-in-time-api/#delete-pits + /// + /// Supported by OpenSearch servers of version 2.4.0 or greater. + public Task DeletePitAsync( + IDeletePitRequest request, + CancellationToken ct = default + ) => + DoRequestAsync( + request, + request.RequestParameters, + ct + ); } } diff --git a/src/OpenSearch.Client/_Generated/Requests.Cluster.cs b/src/OpenSearch.Client/_Generated/Requests.Cluster.cs index fe5fb86e91..4a667a102c 100644 --- a/src/OpenSearch.Client/_Generated/Requests.Cluster.cs +++ b/src/OpenSearch.Client/_Generated/Requests.Cluster.cs @@ -217,13 +217,6 @@ public Time ClusterManagerTimeout set => Q("cluster_manager_timeout", value); } - /// Checks whether local node is commissioned or not. If set to true on a local call it will throw exception if node is decommissioned. - public bool? EnsureNodeCommissioned - { - get => Q("ensure_node_commissioned"); - set => Q("ensure_node_commissioned", value); - } - /// Whether to expand wildcard expression to concrete indices that are open, closed or both. public ExpandWildcards? ExpandWildcards { diff --git a/src/OpenSearch.Client/_Generated/Requests.NoNamespace.cs b/src/OpenSearch.Client/_Generated/Requests.NoNamespace.cs new file mode 100644 index 0000000000..46f6edc529 --- /dev/null +++ b/src/OpenSearch.Client/_Generated/Requests.NoNamespace.cs @@ -0,0 +1,147 @@ +/* SPDX-License-Identifier: Apache-2.0 +* +* The OpenSearch Contributors require contributions made to +* this file be licensed under the Apache-2.0 license or a +* compatible open source license. +*/ +/* +* Modifications Copyright OpenSearch Contributors. See +* GitHub history for details. +* +* Licensed to Elasticsearch B.V. under one or more contributor +* license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright +* ownership. Elasticsearch B.V. licenses this file to you under +* the Apache License, Version 2.0 (the "License"); you may +* not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ----------------------------------------------- +// +// This file is automatically generated +// Please do not edit these files manually +// Run the following in the root of the repos: +// +// *NIX : ./build.sh codegen +// Windows : build.bat codegen +// +// ----------------------------------------------- +// ReSharper disable RedundantUsingDirective +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Linq.Expressions; +using System.Runtime.Serialization; +using OpenSearch.Net; +using OpenSearch.Net.Utf8Json; + +// ReSharper disable RedundantBaseConstructorCall +// ReSharper disable UnusedTypeParameter +// ReSharper disable PartialMethodWithSinglePart +// ReSharper disable RedundantNameQualifier +namespace OpenSearch.Client +{ + [InterfaceDataContract] + public partial interface ICreatePitRequest : IRequest + { + [IgnoreDataMember] + Indices Index { get; } + } + + /// Request for CreatePit https://opensearch.org/docs/latest/search-plugins/point-in-time-api/#create-a-pit + public partial class CreatePitRequest + : PlainRequestBase, + ICreatePitRequest + { + protected ICreatePitRequest Self => this; + internal override ApiUrls ApiUrls => ApiUrlsLookups.NoNamespaceCreatePit; + + /// /{index}/_search/point_in_time + /// this parameter is required + public CreatePitRequest(Indices index) + : base(r => r.Required("index", index)) { } + + /// Used for serialization purposes, making sure we have a parameterless constructor + [SerializationConstructor] + protected CreatePitRequest() + : base() { } + + // values part of the url path + [IgnoreDataMember] + Indices ICreatePitRequest.Index => Self.RouteValues.Get("index"); + + // Request parameters + /// Allow if point in time can be created with partial failures. + public bool? AllowPartialPitCreation + { + get => Q("allow_partial_pit_creation"); + set => Q("allow_partial_pit_creation", value); + } + + /// Whether to expand wildcard expression to concrete indices that are open, closed or both. + public ExpandWildcards? ExpandWildcards + { + get => Q("expand_wildcards"); + set => Q("expand_wildcards", value); + } + + /// Specify the keep alive for point in time. + public Time KeepAlive + { + get => Q