Skip to content

Commit

Permalink
nullable properties based on flavor availability
Browse files Browse the repository at this point in the history
  • Loading branch information
l-trotta committed Dec 17, 2024
1 parent cd58ae3 commit ca431a2
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public class ModelSnapshotUpgrade implements JsonpSerializable {

private final SnapshotUpgradeState state;

@Nullable
private final DiscoveryNodeContent node;

private final String assignmentExplanation;
Expand All @@ -76,7 +77,7 @@ private ModelSnapshotUpgrade(Builder builder) {
this.jobId = ApiTypeHelper.requireNonNull(builder.jobId, this, "jobId");
this.snapshotId = ApiTypeHelper.requireNonNull(builder.snapshotId, this, "snapshotId");
this.state = ApiTypeHelper.requireNonNull(builder.state, this, "state");
this.node = ApiTypeHelper.requireNonNull(builder.node, this, "node");
this.node = builder.node;
this.assignmentExplanation = ApiTypeHelper.requireNonNull(builder.assignmentExplanation, this,
"assignmentExplanation");

Expand Down Expand Up @@ -110,6 +111,7 @@ public final SnapshotUpgradeState state() {
/**
* Required - API name: {@code node}
*/
@Nullable
public final DiscoveryNodeContent node() {
return this.node;
}
Expand Down Expand Up @@ -140,9 +142,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

generator.writeKey("state");
this.state.serialize(generator, mapper);
generator.writeKey("node");
this.node.serialize(generator, mapper);
if (this.node != null) {
generator.writeKey("node");
this.node.serialize(generator, mapper);

}
generator.writeKey("assignment_explanation");
generator.write(this.assignmentExplanation);

Expand All @@ -168,6 +172,7 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder>

private SnapshotUpgradeState state;

@Nullable
private DiscoveryNodeContent node;

private String assignmentExplanation;
Expand Down Expand Up @@ -199,7 +204,7 @@ public final Builder state(SnapshotUpgradeState value) {
/**
* Required - API name: {@code node}
*/
public final Builder node(DiscoveryNodeContent value) {
public final Builder node(@Nullable DiscoveryNodeContent value) {
this.node = value;
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private Http(Builder builder) {
this.currentOpen = builder.currentOpen;
this.totalOpened = builder.totalOpened;
this.clients = ApiTypeHelper.unmodifiable(builder.clients);
this.routes = ApiTypeHelper.unmodifiableRequired(builder.routes, this, "routes");
this.routes = ApiTypeHelper.unmodifiable(builder.routes);

}

Expand Down Expand Up @@ -195,6 +195,7 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder> implement
@Nullable
private List<Client> clients;

@Nullable
private Map<String, HttpRoute> routes;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ private GetBuiltinPrivilegesResponse(Builder builder) {

this.cluster = ApiTypeHelper.unmodifiableRequired(builder.cluster, this, "cluster");
this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index");
this.remoteCluster = ApiTypeHelper.unmodifiableRequired(builder.remoteCluster, this, "remoteCluster");
this.remoteCluster = ApiTypeHelper.unmodifiable(builder.remoteCluster);

}

Expand Down Expand Up @@ -163,6 +163,7 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder>

private List<String> index;

@Nullable
private List<RemoteClusterPrivilege> remoteCluster;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,12 @@ public class Features implements JsonpSerializable {

private final Feature enrich;

@Nullable
private final Feature enterpriseSearch;

private final Feature eql;

@Nullable
private final Feature esql;

private final Feature frozenIndices;
Expand Down Expand Up @@ -107,12 +109,14 @@ public class Features implements JsonpSerializable {

private final Feature transform;

@Nullable
private final Feature universalProfiling;

private final Feature votingOnly;

private final Feature watcher;

@Nullable
private final Feature archive;

// ---------------------------------------------------------------------------------------------
Expand All @@ -125,9 +129,9 @@ private Features(Builder builder) {
this.dataStreams = ApiTypeHelper.requireNonNull(builder.dataStreams, this, "dataStreams");
this.dataTiers = ApiTypeHelper.requireNonNull(builder.dataTiers, this, "dataTiers");
this.enrich = ApiTypeHelper.requireNonNull(builder.enrich, this, "enrich");
this.enterpriseSearch = ApiTypeHelper.requireNonNull(builder.enterpriseSearch, this, "enterpriseSearch");
this.enterpriseSearch = builder.enterpriseSearch;
this.eql = ApiTypeHelper.requireNonNull(builder.eql, this, "eql");
this.esql = ApiTypeHelper.requireNonNull(builder.esql, this, "esql");
this.esql = builder.esql;
this.frozenIndices = ApiTypeHelper.requireNonNull(builder.frozenIndices, this, "frozenIndices");
this.graph = ApiTypeHelper.requireNonNull(builder.graph, this, "graph");
this.ilm = ApiTypeHelper.requireNonNull(builder.ilm, this, "ilm");
Expand All @@ -144,10 +148,10 @@ private Features(Builder builder) {
this.spatial = ApiTypeHelper.requireNonNull(builder.spatial, this, "spatial");
this.sql = ApiTypeHelper.requireNonNull(builder.sql, this, "sql");
this.transform = ApiTypeHelper.requireNonNull(builder.transform, this, "transform");
this.universalProfiling = ApiTypeHelper.requireNonNull(builder.universalProfiling, this, "universalProfiling");
this.universalProfiling = builder.universalProfiling;
this.votingOnly = ApiTypeHelper.requireNonNull(builder.votingOnly, this, "votingOnly");
this.watcher = ApiTypeHelper.requireNonNull(builder.watcher, this, "watcher");
this.archive = ApiTypeHelper.requireNonNull(builder.archive, this, "archive");
this.archive = builder.archive;

}

Expand Down Expand Up @@ -200,6 +204,7 @@ public final Feature enrich() {
/**
* Required - API name: {@code enterprise_search}
*/
@Nullable
public final Feature enterpriseSearch() {
return this.enterpriseSearch;
}
Expand All @@ -214,6 +219,7 @@ public final Feature eql() {
/**
* Required - API name: {@code esql}
*/
@Nullable
public final Feature esql() {
return this.esql;
}
Expand Down Expand Up @@ -327,6 +333,7 @@ public final Feature transform() {
/**
* Required - API name: {@code universal_profiling}
*/
@Nullable
public final Feature universalProfiling() {
return this.universalProfiling;
}
Expand All @@ -348,6 +355,7 @@ public final Feature watcher() {
/**
* Required - API name: {@code archive}
*/
@Nullable
public final Feature archive() {
return this.archive;
}
Expand Down Expand Up @@ -381,15 +389,19 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("enrich");
this.enrich.serialize(generator, mapper);

generator.writeKey("enterprise_search");
this.enterpriseSearch.serialize(generator, mapper);
if (this.enterpriseSearch != null) {
generator.writeKey("enterprise_search");
this.enterpriseSearch.serialize(generator, mapper);

}
generator.writeKey("eql");
this.eql.serialize(generator, mapper);

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

}
generator.writeKey("frozen_indices");
this.frozenIndices.serialize(generator, mapper);

Expand Down Expand Up @@ -437,17 +449,22 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeKey("transform");
this.transform.serialize(generator, mapper);

generator.writeKey("universal_profiling");
this.universalProfiling.serialize(generator, mapper);
if (this.universalProfiling != null) {
generator.writeKey("universal_profiling");
this.universalProfiling.serialize(generator, mapper);

}
generator.writeKey("voting_only");
this.votingOnly.serialize(generator, mapper);

generator.writeKey("watcher");
this.watcher.serialize(generator, mapper);

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

}

}

Expand Down Expand Up @@ -475,10 +492,12 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder> implement

private Feature enrich;

@Nullable
private Feature enterpriseSearch;

private Feature eql;

@Nullable
private Feature esql;

private Feature frozenIndices;
Expand Down Expand Up @@ -512,12 +531,14 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder> implement

private Feature transform;

@Nullable
private Feature universalProfiling;

private Feature votingOnly;

private Feature watcher;

@Nullable
private Feature archive;

/**
Expand Down Expand Up @@ -613,7 +634,7 @@ public final Builder enrich(Function<Feature.Builder, ObjectBuilder<Feature>> fn
/**
* Required - API name: {@code enterprise_search}
*/
public final Builder enterpriseSearch(Feature value) {
public final Builder enterpriseSearch(@Nullable Feature value) {
this.enterpriseSearch = value;
return this;
}
Expand Down Expand Up @@ -643,7 +664,7 @@ public final Builder eql(Function<Feature.Builder, ObjectBuilder<Feature>> fn) {
/**
* Required - API name: {@code esql}
*/
public final Builder esql(Feature value) {
public final Builder esql(@Nullable Feature value) {
this.esql = value;
return this;
}
Expand Down Expand Up @@ -883,7 +904,7 @@ public final Builder transform(Function<Feature.Builder, ObjectBuilder<Feature>>
/**
* Required - API name: {@code universal_profiling}
*/
public final Builder universalProfiling(Feature value) {
public final Builder universalProfiling(@Nullable Feature value) {
this.universalProfiling = value;
return this;
}
Expand Down Expand Up @@ -928,7 +949,7 @@ public final Builder watcher(Function<Feature.Builder, ObjectBuilder<Feature>> f
/**
* Required - API name: {@code archive}
*/
public final Builder archive(Feature value) {
public final Builder archive(@Nullable Feature value) {
this.archive = value;
return this;
}
Expand Down

0 comments on commit ca431a2

Please sign in to comment.