From 6db38a97780fcd59ab97293fee4ef3a9ec61f0c6 Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Tue, 19 Nov 2024 12:58:54 +0100 Subject: [PATCH] [codegen] update to latest spec --- .../elasticsearch/doc-files/api-spec.html | 54 ++-- .../elasticsearch/indices/IndexTemplate.java | 90 +++++++ .../migration/DeprecationsResponse.java | 53 ++++ .../security/ClusterPrivilege.java | 2 + .../GetBuiltinPrivilegesResponse.java | 43 ++++ .../security/PutRoleRequest.java | 63 +++++ .../security/RemoteClusterPrivilege.java | 67 +++++ .../security/RemoteClusterPrivileges.java | 242 ++++++++++++++++++ .../security/RemoteIndicesPrivileges.java | 3 +- .../security/ReplicationAccess.java | 36 +++ .../elasticsearch/security/Restriction.java | 175 +++++++++++++ .../security/RestrictionWorkflow.java | 65 +++++ .../security/RoleDescriptor.java | 172 +++++++++++++ .../security/RoleDescriptorRead.java | 172 +++++++++++++ .../elasticsearch/security/get_role/Role.java | 113 ++++++++ 15 files changed, 1324 insertions(+), 26 deletions(-) create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/RemoteClusterPrivilege.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/RemoteClusterPrivileges.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/Restriction.java create mode 100644 java-client/src/main/java/co/elastic/clients/elasticsearch/security/RestrictionWorkflow.java diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html b/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html index c680732e3..d38d34353 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html @@ -1439,9 +1439,9 @@ 'indices._types.IndexSettingsLifecycleStep': 'indices/_types/IndexSettings.ts#L311-L317', 'indices._types.IndexSettingsTimeSeries': 'indices/_types/IndexSettings.ts#L327-L330', 'indices._types.IndexState': 'indices/_types/IndexState.ts#L27-L40', -'indices._types.IndexTemplate': 'indices/_types/IndexTemplate.ts#L28-L67', -'indices._types.IndexTemplateDataStreamConfiguration': 'indices/_types/IndexTemplate.ts#L69-L80', -'indices._types.IndexTemplateSummary': 'indices/_types/IndexTemplate.ts#L82-L104', +'indices._types.IndexTemplate': 'indices/_types/IndexTemplate.ts#L28-L81', +'indices._types.IndexTemplateDataStreamConfiguration': 'indices/_types/IndexTemplate.ts#L83-L94', +'indices._types.IndexTemplateSummary': 'indices/_types/IndexTemplate.ts#L96-L118', 'indices._types.IndexVersioning': 'indices/_types/IndexSettings.ts#L271-L274', 'indices._types.IndexingPressure': 'indices/_types/IndexSettings.ts#L550-L552', 'indices._types.IndexingPressureMemory': 'indices/_types/IndexSettings.ts#L554-L561', @@ -1815,7 +1815,7 @@ 'migration.deprecations.Deprecation': 'migration/deprecations/types.ts#L29-L35', 'migration.deprecations.DeprecationLevel': 'migration/deprecations/types.ts#L20-L27', 'migration.deprecations.Request': 'migration/deprecations/DeprecationInfoRequest.ts#L23-L32', -'migration.deprecations.Response': 'migration/deprecations/DeprecationInfoResponse.ts#L23-L30', +'migration.deprecations.Response': 'migration/deprecations/DeprecationInfoResponse.ts#L23-L31', 'migration.get_feature_upgrade_status.MigrationFeature': 'migration/get_feature_upgrade_status/GetFeatureUpgradeStatusResponse.ts#L37-L42', 'migration.get_feature_upgrade_status.MigrationFeatureIndexInfo': 'migration/get_feature_upgrade_status/GetFeatureUpgradeStatusResponse.ts#L44-L48', 'migration.get_feature_upgrade_status.MigrationStatus': 'migration/get_feature_upgrade_status/GetFeatureUpgradeStatusResponse.ts#L30-L35', @@ -2393,35 +2393,39 @@ 'searchable_snapshots.stats.Response': 'searchable_snapshots/stats/SearchableSnapshotsStatsResponse.ts#L22-L27', 'security._types.Access': 'security/_types/Access.ts#L22-L31', 'security._types.ApiKey': 'security/_types/ApiKey.ts#L26-L88', -'security._types.ApplicationGlobalUserPrivileges': 'security/_types/Privileges.ts#L372-L374', +'security._types.ApplicationGlobalUserPrivileges': 'security/_types/Privileges.ts#L409-L411', 'security._types.ApplicationPrivileges': 'security/_types/Privileges.ts#L27-L40', 'security._types.BulkError': 'security/_types/Bulk.ts#L24-L33', 'security._types.ClusterNode': 'security/_types/ClusterNode.ts#L22-L24', -'security._types.ClusterPrivilege': 'security/_types/Privileges.ts#L42-L195', +'security._types.ClusterPrivilege': 'security/_types/Privileges.ts#L42-L199', 'security._types.CreatedStatus': 'security/_types/CreatedStatus.ts#L20-L22', 'security._types.FieldRule': 'security/_types/RoleMappingRule.ts#L35-L43', 'security._types.FieldSecurity': 'security/_types/FieldSecurity.ts#L22-L25', -'security._types.GlobalPrivilege': 'security/_types/Privileges.ts#L368-L370', +'security._types.GlobalPrivilege': 'security/_types/Privileges.ts#L405-L407', 'security._types.GrantType': 'security/_types/GrantType.ts#L20-L29', -'security._types.IndexPrivilege': 'security/_types/Privileges.ts#L324-L366', -'security._types.IndicesPrivileges': 'security/_types/Privileges.ts#L198-L222', -'security._types.IndicesPrivilegesQuery': 'security/_types/Privileges.ts#L279-L287', -'security._types.ManageUserPrivileges': 'security/_types/Privileges.ts#L376-L378', +'security._types.IndexPrivilege': 'security/_types/Privileges.ts#L361-L403', +'security._types.IndicesPrivileges': 'security/_types/Privileges.ts#L216-L242', +'security._types.IndicesPrivilegesQuery': 'security/_types/Privileges.ts#L316-L324', +'security._types.ManageUserPrivileges': 'security/_types/Privileges.ts#L413-L415', 'security._types.RealmInfo': 'security/_types/RealmInfo.ts#L22-L25', -'security._types.RemoteIndicesPrivileges': 'security/_types/Privileges.ts#L225-L253', -'security._types.ReplicationAccess': 'security/_types/Privileges.ts#L380-L385', -'security._types.RoleDescriptor': 'security/_types/RoleDescriptor.ts#L31-L64', -'security._types.RoleDescriptorRead': 'security/_types/RoleDescriptor.ts#L66-L98', +'security._types.RemoteClusterPrivilege': 'security/_types/Privileges.ts#L201-L213', +'security._types.RemoteClusterPrivileges': 'security/_types/Privileges.ts#L278-L290', +'security._types.RemoteIndicesPrivileges': 'security/_types/Privileges.ts#L244-L276', +'security._types.ReplicationAccess': 'security/_types/Privileges.ts#L417-L427', +'security._types.Restriction': 'security/_types/RoleDescriptor.ts#L130-L132', +'security._types.RestrictionWorkflow': 'security/_types/RoleDescriptor.ts#L134-L137', +'security._types.RoleDescriptor': 'security/_types/RoleDescriptor.ts#L33-L80', +'security._types.RoleDescriptorRead': 'security/_types/RoleDescriptor.ts#L82-L128', 'security._types.RoleMapping': 'security/_types/RoleMapping.ts#L25-L33', 'security._types.RoleMappingRule': 'security/_types/RoleMappingRule.ts#L22-L33', 'security._types.RoleTemplate': 'security/_types/RoleTemplate.ts#L28-L31', -'security._types.RoleTemplateInlineQuery': 'security/_types/Privileges.ts#L321-L322', -'security._types.RoleTemplateQuery': 'security/_types/Privileges.ts#L289-L299', -'security._types.RoleTemplateScript': 'security/_types/Privileges.ts#L301-L319', -'security._types.SearchAccess': 'security/_types/Privileges.ts#L387-L407', +'security._types.RoleTemplateInlineQuery': 'security/_types/Privileges.ts#L358-L359', +'security._types.RoleTemplateQuery': 'security/_types/Privileges.ts#L326-L336', +'security._types.RoleTemplateScript': 'security/_types/Privileges.ts#L338-L356', +'security._types.SearchAccess': 'security/_types/Privileges.ts#L429-L449', 'security._types.TemplateFormat': 'security/_types/RoleTemplate.ts#L22-L25', 'security._types.User': 'security/_types/User.ts#L23-L31', -'security._types.UserIndicesPrivileges': 'security/_types/Privileges.ts#L255-L277', +'security._types.UserIndicesPrivileges': 'security/_types/Privileges.ts#L292-L314', 'security._types.UserProfile': 'security/_types/UserProfile.ts#L41-L47', 'security._types.UserProfileHitMetadata': 'security/_types/UserProfile.ts#L27-L30', 'security._types.UserProfileUser': 'security/_types/UserProfile.ts#L32-L39', @@ -2481,12 +2485,12 @@ 'security.get_api_key.Request': 'security/get_api_key/SecurityGetApiKeyRequest.ts#L23-L88', 'security.get_api_key.Response': 'security/get_api_key/SecurityGetApiKeyResponse.ts#L22-L24', 'security.get_builtin_privileges.Request': 'security/get_builtin_privileges/SecurityGetBuiltinPrivilegesRequest.ts#L22-L32', -'security.get_builtin_privileges.Response': 'security/get_builtin_privileges/SecurityGetBuiltinPrivilegesResponse.ts#L22-L24', +'security.get_builtin_privileges.Response': 'security/get_builtin_privileges/SecurityGetBuiltinPrivilegesResponse.ts#L26-L35', 'security.get_privileges.Request': 'security/get_privileges/SecurityGetPrivilegesRequest.ts#L23-L35', 'security.get_privileges.Response': 'security/get_privileges/SecurityGetPrivilegesResponse.ts#L23-L26', 'security.get_role.Request': 'security/get_role/SecurityGetRoleRequest.ts#L23-L39', 'security.get_role.Response': 'security/get_role/SecurityGetRoleResponse.ts#L23-L26', -'security.get_role.Role': 'security/get_role/types.ts#L29-L42', +'security.get_role.Role': 'security/get_role/types.ts#L32-L53', 'security.get_role_mapping.Request': 'security/get_role_mapping/SecurityGetRoleMappingRequest.ts#L23-L42', 'security.get_role_mapping.Response': 'security/get_role_mapping/SecurityGetRoleMappingResponse.ts#L23-L26', 'security.get_service_accounts.Request': 'security/get_service_accounts/GetServiceAccountsRequest.ts#L23-L44', @@ -2528,7 +2532,7 @@ 'security.put_privileges.Actions': 'security/put_privileges/types.ts#L22-L27', 'security.put_privileges.Request': 'security/put_privileges/SecurityPutPrivilegesRequest.ts#L25-L38', 'security.put_privileges.Response': 'security/put_privileges/SecurityPutPrivilegesResponse.ts#L23-L26', -'security.put_role.Request': 'security/put_role/SecurityPutRoleRequest.ts#L31-L95', +'security.put_role.Request': 'security/put_role/SecurityPutRoleRequest.ts#L32-L101', 'security.put_role.Response': 'security/put_role/SecurityPutRoleResponse.ts#L22-L24', 'security.put_role_mapping.Request': 'security/put_role_mapping/SecurityPutRoleMappingRequest.ts#L25-L56', 'security.put_role_mapping.Response': 'security/put_role_mapping/SecurityPutRoleMappingResponse.ts#L22-L24', @@ -2953,10 +2957,10 @@ if (hash.length > 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/55d431ab4ffe02043ba6f6a41d27f14542f4c792/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/cf7d574e642f871f48b16f316b56acc17acf4752/specification/" + (paths[hash] || ""); - Please see the Elasticsearch API specification. + Please see the Elasticsearch API specification. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplate.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplate.java index 638061f29..ce5ab90a0 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplate.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexTemplate.java @@ -85,6 +85,11 @@ public class IndexTemplate implements JsonpSerializable { @Nullable private final IndexTemplateDataStreamConfiguration dataStream; + @Nullable + private final Boolean deprecated; + + private final List ignoreMissingComponentTemplates; + // --------------------------------------------------------------------------------------------- private IndexTemplate(Builder builder) { @@ -97,6 +102,8 @@ private IndexTemplate(Builder builder) { this.meta = ApiTypeHelper.unmodifiable(builder.meta); this.allowAutoCreate = builder.allowAutoCreate; this.dataStream = builder.dataStream; + this.deprecated = builder.deprecated; + this.ignoreMissingComponentTemplates = ApiTypeHelper.unmodifiable(builder.ignoreMissingComponentTemplates); } @@ -190,6 +197,27 @@ public final IndexTemplateDataStreamConfiguration dataStream() { return this.dataStream; } + /** + * Marks this index template as deprecated. When creating or updating a + * non-deprecated index template that uses deprecated components, Elasticsearch + * will emit a deprecation warning. + *

+ * API name: {@code deprecated} + */ + @Nullable + public final Boolean deprecated() { + return this.deprecated; + } + + /** + * A list of component template names that are allowed to be absent. + *

+ * API name: {@code ignore_missing_component_templates} + */ + public final List ignoreMissingComponentTemplates() { + return this.ignoreMissingComponentTemplates; + } + /** * Serialize this object to JSON. */ @@ -257,6 +285,21 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.dataStream.serialize(generator, mapper); } + if (this.deprecated != null) { + generator.writeKey("deprecated"); + generator.write(this.deprecated); + + } + if (ApiTypeHelper.isDefined(this.ignoreMissingComponentTemplates)) { + generator.writeKey("ignore_missing_component_templates"); + generator.writeStartArray(); + for (String item0 : this.ignoreMissingComponentTemplates) { + generator.write(item0); + + } + generator.writeEnd(); + + } } @@ -294,6 +337,12 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private IndexTemplateDataStreamConfiguration dataStream; + @Nullable + private Boolean deprecated; + + @Nullable + private List ignoreMissingComponentTemplates; + /** * Required - Name of the index template. *

@@ -450,6 +499,43 @@ public final Builder dataStream( return this.dataStream(fn.apply(new IndexTemplateDataStreamConfiguration.Builder()).build()); } + /** + * Marks this index template as deprecated. When creating or updating a + * non-deprecated index template that uses deprecated components, Elasticsearch + * will emit a deprecation warning. + *

+ * API name: {@code deprecated} + */ + public final Builder deprecated(@Nullable Boolean value) { + this.deprecated = value; + return this; + } + + /** + * A list of component template names that are allowed to be absent. + *

+ * API name: {@code ignore_missing_component_templates} + *

+ * Adds all elements of list to + * ignoreMissingComponentTemplates. + */ + public final Builder ignoreMissingComponentTemplates(List list) { + this.ignoreMissingComponentTemplates = _listAddAll(this.ignoreMissingComponentTemplates, list); + return this; + } + + /** + * A list of component template names that are allowed to be absent. + *

+ * API name: {@code ignore_missing_component_templates} + *

+ * Adds one or more values to ignoreMissingComponentTemplates. + */ + public final Builder ignoreMissingComponentTemplates(String value, String... values) { + this.ignoreMissingComponentTemplates = _listAdd(this.ignoreMissingComponentTemplates, value, values); + return this; + } + @Override protected Builder self() { return this; @@ -488,6 +574,10 @@ protected static void setupIndexTemplateDeserializer(ObjectDeserializer> indexSettings; + private final Map> dataStreams; + private final List nodeSettings; private final List mlSettings; @@ -76,6 +78,7 @@ private DeprecationsResponse(Builder builder) { this.clusterSettings = ApiTypeHelper.unmodifiableRequired(builder.clusterSettings, this, "clusterSettings"); this.indexSettings = ApiTypeHelper.unmodifiableRequired(builder.indexSettings, this, "indexSettings"); + this.dataStreams = ApiTypeHelper.unmodifiableRequired(builder.dataStreams, this, "dataStreams"); this.nodeSettings = ApiTypeHelper.unmodifiableRequired(builder.nodeSettings, this, "nodeSettings"); this.mlSettings = ApiTypeHelper.unmodifiableRequired(builder.mlSettings, this, "mlSettings"); @@ -99,6 +102,13 @@ public final Map> indexSettings() { return this.indexSettings; } + /** + * Required - API name: {@code data_streams} + */ + public final Map> dataStreams() { + return this.dataStreams; + } + /** * Required - API name: {@code node_settings} */ @@ -151,6 +161,24 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + if (ApiTypeHelper.isDefined(this.dataStreams)) { + generator.writeKey("data_streams"); + generator.writeStartObject(); + for (Map.Entry> item0 : this.dataStreams.entrySet()) { + generator.writeKey(item0.getKey()); + generator.writeStartArray(); + if (item0.getValue() != null) { + for (Deprecation item1 : item0.getValue()) { + item1.serialize(generator, mapper); + + } + } + generator.writeEnd(); + + } + generator.writeEnd(); + } if (ApiTypeHelper.isDefined(this.nodeSettings)) { generator.writeKey("node_settings"); @@ -193,6 +221,8 @@ public static class Builder extends WithJsonObjectBuilderBase private Map> indexSettings; + private Map> dataStreams; + private List nodeSettings; private List mlSettings; @@ -246,6 +276,26 @@ public final Builder indexSettings(String key, List value) { return this; } + /** + * Required - API name: {@code data_streams} + *

+ * Adds all entries of map to dataStreams. + */ + public final Builder dataStreams(Map> map) { + this.dataStreams = _mapPutAll(this.dataStreams, map); + return this; + } + + /** + * Required - API name: {@code data_streams} + *

+ * Adds an entry to dataStreams. + */ + public final Builder dataStreams(String key, List value) { + this.dataStreams = _mapPut(this.dataStreams, key, value); + return this; + } + /** * Required - API name: {@code node_settings} *

@@ -337,6 +387,9 @@ protected static void setupDeprecationsResponseDeserializer(ObjectDeserializer index; + private final List remoteCluster; + // --------------------------------------------------------------------------------------------- private GetBuiltinPrivilegesResponse(Builder builder) { this.cluster = ApiTypeHelper.unmodifiableRequired(builder.cluster, this, "cluster"); this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); + this.remoteCluster = ApiTypeHelper.unmodifiableRequired(builder.remoteCluster, this, "remoteCluster"); } @@ -92,6 +95,13 @@ public final List index() { return this.index; } + /** + * Required - API name: {@code remote_cluster} + */ + public final List remoteCluster() { + return this.remoteCluster; + } + /** * Serialize this object to JSON. */ @@ -123,6 +133,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } + if (ApiTypeHelper.isDefined(this.remoteCluster)) { + generator.writeKey("remote_cluster"); + generator.writeStartArray(); + for (RemoteClusterPrivilege item0 : this.remoteCluster) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + + } } @@ -144,6 +163,8 @@ public static class Builder extends WithJsonObjectBuilderBase private List index; + private List remoteCluster; + /** * Required - API name: {@code cluster} *

@@ -184,6 +205,26 @@ public final Builder index(String value, String... values) { return this; } + /** + * Required - API name: {@code remote_cluster} + *

+ * Adds all elements of list to remoteCluster. + */ + public final Builder remoteCluster(List list) { + this.remoteCluster = _listAddAll(this.remoteCluster, list); + return this; + } + + /** + * Required - API name: {@code remote_cluster} + *

+ * Adds one or more values to remoteCluster. + */ + public final Builder remoteCluster(RemoteClusterPrivilege value, RemoteClusterPrivilege... values) { + this.remoteCluster = _listAdd(this.remoteCluster, value, values); + return this; + } + @Override protected Builder self() { return this; @@ -216,6 +257,8 @@ protected static void setupGetBuiltinPrivilegesResponseDeserializer( op.add(Builder::cluster, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "cluster"); op.add(Builder::index, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "index"); + op.add(Builder::remoteCluster, JsonpDeserializer.arrayDeserializer(RemoteClusterPrivilege._DESERIALIZER), + "remote_cluster"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleRequest.java index a5381c075..59d1df3c5 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleRequest.java @@ -90,6 +90,8 @@ public class PutRoleRequest extends RequestBase implements JsonpSerializable { @Nullable private final Refresh refresh; + private final List remoteCluster; + private final List remoteIndices; private final List runAs; @@ -108,6 +110,7 @@ private PutRoleRequest(Builder builder) { this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); this.refresh = builder.refresh; + this.remoteCluster = ApiTypeHelper.unmodifiable(builder.remoteCluster); this.remoteIndices = ApiTypeHelper.unmodifiable(builder.remoteIndices); this.runAs = ApiTypeHelper.unmodifiable(builder.runAs); this.transientMetadata = ApiTypeHelper.unmodifiable(builder.transientMetadata); @@ -203,6 +206,15 @@ public final Refresh refresh() { return this.refresh; } + /** + * A list of remote cluster permissions entries. + *

+ * API name: {@code remote_cluster} + */ + public final List remoteCluster() { + return this.remoteCluster; + } + /** * A list of remote indices permissions entries. *

@@ -305,6 +317,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + if (ApiTypeHelper.isDefined(this.remoteCluster)) { + generator.writeKey("remote_cluster"); + generator.writeStartArray(); + for (RemoteClusterPrivileges item0 : this.remoteCluster) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + } if (ApiTypeHelper.isDefined(this.remoteIndices)) { generator.writeKey("remote_indices"); @@ -370,6 +392,9 @@ public static class Builder extends RequestBase.AbstractBuilder impleme @Nullable private Refresh refresh; + @Nullable + private List remoteCluster; + @Nullable private List remoteIndices; @@ -567,6 +592,42 @@ public final Builder refresh(@Nullable Refresh value) { return this; } + /** + * A list of remote cluster permissions entries. + *

+ * API name: {@code remote_cluster} + *

+ * Adds all elements of list to remoteCluster. + */ + public final Builder remoteCluster(List list) { + this.remoteCluster = _listAddAll(this.remoteCluster, list); + return this; + } + + /** + * A list of remote cluster permissions entries. + *

+ * API name: {@code remote_cluster} + *

+ * Adds one or more values to remoteCluster. + */ + public final Builder remoteCluster(RemoteClusterPrivileges value, RemoteClusterPrivileges... values) { + this.remoteCluster = _listAdd(this.remoteCluster, value, values); + return this; + } + + /** + * A list of remote cluster permissions entries. + *

+ * API name: {@code remote_cluster} + *

+ * Adds a value to remoteCluster using a builder lambda. + */ + public final Builder remoteCluster( + Function> fn) { + return remoteCluster(fn.apply(new RemoteClusterPrivileges.Builder()).build()); + } + /** * A list of remote indices permissions entries. *

@@ -703,6 +764,8 @@ protected static void setupPutRoleRequestDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public enum RemoteClusterPrivilege implements JsonEnum { + MonitorEnrich("monitor_enrich"), + + MonitorStats("monitor_stats"), + + ; + + private final String jsonValue; + + RemoteClusterPrivilege(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + RemoteClusterPrivilege.values()); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RemoteClusterPrivileges.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RemoteClusterPrivileges.java new file mode 100644 index 000000000..619b3d03b --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RemoteClusterPrivileges.java @@ -0,0 +1,242 @@ +/* + * 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. + */ + +package co.elastic.clients.elasticsearch.security; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: security._types.RemoteClusterPrivileges + +/** + * The subset of cluster level privileges that can be defined for remote + * clusters. + * + * @see API + * specification + */ +@JsonpDeserializable +public class RemoteClusterPrivileges implements JsonpSerializable { + private final List clusters; + + private final List privileges; + + // --------------------------------------------------------------------------------------------- + + private RemoteClusterPrivileges(Builder builder) { + + this.clusters = ApiTypeHelper.unmodifiableRequired(builder.clusters, this, "clusters"); + this.privileges = ApiTypeHelper.unmodifiableRequired(builder.privileges, this, "privileges"); + + } + + public static RemoteClusterPrivileges of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - A list of cluster aliases to which the permissions in this entry + * apply. + *

+ * API name: {@code clusters} + */ + public final List clusters() { + return this.clusters; + } + + /** + * Required - The cluster level privileges that owners of the role have on the + * remote cluster. + *

+ * API name: {@code privileges} + */ + public final List privileges() { + return this.privileges; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (ApiTypeHelper.isDefined(this.clusters)) { + generator.writeKey("clusters"); + generator.writeStartArray(); + for (String item0 : this.clusters) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.privileges)) { + generator.writeKey("privileges"); + generator.writeStartArray(); + for (RemoteClusterPrivilege item0 : this.privileges) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RemoteClusterPrivileges}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private List clusters; + + private List privileges; + + /** + * Required - A list of cluster aliases to which the permissions in this entry + * apply. + *

+ * API name: {@code clusters} + *

+ * Adds all elements of list to clusters. + */ + public final Builder clusters(List list) { + this.clusters = _listAddAll(this.clusters, list); + return this; + } + + /** + * Required - A list of cluster aliases to which the permissions in this entry + * apply. + *

+ * API name: {@code clusters} + *

+ * Adds one or more values to clusters. + */ + public final Builder clusters(String value, String... values) { + this.clusters = _listAdd(this.clusters, value, values); + return this; + } + + /** + * Required - The cluster level privileges that owners of the role have on the + * remote cluster. + *

+ * API name: {@code privileges} + *

+ * Adds all elements of list to privileges. + */ + public final Builder privileges(List list) { + this.privileges = _listAddAll(this.privileges, list); + return this; + } + + /** + * Required - The cluster level privileges that owners of the role have on the + * remote cluster. + *

+ * API name: {@code privileges} + *

+ * Adds one or more values to privileges. + */ + public final Builder privileges(RemoteClusterPrivilege value, RemoteClusterPrivilege... values) { + this.privileges = _listAdd(this.privileges, value, values); + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link RemoteClusterPrivileges}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public RemoteClusterPrivileges build() { + _checkSingleUse(); + + return new RemoteClusterPrivileges(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RemoteClusterPrivileges} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, RemoteClusterPrivileges::setupRemoteClusterPrivilegesDeserializer); + + protected static void setupRemoteClusterPrivilegesDeserializer( + ObjectDeserializer op) { + + op.add(Builder::clusters, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "clusters"); + op.add(Builder::privileges, JsonpDeserializer.arrayDeserializer(RemoteClusterPrivilege._DESERIALIZER), + "privileges"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RemoteIndicesPrivileges.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RemoteIndicesPrivileges.java index 73659d0fc..bf0228ca9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RemoteIndicesPrivileges.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RemoteIndicesPrivileges.java @@ -55,7 +55,8 @@ // typedef: security._types.RemoteIndicesPrivileges /** - * + * The subset of index level privileges that can be defined for remote clusters. + * * @see API * specification diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ReplicationAccess.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ReplicationAccess.java index 7907d7f89..5bd2ca9e1 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ReplicationAccess.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ReplicationAccess.java @@ -30,6 +30,7 @@ import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; import java.lang.String; import java.util.List; import java.util.Objects; @@ -63,11 +64,15 @@ public class ReplicationAccess implements JsonpSerializable { private final List names; + @Nullable + private final Boolean allowRestrictedIndices; + // --------------------------------------------------------------------------------------------- private ReplicationAccess(Builder builder) { this.names = ApiTypeHelper.unmodifiableRequired(builder.names, this, "names"); + this.allowRestrictedIndices = builder.allowRestrictedIndices; } @@ -85,6 +90,17 @@ public final List names() { return this.names; } + /** + * This needs to be set to true if the patterns in the names field should cover + * system indices. + *

+ * API name: {@code allow_restricted_indices} + */ + @Nullable + public final Boolean allowRestrictedIndices() { + return this.allowRestrictedIndices; + } + /** * Serialize this object to JSON. */ @@ -106,6 +122,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } + if (this.allowRestrictedIndices != null) { + generator.writeKey("allow_restricted_indices"); + generator.write(this.allowRestrictedIndices); + + } } @@ -123,6 +144,9 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { private List names; + @Nullable + private Boolean allowRestrictedIndices; + /** * Required - A list of indices (or index name patterns) to which the * permissions in this entry apply. @@ -149,6 +173,17 @@ public final Builder names(String value, String... values) { return this; } + /** + * This needs to be set to true if the patterns in the names field should cover + * system indices. + *

+ * API name: {@code allow_restricted_indices} + */ + public final Builder allowRestrictedIndices(@Nullable Boolean value) { + this.allowRestrictedIndices = value; + return this; + } + @Override protected Builder self() { return this; @@ -178,6 +213,7 @@ public ReplicationAccess build() { protected static void setupReplicationAccessDeserializer(ObjectDeserializer op) { op.add(Builder::names, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "names"); + op.add(Builder::allowRestrictedIndices, JsonpDeserializer.booleanDeserializer(), "allow_restricted_indices"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/Restriction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/Restriction.java new file mode 100644 index 000000000..2d48411ac --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/Restriction.java @@ -0,0 +1,175 @@ +/* + * 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. + */ + +package co.elastic.clients.elasticsearch.security; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: security._types.Restriction + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class Restriction implements JsonpSerializable { + private final List workflows; + + // --------------------------------------------------------------------------------------------- + + private Restriction(Builder builder) { + + this.workflows = ApiTypeHelper.unmodifiableRequired(builder.workflows, this, "workflows"); + + } + + public static Restriction of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code workflows} + */ + public final List workflows() { + return this.workflows; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (ApiTypeHelper.isDefined(this.workflows)) { + generator.writeKey("workflows"); + generator.writeStartArray(); + for (String item0 : this.workflows) { + generator.write(item0); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link Restriction}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private List workflows; + + /** + * Required - API name: {@code workflows} + *

+ * Adds all elements of list to workflows. + */ + public final Builder workflows(List list) { + this.workflows = _listAddAll(this.workflows, list); + return this; + } + + /** + * Required - API name: {@code workflows} + *

+ * Adds one or more values to workflows. + */ + public final Builder workflows(String value, String... values) { + this.workflows = _listAdd(this.workflows, value, values); + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link Restriction}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public Restriction build() { + _checkSingleUse(); + + return new Restriction(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Restriction} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + Restriction::setupRestrictionDeserializer); + + protected static void setupRestrictionDeserializer(ObjectDeserializer op) { + + op.add(Builder::workflows, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "workflows"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RestrictionWorkflow.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RestrictionWorkflow.java new file mode 100644 index 000000000..4d7f7da51 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RestrictionWorkflow.java @@ -0,0 +1,65 @@ +/* + * 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. + */ + +package co.elastic.clients.elasticsearch.security; + +import co.elastic.clients.json.JsonEnum; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public enum RestrictionWorkflow implements JsonEnum { + SearchApplicationQuery("search_application_query"), + + ; + + private final String jsonValue; + + RestrictionWorkflow(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + RestrictionWorkflow.values()); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptor.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptor.java index d19de378e..f2f4db6eb 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptor.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptor.java @@ -66,6 +66,10 @@ public class RoleDescriptor implements JsonpSerializable { private final List indices; + private final List remoteIndices; + + private final List remoteCluster; + private final List global; private final List applications; @@ -77,6 +81,9 @@ public class RoleDescriptor implements JsonpSerializable { @Nullable private final String description; + @Nullable + private final Restriction restriction; + private final Map transientMetadata; // --------------------------------------------------------------------------------------------- @@ -85,11 +92,14 @@ protected RoleDescriptor(AbstractBuilder builder) { this.cluster = ApiTypeHelper.unmodifiable(builder.cluster); this.indices = ApiTypeHelper.unmodifiable(builder.indices); + this.remoteIndices = ApiTypeHelper.unmodifiable(builder.remoteIndices); + this.remoteCluster = ApiTypeHelper.unmodifiable(builder.remoteCluster); this.global = ApiTypeHelper.unmodifiable(builder.global); this.applications = ApiTypeHelper.unmodifiable(builder.applications); this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); this.runAs = ApiTypeHelper.unmodifiable(builder.runAs); this.description = builder.description; + this.restriction = builder.restriction; this.transientMetadata = ApiTypeHelper.unmodifiable(builder.transientMetadata); } @@ -117,6 +127,25 @@ public final List indices() { return this.indices; } + /** + * A list of indices permissions for remote clusters. + *

+ * API name: {@code remote_indices} + */ + public final List remoteIndices() { + return this.remoteIndices; + } + + /** + * A list of cluster permissions for remote clusters. Note - this is limited a + * subset of the cluster permissions. + *

+ * API name: {@code remote_cluster} + */ + public final List remoteCluster() { + return this.remoteCluster; + } + /** * An object defining global privileges. A global privilege is a form of cluster * privilege that is request-aware. Support for global privileges is currently @@ -169,6 +198,16 @@ public final String description() { return this.description; } + /** + * Restriction for when the role descriptor is allowed to be effective. + *

+ * API name: {@code restriction} + */ + @Nullable + public final Restriction restriction() { + return this.restriction; + } + /** * API name: {@code transient_metadata} */ @@ -206,6 +245,26 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + if (ApiTypeHelper.isDefined(this.remoteIndices)) { + generator.writeKey("remote_indices"); + generator.writeStartArray(); + for (RemoteIndicesPrivileges item0 : this.remoteIndices) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.remoteCluster)) { + generator.writeKey("remote_cluster"); + generator.writeStartArray(); + for (RemoteClusterPrivileges item0 : this.remoteCluster) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + } if (ApiTypeHelper.isDefined(this.global)) { generator.writeKey("global"); @@ -252,6 +311,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("description"); generator.write(this.description); + } + if (this.restriction != null) { + generator.writeKey("restriction"); + this.restriction.serialize(generator, mapper); + } if (ApiTypeHelper.isDefined(this.transientMetadata)) { generator.writeKey("transient_metadata"); @@ -308,6 +372,12 @@ public abstract static class AbstractBuilder indices; + @Nullable + private List remoteIndices; + + @Nullable + private List remoteCluster; + @Nullable private List global; @@ -323,6 +393,9 @@ public abstract static class AbstractBuilder transientMetadata; @@ -387,6 +460,81 @@ public final BuilderT indices(Function + * API name: {@code remote_indices} + *

+ * Adds all elements of list to remoteIndices. + */ + public final BuilderT remoteIndices(List list) { + this.remoteIndices = _listAddAll(this.remoteIndices, list); + return self(); + } + + /** + * A list of indices permissions for remote clusters. + *

+ * API name: {@code remote_indices} + *

+ * Adds one or more values to remoteIndices. + */ + public final BuilderT remoteIndices(RemoteIndicesPrivileges value, RemoteIndicesPrivileges... values) { + this.remoteIndices = _listAdd(this.remoteIndices, value, values); + return self(); + } + + /** + * A list of indices permissions for remote clusters. + *

+ * API name: {@code remote_indices} + *

+ * Adds a value to remoteIndices using a builder lambda. + */ + public final BuilderT remoteIndices( + Function> fn) { + return remoteIndices(fn.apply(new RemoteIndicesPrivileges.Builder()).build()); + } + + /** + * A list of cluster permissions for remote clusters. Note - this is limited a + * subset of the cluster permissions. + *

+ * API name: {@code remote_cluster} + *

+ * Adds all elements of list to remoteCluster. + */ + public final BuilderT remoteCluster(List list) { + this.remoteCluster = _listAddAll(this.remoteCluster, list); + return self(); + } + + /** + * A list of cluster permissions for remote clusters. Note - this is limited a + * subset of the cluster permissions. + *

+ * API name: {@code remote_cluster} + *

+ * Adds one or more values to remoteCluster. + */ + public final BuilderT remoteCluster(RemoteClusterPrivileges value, RemoteClusterPrivileges... values) { + this.remoteCluster = _listAdd(this.remoteCluster, value, values); + return self(); + } + + /** + * A list of cluster permissions for remote clusters. Note - this is limited a + * subset of the cluster permissions. + *

+ * API name: {@code remote_cluster} + *

+ * Adds a value to remoteCluster using a builder lambda. + */ + public final BuilderT remoteCluster( + Function> fn) { + return remoteCluster(fn.apply(new RemoteClusterPrivileges.Builder()).build()); + } + /** * An object defining global privileges. A global privilege is a form of cluster * privilege that is request-aware. Support for global privileges is currently @@ -530,6 +678,25 @@ public final BuilderT description(@Nullable String value) { return self(); } + /** + * Restriction for when the role descriptor is allowed to be effective. + *

+ * API name: {@code restriction} + */ + public final BuilderT restriction(@Nullable Restriction value) { + this.restriction = value; + return self(); + } + + /** + * Restriction for when the role descriptor is allowed to be effective. + *

+ * API name: {@code restriction} + */ + public final BuilderT restriction(Function> fn) { + return this.restriction(fn.apply(new Restriction.Builder()).build()); + } + /** * API name: {@code transient_metadata} *

@@ -569,6 +736,10 @@ protected static > void setupRoleDesc "cluster"); op.add(AbstractBuilder::indices, JsonpDeserializer.arrayDeserializer(IndicesPrivileges._DESERIALIZER), "indices", "index"); + op.add(AbstractBuilder::remoteIndices, + JsonpDeserializer.arrayDeserializer(RemoteIndicesPrivileges._DESERIALIZER), "remote_indices"); + op.add(AbstractBuilder::remoteCluster, + JsonpDeserializer.arrayDeserializer(RemoteClusterPrivileges._DESERIALIZER), "remote_cluster"); op.add(AbstractBuilder::global, JsonpDeserializer.arrayDeserializer(GlobalPrivilege._DESERIALIZER), "global"); op.add(AbstractBuilder::applications, JsonpDeserializer.arrayDeserializer(ApplicationPrivileges._DESERIALIZER), "applications"); @@ -576,6 +747,7 @@ protected static > void setupRoleDesc op.add(AbstractBuilder::runAs, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "run_as"); op.add(AbstractBuilder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(AbstractBuilder::restriction, Restriction._DESERIALIZER, "restriction"); op.add(AbstractBuilder::transientMetadata, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "transient_metadata"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptorRead.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptorRead.java index 07c3ac990..632a06b9b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptorRead.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptorRead.java @@ -67,6 +67,10 @@ public class RoleDescriptorRead implements JsonpSerializable { private final List indices; + private final List remoteIndices; + + private final List remoteCluster; + private final List global; private final List applications; @@ -78,6 +82,9 @@ public class RoleDescriptorRead implements JsonpSerializable { @Nullable private final String description; + @Nullable + private final Restriction restriction; + private final Map transientMetadata; // --------------------------------------------------------------------------------------------- @@ -86,11 +93,14 @@ private RoleDescriptorRead(Builder builder) { this.cluster = ApiTypeHelper.unmodifiableRequired(builder.cluster, this, "cluster"); this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); + this.remoteIndices = ApiTypeHelper.unmodifiable(builder.remoteIndices); + this.remoteCluster = ApiTypeHelper.unmodifiable(builder.remoteCluster); this.global = ApiTypeHelper.unmodifiable(builder.global); this.applications = ApiTypeHelper.unmodifiable(builder.applications); this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); this.runAs = ApiTypeHelper.unmodifiable(builder.runAs); this.description = builder.description; + this.restriction = builder.restriction; this.transientMetadata = ApiTypeHelper.unmodifiable(builder.transientMetadata); } @@ -118,6 +128,25 @@ public final List indices() { return this.indices; } + /** + * A list of indices permissions for remote clusters. + *

+ * API name: {@code remote_indices} + */ + public final List remoteIndices() { + return this.remoteIndices; + } + + /** + * A list of cluster permissions for remote clusters. Note - this is limited a + * subset of the cluster permissions. + *

+ * API name: {@code remote_cluster} + */ + public final List remoteCluster() { + return this.remoteCluster; + } + /** * An object defining global privileges. A global privilege is a form of cluster * privilege that is request-aware. Support for global privileges is currently @@ -167,6 +196,16 @@ public final String description() { return this.description; } + /** + * Restriction for when the role descriptor is allowed to be effective. + *

+ * API name: {@code restriction} + */ + @Nullable + public final Restriction restriction() { + return this.restriction; + } + /** * API name: {@code transient_metadata} */ @@ -204,6 +243,26 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + if (ApiTypeHelper.isDefined(this.remoteIndices)) { + generator.writeKey("remote_indices"); + generator.writeStartArray(); + for (RemoteIndicesPrivileges item0 : this.remoteIndices) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.remoteCluster)) { + generator.writeKey("remote_cluster"); + generator.writeStartArray(); + for (RemoteClusterPrivileges item0 : this.remoteCluster) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + } if (ApiTypeHelper.isDefined(this.global)) { generator.writeKey("global"); @@ -250,6 +309,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("description"); generator.write(this.description); + } + if (this.restriction != null) { + generator.writeKey("restriction"); + this.restriction.serialize(generator, mapper); + } if (ApiTypeHelper.isDefined(this.transientMetadata)) { generator.writeKey("transient_metadata"); @@ -283,6 +347,12 @@ public static class Builder extends WithJsonObjectBuilderBase private List indices; + @Nullable + private List remoteIndices; + + @Nullable + private List remoteCluster; + @Nullable private List global; @@ -298,6 +368,9 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private String description; + @Nullable + private Restriction restriction; + @Nullable private Map transientMetadata; @@ -362,6 +435,81 @@ public final Builder indices(Function + * API name: {@code remote_indices} + *

+ * Adds all elements of list to remoteIndices. + */ + public final Builder remoteIndices(List list) { + this.remoteIndices = _listAddAll(this.remoteIndices, list); + return this; + } + + /** + * A list of indices permissions for remote clusters. + *

+ * API name: {@code remote_indices} + *

+ * Adds one or more values to remoteIndices. + */ + public final Builder remoteIndices(RemoteIndicesPrivileges value, RemoteIndicesPrivileges... values) { + this.remoteIndices = _listAdd(this.remoteIndices, value, values); + return this; + } + + /** + * A list of indices permissions for remote clusters. + *

+ * API name: {@code remote_indices} + *

+ * Adds a value to remoteIndices using a builder lambda. + */ + public final Builder remoteIndices( + Function> fn) { + return remoteIndices(fn.apply(new RemoteIndicesPrivileges.Builder()).build()); + } + + /** + * A list of cluster permissions for remote clusters. Note - this is limited a + * subset of the cluster permissions. + *

+ * API name: {@code remote_cluster} + *

+ * Adds all elements of list to remoteCluster. + */ + public final Builder remoteCluster(List list) { + this.remoteCluster = _listAddAll(this.remoteCluster, list); + return this; + } + + /** + * A list of cluster permissions for remote clusters. Note - this is limited a + * subset of the cluster permissions. + *

+ * API name: {@code remote_cluster} + *

+ * Adds one or more values to remoteCluster. + */ + public final Builder remoteCluster(RemoteClusterPrivileges value, RemoteClusterPrivileges... values) { + this.remoteCluster = _listAdd(this.remoteCluster, value, values); + return this; + } + + /** + * A list of cluster permissions for remote clusters. Note - this is limited a + * subset of the cluster permissions. + *

+ * API name: {@code remote_cluster} + *

+ * Adds a value to remoteCluster using a builder lambda. + */ + public final Builder remoteCluster( + Function> fn) { + return remoteCluster(fn.apply(new RemoteClusterPrivileges.Builder()).build()); + } + /** * An object defining global privileges. A global privilege is a form of cluster * privilege that is request-aware. Support for global privileges is currently @@ -499,6 +647,25 @@ public final Builder description(@Nullable String value) { return this; } + /** + * Restriction for when the role descriptor is allowed to be effective. + *

+ * API name: {@code restriction} + */ + public final Builder restriction(@Nullable Restriction value) { + this.restriction = value; + return this; + } + + /** + * Restriction for when the role descriptor is allowed to be effective. + *

+ * API name: {@code restriction} + */ + public final Builder restriction(Function> fn) { + return this.restriction(fn.apply(new Restriction.Builder()).build()); + } + /** * API name: {@code transient_metadata} *

@@ -551,12 +718,17 @@ protected static void setupRoleDescriptorReadDeserializer(ObjectDeserializer indices; + private final List remoteIndices; + + private final List remoteCluster; + private final Map metadata; private final List runAs; @@ -87,6 +94,8 @@ private Role(Builder builder) { this.cluster = ApiTypeHelper.unmodifiableRequired(builder.cluster, this, "cluster"); this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); + this.remoteIndices = ApiTypeHelper.unmodifiable(builder.remoteIndices); + this.remoteCluster = ApiTypeHelper.unmodifiable(builder.remoteCluster); this.metadata = ApiTypeHelper.unmodifiableRequired(builder.metadata, this, "metadata"); this.runAs = ApiTypeHelper.unmodifiableRequired(builder.runAs, this, "runAs"); this.transientMetadata = ApiTypeHelper.unmodifiable(builder.transientMetadata); @@ -114,6 +123,20 @@ public final List indices() { return this.indices; } + /** + * API name: {@code remote_indices} + */ + public final List remoteIndices() { + return this.remoteIndices; + } + + /** + * API name: {@code remote_cluster} + */ + public final List remoteCluster() { + return this.remoteCluster; + } + /** * Required - API name: {@code metadata} */ @@ -186,6 +209,26 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + if (ApiTypeHelper.isDefined(this.remoteIndices)) { + generator.writeKey("remote_indices"); + generator.writeStartArray(); + for (RemoteIndicesPrivileges item0 : this.remoteIndices) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.remoteCluster)) { + generator.writeKey("remote_cluster"); + generator.writeStartArray(); + for (RemoteClusterPrivileges item0 : this.remoteCluster) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + } if (ApiTypeHelper.isDefined(this.metadata)) { generator.writeKey("metadata"); @@ -292,6 +335,12 @@ public static class Builder extends WithJsonObjectBuilderBase implement private List indices; + @Nullable + private List remoteIndices; + + @Nullable + private List remoteCluster; + private Map metadata; private List runAs; @@ -356,6 +405,66 @@ public final Builder indices(Function + * Adds all elements of list to remoteIndices. + */ + public final Builder remoteIndices(List list) { + this.remoteIndices = _listAddAll(this.remoteIndices, list); + return this; + } + + /** + * API name: {@code remote_indices} + *

+ * Adds one or more values to remoteIndices. + */ + public final Builder remoteIndices(RemoteIndicesPrivileges value, RemoteIndicesPrivileges... values) { + this.remoteIndices = _listAdd(this.remoteIndices, value, values); + return this; + } + + /** + * API name: {@code remote_indices} + *

+ * Adds a value to remoteIndices using a builder lambda. + */ + public final Builder remoteIndices( + Function> fn) { + return remoteIndices(fn.apply(new RemoteIndicesPrivileges.Builder()).build()); + } + + /** + * API name: {@code remote_cluster} + *

+ * Adds all elements of list to remoteCluster. + */ + public final Builder remoteCluster(List list) { + this.remoteCluster = _listAddAll(this.remoteCluster, list); + return this; + } + + /** + * API name: {@code remote_cluster} + *

+ * Adds one or more values to remoteCluster. + */ + public final Builder remoteCluster(RemoteClusterPrivileges value, RemoteClusterPrivileges... values) { + this.remoteCluster = _listAdd(this.remoteCluster, value, values); + return this; + } + + /** + * API name: {@code remote_cluster} + *

+ * Adds a value to remoteCluster using a builder lambda. + */ + public final Builder remoteCluster( + Function> fn) { + return remoteCluster(fn.apply(new RemoteClusterPrivileges.Builder()).build()); + } + /** * Required - API name: {@code metadata} *

@@ -526,6 +635,10 @@ protected static void setupRoleDeserializer(ObjectDeserializer op) op.add(Builder::cluster, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "cluster"); op.add(Builder::indices, JsonpDeserializer.arrayDeserializer(IndicesPrivileges._DESERIALIZER), "indices"); + op.add(Builder::remoteIndices, JsonpDeserializer.arrayDeserializer(RemoteIndicesPrivileges._DESERIALIZER), + "remote_indices"); + op.add(Builder::remoteCluster, JsonpDeserializer.arrayDeserializer(RemoteClusterPrivileges._DESERIALIZER), + "remote_cluster"); op.add(Builder::metadata, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "metadata"); op.add(Builder::runAs, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "run_as"); op.add(Builder::transientMetadata, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER),