From 98a16c3dce1daff96934c7963881e55965fa2d45 Mon Sep 17 00:00:00 2001 From: Steve Gordon Date: Thu, 29 Sep 2022 12:05:39 +0100 Subject: [PATCH] Generate client from 8.4 API specification (#6679) --- .../_Generated/Api/ApiUrlsLookup.g.cs | 1 + .../AsyncSearch/AsyncSearchSubmitRequest.g.cs | 108 ++++ .../_Generated/Api/SearchRequest.g.cs | 108 ++++ .../Security/SecurityUpdateApiKeyRequest.g.cs | 159 ++++++ .../SecurityUpdateApiKeyResponse.g.cs | 31 ++ .../Client/ElasticsearchClient.Security.g.cs | 58 +++ .../_Generated/Types/KnnQuery.g.cs | 357 +++++++++++++ .../_Generated/Types/MultisearchBody.g.cs | 106 ++++ .../ApplicationGlobalUserPrivileges.g.cs | 93 ++++ .../Types/Security/ApplicationPrivileges.g.cs | 85 ++++ .../Types/Security/FieldSecurity.g.cs | 99 ++++ .../Types/Security/GlobalPrivilege.g.cs | 93 ++++ .../Types/Security/IndicesPrivileges.g.cs | 186 +++++++ .../Security/IndicesPrivilegesQuery.g.cs | 31 ++ .../Types/Security/ManageUserPrivileges.g.cs | 57 +++ .../Types/Security/RoleDescriptor.g.cs | 479 ++++++++++++++++++ .../Security/RoleTemplateInlineScript.g.cs | 111 ++++ .../Types/Security/RoleTemplateQuery.g.cs | 61 +++ .../Types/Security/RoleTemplateScript.g.cs | 38 ++ .../Security/TransientMetadataConfig.g.cs | 57 +++ 20 files changed, 2318 insertions(+) create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SecurityUpdateApiKeyRequest.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SecurityUpdateApiKeyResponse.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnQuery.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationGlobalUserPrivileges.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationPrivileges.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FieldSecurity.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GlobalPrivilege.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndicesPrivileges.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndicesPrivilegesQuery.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ManageUserPrivileges.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptor.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleTemplateInlineScript.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleTemplateQuery.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleTemplateScript.g.cs create mode 100644 src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/TransientMetadataConfig.g.cs diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlsLookup.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlsLookup.g.cs index 98b93dba421..863ef3d1b63 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlsLookup.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/ApiUrlsLookup.g.cs @@ -263,6 +263,7 @@ internal static class ApiUrlsLookups internal static ApiUrls SecuritySamlLogout = new ApiUrls(new[] { "/_security/saml/logout" }); internal static ApiUrls SecuritySamlPrepareAuthentication = new ApiUrls(new[] { "/_security/saml/prepare" }); internal static ApiUrls SecuritySamlServiceProviderMetadata = new ApiUrls(new[] { "/_security/saml/metadata/{realm_name}" }); + internal static ApiUrls SecurityUpdateApiKey = new ApiUrls(new[] { "/_security/api_key/{id}" }); internal static ApiUrls SnapshotLifecycleManagementDeleteLifecycle = new ApiUrls(new[] { "/_slm/policy/{policy_id}" }); internal static ApiUrls SnapshotLifecycleManagementExecuteLifecycle = new ApiUrls(new[] { "/_slm/policy/{policy_id}/_execute" }); internal static ApiUrls SnapshotLifecycleManagementExecuteRetention = new ApiUrls(new[] { "/_slm/_execute_retention" }); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/AsyncSearchSubmitRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/AsyncSearchSubmitRequest.g.cs index 7ff17265fda..0b360f860f0 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/AsyncSearchSubmitRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/AsyncSearch/AsyncSearchSubmitRequest.g.cs @@ -190,6 +190,12 @@ public override AsyncSearchSubmitRequest Read(ref Utf8JsonReader reader, Type ty continue; } + if (property == "knn") + { + variant.Knn = JsonSerializer.Deserialize(ref reader, options); + continue; + } + if (property == "min_score") { variant.MinScore = JsonSerializer.Deserialize(ref reader, options); @@ -384,6 +390,12 @@ public override void Write(Utf8JsonWriter writer, AsyncSearchSubmitRequest value JsonSerializer.Serialize(writer, value.DocvalueFields, options); } + if (value.Knn is not null) + { + writer.WritePropertyName("knn"); + JsonSerializer.Serialize(writer, value.Knn, options); + } + if (value.MinScore.HasValue) { writer.WritePropertyName("min_score"); @@ -666,6 +678,10 @@ public AsyncSearchSubmitRequest(Elastic.Clients.Elasticsearch.Indices? indices) [JsonPropertyName("docvalue_fields")] public IEnumerable? DocvalueFields { get; set; } + [JsonInclude] + [JsonPropertyName("knn")] + public Elastic.Clients.Elasticsearch.KnnQuery? Knn { get; set; } + [JsonInclude] [JsonPropertyName("min_score")] public double? MinScore { get; set; } @@ -845,6 +861,12 @@ public AsyncSearchSubmitRequestDescriptor Indices(Elastic.Clients.Ela private Action> HighlightDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.KnnQuery? KnnValue { get; set; } + + private KnnQueryDescriptor KnnDescriptor { get; set; } + + private Action> KnnDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.QueryDsl.QueryContainer? PostFilterValue { get; set; } private QueryDsl.QueryContainerDescriptor PostFilterDescriptor { get; set; } @@ -1067,6 +1089,30 @@ public AsyncSearchSubmitRequestDescriptor Highlight(Action Knn(Elastic.Clients.Elasticsearch.KnnQuery? knn) + { + KnnDescriptor = null; + KnnDescriptorAction = null; + KnnValue = knn; + return Self; + } + + public AsyncSearchSubmitRequestDescriptor Knn(KnnQueryDescriptor descriptor) + { + KnnValue = null; + KnnDescriptorAction = null; + KnnDescriptor = descriptor; + return Self; + } + + public AsyncSearchSubmitRequestDescriptor Knn(Action> configure) + { + KnnValue = null; + KnnDescriptor = null; + KnnDescriptorAction = configure; + return Self; + } + public AsyncSearchSubmitRequestDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryContainer? postFilter) { PostFilterDescriptor = null; @@ -1462,6 +1508,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, HighlightValue, options); } + if (KnnDescriptor is not null) + { + writer.WritePropertyName("knn"); + JsonSerializer.Serialize(writer, KnnDescriptor, options); + } + else if (KnnDescriptorAction is not null) + { + writer.WritePropertyName("knn"); + JsonSerializer.Serialize(writer, new KnnQueryDescriptor(KnnDescriptorAction), options); + } + else if (KnnValue is not null) + { + writer.WritePropertyName("knn"); + JsonSerializer.Serialize(writer, KnnValue, options); + } + if (PostFilterDescriptor is not null) { writer.WritePropertyName("post_filter"); @@ -1779,6 +1841,12 @@ public AsyncSearchSubmitRequestDescriptor Indices(Elastic.Clients.Elasticsearch. private Action HighlightDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.KnnQuery? KnnValue { get; set; } + + private KnnQueryDescriptor KnnDescriptor { get; set; } + + private Action KnnDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.QueryDsl.QueryContainer? PostFilterValue { get; set; } private QueryDsl.QueryContainerDescriptor PostFilterDescriptor { get; set; } @@ -2001,6 +2069,30 @@ public AsyncSearchSubmitRequestDescriptor Highlight(Action return Self; } + public AsyncSearchSubmitRequestDescriptor Knn(Elastic.Clients.Elasticsearch.KnnQuery? knn) + { + KnnDescriptor = null; + KnnDescriptorAction = null; + KnnValue = knn; + return Self; + } + + public AsyncSearchSubmitRequestDescriptor Knn(KnnQueryDescriptor descriptor) + { + KnnValue = null; + KnnDescriptorAction = null; + KnnDescriptor = descriptor; + return Self; + } + + public AsyncSearchSubmitRequestDescriptor Knn(Action configure) + { + KnnValue = null; + KnnDescriptor = null; + KnnDescriptorAction = configure; + return Self; + } + public AsyncSearchSubmitRequestDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryContainer? postFilter) { PostFilterDescriptor = null; @@ -2402,6 +2494,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, HighlightValue, options); } + if (KnnDescriptor is not null) + { + writer.WritePropertyName("knn"); + JsonSerializer.Serialize(writer, KnnDescriptor, options); + } + else if (KnnDescriptorAction is not null) + { + writer.WritePropertyName("knn"); + JsonSerializer.Serialize(writer, new KnnQueryDescriptor(KnnDescriptorAction), options); + } + else if (KnnValue is not null) + { + writer.WritePropertyName("knn"); + JsonSerializer.Serialize(writer, KnnValue, options); + } + if (PostFilterDescriptor is not null) { writer.WritePropertyName("post_filter"); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchRequest.g.cs index 8a18760da05..63bd25b5329 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchRequest.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/SearchRequest.g.cs @@ -181,6 +181,12 @@ public override SearchRequest Read(ref Utf8JsonReader reader, Type typeToConvert continue; } + if (property == "knn") + { + variant.Knn = JsonSerializer.Deserialize(ref reader, options); + continue; + } + if (property == "min_score") { variant.MinScore = JsonSerializer.Deserialize(ref reader, options); @@ -375,6 +381,12 @@ public override void Write(Utf8JsonWriter writer, SearchRequest value, JsonSeria JsonSerializer.Serialize(writer, value.DocvalueFields, options); } + if (value.Knn is not null) + { + writer.WritePropertyName("knn"); + JsonSerializer.Serialize(writer, value.Knn, options); + } + if (value.MinScore.HasValue) { writer.WritePropertyName("min_score"); @@ -648,6 +660,10 @@ public SearchRequest(Elastic.Clients.Elasticsearch.Indices? indices) : base(r => [JsonPropertyName("docvalue_fields")] public IEnumerable? DocvalueFields { get; set; } + [JsonInclude] + [JsonPropertyName("knn")] + public Elastic.Clients.Elasticsearch.KnnQuery? Knn { get; set; } + [JsonInclude] [JsonPropertyName("min_score")] public double? MinScore { get; set; } @@ -828,6 +844,12 @@ public SearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch. private Action> HighlightDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.KnnQuery? KnnValue { get; set; } + + private KnnQueryDescriptor KnnDescriptor { get; set; } + + private Action> KnnDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.QueryDsl.QueryContainer? PostFilterValue { get; set; } private QueryDsl.QueryContainerDescriptor PostFilterDescriptor { get; set; } @@ -1050,6 +1072,30 @@ public SearchRequestDescriptor Highlight(Action Knn(Elastic.Clients.Elasticsearch.KnnQuery? knn) + { + KnnDescriptor = null; + KnnDescriptorAction = null; + KnnValue = knn; + return Self; + } + + public SearchRequestDescriptor Knn(KnnQueryDescriptor descriptor) + { + KnnValue = null; + KnnDescriptorAction = null; + KnnDescriptor = descriptor; + return Self; + } + + public SearchRequestDescriptor Knn(Action> configure) + { + KnnValue = null; + KnnDescriptor = null; + KnnDescriptorAction = configure; + return Self; + } + public SearchRequestDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryContainer? postFilter) { PostFilterDescriptor = null; @@ -1445,6 +1491,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, HighlightValue, options); } + if (KnnDescriptor is not null) + { + writer.WritePropertyName("knn"); + JsonSerializer.Serialize(writer, KnnDescriptor, options); + } + else if (KnnDescriptorAction is not null) + { + writer.WritePropertyName("knn"); + JsonSerializer.Serialize(writer, new KnnQueryDescriptor(KnnDescriptorAction), options); + } + else if (KnnValue is not null) + { + writer.WritePropertyName("knn"); + JsonSerializer.Serialize(writer, KnnValue, options); + } + if (PostFilterDescriptor is not null) { writer.WritePropertyName("post_filter"); @@ -1763,6 +1825,12 @@ public SearchRequestDescriptor Indices(Elastic.Clients.Elasticsearch.Indices? in private Action HighlightDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.KnnQuery? KnnValue { get; set; } + + private KnnQueryDescriptor KnnDescriptor { get; set; } + + private Action KnnDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.QueryDsl.QueryContainer? PostFilterValue { get; set; } private QueryDsl.QueryContainerDescriptor PostFilterDescriptor { get; set; } @@ -1985,6 +2053,30 @@ public SearchRequestDescriptor Highlight(Action configure) return Self; } + public SearchRequestDescriptor Knn(Elastic.Clients.Elasticsearch.KnnQuery? knn) + { + KnnDescriptor = null; + KnnDescriptorAction = null; + KnnValue = knn; + return Self; + } + + public SearchRequestDescriptor Knn(KnnQueryDescriptor descriptor) + { + KnnValue = null; + KnnDescriptorAction = null; + KnnDescriptor = descriptor; + return Self; + } + + public SearchRequestDescriptor Knn(Action configure) + { + KnnValue = null; + KnnDescriptor = null; + KnnDescriptorAction = configure; + return Self; + } + public SearchRequestDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryContainer? postFilter) { PostFilterDescriptor = null; @@ -2386,6 +2478,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, HighlightValue, options); } + if (KnnDescriptor is not null) + { + writer.WritePropertyName("knn"); + JsonSerializer.Serialize(writer, KnnDescriptor, options); + } + else if (KnnDescriptorAction is not null) + { + writer.WritePropertyName("knn"); + JsonSerializer.Serialize(writer, new KnnQueryDescriptor(KnnDescriptorAction), options); + } + else if (KnnValue is not null) + { + writer.WritePropertyName("knn"); + JsonSerializer.Serialize(writer, KnnValue, options); + } + if (PostFilterDescriptor is not null) { writer.WritePropertyName("post_filter"); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SecurityUpdateApiKeyRequest.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SecurityUpdateApiKeyRequest.g.cs new file mode 100644 index 00000000000..979470a0829 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SecurityUpdateApiKeyRequest.g.cs @@ -0,0 +1,159 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch.Security +{ + public sealed class SecurityUpdateApiKeyRequestParameters : RequestParameters + { + } + + public sealed partial class SecurityUpdateApiKeyRequest : PlainRequestBase + { + public SecurityUpdateApiKeyRequest(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + { + } + + internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityUpdateApiKey; + protected override HttpMethod HttpMethod => HttpMethod.PUT; + protected override bool SupportsBody => true; + [JsonInclude] + [JsonPropertyName("role_descriptors")] + public Dictionary? RoleDescriptors { get; set; } + + [JsonInclude] + [JsonPropertyName("metadata")] + public Dictionary? Metadata { get; set; } + } + + public sealed partial class SecurityUpdateApiKeyRequestDescriptor : RequestDescriptorBase, SecurityUpdateApiKeyRequestParameters> + { + internal SecurityUpdateApiKeyRequestDescriptor(Action> configure) => configure.Invoke(this); + public SecurityUpdateApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + { + } + + internal SecurityUpdateApiKeyRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityUpdateApiKey; + protected override HttpMethod HttpMethod => HttpMethod.PUT; + protected override bool SupportsBody => true; + public SecurityUpdateApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + { + RouteValues.Required("id", id); + return Self; + } + + private Dictionary? MetadataValue { get; set; } + + private Dictionary? RoleDescriptorsValue { get; set; } + + public SecurityUpdateApiKeyRequestDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public SecurityUpdateApiKeyRequestDescriptor RoleDescriptors(Func, FluentDictionary> selector) + { + RoleDescriptorsValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (RoleDescriptorsValue is not null) + { + writer.WritePropertyName("role_descriptors"); + JsonSerializer.Serialize(writer, RoleDescriptorsValue, options); + } + + writer.WriteEndObject(); + } + } + + public sealed partial class SecurityUpdateApiKeyRequestDescriptor : RequestDescriptorBase + { + internal SecurityUpdateApiKeyRequestDescriptor(Action configure) => configure.Invoke(this); + public SecurityUpdateApiKeyRequestDescriptor(Elastic.Clients.Elasticsearch.Id id) : base(r => r.Required("id", id)) + { + } + + internal SecurityUpdateApiKeyRequestDescriptor() + { + } + + internal override ApiUrls ApiUrls => ApiUrlsLookups.SecurityUpdateApiKey; + protected override HttpMethod HttpMethod => HttpMethod.PUT; + protected override bool SupportsBody => true; + public SecurityUpdateApiKeyRequestDescriptor Id(Elastic.Clients.Elasticsearch.Id id) + { + RouteValues.Required("id", id); + return Self; + } + + private Dictionary? MetadataValue { get; set; } + + private Dictionary? RoleDescriptorsValue { get; set; } + + public SecurityUpdateApiKeyRequestDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public SecurityUpdateApiKeyRequestDescriptor RoleDescriptors(Func, FluentDictionary> selector) + { + RoleDescriptorsValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (RoleDescriptorsValue is not null) + { + writer.WritePropertyName("role_descriptors"); + JsonSerializer.Serialize(writer, RoleDescriptorsValue, options); + } + + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SecurityUpdateApiKeyResponse.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SecurityUpdateApiKeyResponse.g.cs new file mode 100644 index 00000000000..94a3f903969 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Api/Security/SecurityUpdateApiKeyResponse.g.cs @@ -0,0 +1,31 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +using Elastic.Transport.Products.Elasticsearch; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch.Security +{ + public sealed partial class SecurityUpdateApiKeyResponse : ElasticsearchResponseBase + { + [JsonInclude] + [JsonPropertyName("updated")] + public bool Updated { get; init; } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Security.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Security.g.cs index 49f22c2b58f..fc9871eca61 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Security.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Client/ElasticsearchClient.Security.g.cs @@ -1303,5 +1303,63 @@ public Task SamlServiceProviderMeta descriptor.BeforeRequest(); return DoRequestAsync(descriptor); } + + public SecurityUpdateApiKeyResponse UpdateApiKey(SecurityUpdateApiKeyRequest request) + { + request.BeforeRequest(); + return DoRequest(request); + } + + public Task UpdateApiKeyAsync(SecurityUpdateApiKeyRequest request, CancellationToken cancellationToken = default) + { + request.BeforeRequest(); + return DoRequestAsync(request, cancellationToken); + } + + public SecurityUpdateApiKeyResponse UpdateApiKey(Elastic.Clients.Elasticsearch.Id id) + { + var descriptor = new SecurityUpdateApiKeyRequestDescriptor(id); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + public SecurityUpdateApiKeyResponse UpdateApiKey(Elastic.Clients.Elasticsearch.Id id, Action configureRequest) + { + var descriptor = new SecurityUpdateApiKeyRequestDescriptor(id); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest(descriptor); + } + + public SecurityUpdateApiKeyResponse UpdateApiKey(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest) + { + var descriptor = new SecurityUpdateApiKeyRequestDescriptor(id); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequest, SecurityUpdateApiKeyResponse>(descriptor); + } + + public Task UpdateApiKeyAsync(Elastic.Clients.Elasticsearch.Id id, CancellationToken cancellationToken = default) + { + var descriptor = new SecurityUpdateApiKeyRequestDescriptor(id); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor); + } + + public Task UpdateApiKeyAsync(Elastic.Clients.Elasticsearch.Id id, Action configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new SecurityUpdateApiKeyRequestDescriptor(id); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync(descriptor); + } + + public Task UpdateApiKeyAsync(Elastic.Clients.Elasticsearch.Id id, Action> configureRequest, CancellationToken cancellationToken = default) + { + var descriptor = new SecurityUpdateApiKeyRequestDescriptor(id); + configureRequest?.Invoke(descriptor); + descriptor.BeforeRequest(); + return DoRequestAsync, SecurityUpdateApiKeyResponse>(descriptor); + } } } \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnQuery.g.cs new file mode 100644 index 00000000000..fcf31f6fc4f --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/KnnQuery.g.cs @@ -0,0 +1,357 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch +{ + public sealed partial class KnnQuery + { + [JsonInclude] + [JsonPropertyName("boost")] + public float? Boost { get; set; } + + [JsonInclude] + [JsonPropertyName("field")] + public Elastic.Clients.Elasticsearch.Field Field { get; set; } + + [JsonInclude] + [JsonPropertyName("filter")] + public IEnumerable? Filter { get; set; } + + [JsonInclude] + [JsonPropertyName("k")] + public long k { get; set; } + + [JsonInclude] + [JsonPropertyName("num_candidates")] + public long NumCandidates { get; set; } + + [JsonInclude] + [JsonPropertyName("query_vector")] + public IEnumerable QueryVector { get; set; } + } + + public sealed partial class KnnQueryDescriptor : SerializableDescriptorBase> + { + internal KnnQueryDescriptor(Action> configure) => configure.Invoke(this); + public KnnQueryDescriptor() : base() + { + } + + private IEnumerable? FilterValue { get; set; } + + private QueryDsl.QueryContainerDescriptor FilterDescriptor { get; set; } + + private Action> FilterDescriptorAction { get; set; } + + private Action>[] FilterDescriptorActions { get; set; } + + private float? BoostValue { get; set; } + + private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } + + private long kValue { get; set; } + + private long NumCandidatesValue { get; set; } + + private IEnumerable QueryVectorValue { get; set; } + + public KnnQueryDescriptor Filter(IEnumerable? filter) + { + FilterDescriptor = null; + FilterDescriptorAction = null; + FilterDescriptorActions = null; + FilterValue = filter; + return Self; + } + + public KnnQueryDescriptor Filter(QueryDsl.QueryContainerDescriptor descriptor) + { + FilterValue = null; + FilterDescriptorAction = null; + FilterDescriptorActions = null; + FilterDescriptor = descriptor; + return Self; + } + + public KnnQueryDescriptor Filter(Action> configure) + { + FilterValue = null; + FilterDescriptor = null; + FilterDescriptorActions = null; + FilterDescriptorAction = configure; + return Self; + } + + public KnnQueryDescriptor Filter(params Action>[] configure) + { + FilterValue = null; + FilterDescriptor = null; + FilterDescriptorAction = null; + FilterDescriptorActions = configure; + return Self; + } + + public KnnQueryDescriptor Boost(float? boost) + { + BoostValue = boost; + return Self; + } + + public KnnQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + { + FieldValue = field; + return Self; + } + + public KnnQueryDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public KnnQueryDescriptor k(long k) + { + kValue = k; + return Self; + } + + public KnnQueryDescriptor NumCandidates(long numCandidates) + { + NumCandidatesValue = numCandidates; + return Self; + } + + public KnnQueryDescriptor QueryVector(IEnumerable queryVector) + { + QueryVectorValue = queryVector; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (FilterDescriptor is not null) + { + writer.WritePropertyName("filter"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, FilterDescriptor, options); + writer.WriteEndArray(); + } + else if (FilterDescriptorAction is not null) + { + writer.WritePropertyName("filter"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new QueryDsl.QueryContainerDescriptor(FilterDescriptorAction), options); + writer.WriteEndArray(); + } + else if (FilterDescriptorActions is not null) + { + writer.WritePropertyName("filter"); + writer.WriteStartArray(); + foreach (var action in FilterDescriptorActions) + { + JsonSerializer.Serialize(writer, new QueryDsl.QueryContainerDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (FilterValue is not null) + { + writer.WritePropertyName("filter"); + JsonSerializer.Serialize(writer, FilterValue, options); + } + + if (BoostValue.HasValue) + { + writer.WritePropertyName("boost"); + writer.WriteNumberValue(BoostValue.Value); + } + + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + writer.WritePropertyName("k"); + writer.WriteNumberValue(kValue); + writer.WritePropertyName("num_candidates"); + writer.WriteNumberValue(NumCandidatesValue); + writer.WritePropertyName("query_vector"); + JsonSerializer.Serialize(writer, QueryVectorValue, options); + writer.WriteEndObject(); + } + } + + public sealed partial class KnnQueryDescriptor : SerializableDescriptorBase + { + internal KnnQueryDescriptor(Action configure) => configure.Invoke(this); + public KnnQueryDescriptor() : base() + { + } + + private IEnumerable? FilterValue { get; set; } + + private QueryDsl.QueryContainerDescriptor FilterDescriptor { get; set; } + + private Action FilterDescriptorAction { get; set; } + + private Action[] FilterDescriptorActions { get; set; } + + private float? BoostValue { get; set; } + + private Elastic.Clients.Elasticsearch.Field FieldValue { get; set; } + + private long kValue { get; set; } + + private long NumCandidatesValue { get; set; } + + private IEnumerable QueryVectorValue { get; set; } + + public KnnQueryDescriptor Filter(IEnumerable? filter) + { + FilterDescriptor = null; + FilterDescriptorAction = null; + FilterDescriptorActions = null; + FilterValue = filter; + return Self; + } + + public KnnQueryDescriptor Filter(QueryDsl.QueryContainerDescriptor descriptor) + { + FilterValue = null; + FilterDescriptorAction = null; + FilterDescriptorActions = null; + FilterDescriptor = descriptor; + return Self; + } + + public KnnQueryDescriptor Filter(Action configure) + { + FilterValue = null; + FilterDescriptor = null; + FilterDescriptorActions = null; + FilterDescriptorAction = configure; + return Self; + } + + public KnnQueryDescriptor Filter(params Action[] configure) + { + FilterValue = null; + FilterDescriptor = null; + FilterDescriptorAction = null; + FilterDescriptorActions = configure; + return Self; + } + + public KnnQueryDescriptor Boost(float? boost) + { + BoostValue = boost; + return Self; + } + + public KnnQueryDescriptor Field(Elastic.Clients.Elasticsearch.Field field) + { + FieldValue = field; + return Self; + } + + public KnnQueryDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public KnnQueryDescriptor Field(Expression> field) + { + FieldValue = field; + return Self; + } + + public KnnQueryDescriptor k(long k) + { + kValue = k; + return Self; + } + + public KnnQueryDescriptor NumCandidates(long numCandidates) + { + NumCandidatesValue = numCandidates; + return Self; + } + + public KnnQueryDescriptor QueryVector(IEnumerable queryVector) + { + QueryVectorValue = queryVector; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (FilterDescriptor is not null) + { + writer.WritePropertyName("filter"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, FilterDescriptor, options); + writer.WriteEndArray(); + } + else if (FilterDescriptorAction is not null) + { + writer.WritePropertyName("filter"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new QueryDsl.QueryContainerDescriptor(FilterDescriptorAction), options); + writer.WriteEndArray(); + } + else if (FilterDescriptorActions is not null) + { + writer.WritePropertyName("filter"); + writer.WriteStartArray(); + foreach (var action in FilterDescriptorActions) + { + JsonSerializer.Serialize(writer, new QueryDsl.QueryContainerDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (FilterValue is not null) + { + writer.WritePropertyName("filter"); + JsonSerializer.Serialize(writer, FilterValue, options); + } + + if (BoostValue.HasValue) + { + writer.WritePropertyName("boost"); + writer.WriteNumberValue(BoostValue.Value); + } + + writer.WritePropertyName("field"); + JsonSerializer.Serialize(writer, FieldValue, options); + writer.WritePropertyName("k"); + writer.WriteNumberValue(kValue); + writer.WritePropertyName("num_candidates"); + writer.WriteNumberValue(NumCandidatesValue); + writer.WritePropertyName("query_vector"); + JsonSerializer.Serialize(writer, QueryVectorValue, options); + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MultisearchBody.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MultisearchBody.g.cs index 3042dd41841..c3d44b8ce8d 100644 --- a/src/Elastic.Clients.Elasticsearch/_Generated/Types/MultisearchBody.g.cs +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/MultisearchBody.g.cs @@ -96,6 +96,12 @@ public override MultisearchBody Read(ref Utf8JsonReader reader, Type typeToConve continue; } + if (property == "knn") + { + variant.Knn = JsonSerializer.Deserialize(ref reader, options); + continue; + } + if (property == "min_score") { variant.MinScore = JsonSerializer.Deserialize(ref reader, options); @@ -284,6 +290,12 @@ public override void Write(Utf8JsonWriter writer, MultisearchBody value, JsonSer JsonSerializer.Serialize(writer, value.IndicesBoost, options); } + if (value.Knn is not null) + { + writer.WritePropertyName("knn"); + JsonSerializer.Serialize(writer, value.Knn, options); + } + if (value.MinScore.HasValue) { writer.WritePropertyName("min_score"); @@ -431,6 +443,8 @@ public sealed partial class MultisearchBody public IEnumerable>? IndicesBoost { get; set; } + public Elastic.Clients.Elasticsearch.KnnQuery? Knn { get; set; } + public double? MinScore { get; set; } public Elastic.Clients.Elasticsearch.PointInTimeReference? Pit { get; set; } @@ -508,6 +522,12 @@ public MultisearchBodyDescriptor() : base() private Action> HighlightDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.KnnQuery? KnnValue { get; set; } + + private KnnQueryDescriptor KnnDescriptor { get; set; } + + private Action> KnnDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.QueryDsl.QueryContainer? PostFilterValue { get; set; } private QueryDsl.QueryContainerDescriptor PostFilterDescriptor { get; set; } @@ -702,6 +722,30 @@ public MultisearchBodyDescriptor Highlight(Action Knn(Elastic.Clients.Elasticsearch.KnnQuery? knn) + { + KnnDescriptor = null; + KnnDescriptorAction = null; + KnnValue = knn; + return Self; + } + + public MultisearchBodyDescriptor Knn(KnnQueryDescriptor descriptor) + { + KnnValue = null; + KnnDescriptorAction = null; + KnnDescriptor = descriptor; + return Self; + } + + public MultisearchBodyDescriptor Knn(Action> configure) + { + KnnValue = null; + KnnDescriptor = null; + KnnDescriptorAction = configure; + return Self; + } + public MultisearchBodyDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryContainer? postFilter) { PostFilterDescriptor = null; @@ -1063,6 +1107,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, HighlightValue, options); } + if (KnnDescriptor is not null) + { + writer.WritePropertyName("knn"); + JsonSerializer.Serialize(writer, KnnDescriptor, options); + } + else if (KnnDescriptorAction is not null) + { + writer.WritePropertyName("knn"); + JsonSerializer.Serialize(writer, new KnnQueryDescriptor(KnnDescriptorAction), options); + } + else if (KnnValue is not null) + { + writer.WritePropertyName("knn"); + JsonSerializer.Serialize(writer, KnnValue, options); + } + if (PostFilterDescriptor is not null) { writer.WritePropertyName("post_filter"); @@ -1323,6 +1383,12 @@ public MultisearchBodyDescriptor() : base() private Action HighlightDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.KnnQuery? KnnValue { get; set; } + + private KnnQueryDescriptor KnnDescriptor { get; set; } + + private Action KnnDescriptorAction { get; set; } + private Elastic.Clients.Elasticsearch.QueryDsl.QueryContainer? PostFilterValue { get; set; } private QueryDsl.QueryContainerDescriptor PostFilterDescriptor { get; set; } @@ -1517,6 +1583,30 @@ public MultisearchBodyDescriptor Highlight(Action configure return Self; } + public MultisearchBodyDescriptor Knn(Elastic.Clients.Elasticsearch.KnnQuery? knn) + { + KnnDescriptor = null; + KnnDescriptorAction = null; + KnnValue = knn; + return Self; + } + + public MultisearchBodyDescriptor Knn(KnnQueryDescriptor descriptor) + { + KnnValue = null; + KnnDescriptorAction = null; + KnnDescriptor = descriptor; + return Self; + } + + public MultisearchBodyDescriptor Knn(Action configure) + { + KnnValue = null; + KnnDescriptor = null; + KnnDescriptorAction = configure; + return Self; + } + public MultisearchBodyDescriptor PostFilter(Elastic.Clients.Elasticsearch.QueryDsl.QueryContainer? postFilter) { PostFilterDescriptor = null; @@ -1884,6 +1974,22 @@ protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions o JsonSerializer.Serialize(writer, HighlightValue, options); } + if (KnnDescriptor is not null) + { + writer.WritePropertyName("knn"); + JsonSerializer.Serialize(writer, KnnDescriptor, options); + } + else if (KnnDescriptorAction is not null) + { + writer.WritePropertyName("knn"); + JsonSerializer.Serialize(writer, new KnnQueryDescriptor(KnnDescriptorAction), options); + } + else if (KnnValue is not null) + { + writer.WritePropertyName("knn"); + JsonSerializer.Serialize(writer, KnnValue, options); + } + if (PostFilterDescriptor is not null) { writer.WritePropertyName("post_filter"); diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationGlobalUserPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationGlobalUserPrivileges.g.cs new file mode 100644 index 00000000000..65634fb40cf --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationGlobalUserPrivileges.g.cs @@ -0,0 +1,93 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch.Security +{ + public sealed partial class ApplicationGlobalUserPrivileges + { + [JsonInclude] + [JsonPropertyName("manage")] + public Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges Manage { get; set; } + } + + public sealed partial class ApplicationGlobalUserPrivilegesDescriptor : SerializableDescriptorBase + { + internal ApplicationGlobalUserPrivilegesDescriptor(Action configure) => configure.Invoke(this); + public ApplicationGlobalUserPrivilegesDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges ManageValue { get; set; } + + private ManageUserPrivilegesDescriptor ManageDescriptor { get; set; } + + private Action ManageDescriptorAction { get; set; } + + public ApplicationGlobalUserPrivilegesDescriptor Manage(Elastic.Clients.Elasticsearch.Security.ManageUserPrivileges manage) + { + ManageDescriptor = null; + ManageDescriptorAction = null; + ManageValue = manage; + return Self; + } + + public ApplicationGlobalUserPrivilegesDescriptor Manage(ManageUserPrivilegesDescriptor descriptor) + { + ManageValue = null; + ManageDescriptorAction = null; + ManageDescriptor = descriptor; + return Self; + } + + public ApplicationGlobalUserPrivilegesDescriptor Manage(Action configure) + { + ManageValue = null; + ManageDescriptor = null; + ManageDescriptorAction = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ManageDescriptor is not null) + { + writer.WritePropertyName("manage"); + JsonSerializer.Serialize(writer, ManageDescriptor, options); + } + else if (ManageDescriptorAction is not null) + { + writer.WritePropertyName("manage"); + JsonSerializer.Serialize(writer, new ManageUserPrivilegesDescriptor(ManageDescriptorAction), options); + } + else + { + writer.WritePropertyName("manage"); + JsonSerializer.Serialize(writer, ManageValue, options); + } + + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationPrivileges.g.cs new file mode 100644 index 00000000000..8aeb587786d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ApplicationPrivileges.g.cs @@ -0,0 +1,85 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch.Security +{ + public sealed partial class ApplicationPrivileges + { + [JsonInclude] + [JsonPropertyName("application")] + public string Application { get; set; } + + [JsonInclude] + [JsonPropertyName("privileges")] + public IEnumerable Privileges { get; set; } + + [JsonInclude] + [JsonPropertyName("resources")] + public IEnumerable Resources { get; set; } + } + + public sealed partial class ApplicationPrivilegesDescriptor : SerializableDescriptorBase + { + internal ApplicationPrivilegesDescriptor(Action configure) => configure.Invoke(this); + public ApplicationPrivilegesDescriptor() : base() + { + } + + private string ApplicationValue { get; set; } + + private IEnumerable PrivilegesValue { get; set; } + + private IEnumerable ResourcesValue { get; set; } + + public ApplicationPrivilegesDescriptor Application(string application) + { + ApplicationValue = application; + return Self; + } + + public ApplicationPrivilegesDescriptor Privileges(IEnumerable privileges) + { + PrivilegesValue = privileges; + return Self; + } + + public ApplicationPrivilegesDescriptor Resources(IEnumerable resources) + { + ResourcesValue = resources; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("application"); + writer.WriteStringValue(ApplicationValue); + writer.WritePropertyName("privileges"); + JsonSerializer.Serialize(writer, PrivilegesValue, options); + writer.WritePropertyName("resources"); + JsonSerializer.Serialize(writer, ResourcesValue, options); + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FieldSecurity.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FieldSecurity.g.cs new file mode 100644 index 00000000000..eac497edc2b --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/FieldSecurity.g.cs @@ -0,0 +1,99 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch.Security +{ + public sealed partial class FieldSecurity + { + [JsonInclude] + [JsonPropertyName("except")] + public Elastic.Clients.Elasticsearch.Fields? Except { get; set; } + + [JsonInclude] + [JsonPropertyName("grant")] + public Elastic.Clients.Elasticsearch.Fields Grant { get; set; } + } + + public sealed partial class FieldSecurityDescriptor : SerializableDescriptorBase + { + internal FieldSecurityDescriptor(Action configure) => configure.Invoke(this); + public FieldSecurityDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Fields? ExceptValue { get; set; } + + private Elastic.Clients.Elasticsearch.Fields GrantValue { get; set; } + + public FieldSecurityDescriptor Except(Elastic.Clients.Elasticsearch.Fields? except) + { + ExceptValue = except; + return Self; + } + + public FieldSecurityDescriptor Except(Expression> except) + { + ExceptValue = except; + return Self; + } + + public FieldSecurityDescriptor Except(Expression> except) + { + ExceptValue = except; + return Self; + } + + public FieldSecurityDescriptor Grant(Elastic.Clients.Elasticsearch.Fields grant) + { + GrantValue = grant; + return Self; + } + + public FieldSecurityDescriptor Grant(Expression> grant) + { + GrantValue = grant; + return Self; + } + + public FieldSecurityDescriptor Grant(Expression> grant) + { + GrantValue = grant; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ExceptValue is not null) + { + writer.WritePropertyName("except"); + JsonSerializer.Serialize(writer, ExceptValue, options); + } + + writer.WritePropertyName("grant"); + JsonSerializer.Serialize(writer, GrantValue, options); + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GlobalPrivilege.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GlobalPrivilege.g.cs new file mode 100644 index 00000000000..9c619c738b3 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/GlobalPrivilege.g.cs @@ -0,0 +1,93 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch.Security +{ + public sealed partial class GlobalPrivilege + { + [JsonInclude] + [JsonPropertyName("application")] + public Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges Application { get; set; } + } + + public sealed partial class GlobalPrivilegeDescriptor : SerializableDescriptorBase + { + internal GlobalPrivilegeDescriptor(Action configure) => configure.Invoke(this); + public GlobalPrivilegeDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges ApplicationValue { get; set; } + + private ApplicationGlobalUserPrivilegesDescriptor ApplicationDescriptor { get; set; } + + private Action ApplicationDescriptorAction { get; set; } + + public GlobalPrivilegeDescriptor Application(Elastic.Clients.Elasticsearch.Security.ApplicationGlobalUserPrivileges application) + { + ApplicationDescriptor = null; + ApplicationDescriptorAction = null; + ApplicationValue = application; + return Self; + } + + public GlobalPrivilegeDescriptor Application(ApplicationGlobalUserPrivilegesDescriptor descriptor) + { + ApplicationValue = null; + ApplicationDescriptorAction = null; + ApplicationDescriptor = descriptor; + return Self; + } + + public GlobalPrivilegeDescriptor Application(Action configure) + { + ApplicationValue = null; + ApplicationDescriptor = null; + ApplicationDescriptorAction = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ApplicationDescriptor is not null) + { + writer.WritePropertyName("application"); + JsonSerializer.Serialize(writer, ApplicationDescriptor, options); + } + else if (ApplicationDescriptorAction is not null) + { + writer.WritePropertyName("application"); + JsonSerializer.Serialize(writer, new ApplicationGlobalUserPrivilegesDescriptor(ApplicationDescriptorAction), options); + } + else + { + writer.WritePropertyName("application"); + JsonSerializer.Serialize(writer, ApplicationValue, options); + } + + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndicesPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndicesPrivileges.g.cs new file mode 100644 index 00000000000..9c4bb169a8d --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndicesPrivileges.g.cs @@ -0,0 +1,186 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch.Security +{ + public sealed partial class IndicesPrivileges + { + [JsonInclude] + [JsonPropertyName("allow_restricted_indices")] + public bool? AllowRestrictedIndices { get; set; } + + [JsonInclude] + [JsonPropertyName("field_security")] + public IEnumerable? FieldSecurity { get; set; } + + [JsonInclude] + [JsonPropertyName("names")] + public Elastic.Clients.Elasticsearch.Indices Names { get; set; } + + [JsonInclude] + [JsonPropertyName("privileges")] + public IEnumerable Privileges { get; set; } + + [JsonInclude] + [JsonPropertyName("query")] + public Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesQuery? Query { get; set; } + } + + public sealed partial class IndicesPrivilegesDescriptor : SerializableDescriptorBase + { + internal IndicesPrivilegesDescriptor(Action configure) => configure.Invoke(this); + public IndicesPrivilegesDescriptor() : base() + { + } + + private bool? AllowRestrictedIndicesValue { get; set; } + + private IEnumerable? FieldSecurityValue { get; set; } + + private FieldSecurityDescriptor FieldSecurityDescriptor { get; set; } + + private Action FieldSecurityDescriptorAction { get; set; } + + private Action[] FieldSecurityDescriptorActions { get; set; } + + private Elastic.Clients.Elasticsearch.Indices NamesValue { get; set; } + + private IEnumerable PrivilegesValue { get; set; } + + private Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesQuery? QueryValue { get; set; } + + public IndicesPrivilegesDescriptor AllowRestrictedIndices(bool? allowRestrictedIndices = true) + { + AllowRestrictedIndicesValue = allowRestrictedIndices; + return Self; + } + + public IndicesPrivilegesDescriptor FieldSecurity(IEnumerable? fieldSecurity) + { + FieldSecurityDescriptor = null; + FieldSecurityDescriptorAction = null; + FieldSecurityDescriptorActions = null; + FieldSecurityValue = fieldSecurity; + return Self; + } + + public IndicesPrivilegesDescriptor FieldSecurity(FieldSecurityDescriptor descriptor) + { + FieldSecurityValue = null; + FieldSecurityDescriptorAction = null; + FieldSecurityDescriptorActions = null; + FieldSecurityDescriptor = descriptor; + return Self; + } + + public IndicesPrivilegesDescriptor FieldSecurity(Action configure) + { + FieldSecurityValue = null; + FieldSecurityDescriptor = null; + FieldSecurityDescriptorActions = null; + FieldSecurityDescriptorAction = configure; + return Self; + } + + public IndicesPrivilegesDescriptor FieldSecurity(params Action[] configure) + { + FieldSecurityValue = null; + FieldSecurityDescriptor = null; + FieldSecurityDescriptorAction = null; + FieldSecurityDescriptorActions = configure; + return Self; + } + + public IndicesPrivilegesDescriptor Names(Elastic.Clients.Elasticsearch.Indices names) + { + NamesValue = names; + return Self; + } + + public IndicesPrivilegesDescriptor Privileges(IEnumerable privileges) + { + PrivilegesValue = privileges; + return Self; + } + + public IndicesPrivilegesDescriptor Query(Elastic.Clients.Elasticsearch.Security.IndicesPrivilegesQuery? query) + { + QueryValue = query; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (AllowRestrictedIndicesValue.HasValue) + { + writer.WritePropertyName("allow_restricted_indices"); + writer.WriteBooleanValue(AllowRestrictedIndicesValue.Value); + } + + if (FieldSecurityDescriptor is not null) + { + writer.WritePropertyName("field_security"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, FieldSecurityDescriptor, options); + writer.WriteEndArray(); + } + else if (FieldSecurityDescriptorAction is not null) + { + writer.WritePropertyName("field_security"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new FieldSecurityDescriptor(FieldSecurityDescriptorAction), options); + writer.WriteEndArray(); + } + else if (FieldSecurityDescriptorActions is not null) + { + writer.WritePropertyName("field_security"); + writer.WriteStartArray(); + foreach (var action in FieldSecurityDescriptorActions) + { + JsonSerializer.Serialize(writer, new FieldSecurityDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (FieldSecurityValue is not null) + { + writer.WritePropertyName("field_security"); + JsonSerializer.Serialize(writer, FieldSecurityValue, options); + } + + writer.WritePropertyName("names"); + JsonSerializer.Serialize(writer, NamesValue, options); + writer.WritePropertyName("privileges"); + JsonSerializer.Serialize(writer, PrivilegesValue, options); + if (QueryValue is not null) + { + writer.WritePropertyName("query"); + JsonSerializer.Serialize(writer, QueryValue, options); + } + + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndicesPrivilegesQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndicesPrivilegesQuery.g.cs new file mode 100644 index 00000000000..419d530276c --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/IndicesPrivilegesQuery.g.cs @@ -0,0 +1,31 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch.Security +{ + public partial class IndicesPrivilegesQuery + { + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ManageUserPrivileges.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ManageUserPrivileges.g.cs new file mode 100644 index 00000000000..a9c47a92ad3 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/ManageUserPrivileges.g.cs @@ -0,0 +1,57 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch.Security +{ + public sealed partial class ManageUserPrivileges + { + [JsonInclude] + [JsonPropertyName("applications")] + public IEnumerable Applications { get; set; } + } + + public sealed partial class ManageUserPrivilegesDescriptor : SerializableDescriptorBase + { + internal ManageUserPrivilegesDescriptor(Action configure) => configure.Invoke(this); + public ManageUserPrivilegesDescriptor() : base() + { + } + + private IEnumerable ApplicationsValue { get; set; } + + public ManageUserPrivilegesDescriptor Applications(IEnumerable applications) + { + ApplicationsValue = applications; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("applications"); + JsonSerializer.Serialize(writer, ApplicationsValue, options); + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptor.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptor.g.cs new file mode 100644 index 00000000000..835248dff56 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleDescriptor.g.cs @@ -0,0 +1,479 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch.Security +{ + internal sealed class RoleDescriptorConverter : JsonConverter + { + public override RoleDescriptor Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (reader.TokenType != JsonTokenType.StartObject) + throw new JsonException("Unexpected JSON detected."); + var variant = new RoleDescriptor(); + while (reader.Read() && reader.TokenType != JsonTokenType.EndObject) + { + if (reader.TokenType == JsonTokenType.PropertyName) + { + var property = reader.GetString(); + if (property == "applications") + { + variant.Applications = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "cluster") + { + variant.Cluster = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "global") + { + variant.Global = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "indices" || property == "index") + { + variant.Indices = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "metadata") + { + variant.Metadata = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "run_as") + { + variant.RunAs = JsonSerializer.Deserialize?>(ref reader, options); + continue; + } + + if (property == "transient_metadata") + { + variant.TransientMetadata = JsonSerializer.Deserialize(ref reader, options); + continue; + } + } + } + + return variant; + } + + public override void Write(Utf8JsonWriter writer, RoleDescriptor value, JsonSerializerOptions options) + { + writer.WriteStartObject(); + if (value.Applications is not null) + { + writer.WritePropertyName("applications"); + JsonSerializer.Serialize(writer, value.Applications, options); + } + + if (value.Cluster is not null) + { + writer.WritePropertyName("cluster"); + JsonSerializer.Serialize(writer, value.Cluster, options); + } + + if (value.Global is not null) + { + writer.WritePropertyName("global"); + JsonSerializer.Serialize(writer, value.Global, options); + } + + if (value.Indices is not null) + { + writer.WritePropertyName("indices"); + JsonSerializer.Serialize(writer, value.Indices, options); + } + + if (value.Metadata is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, value.Metadata, options); + } + + if (value.RunAs is not null) + { + writer.WritePropertyName("run_as"); + JsonSerializer.Serialize(writer, value.RunAs, options); + } + + if (value.TransientMetadata is not null) + { + writer.WritePropertyName("transient_metadata"); + JsonSerializer.Serialize(writer, value.TransientMetadata, options); + } + + writer.WriteEndObject(); + } + } + + [JsonConverter(typeof(RoleDescriptorConverter))] + public sealed partial class RoleDescriptor + { + public IEnumerable? Applications { get; set; } + + public IEnumerable? Cluster { get; set; } + + public IEnumerable? Global { get; set; } + + public IEnumerable? Indices { get; set; } + + public Dictionary? Metadata { get; set; } + + public IEnumerable? RunAs { get; set; } + + public Elastic.Clients.Elasticsearch.Security.TransientMetadataConfig? TransientMetadata { get; set; } + } + + public sealed partial class RoleDescriptorDescriptor : SerializableDescriptorBase + { + internal RoleDescriptorDescriptor(Action configure) => configure.Invoke(this); + public RoleDescriptorDescriptor() : base() + { + } + + private IEnumerable? ApplicationsValue { get; set; } + + private ApplicationPrivilegesDescriptor ApplicationsDescriptor { get; set; } + + private Action ApplicationsDescriptorAction { get; set; } + + private Action[] ApplicationsDescriptorActions { get; set; } + + private IEnumerable? ClusterValue { get; set; } + + private IEnumerable? GlobalValue { get; set; } + + private GlobalPrivilegeDescriptor GlobalDescriptor { get; set; } + + private Action GlobalDescriptorAction { get; set; } + + private Action[] GlobalDescriptorActions { get; set; } + + private IEnumerable? IndicesValue { get; set; } + + private IndicesPrivilegesDescriptor IndicesDescriptor { get; set; } + + private Action IndicesDescriptorAction { get; set; } + + private Action[] IndicesDescriptorActions { get; set; } + + private Dictionary? MetadataValue { get; set; } + + private IEnumerable? RunAsValue { get; set; } + + private Elastic.Clients.Elasticsearch.Security.TransientMetadataConfig? TransientMetadataValue { get; set; } + + private TransientMetadataConfigDescriptor TransientMetadataDescriptor { get; set; } + + private Action TransientMetadataDescriptorAction { get; set; } + + public RoleDescriptorDescriptor Applications(IEnumerable? applications) + { + ApplicationsDescriptor = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = null; + ApplicationsValue = applications; + return Self; + } + + public RoleDescriptorDescriptor Applications(ApplicationPrivilegesDescriptor descriptor) + { + ApplicationsValue = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = null; + ApplicationsDescriptor = descriptor; + return Self; + } + + public RoleDescriptorDescriptor Applications(Action configure) + { + ApplicationsValue = null; + ApplicationsDescriptor = null; + ApplicationsDescriptorActions = null; + ApplicationsDescriptorAction = configure; + return Self; + } + + public RoleDescriptorDescriptor Applications(params Action[] configure) + { + ApplicationsValue = null; + ApplicationsDescriptor = null; + ApplicationsDescriptorAction = null; + ApplicationsDescriptorActions = configure; + return Self; + } + + public RoleDescriptorDescriptor Cluster(IEnumerable? cluster) + { + ClusterValue = cluster; + return Self; + } + + public RoleDescriptorDescriptor Global(IEnumerable? global) + { + GlobalDescriptor = null; + GlobalDescriptorAction = null; + GlobalDescriptorActions = null; + GlobalValue = global; + return Self; + } + + public RoleDescriptorDescriptor Global(GlobalPrivilegeDescriptor descriptor) + { + GlobalValue = null; + GlobalDescriptorAction = null; + GlobalDescriptorActions = null; + GlobalDescriptor = descriptor; + return Self; + } + + public RoleDescriptorDescriptor Global(Action configure) + { + GlobalValue = null; + GlobalDescriptor = null; + GlobalDescriptorActions = null; + GlobalDescriptorAction = configure; + return Self; + } + + public RoleDescriptorDescriptor Global(params Action[] configure) + { + GlobalValue = null; + GlobalDescriptor = null; + GlobalDescriptorAction = null; + GlobalDescriptorActions = configure; + return Self; + } + + public RoleDescriptorDescriptor Indices(IEnumerable? indices) + { + IndicesDescriptor = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = null; + IndicesValue = indices; + return Self; + } + + public RoleDescriptorDescriptor Indices(IndicesPrivilegesDescriptor descriptor) + { + IndicesValue = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = null; + IndicesDescriptor = descriptor; + return Self; + } + + public RoleDescriptorDescriptor Indices(Action configure) + { + IndicesValue = null; + IndicesDescriptor = null; + IndicesDescriptorActions = null; + IndicesDescriptorAction = configure; + return Self; + } + + public RoleDescriptorDescriptor Indices(params Action[] configure) + { + IndicesValue = null; + IndicesDescriptor = null; + IndicesDescriptorAction = null; + IndicesDescriptorActions = configure; + return Self; + } + + public RoleDescriptorDescriptor Metadata(Func, FluentDictionary> selector) + { + MetadataValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public RoleDescriptorDescriptor RunAs(IEnumerable? runAs) + { + RunAsValue = runAs; + return Self; + } + + public RoleDescriptorDescriptor TransientMetadata(Elastic.Clients.Elasticsearch.Security.TransientMetadataConfig? transientMetadata) + { + TransientMetadataDescriptor = null; + TransientMetadataDescriptorAction = null; + TransientMetadataValue = transientMetadata; + return Self; + } + + public RoleDescriptorDescriptor TransientMetadata(TransientMetadataConfigDescriptor descriptor) + { + TransientMetadataValue = null; + TransientMetadataDescriptorAction = null; + TransientMetadataDescriptor = descriptor; + return Self; + } + + public RoleDescriptorDescriptor TransientMetadata(Action configure) + { + TransientMetadataValue = null; + TransientMetadataDescriptor = null; + TransientMetadataDescriptorAction = configure; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (ApplicationsDescriptor is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, ApplicationsDescriptor, options); + writer.WriteEndArray(); + } + else if (ApplicationsDescriptorAction is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new ApplicationPrivilegesDescriptor(ApplicationsDescriptorAction), options); + writer.WriteEndArray(); + } + else if (ApplicationsDescriptorActions is not null) + { + writer.WritePropertyName("applications"); + writer.WriteStartArray(); + foreach (var action in ApplicationsDescriptorActions) + { + JsonSerializer.Serialize(writer, new ApplicationPrivilegesDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (ApplicationsValue is not null) + { + writer.WritePropertyName("applications"); + JsonSerializer.Serialize(writer, ApplicationsValue, options); + } + + if (ClusterValue is not null) + { + writer.WritePropertyName("cluster"); + JsonSerializer.Serialize(writer, ClusterValue, options); + } + + if (GlobalDescriptor is not null) + { + writer.WritePropertyName("global"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, GlobalDescriptor, options); + writer.WriteEndArray(); + } + else if (GlobalDescriptorAction is not null) + { + writer.WritePropertyName("global"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new GlobalPrivilegeDescriptor(GlobalDescriptorAction), options); + writer.WriteEndArray(); + } + else if (GlobalDescriptorActions is not null) + { + writer.WritePropertyName("global"); + writer.WriteStartArray(); + foreach (var action in GlobalDescriptorActions) + { + JsonSerializer.Serialize(writer, new GlobalPrivilegeDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (GlobalValue is not null) + { + writer.WritePropertyName("global"); + JsonSerializer.Serialize(writer, GlobalValue, options); + } + + if (IndicesDescriptor is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, IndicesDescriptor, options); + writer.WriteEndArray(); + } + else if (IndicesDescriptorAction is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + JsonSerializer.Serialize(writer, new IndicesPrivilegesDescriptor(IndicesDescriptorAction), options); + writer.WriteEndArray(); + } + else if (IndicesDescriptorActions is not null) + { + writer.WritePropertyName("indices"); + writer.WriteStartArray(); + foreach (var action in IndicesDescriptorActions) + { + JsonSerializer.Serialize(writer, new IndicesPrivilegesDescriptor(action), options); + } + + writer.WriteEndArray(); + } + else if (IndicesValue is not null) + { + writer.WritePropertyName("indices"); + JsonSerializer.Serialize(writer, IndicesValue, options); + } + + if (MetadataValue is not null) + { + writer.WritePropertyName("metadata"); + JsonSerializer.Serialize(writer, MetadataValue, options); + } + + if (RunAsValue is not null) + { + writer.WritePropertyName("run_as"); + JsonSerializer.Serialize(writer, RunAsValue, options); + } + + if (TransientMetadataDescriptor is not null) + { + writer.WritePropertyName("transient_metadata"); + JsonSerializer.Serialize(writer, TransientMetadataDescriptor, options); + } + else if (TransientMetadataDescriptorAction is not null) + { + writer.WritePropertyName("transient_metadata"); + JsonSerializer.Serialize(writer, new TransientMetadataConfigDescriptor(TransientMetadataDescriptorAction), options); + } + else if (TransientMetadataValue is not null) + { + writer.WritePropertyName("transient_metadata"); + JsonSerializer.Serialize(writer, TransientMetadataValue, options); + } + + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleTemplateInlineScript.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleTemplateInlineScript.g.cs new file mode 100644 index 00000000000..90e43350a4c --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleTemplateInlineScript.g.cs @@ -0,0 +1,111 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch.Security +{ + public sealed partial class RoleTemplateInlineScript + { + [JsonInclude] + [JsonPropertyName("lang")] + public string? Lang { get; set; } + + [JsonInclude] + [JsonPropertyName("options")] + public Dictionary? Options { get; set; } + + [JsonInclude] + [JsonPropertyName("params")] + public Dictionary? Params { get; set; } + + [JsonInclude] + [JsonPropertyName("source")] + public Union Source { get; set; } + } + + public sealed partial class RoleTemplateInlineScriptDescriptor : SerializableDescriptorBase + { + internal RoleTemplateInlineScriptDescriptor(Action configure) => configure.Invoke(this); + public RoleTemplateInlineScriptDescriptor() : base() + { + } + + private string? LangValue { get; set; } + + private Dictionary? OptionsValue { get; set; } + + private Dictionary? ParamsValue { get; set; } + + private Union SourceValue { get; set; } + + public RoleTemplateInlineScriptDescriptor Lang(string? lang) + { + LangValue = lang; + return Self; + } + + public RoleTemplateInlineScriptDescriptor Options(Func, FluentDictionary> selector) + { + OptionsValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public RoleTemplateInlineScriptDescriptor Params(Func, FluentDictionary> selector) + { + ParamsValue = selector?.Invoke(new FluentDictionary()); + return Self; + } + + public RoleTemplateInlineScriptDescriptor Source(Union source) + { + SourceValue = source; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (LangValue is not null) + { + writer.WritePropertyName("lang"); + JsonSerializer.Serialize(writer, LangValue, options); + } + + if (OptionsValue is not null) + { + writer.WritePropertyName("options"); + JsonSerializer.Serialize(writer, OptionsValue, options); + } + + if (ParamsValue is not null) + { + writer.WritePropertyName("params"); + JsonSerializer.Serialize(writer, ParamsValue, options); + } + + writer.WritePropertyName("source"); + JsonSerializer.Serialize(writer, SourceValue, options); + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleTemplateQuery.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleTemplateQuery.g.cs new file mode 100644 index 00000000000..3e34d8026c4 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleTemplateQuery.g.cs @@ -0,0 +1,61 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch.Security +{ + public sealed partial class RoleTemplateQuery + { + [JsonInclude] + [JsonPropertyName("template")] + public Elastic.Clients.Elasticsearch.Security.RoleTemplateScript? Template { get; set; } + } + + public sealed partial class RoleTemplateQueryDescriptor : SerializableDescriptorBase + { + internal RoleTemplateQueryDescriptor(Action configure) => configure.Invoke(this); + public RoleTemplateQueryDescriptor() : base() + { + } + + private Elastic.Clients.Elasticsearch.Security.RoleTemplateScript? TemplateValue { get; set; } + + public RoleTemplateQueryDescriptor Template(Elastic.Clients.Elasticsearch.Security.RoleTemplateScript? template) + { + TemplateValue = template; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + if (TemplateValue is not null) + { + writer.WritePropertyName("template"); + JsonSerializer.Serialize(writer, TemplateValue, options); + } + + writer.WriteEndObject(); + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleTemplateScript.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleTemplateScript.g.cs new file mode 100644 index 00000000000..7c32ad0fd95 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/RoleTemplateScript.g.cs @@ -0,0 +1,38 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +using Elastic.Transport; +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch.Security +{ + public partial class RoleTemplateScript : Union + { + public RoleTemplateScript(Elastic.Clients.Elasticsearch.Security.RoleTemplateInlineScript roleTemplateInlineScript) : base(roleTemplateInlineScript) + { + } + + public RoleTemplateScript(Elastic.Clients.Elasticsearch.StoredScriptId storedScriptId) : base(storedScriptId) + { + } + } +} \ No newline at end of file diff --git a/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/TransientMetadataConfig.g.cs b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/TransientMetadataConfig.g.cs new file mode 100644 index 00000000000..71501cca833 --- /dev/null +++ b/src/Elastic.Clients.Elasticsearch/_Generated/Types/Security/TransientMetadataConfig.g.cs @@ -0,0 +1,57 @@ +// Licensed to Elasticsearch B.V under one or more agreements. +// Elasticsearch B.V licenses this file to you under the Apache 2.0 License. +// See the LICENSE file in the project root for more information. +// +// ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗ +// ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝ +// ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗ +// ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝ +// ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗ +// ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝ +// ------------------------------------------------ +// +// This file is automatically generated. +// Please do not edit these files manually. +// +// ------------------------------------------------ + +using System; +using System.Collections.Generic; +using System.Linq.Expressions; +using System.Text.Json; +using System.Text.Json.Serialization; + +#nullable restore +namespace Elastic.Clients.Elasticsearch.Security +{ + public sealed partial class TransientMetadataConfig + { + [JsonInclude] + [JsonPropertyName("enabled")] + public bool Enabled { get; set; } + } + + public sealed partial class TransientMetadataConfigDescriptor : SerializableDescriptorBase + { + internal TransientMetadataConfigDescriptor(Action configure) => configure.Invoke(this); + public TransientMetadataConfigDescriptor() : base() + { + } + + private bool EnabledValue { get; set; } + + public TransientMetadataConfigDescriptor Enabled(bool enabled = true) + { + EnabledValue = enabled; + return Self; + } + + protected override void Serialize(Utf8JsonWriter writer, JsonSerializerOptions options, IElasticsearchClientSettings settings) + { + writer.WriteStartObject(); + writer.WritePropertyName("enabled"); + writer.WriteBooleanValue(EnabledValue); + writer.WriteEndObject(); + } + } +} \ No newline at end of file