diff --git a/CHANGELOG.md b/CHANGELOG.md index dae19dce74..2e65658050 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ This section is for maintaining a changelog for all breaking changes for the cli ### Removed ### Fixed +- Fixed handling of NodeInfo fields that are not returned by Amazon OpenSearch Service ([#1132](https://github.com/opensearch-project/opensearch-java/pull/1132)) ### Security diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfo.java b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfo.java index 94df6b761c..4b97120434 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfo.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/nodes/info/NodeInfo.java @@ -60,11 +60,13 @@ public class NodeInfo implements PlainJsonSerializable { private final String buildType; + @Nullable private final String host; @Nullable private final NodeInfoHttp http; + @Nullable private final String ip; @Nullable @@ -99,6 +101,7 @@ public class NodeInfo implements PlainJsonSerializable { @Nullable private final NodeInfoTransport transport; + @Nullable private final String transportAddress; private final String version; @@ -117,9 +120,9 @@ private NodeInfo(Builder builder) { this.attributes = ApiTypeHelper.unmodifiable(builder.attributes); this.buildHash = ApiTypeHelper.requireNonNull(builder.buildHash, this, "buildHash"); this.buildType = ApiTypeHelper.requireNonNull(builder.buildType, this, "buildType"); - this.host = ApiTypeHelper.requireNonNull(builder.host, this, "host"); + this.host = builder.host; this.http = builder.http; - this.ip = ApiTypeHelper.requireNonNull(builder.ip, this, "ip"); + this.ip = builder.ip; this.jvm = builder.jvm; this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); this.network = builder.network; @@ -132,7 +135,7 @@ private NodeInfo(Builder builder) { this.totalIndexingBuffer = builder.totalIndexingBuffer; this.totalIndexingBufferInBytes = builder.totalIndexingBufferInBytes; this.transport = builder.transport; - this.transportAddress = ApiTypeHelper.requireNonNull(builder.transportAddress, this, "transportAddress"); + this.transportAddress = builder.transportAddress; this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); this.modules = ApiTypeHelper.unmodifiable(builder.modules); this.ingest = builder.ingest; @@ -173,6 +176,7 @@ public final String buildType() { *
* API name: {@code host} */ + @Nullable public final String host() { return this.host; } @@ -190,6 +194,7 @@ public final NodeInfoHttp http() { *
* API name: {@code ip} */ + @Nullable public final String ip() { return this.ip; } @@ -299,6 +304,7 @@ public final NodeInfoTransport transport() { *
* API name: {@code transport_address}
*/
+ @Nullable
public final String transportAddress() {
return this.transportAddress;
}
@@ -496,11 +502,13 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder