Skip to content

Commit

Permalink
Removed null constraints on NodeInfo fields that are returned null fr…
Browse files Browse the repository at this point in the history
…om Amazon OpenSearch Service (opensearch-project#1132)

* Removed the null constraints on NodeInfo.host, NodeInfo.Ip, NodeInfo.TransportAddress

Signed-off-by: Dan Cecoi <[email protected]>

* Added a CHANGELOG entry, made the getters nullable and removed extra white space

Signed-off-by: Dan Cecoi <[email protected]>

* modified the PR link in the changelog

Signed-off-by: Dan Cecoi <[email protected]>

---------

Signed-off-by: Dan Cecoi <[email protected]>
Co-authored-by: Dan Cecoi <[email protected]>
  • Loading branch information
dancristiancecoi and Dan Cecoi authored Aug 12, 2024
1 parent 814ff4b commit 94171f8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -99,6 +101,7 @@ public class NodeInfo implements PlainJsonSerializable {
@Nullable
private final NodeInfoTransport transport;

@Nullable
private final String transportAddress;

private final String version;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -173,6 +176,7 @@ public final String buildType() {
* <p>
* API name: {@code host}
*/
@Nullable
public final String host() {
return this.host;
}
Expand All @@ -190,6 +194,7 @@ public final NodeInfoHttp http() {
* <p>
* API name: {@code ip}
*/
@Nullable
public final String ip() {
return this.ip;
}
Expand Down Expand Up @@ -299,6 +304,7 @@ public final NodeInfoTransport transport() {
* <p>
* API name: {@code transport_address}
*/
@Nullable
public final String transportAddress() {
return this.transportAddress;
}
Expand Down Expand Up @@ -496,11 +502,13 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder<N

private String buildType;

@Nullable
private String host;

@Nullable
private NodeInfoHttp http;

@Nullable
private String ip;

@Nullable
Expand Down Expand Up @@ -537,6 +545,7 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder<N
@Nullable
private NodeInfoTransport transport;

@Nullable
private String transportAddress;

private String version;
Expand Down Expand Up @@ -593,7 +602,7 @@ public final Builder buildType(String value) {
* <p>
* API name: {@code host}
*/
public final Builder host(String value) {
public final Builder host(@Nullable String value) {
this.host = value;
return this;
}
Expand All @@ -618,7 +627,7 @@ public final Builder http(Function<NodeInfoHttp.Builder, ObjectBuilder<NodeInfoH
* <p>
* API name: {@code ip}
*/
public final Builder ip(String value) {
public final Builder ip(@Nullable String value) {
this.ip = value;
return this;
}
Expand Down Expand Up @@ -828,7 +837,7 @@ public final Builder transport(Function<NodeInfoTransport.Builder, ObjectBuilder
* <p>
* API name: {@code transport_address}
*/
public final Builder transportAddress(String value) {
public final Builder transportAddress(@Nullable String value) {
this.transportAddress = value;
return this;
}
Expand Down

0 comments on commit 94171f8

Please sign in to comment.