Skip to content

Commit

Permalink
[Backport 2.x] Fixing cluster stats response for role types and addin…
Browse files Browse the repository at this point in the history
…g search role type (opensearch-project#849)

* Fixing cluster stats response for role types and adding search role type (opensearch-project#848)

* Fixing cluster stats response for role types and adding search role type

Signed-off-by: Vacha Shah <[email protected]>

* Add CHANGELOG

Signed-off-by: Vacha Shah <[email protected]>

---------

Signed-off-by: Vacha Shah <[email protected]>
(cherry picked from commit 638d9b9)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Fixing missing required property exception for cluster manager for 1.x servers

Signed-off-by: Vacha Shah <[email protected]>

---------

Signed-off-by: Vacha Shah <[email protected]>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Vacha Shah <[email protected]>
  • Loading branch information
3 people authored Feb 15, 2024
1 parent 71cf187 commit c32c230
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 216 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)

## [Unreleased 2.x]
### Added
- Add search role type for nodes in cluster stats ([#848](https://github.com/opensearch-project/opensearch-java/pull/848))

### Dependencies

Expand All @@ -13,6 +14,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
### Removed

### Fixed
- Fix ClusterStatsResponse field deserialization ([#848](https://github.com/opensearch-project/opensearch-java/pull/848))

### Security

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,17 @@ public class ClusterNodeCount implements JsonpSerializable {

private final int ingest;

private final int clusterManager;
@Deprecated
private final Integer master;

private final int total;

private final int votingOnly;

private final int dataCold;

@Nullable
private final Integer dataFrozen;

private final int dataContent;

private final int dataWarm;
private final Integer clusterManager;

private final int dataHot;

private final int ml;
private final int total;

private final int remoteClusterClient;

private final int transform;
@Nullable
private final Integer search;

// ---------------------------------------------------------------------------------------------

Expand All @@ -85,18 +74,11 @@ private ClusterNodeCount(Builder builder) {
this.coordinatingOnly = ApiTypeHelper.requireNonNull(builder.coordinatingOnly, this, "coordinatingOnly");
this.data = ApiTypeHelper.requireNonNull(builder.data, this, "data");
this.ingest = ApiTypeHelper.requireNonNull(builder.ingest, this, "ingest");
this.clusterManager = ApiTypeHelper.requireNonNull(builder.clusterManager, this, "clusterManager");
this.master = builder.master;
this.clusterManager = builder.clusterManager;
this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total");
this.votingOnly = ApiTypeHelper.requireNonNull(builder.votingOnly, this, "votingOnly");
this.dataCold = ApiTypeHelper.requireNonNull(builder.dataCold, this, "dataCold");
this.dataFrozen = builder.dataFrozen;
this.dataContent = ApiTypeHelper.requireNonNull(builder.dataContent, this, "dataContent");
this.dataWarm = ApiTypeHelper.requireNonNull(builder.dataWarm, this, "dataWarm");
this.dataHot = ApiTypeHelper.requireNonNull(builder.dataHot, this, "dataHot");
this.ml = ApiTypeHelper.requireNonNull(builder.ml, this, "ml");
this.remoteClusterClient = ApiTypeHelper.requireNonNull(builder.remoteClusterClient, this, "remoteClusterClient");
this.transform = ApiTypeHelper.requireNonNull(builder.transform, this, "transform");

this.search = builder.search;
}

public static ClusterNodeCount of(Function<Builder, ObjectBuilder<ClusterNodeCount>> fn) {
Expand Down Expand Up @@ -125,7 +107,15 @@ public final int ingest() {
}

/**
* Required - API name: {@code clusterManager}
* API name: {@code master}
*/
@Deprecated
public final int master() {
return this.master;
}

/**
* API name: {@code clusterManager}
*/
public final int clusterManager() {
return this.clusterManager;
Expand All @@ -138,56 +128,6 @@ public final int total() {
return this.total;
}

/**
* Required - API name: {@code voting_only}
*/
public final int votingOnly() {
return this.votingOnly;
}

/**
* Required - API name: {@code data_cold}
*/
public final int dataCold() {
return this.dataCold;
}

/**
* API name: {@code data_frozen}
*/
@Nullable
public final Integer dataFrozen() {
return this.dataFrozen;
}

/**
* Required - API name: {@code data_content}
*/
public final int dataContent() {
return this.dataContent;
}

/**
* Required - API name: {@code data_warm}
*/
public final int dataWarm() {
return this.dataWarm;
}

/**
* Required - API name: {@code data_hot}
*/
public final int dataHot() {
return this.dataHot;
}

/**
* Required - API name: {@code ml}
*/
public final int ml() {
return this.ml;
}

/**
* Required - API name: {@code remote_cluster_client}
*/
Expand All @@ -196,10 +136,11 @@ public final int remoteClusterClient() {
}

/**
* Required - API name: {@code transform}
* API name: {@code search}
*/
public final int transform() {
return this.transform;
@Nullable
public final Integer search() {
return this.search;
}

/**
Expand All @@ -222,40 +163,26 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("ingest");
generator.write(this.ingest);

generator.writeKey("cluster_manager");
generator.write(this.clusterManager);

generator.writeKey("total");
generator.write(this.total);

generator.writeKey("voting_only");
generator.write(this.votingOnly);

generator.writeKey("data_cold");
generator.write(this.dataCold);

if (this.dataFrozen != null) {
generator.writeKey("data_frozen");
generator.write(this.dataFrozen);

if (this.master != null) {
generator.writeKey("master");
generator.write(this.master);
}
generator.writeKey("data_content");
generator.write(this.dataContent);

generator.writeKey("data_warm");
generator.write(this.dataWarm);

generator.writeKey("data_hot");
generator.write(this.dataHot);
if (this.clusterManager != null) {
generator.writeKey("cluster_manager");
generator.write(this.clusterManager);
}

generator.writeKey("ml");
generator.write(this.ml);
generator.writeKey("total");
generator.write(this.total);

generator.writeKey("remote_cluster_client");
generator.write(this.remoteClusterClient);

generator.writeKey("transform");
generator.write(this.transform);
if (this.search != null) {
generator.writeKey("search");
generator.write(this.search);
}

}

Expand All @@ -272,28 +199,15 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder<C

private Integer ingest;

private Integer master;

private Integer clusterManager;

private Integer total;

private Integer votingOnly;

private Integer dataCold;

@Nullable
private Integer dataFrozen;

private Integer dataContent;

private Integer dataWarm;

private Integer dataHot;

private Integer ml;

private Integer remoteClusterClient;

private Integer transform;
private Integer search;

/**
* Required - API name: {@code coordinating_only}
Expand All @@ -320,74 +234,27 @@ public final Builder ingest(int value) {
}

/**
* Required - API name: {@code clusterManager}
*/
public final Builder clusterManager(int value) {
this.clusterManager = value;
return this;
}

/**
* Required - API name: {@code total}
*/
public final Builder total(int value) {
this.total = value;
return this;
}

/**
* Required - API name: {@code voting_only}
* API name: {@code master}
*/
public final Builder votingOnly(int value) {
this.votingOnly = value;
@Deprecated
public final Builder master(int value) {
this.master = value;
return this;
}

/**
* Required - API name: {@code data_cold}
* API name: {@code clusterManager}
*/
public final Builder dataCold(int value) {
this.dataCold = value;
return this;
}

/**
* API name: {@code data_frozen}
*/
public final Builder dataFrozen(@Nullable Integer value) {
this.dataFrozen = value;
return this;
}

/**
* Required - API name: {@code data_content}
*/
public final Builder dataContent(int value) {
this.dataContent = value;
return this;
}

/**
* Required - API name: {@code data_warm}
*/
public final Builder dataWarm(int value) {
this.dataWarm = value;
return this;
}

/**
* Required - API name: {@code data_hot}
*/
public final Builder dataHot(int value) {
this.dataHot = value;
public final Builder clusterManager(int value) {
this.clusterManager = value;
return this;
}

/**
* Required - API name: {@code ml}
* Required - API name: {@code total}
*/
public final Builder ml(int value) {
this.ml = value;
public final Builder total(int value) {
this.total = value;
return this;
}

Expand All @@ -400,10 +267,11 @@ public final Builder remoteClusterClient(int value) {
}

/**
* Required - API name: {@code transform}
* API name: {@code search}
*/
public final Builder transform(int value) {
this.transform = value;
@Nullable
public final Builder search(int value) {
this.search = value;
return this;
}

Expand Down Expand Up @@ -435,17 +303,11 @@ protected static void setupClusterNodeCountDeserializer(ObjectDeserializer<Clust
op.add(Builder::coordinatingOnly, JsonpDeserializer.integerDeserializer(), "coordinating_only");
op.add(Builder::data, JsonpDeserializer.integerDeserializer(), "data");
op.add(Builder::ingest, JsonpDeserializer.integerDeserializer(), "ingest");
op.add(Builder::master, JsonpDeserializer.integerDeserializer(), "master");
op.add(Builder::clusterManager, JsonpDeserializer.integerDeserializer(), "cluster_manager");
op.add(Builder::total, JsonpDeserializer.integerDeserializer(), "total");
op.add(Builder::votingOnly, JsonpDeserializer.integerDeserializer(), "voting_only");
op.add(Builder::dataCold, JsonpDeserializer.integerDeserializer(), "data_cold");
op.add(Builder::dataFrozen, JsonpDeserializer.integerDeserializer(), "data_frozen");
op.add(Builder::dataContent, JsonpDeserializer.integerDeserializer(), "data_content");
op.add(Builder::dataWarm, JsonpDeserializer.integerDeserializer(), "data_warm");
op.add(Builder::dataHot, JsonpDeserializer.integerDeserializer(), "data_hot");
op.add(Builder::ml, JsonpDeserializer.integerDeserializer(), "ml");
op.add(Builder::remoteClusterClient, JsonpDeserializer.integerDeserializer(), "remote_cluster_client");
op.add(Builder::transform, JsonpDeserializer.integerDeserializer(), "transform");
op.add(Builder::search, JsonpDeserializer.integerDeserializer(), "search");

}

Expand Down
Loading

0 comments on commit c32c230

Please sign in to comment.