Skip to content

Commit

Permalink
Extra node info fields
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Farr <tsfarr@amazon.com>
  • Loading branch information
Xtansia committed Jan 3, 2025
1 parent 30dd4f7 commit b9e9e58
Show file tree
Hide file tree
Showing 6 changed files with 821 additions and 297 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ public class NodeJvmInfo implements PlainJsonSerializable, ToCopyableBuilder<Nod

private final int pid;

@Nullable
private final String startTime;

private final long startTimeInMillis;

@Nullable
Expand Down Expand Up @@ -106,6 +109,7 @@ private NodeJvmInfo(Builder builder) {
this.mem = ApiTypeHelper.requireNonNull(builder.mem, this, "mem");
this.memoryPools = ApiTypeHelper.unmodifiable(builder.memoryPools);
this.pid = ApiTypeHelper.requireNonNull(builder.pid, this, "pid");
this.startTime = builder.startTime;
this.startTimeInMillis = ApiTypeHelper.requireNonNull(builder.startTimeInMillis, this, "startTimeInMillis");
this.usingBundledJdk = builder.usingBundledJdk;
this.usingCompressedOrdinaryObjectPointers = builder.usingCompressedOrdinaryObjectPointers;
Expand Down Expand Up @@ -165,6 +169,14 @@ public final int pid() {
return this.pid;
}

/**
* API name: {@code start_time}
*/
@Nullable
public final String startTime() {
return this.startTime;
}

/**
* Required - API name: {@code start_time_in_millis}
*/
Expand Down Expand Up @@ -267,6 +279,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("pid");
generator.write(this.pid);

if (this.startTime != null) {
generator.writeKey("start_time");
generator.write(this.startTime);
}

generator.writeKey("start_time_in_millis");
generator.write(this.startTimeInMillis);

Expand Down Expand Up @@ -327,6 +344,8 @@ public static class Builder extends ObjectBuilderBase implements CopyableBuilder
@Nullable
private List<String> memoryPools;
private Integer pid;
@Nullable
private String startTime;
private Long startTimeInMillis;
@Nullable
private Boolean usingBundledJdk;
Expand All @@ -350,6 +369,7 @@ private Builder(NodeJvmInfo o) {
this.mem = o.mem;
this.memoryPools = _listCopy(o.memoryPools);
this.pid = o.pid;
this.startTime = o.startTime;
this.startTimeInMillis = o.startTimeInMillis;
this.usingBundledJdk = o.usingBundledJdk;
this.usingCompressedOrdinaryObjectPointers = o.usingCompressedOrdinaryObjectPointers;
Expand All @@ -366,6 +386,7 @@ private Builder(Builder o) {
this.mem = o.mem;
this.memoryPools = _listCopy(o.memoryPools);
this.pid = o.pid;
this.startTime = o.startTime;
this.startTimeInMillis = o.startTimeInMillis;
this.usingBundledJdk = o.usingBundledJdk;
this.usingCompressedOrdinaryObjectPointers = o.usingCompressedOrdinaryObjectPointers;
Expand Down Expand Up @@ -494,6 +515,15 @@ public final Builder pid(int value) {
return this;
}

/**
* API name: {@code start_time}
*/
@Nonnull
public final Builder startTime(@Nullable String value) {
this.startTime = value;
return this;
}

/**
* Required - API name: {@code start_time_in_millis}
*/
Expand Down Expand Up @@ -588,6 +618,7 @@ protected static void setupNodeJvmInfoDeserializer(ObjectDeserializer<NodeJvmInf
op.add(Builder::mem, NodeInfoJvmMemory._DESERIALIZER, "mem");
op.add(Builder::memoryPools, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "memory_pools");
op.add(Builder::pid, JsonpDeserializer.integerDeserializer(), "pid");
op.add(Builder::startTime, JsonpDeserializer.stringDeserializer(), "start_time");
op.add(Builder::startTimeInMillis, JsonpDeserializer.longDeserializer(), "start_time_in_millis");
op.add(Builder::usingBundledJdk, JsonpDeserializer.booleanDeserializer(), "using_bundled_jdk");
op.add(
Expand All @@ -610,6 +641,7 @@ public int hashCode() {
result = 31 * result + this.mem.hashCode();
result = 31 * result + Objects.hashCode(this.memoryPools);
result = 31 * result + Integer.hashCode(this.pid);
result = 31 * result + Objects.hashCode(this.startTime);
result = 31 * result + Long.hashCode(this.startTimeInMillis);
result = 31 * result + Objects.hashCode(this.usingBundledJdk);
result = 31 * result + Objects.hashCode(this.usingCompressedOrdinaryObjectPointers);
Expand All @@ -631,6 +663,7 @@ public boolean equals(Object o) {
&& this.mem.equals(other.mem)
&& Objects.equals(this.memoryPools, other.memoryPools)
&& this.pid == other.pid
&& Objects.equals(this.startTime, other.startTime)
&& this.startTimeInMillis == other.startTimeInMillis
&& Objects.equals(this.usingBundledJdk, other.usingBundledJdk)
&& Objects.equals(this.usingCompressedOrdinaryObjectPointers, other.usingCompressedOrdinaryObjectPointers)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import org.opensearch.client.json.ObjectBuilderDeserializer;
import org.opensearch.client.json.ObjectDeserializer;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.opensearch._types.Time;
import org.opensearch.client.util.ApiTypeHelper;
import org.opensearch.client.util.CopyableBuilder;
import org.opensearch.client.util.ObjectBuilder;
Expand Down Expand Up @@ -83,6 +84,9 @@ public class NodeOperatingSystemInfo
@Nullable
private final String prettyName;

@Nullable
private final Time refreshInterval;

private final long refreshIntervalInMillis;

@Nullable
Expand All @@ -101,6 +105,7 @@ private NodeOperatingSystemInfo(Builder builder) {
this.mem = builder.mem;
this.name = builder.name;
this.prettyName = builder.prettyName;
this.refreshInterval = builder.refreshInterval;
this.refreshIntervalInMillis = ApiTypeHelper.requireNonNull(builder.refreshIntervalInMillis, this, "refreshIntervalInMillis");
this.swap = builder.swap;
this.version = builder.version;
Expand Down Expand Up @@ -175,6 +180,14 @@ public final String prettyName() {
return this.prettyName;
}

/**
* API name: {@code refresh_interval}
*/
@Nullable
public final Time refreshInterval() {
return this.refreshInterval;
}

/**
* Required - API name: {@code refresh_interval_in_millis}
*/
Expand Down Expand Up @@ -242,6 +255,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.write(this.prettyName);
}

if (this.refreshInterval != null) {
generator.writeKey("refresh_interval");
this.refreshInterval.serialize(generator, mapper);
}

generator.writeKey("refresh_interval_in_millis");
generator.write(this.refreshIntervalInMillis);

Expand Down Expand Up @@ -286,6 +304,8 @@ public static class Builder extends ObjectBuilderBase implements CopyableBuilder
private String name;
@Nullable
private String prettyName;
@Nullable
private Time refreshInterval;
private Long refreshIntervalInMillis;
@Nullable
private NodeInfoMemory swap;
Expand All @@ -302,6 +322,7 @@ private Builder(NodeOperatingSystemInfo o) {
this.mem = o.mem;
this.name = o.name;
this.prettyName = o.prettyName;
this.refreshInterval = o.refreshInterval;
this.refreshIntervalInMillis = o.refreshIntervalInMillis;
this.swap = o.swap;
this.version = o.version;
Expand All @@ -315,6 +336,7 @@ private Builder(Builder o) {
this.mem = o.mem;
this.name = o.name;
this.prettyName = o.prettyName;
this.refreshInterval = o.refreshInterval;
this.refreshIntervalInMillis = o.refreshIntervalInMillis;
this.swap = o.swap;
this.version = o.version;
Expand Down Expand Up @@ -415,6 +437,23 @@ public final Builder prettyName(@Nullable String value) {
return this;
}

/**
* API name: {@code refresh_interval}
*/
@Nonnull
public final Builder refreshInterval(@Nullable Time value) {
this.refreshInterval = value;
return this;
}

/**
* API name: {@code refresh_interval}
*/
@Nonnull
public final Builder refreshInterval(Function<Time.Builder, ObjectBuilder<Time>> fn) {
return refreshInterval(fn.apply(new Time.Builder()).build());
}

/**
* Required - API name: {@code refresh_interval_in_millis}
*/
Expand Down Expand Up @@ -482,6 +521,7 @@ protected static void setupNodeOperatingSystemInfoDeserializer(ObjectDeserialize
op.add(Builder::mem, NodeInfoMemory._DESERIALIZER, "mem");
op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name");
op.add(Builder::prettyName, JsonpDeserializer.stringDeserializer(), "pretty_name");
op.add(Builder::refreshInterval, Time._DESERIALIZER, "refresh_interval");
op.add(Builder::refreshIntervalInMillis, JsonpDeserializer.longDeserializer(), "refresh_interval_in_millis");
op.add(Builder::swap, NodeInfoMemory._DESERIALIZER, "swap");
op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version");
Expand All @@ -497,6 +537,7 @@ public int hashCode() {
result = 31 * result + Objects.hashCode(this.mem);
result = 31 * result + Objects.hashCode(this.name);
result = 31 * result + Objects.hashCode(this.prettyName);
result = 31 * result + Objects.hashCode(this.refreshInterval);
result = 31 * result + Long.hashCode(this.refreshIntervalInMillis);
result = 31 * result + Objects.hashCode(this.swap);
result = 31 * result + Objects.hashCode(this.version);
Expand All @@ -515,6 +556,7 @@ public boolean equals(Object o) {
&& Objects.equals(this.mem, other.mem)
&& Objects.equals(this.name, other.name)
&& Objects.equals(this.prettyName, other.prettyName)
&& Objects.equals(this.refreshInterval, other.refreshInterval)
&& this.refreshIntervalInMillis == other.refreshIntervalInMillis
&& Objects.equals(this.swap, other.swap)
&& Objects.equals(this.version, other.version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,18 @@
package org.opensearch.client.opensearch.nodes.info;

import jakarta.json.stream.JsonGenerator;
import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Generated;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opensearch.client.json.JsonpDeserializable;
import org.opensearch.client.json.JsonpDeserializer;
import org.opensearch.client.json.JsonpMapper;
import org.opensearch.client.json.ObjectBuilderDeserializer;
import org.opensearch.client.json.ObjectDeserializer;
import org.opensearch.client.json.PlainJsonSerializable;
import org.opensearch.client.opensearch._types.Time;
import org.opensearch.client.util.ApiTypeHelper;
import org.opensearch.client.util.CopyableBuilder;
import org.opensearch.client.util.ObjectBuilder;
Expand All @@ -62,13 +65,17 @@ public class NodeProcessInfo implements PlainJsonSerializable, ToCopyableBuilder

private final boolean mlockall;

@Nullable
private final Time refreshInterval;

private final long refreshIntervalInMillis;

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

private NodeProcessInfo(Builder builder) {
this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id");
this.mlockall = ApiTypeHelper.requireNonNull(builder.mlockall, this, "mlockall");
this.refreshInterval = builder.refreshInterval;
this.refreshIntervalInMillis = ApiTypeHelper.requireNonNull(builder.refreshIntervalInMillis, this, "refreshIntervalInMillis");
}

Expand Down Expand Up @@ -96,6 +103,14 @@ public final boolean mlockall() {
return this.mlockall;
}

/**
* API name: {@code refresh_interval}
*/
@Nullable
public final Time refreshInterval() {
return this.refreshInterval;
}

/**
* Required - API name: {@code refresh_interval_in_millis}
*/
Expand All @@ -120,6 +135,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("mlockall");
generator.write(this.mlockall);

if (this.refreshInterval != null) {
generator.writeKey("refresh_interval");
this.refreshInterval.serialize(generator, mapper);
}

generator.writeKey("refresh_interval_in_millis");
generator.write(this.refreshIntervalInMillis);
}
Expand All @@ -143,19 +163,23 @@ public static Builder builder() {
public static class Builder extends ObjectBuilderBase implements CopyableBuilder<Builder, NodeProcessInfo> {
private Long id;
private Boolean mlockall;
@Nullable
private Time refreshInterval;
private Long refreshIntervalInMillis;

public Builder() {}

private Builder(NodeProcessInfo o) {
this.id = o.id;
this.mlockall = o.mlockall;
this.refreshInterval = o.refreshInterval;
this.refreshIntervalInMillis = o.refreshIntervalInMillis;
}

private Builder(Builder o) {
this.id = o.id;
this.mlockall = o.mlockall;
this.refreshInterval = o.refreshInterval;
this.refreshIntervalInMillis = o.refreshIntervalInMillis;
}

Expand Down Expand Up @@ -189,6 +213,23 @@ public final Builder mlockall(boolean value) {
return this;
}

/**
* API name: {@code refresh_interval}
*/
@Nonnull
public final Builder refreshInterval(@Nullable Time value) {
this.refreshInterval = value;
return this;
}

/**
* API name: {@code refresh_interval}
*/
@Nonnull
public final Builder refreshInterval(Function<Time.Builder, ObjectBuilder<Time>> fn) {
return refreshInterval(fn.apply(new Time.Builder()).build());
}

/**
* Required - API name: {@code refresh_interval_in_millis}
*/
Expand Down Expand Up @@ -225,6 +266,7 @@ public NodeProcessInfo build() {
protected static void setupNodeProcessInfoDeserializer(ObjectDeserializer<NodeProcessInfo.Builder> op) {
op.add(Builder::id, JsonpDeserializer.longDeserializer(), "id");
op.add(Builder::mlockall, JsonpDeserializer.booleanDeserializer(), "mlockall");
op.add(Builder::refreshInterval, Time._DESERIALIZER, "refresh_interval");
op.add(Builder::refreshIntervalInMillis, JsonpDeserializer.longDeserializer(), "refresh_interval_in_millis");
}

Expand All @@ -233,6 +275,7 @@ public int hashCode() {
int result = 17;
result = 31 * result + Long.hashCode(this.id);
result = 31 * result + Boolean.hashCode(this.mlockall);
result = 31 * result + Objects.hashCode(this.refreshInterval);
result = 31 * result + Long.hashCode(this.refreshIntervalInMillis);
return result;
}
Expand All @@ -242,6 +285,9 @@ public boolean equals(Object o) {
if (this == o) return true;
if (o == null || this.getClass() != o.getClass()) return false;
NodeProcessInfo other = (NodeProcessInfo) o;
return this.id == other.id && this.mlockall == other.mlockall && this.refreshIntervalInMillis == other.refreshIntervalInMillis;
return this.id == other.id
&& this.mlockall == other.mlockall
&& Objects.equals(this.refreshInterval, other.refreshInterval)
&& this.refreshIntervalInMillis == other.refreshIntervalInMillis;
}
}
Loading

0 comments on commit b9e9e58

Please sign in to comment.