Skip to content

Commit 7778655

Browse files
committed
field_security fix
1 parent 2f1e501 commit 7778655

File tree

2 files changed

+14
-34
lines changed

2 files changed

+14
-34
lines changed

java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2351,10 +2351,10 @@
23512351
if (hash.length > 1) {
23522352
hash = hash.substring(1);
23532353
}
2354-
window.location = "https://github.com/elastic/elasticsearch-specification/tree/b60d8e6f23d4ac1f435c642ae78cd8133f950f58/specification/" + (paths[hash] || "");
2354+
window.location = "https://github.com/elastic/elasticsearch-specification/tree/02a7acb1326e163af376a0d154b01dfcdbe94ac7/specification/" + (paths[hash] || "");
23552355
</script>
23562356
</head>
23572357
<body>
2358-
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/b60d8e6f23d4ac1f435c642ae78cd8133f950f58/specification/">Elasticsearch API specification</a>.
2358+
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/02a7acb1326e163af376a0d154b01dfcdbe94ac7/specification/">Elasticsearch API specification</a>.
23592359
</body>
23602360
</html>

java-client/src/main/java/co/elastic/clients/elasticsearch/security/IndicesPrivileges.java

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@
6363
*/
6464
@JsonpDeserializable
6565
public class IndicesPrivileges implements JsonpSerializable {
66-
private final List<FieldSecurity> fieldSecurity;
66+
@Nullable
67+
private final FieldSecurity fieldSecurity;
6768

6869
private final List<String> names;
6970

@@ -79,7 +80,7 @@ public class IndicesPrivileges implements JsonpSerializable {
7980

8081
private IndicesPrivileges(Builder builder) {
8182

82-
this.fieldSecurity = ApiTypeHelper.unmodifiable(builder.fieldSecurity);
83+
this.fieldSecurity = builder.fieldSecurity;
8384
this.names = ApiTypeHelper.unmodifiableRequired(builder.names, this, "names");
8485
this.privileges = ApiTypeHelper.unmodifiableRequired(builder.privileges, this, "privileges");
8586
this.query = builder.query;
@@ -96,7 +97,8 @@ public static IndicesPrivileges of(Function<Builder, ObjectBuilder<IndicesPrivil
9697
* <p>
9798
* API name: {@code field_security}
9899
*/
99-
public final List<FieldSecurity> fieldSecurity() {
100+
@Nullable
101+
public final FieldSecurity fieldSecurity() {
100102
return this.fieldSecurity;
101103
}
102104

@@ -160,14 +162,9 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
160162

161163
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
162164

163-
if (ApiTypeHelper.isDefined(this.fieldSecurity)) {
165+
if (this.fieldSecurity != null) {
164166
generator.writeKey("field_security");
165-
generator.writeStartArray();
166-
for (FieldSecurity item0 : this.fieldSecurity) {
167-
item0.serialize(generator, mapper);
168-
169-
}
170-
generator.writeEnd();
167+
this.fieldSecurity.serialize(generator, mapper);
171168

172169
}
173170
if (ApiTypeHelper.isDefined(this.names)) {
@@ -216,7 +213,7 @@ public String toString() {
216213

217214
public static class Builder extends WithJsonObjectBuilderBase<Builder> implements ObjectBuilder<IndicesPrivileges> {
218215
@Nullable
219-
private List<FieldSecurity> fieldSecurity;
216+
private FieldSecurity fieldSecurity;
220217

221218
private List<String> names;
222219

@@ -232,35 +229,19 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder> implement
232229
* The document fields that the owners of the role have read access to.
233230
* <p>
234231
* API name: {@code field_security}
235-
* <p>
236-
* Adds all elements of <code>list</code> to <code>fieldSecurity</code>.
237232
*/
238-
public final Builder fieldSecurity(List<FieldSecurity> list) {
239-
this.fieldSecurity = _listAddAll(this.fieldSecurity, list);
233+
public final Builder fieldSecurity(@Nullable FieldSecurity value) {
234+
this.fieldSecurity = value;
240235
return this;
241236
}
242237

243238
/**
244239
* The document fields that the owners of the role have read access to.
245240
* <p>
246241
* API name: {@code field_security}
247-
* <p>
248-
* Adds one or more values to <code>fieldSecurity</code>.
249-
*/
250-
public final Builder fieldSecurity(FieldSecurity value, FieldSecurity... values) {
251-
this.fieldSecurity = _listAdd(this.fieldSecurity, value, values);
252-
return this;
253-
}
254-
255-
/**
256-
* The document fields that the owners of the role have read access to.
257-
* <p>
258-
* API name: {@code field_security}
259-
* <p>
260-
* Adds a value to <code>fieldSecurity</code> using a builder lambda.
261242
*/
262243
public final Builder fieldSecurity(Function<FieldSecurity.Builder, ObjectBuilder<FieldSecurity>> fn) {
263-
return fieldSecurity(fn.apply(new FieldSecurity.Builder()).build());
244+
return this.fieldSecurity(fn.apply(new FieldSecurity.Builder()).build());
264245
}
265246

266247
/**
@@ -385,8 +366,7 @@ public IndicesPrivileges build() {
385366

386367
protected static void setupIndicesPrivilegesDeserializer(ObjectDeserializer<IndicesPrivileges.Builder> op) {
387368

388-
op.add(Builder::fieldSecurity, JsonpDeserializer.arrayDeserializer(FieldSecurity._DESERIALIZER),
389-
"field_security");
369+
op.add(Builder::fieldSecurity, FieldSecurity._DESERIALIZER, "field_security");
390370
op.add(Builder::names, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "names");
391371
op.add(Builder::privileges, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()),
392372
"privileges");

0 commit comments

Comments
 (0)