Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8b7607c

Browse files
committed
[codegen] update to latest spec and generator
1 parent 3d3856b commit 8b7607c

37 files changed

+1491
-47
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/cat/AliasesRequest.java

Lines changed: 21 additions & 3 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.HashMap;
3637
import java.util.List;
3738
import java.util.Map;
@@ -112,7 +113,8 @@ public final List<ExpandWildcard> expandWildcards() {
112113
}
113114

114115
/**
115-
* List of columns to appear in the response. Supports simple wildcards.
116+
* A comma-separated list of columns names to display. It supports simple
117+
* wildcards.
116118
* <p>
117119
* API name: {@code h}
118120
*/
@@ -211,7 +213,8 @@ public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... val
211213
}
212214

213215
/**
214-
* List of columns to appear in the response. Supports simple wildcards.
216+
* A comma-separated list of columns names to display. It supports simple
217+
* wildcards.
215218
* <p>
216219
* API name: {@code h}
217220
* <p>
@@ -223,7 +226,8 @@ public final Builder h(List<String> list) {
223226
}
224227

225228
/**
226-
* List of columns to appear in the response. Supports simple wildcards.
229+
* A comma-separated list of columns names to display. It supports simple
230+
* wildcards.
227231
* <p>
228232
* API name: {@code h}
229233
* <p>
@@ -234,6 +238,20 @@ public final Builder h(String value, String... values) {
234238
return this;
235239
}
236240

241+
/**
242+
* A comma-separated list of columns names to display. It supports simple
243+
* wildcards.
244+
* <p>
245+
* API name: {@code h}
246+
* <p>
247+
* Adds one or more enum values to <code>h</code>.
248+
*/
249+
public final Builder h(CatAliasesColumn value, CatAliasesColumn... values) {
250+
this.h = _listAdd(this.h, value.jsonValue(),
251+
Arrays.stream(values).map(CatAliasesColumn::jsonValue).toArray(String[]::new));
252+
return this;
253+
}
254+
237255
/**
238256
* If <code>true</code>, the request computes the list of selected nodes from
239257
* the local cluster state. If <code>false</code> the list of selected nodes are

java-client/src/main/java/co/elastic/clients/elasticsearch/cat/AllocationRequest.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import jakarta.json.stream.JsonGenerator;
3434
import java.lang.Boolean;
3535
import java.lang.String;
36+
import java.util.Arrays;
3637
import java.util.HashMap;
3738
import java.util.List;
3839
import java.util.Map;
@@ -115,7 +116,8 @@ public final Bytes bytes() {
115116
}
116117

117118
/**
118-
* List of columns to appear in the response. Supports simple wildcards.
119+
* A comma-separated list of columns names to display. It supports simple
120+
* wildcards.
119121
* <p>
120122
* API name: {@code h}
121123
*/
@@ -206,7 +208,8 @@ public final Builder bytes(@Nullable Bytes value) {
206208
}
207209

208210
/**
209-
* List of columns to appear in the response. Supports simple wildcards.
211+
* A comma-separated list of columns names to display. It supports simple
212+
* wildcards.
210213
* <p>
211214
* API name: {@code h}
212215
* <p>
@@ -218,7 +221,8 @@ public final Builder h(List<String> list) {
218221
}
219222

220223
/**
221-
* List of columns to appear in the response. Supports simple wildcards.
224+
* A comma-separated list of columns names to display. It supports simple
225+
* wildcards.
222226
* <p>
223227
* API name: {@code h}
224228
* <p>
@@ -229,6 +233,20 @@ public final Builder h(String value, String... values) {
229233
return this;
230234
}
231235

236+
/**
237+
* A comma-separated list of columns names to display. It supports simple
238+
* wildcards.
239+
* <p>
240+
* API name: {@code h}
241+
* <p>
242+
* Adds one or more enum values to <code>h</code>.
243+
*/
244+
public final Builder h(CatAllocationColumn value, CatAllocationColumn... values) {
245+
this.h = _listAdd(this.h, value.jsonValue(),
246+
Arrays.stream(values).map(CatAllocationColumn::jsonValue).toArray(String[]::new));
247+
return this;
248+
}
249+
232250
/**
233251
* If <code>true</code>, the request computes the list of selected nodes from
234252
* the local cluster state. If <code>false</code> the list of selected nodes are
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package co.elastic.clients.elasticsearch.cat;
21+
22+
import co.elastic.clients.json.JsonEnum;
23+
import co.elastic.clients.json.JsonpDeserializable;
24+
import co.elastic.clients.json.JsonpDeserializer;
25+
26+
//----------------------------------------------------------------
27+
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
28+
//----------------------------------------------------------------
29+
//
30+
// This code is generated from the Elasticsearch API specification
31+
// at https://github.com/elastic/elasticsearch-specification
32+
//
33+
// Manual updates to this file will be lost when the code is
34+
// re-generated.
35+
//
36+
// If you find a property that is missing or wrongly typed, please
37+
// open an issue or a PR on the API specification repository.
38+
//
39+
//----------------------------------------------------------------
40+
41+
/**
42+
*
43+
* @see <a href="../doc-files/api-spec.html#cat._types.CatAliasesColumn">API
44+
* specification</a>
45+
*/
46+
@JsonpDeserializable
47+
public enum CatAliasesColumn implements JsonEnum {
48+
/**
49+
* The name of the alias.
50+
*/
51+
Alias("alias", "a"),
52+
53+
/**
54+
* The name of the index the alias points to.
55+
*/
56+
Index("index", "i", "idx"),
57+
58+
/**
59+
* The filter applied to the alias.
60+
*/
61+
Filter("filter", "f", "fi"),
62+
63+
/**
64+
* Index routing value for the alias.
65+
*/
66+
RoutingIndex("routing.index", "ri", "routingIndex"),
67+
68+
/**
69+
* Search routing value for the alias.
70+
*/
71+
RoutingSearch("routing.search", "rs", "routingSearch"),
72+
73+
/**
74+
* Indicates if the index is the write index for the alias.
75+
*/
76+
IsWriteIndex("is_write_index", "w", "isWriteIndex"),
77+
78+
;
79+
80+
private final String jsonValue;
81+
private final String[] aliases;
82+
83+
CatAliasesColumn(String jsonValue, String... aliases) {
84+
this.jsonValue = jsonValue;
85+
this.aliases = aliases;
86+
}
87+
88+
public String jsonValue() {
89+
return this.jsonValue;
90+
}
91+
92+
public String[] aliases() {
93+
return this.aliases;
94+
}
95+
96+
public static final JsonEnum.Deserializer<CatAliasesColumn> _DESERIALIZER = new JsonEnum.Deserializer<>(
97+
CatAliasesColumn.values());
98+
}

0 commit comments

Comments
 (0)