Skip to content

Commit c3b62c9

Browse files
authored
Fixing missing required property exception for cluster manager for 1.x servers (#851)
Signed-off-by: Vacha Shah <[email protected]>
1 parent 638d9b9 commit c3b62c9

File tree

1 file changed

+37
-6
lines changed

1 file changed

+37
-6
lines changed

java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterNodeCount.java

+37-6
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ public class ClusterNodeCount implements JsonpSerializable {
5555

5656
private final int ingest;
5757

58-
private final int clusterManager;
58+
@Deprecated
59+
private final Integer master;
60+
61+
private final Integer clusterManager;
5962

6063
private final int total;
6164

@@ -71,7 +74,8 @@ private ClusterNodeCount(Builder builder) {
7174
this.coordinatingOnly = ApiTypeHelper.requireNonNull(builder.coordinatingOnly, this, "coordinatingOnly");
7275
this.data = ApiTypeHelper.requireNonNull(builder.data, this, "data");
7376
this.ingest = ApiTypeHelper.requireNonNull(builder.ingest, this, "ingest");
74-
this.clusterManager = ApiTypeHelper.requireNonNull(builder.clusterManager, this, "clusterManager");
77+
this.master = builder.master;
78+
this.clusterManager = builder.clusterManager;
7579
this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total");
7680
this.remoteClusterClient = ApiTypeHelper.requireNonNull(builder.remoteClusterClient, this, "remoteClusterClient");
7781
this.search = builder.search;
@@ -103,7 +107,15 @@ public final int ingest() {
103107
}
104108

105109
/**
106-
* Required - API name: {@code clusterManager}
110+
* API name: {@code master}
111+
*/
112+
@Deprecated
113+
public final int master() {
114+
return this.master;
115+
}
116+
117+
/**
118+
* API name: {@code clusterManager}
107119
*/
108120
public final int clusterManager() {
109121
return this.clusterManager;
@@ -151,8 +163,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
151163
generator.writeKey("ingest");
152164
generator.write(this.ingest);
153165

154-
generator.writeKey("cluster_manager");
155-
generator.write(this.clusterManager);
166+
if (this.master != null) {
167+
generator.writeKey("master");
168+
generator.write(this.master);
169+
}
170+
171+
if (this.clusterManager != null) {
172+
generator.writeKey("cluster_manager");
173+
generator.write(this.clusterManager);
174+
}
156175

157176
generator.writeKey("total");
158177
generator.write(this.total);
@@ -180,6 +199,8 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder<C
180199

181200
private Integer ingest;
182201

202+
private Integer master;
203+
183204
private Integer clusterManager;
184205

185206
private Integer total;
@@ -213,7 +234,16 @@ public final Builder ingest(int value) {
213234
}
214235

215236
/**
216-
* Required - API name: {@code clusterManager}
237+
* API name: {@code master}
238+
*/
239+
@Deprecated
240+
public final Builder master(int value) {
241+
this.master = value;
242+
return this;
243+
}
244+
245+
/**
246+
* API name: {@code clusterManager}
217247
*/
218248
public final Builder clusterManager(int value) {
219249
this.clusterManager = value;
@@ -273,6 +303,7 @@ protected static void setupClusterNodeCountDeserializer(ObjectDeserializer<Clust
273303
op.add(Builder::coordinatingOnly, JsonpDeserializer.integerDeserializer(), "coordinating_only");
274304
op.add(Builder::data, JsonpDeserializer.integerDeserializer(), "data");
275305
op.add(Builder::ingest, JsonpDeserializer.integerDeserializer(), "ingest");
306+
op.add(Builder::master, JsonpDeserializer.integerDeserializer(), "master");
276307
op.add(Builder::clusterManager, JsonpDeserializer.integerDeserializer(), "cluster_manager");
277308
op.add(Builder::total, JsonpDeserializer.integerDeserializer(), "total");
278309
op.add(Builder::remoteClusterClient, JsonpDeserializer.integerDeserializer(), "remote_cluster_client");

0 commit comments

Comments
 (0)