Skip to content

Commit a7b3051

Browse files
committed
[codegen] update to latest spec and generator
1 parent f9493d2 commit a7b3051

File tree

16 files changed

+258
-16
lines changed

16 files changed

+258
-16
lines changed

java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ShardFailure.java

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import co.elastic.clients.util.ObjectBuilder;
3131
import co.elastic.clients.util.WithJsonObjectBuilderBase;
3232
import jakarta.json.stream.JsonGenerator;
33+
import java.lang.Boolean;
3334
import java.lang.Integer;
3435
import java.lang.String;
3536
import java.util.Objects;
@@ -68,20 +69,25 @@ public class ShardFailure implements JsonpSerializable {
6869

6970
private final ErrorCause reason;
7071

71-
private final int shard;
72+
@Nullable
73+
private final Integer shard;
7274

7375
@Nullable
7476
private final String status;
7577

78+
@Nullable
79+
private final Boolean primary;
80+
7681
// ---------------------------------------------------------------------------------------------
7782

7883
private ShardFailure(Builder builder) {
7984

8085
this.index = builder.index;
8186
this.node = builder.node;
8287
this.reason = ApiTypeHelper.requireNonNull(builder.reason, this, "reason");
83-
this.shard = ApiTypeHelper.requireNonNull(builder.shard, this, "shard", 0);
88+
this.shard = builder.shard;
8489
this.status = builder.status;
90+
this.primary = builder.primary;
8591

8692
}
8793

@@ -113,9 +119,10 @@ public final ErrorCause reason() {
113119
}
114120

115121
/**
116-
* Required - API name: {@code shard}
122+
* API name: {@code shard}
117123
*/
118-
public final int shard() {
124+
@Nullable
125+
public final Integer shard() {
119126
return this.shard;
120127
}
121128

@@ -127,6 +134,14 @@ public final String status() {
127134
return this.status;
128135
}
129136

137+
/**
138+
* API name: {@code primary}
139+
*/
140+
@Nullable
141+
public final Boolean primary() {
142+
return this.primary;
143+
}
144+
130145
/**
131146
* Serialize this object to JSON.
132147
*/
@@ -151,14 +166,21 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
151166
generator.writeKey("reason");
152167
this.reason.serialize(generator, mapper);
153168

154-
generator.writeKey("shard");
155-
generator.write(this.shard);
169+
if (this.shard != null) {
170+
generator.writeKey("shard");
171+
generator.write(this.shard);
156172

173+
}
157174
if (this.status != null) {
158175
generator.writeKey("status");
159176
generator.write(this.status);
160177

161178
}
179+
if (this.primary != null) {
180+
generator.writeKey("primary");
181+
generator.write(this.primary);
182+
183+
}
162184

163185
}
164186

@@ -182,11 +204,15 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder> implement
182204

183205
private ErrorCause reason;
184206

207+
@Nullable
185208
private Integer shard;
186209

187210
@Nullable
188211
private String status;
189212

213+
@Nullable
214+
private Boolean primary;
215+
190216
/**
191217
* API name: {@code index}
192218
*/
@@ -219,9 +245,9 @@ public final Builder reason(Function<ErrorCause.Builder, ObjectBuilder<ErrorCaus
219245
}
220246

221247
/**
222-
* Required - API name: {@code shard}
248+
* API name: {@code shard}
223249
*/
224-
public final Builder shard(int value) {
250+
public final Builder shard(@Nullable Integer value) {
225251
this.shard = value;
226252
return this;
227253
}
@@ -234,6 +260,14 @@ public final Builder status(@Nullable String value) {
234260
return this;
235261
}
236262

263+
/**
264+
* API name: {@code primary}
265+
*/
266+
public final Builder primary(@Nullable Boolean value) {
267+
this.primary = value;
268+
return this;
269+
}
270+
237271
@Override
238272
protected Builder self() {
239273
return this;
@@ -262,11 +296,12 @@ public ShardFailure build() {
262296

263297
protected static void setupShardFailureDeserializer(ObjectDeserializer<ShardFailure.Builder> op) {
264298

265-
op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index");
266-
op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node");
299+
op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index", "_index");
300+
op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node", "_node");
267301
op.add(Builder::reason, ErrorCause._DESERIALIZER, "reason");
268-
op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard");
302+
op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard", "_shard");
269303
op.add(Builder::status, JsonpDeserializer.stringDeserializer(), "status");
304+
op.add(Builder::primary, JsonpDeserializer.booleanDeserializer(), "primary");
270305

271306
}
272307

java-client/src/main/java/co/elastic/clients/elasticsearch/_types/aggregations/BucketsPath.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import java.util.Map;
3939
import java.util.Objects;
4040
import java.util.function.Function;
41+
import java.util.stream.Collectors;
4142
import javax.annotation.Nullable;
4243

4344
//----------------------------------------------------------------
@@ -92,6 +93,21 @@ private BucketsPath(Kind kind, Object value) {
9293
this._value = value;
9394
}
9495

96+
public String _toJsonString() {
97+
switch (_kind) {
98+
case Array :
99+
return this.array().stream().map(v -> v).collect(Collectors.joining(","));
100+
case Dict :
101+
return this.dict().entrySet().stream().map(e -> e.getKey() + ":" + e.getValue())
102+
.collect(Collectors.joining(","));
103+
case Single :
104+
return this.single();
105+
106+
default :
107+
throw new IllegalStateException("Unknown kind " + _kind);
108+
}
109+
}
110+
95111
private BucketsPath(Builder builder) {
96112

97113
this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, "<variant kind>");

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@
259259
'_global.update_by_query_rethrottle.UpdateByQueryRethrottleNode': '_global/update_by_query_rethrottle/UpdateByQueryRethrottleNode.ts#L25-L27',
260260
'_spec_utils.BaseNode': '_spec_utils/BaseNode.ts#L25-L32',
261261
'_types.AcknowledgedResponseBase': '_types/Base.ts#L69-L72',
262-
'_types.BulkIndexByScrollFailure': '_types/Errors.ts#L60-L65',
262+
'_types.BulkIndexByScrollFailure': '_types/Errors.ts#L64-L69',
263263
'_types.BulkStats': '_types/Stats.ts#L71-L81',
264264
'_types.Bytes': '_types/common.ts#L173-L185',
265265
'_types.ClusterDetails': '_types/Stats.ts#L45-L52',
@@ -345,7 +345,7 @@
345345
'_types.SearchTransform': '_types/Transform.ts#L46-L49',
346346
'_types.SearchType': '_types/common.ts#L279-L284',
347347
'_types.SegmentsStats': '_types/Stats.ts#L276-L369',
348-
'_types.ShardFailure': '_types/Errors.ts#L52-L58',
348+
'_types.ShardFailure': '_types/Errors.ts#L52-L62',
349349
'_types.ShardStatistics': '_types/Stats.ts#L54-L69',
350350
'_types.ShardsOperationResponseBase': '_types/Base.ts#L142-L145',
351351
'_types.SlicedScroll': '_types/SlicedScroll.ts#L23-L27',
@@ -358,7 +358,7 @@
358358
'_types.StoreStats': '_types/Stats.ts#L371-L398',
359359
'_types.StoredScript': '_types/Scripting.ts#L47-L59',
360360
'_types.SuggestMode': '_types/common.ts#L286-L299',
361-
'_types.TaskFailure': '_types/Errors.ts#L67-L72',
361+
'_types.TaskFailure': '_types/Errors.ts#L71-L76',
362362
'_types.TextEmbedding': '_types/Knn.ts#L79-L82',
363363
'_types.TextSimilarityReranker': '_types/Retriever.ts#L88-L99',
364364
'_types.ThreadType': '_types/common.ts#L301-L307',
@@ -3050,10 +3050,10 @@
30503050
if (hash.length > 1) {
30513051
hash = hash.substring(1);
30523052
}
3053-
window.location = "https://github.com/elastic/elasticsearch-specification/tree/ae36ad64e10fe521fa5632accac9b49dc89b984a/specification/" + (paths[hash] || "");
3053+
window.location = "https://github.com/elastic/elasticsearch-specification/tree/ec0753ff05b2d4d16b7976cba9ad3665ca93c618/specification/" + (paths[hash] || "");
30543054
</script>
30553055
</head>
30563056
<body>
3057-
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/ae36ad64e10fe521fa5632accac9b49dc89b984a/specification/">Elasticsearch API specification</a>.
3057+
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/ec0753ff05b2d4d16b7976cba9ad3665ca93c618/specification/">Elasticsearch API specification</a>.
30583058
</body>
30593059
</html>

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import co.elastic.clients.util.WithJsonObjectBuilderBase;
3232
import jakarta.json.stream.JsonGenerator;
3333
import java.lang.String;
34+
import java.util.Arrays;
3435
import java.util.List;
3536
import java.util.Objects;
3637
import java.util.function.Function;
@@ -200,6 +201,20 @@ public final Builder cluster(String value, String... values) {
200201
return this;
201202
}
202203

204+
/**
205+
* Required - The list of cluster privileges that are understood by this version
206+
* of Elasticsearch.
207+
* <p>
208+
* API name: {@code cluster}
209+
* <p>
210+
* Adds one or more enum values to <code>cluster</code>.
211+
*/
212+
public final Builder cluster(ClusterPrivilege value, ClusterPrivilege... values) {
213+
this.cluster = _listAdd(this.cluster, value.jsonValue(),
214+
Arrays.stream(values).map(ClusterPrivilege::jsonValue).toArray(String[]::new));
215+
return this;
216+
}
217+
203218
/**
204219
* Required - The list of index privileges that are understood by this version
205220
* of Elasticsearch.

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import co.elastic.clients.util.ObjectBuilder;
3636
import jakarta.json.stream.JsonGenerator;
3737
import java.lang.String;
38+
import java.util.Arrays;
3839
import java.util.Collections;
3940
import java.util.HashMap;
4041
import java.util.List;
@@ -248,6 +249,19 @@ public final Builder cluster(String value, String... values) {
248249
return this;
249250
}
250251

252+
/**
253+
* A list of the cluster privileges that you want to check.
254+
* <p>
255+
* API name: {@code cluster}
256+
* <p>
257+
* Adds one or more enum values to <code>cluster</code>.
258+
*/
259+
public final Builder cluster(ClusterPrivilege value, ClusterPrivilege... values) {
260+
this.cluster = _listAdd(this.cluster, value.jsonValue(),
261+
Arrays.stream(values).map(ClusterPrivilege::jsonValue).toArray(String[]::new));
262+
return this;
263+
}
264+
251265
/**
252266
* API name: {@code index}
253267
* <p>

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import jakarta.json.stream.JsonGenerator;
3535
import java.lang.Boolean;
3636
import java.lang.String;
37+
import java.util.Arrays;
3738
import java.util.List;
3839
import java.util.Objects;
3940
import java.util.function.Function;
@@ -297,6 +298,20 @@ public final Builder privileges(String value, String... values) {
297298
return this;
298299
}
299300

301+
/**
302+
* Required - The index level privileges that owners of the role have on the
303+
* specified indices.
304+
* <p>
305+
* API name: {@code privileges}
306+
* <p>
307+
* Adds one or more enum values to <code>privileges</code>.
308+
*/
309+
public final Builder privileges(IndexPrivilege value, IndexPrivilege... values) {
310+
this.privileges = _listAdd(this.privileges, value.jsonValue(),
311+
Arrays.stream(values).map(IndexPrivilege::jsonValue).toArray(String[]::new));
312+
return this;
313+
}
314+
300315
/**
301316
* A search query that defines the documents the owners of the role have access
302317
* to. A document within the specified indices must match this query for it to

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import co.elastic.clients.util.ObjectBuilder;
3636
import jakarta.json.stream.JsonGenerator;
3737
import java.lang.String;
38+
import java.util.Arrays;
3839
import java.util.HashMap;
3940
import java.util.List;
4041
import java.util.Map;
@@ -466,6 +467,20 @@ public final Builder cluster(String value, String... values) {
466467
return this;
467468
}
468469

470+
/**
471+
* A list of cluster privileges. These privileges define the cluster-level
472+
* actions for users with this role.
473+
* <p>
474+
* API name: {@code cluster}
475+
* <p>
476+
* Adds one or more enum values to <code>cluster</code>.
477+
*/
478+
public final Builder cluster(ClusterPrivilege value, ClusterPrivilege... values) {
479+
this.cluster = _listAdd(this.cluster, value.jsonValue(),
480+
Arrays.stream(values).map(ClusterPrivilege::jsonValue).toArray(String[]::new));
481+
return this;
482+
}
483+
469484
/**
470485
* Optional description of the role descriptor
471486
* <p>

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import jakarta.json.stream.JsonGenerator;
3333
import java.lang.Boolean;
3434
import java.lang.String;
35+
import java.util.Arrays;
3536
import java.util.List;
3637
import java.util.Objects;
3738
import java.util.function.Function;
@@ -347,6 +348,20 @@ public final Builder privileges(String value, String... values) {
347348
return this;
348349
}
349350

351+
/**
352+
* Required - The index level privileges that owners of the role have on the
353+
* specified indices.
354+
* <p>
355+
* API name: {@code privileges}
356+
* <p>
357+
* Adds one or more enum values to <code>privileges</code>.
358+
*/
359+
public final Builder privileges(IndexPrivilege value, IndexPrivilege... values) {
360+
this.privileges = _listAdd(this.privileges, value.jsonValue(),
361+
Arrays.stream(values).map(IndexPrivilege::jsonValue).toArray(String[]::new));
362+
return this;
363+
}
364+
350365
/**
351366
* A search query that defines the documents the owners of the role have access
352367
* to. A document within the specified indices must match this query for it to

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import jakarta.json.stream.JsonGenerator;
3333
import java.lang.Boolean;
3434
import java.lang.String;
35+
import java.util.Arrays;
3536
import java.util.List;
3637
import java.util.Objects;
3738
import java.util.function.Function;
@@ -335,6 +336,20 @@ public final Builder privileges(String value, String... values) {
335336
return this;
336337
}
337338

339+
/**
340+
* Required - The index level privileges that owners of the role have on the
341+
* specified indices.
342+
* <p>
343+
* API name: {@code privileges}
344+
* <p>
345+
* Adds one or more enum values to <code>privileges</code>.
346+
*/
347+
public final Builder privileges(IndexPrivilege value, IndexPrivilege... values) {
348+
this.privileges = _listAdd(this.privileges, value.jsonValue(),
349+
Arrays.stream(values).map(IndexPrivilege::jsonValue).toArray(String[]::new));
350+
return this;
351+
}
352+
338353
/**
339354
* Search queries that define the documents the user has access to. A document
340355
* within the specified indices must match these queries for it to be accessible

0 commit comments

Comments
 (0)