diff --git a/UPGRADING.md b/UPGRADING.md index cd7e6bb2b5..8de42c6750 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -279,4 +279,42 @@ After: ### ShardStats renamed to IndexShardStats - The `ShardStats` class has been renamed to `IndexShardStats`, this affects: - - `IndicesStats`'s `shards` field. \ No newline at end of file + - `IndicesStats`'s `shards` field. + +### AllocationExplainResponse +- The `allocationDelay`, `configuredDelay` and `remainingDelay` properties have been corrected to be of type `Time` instead of `String`. + +### PutComponentTemplateRequest +- The `aliases`, `mappings` and `settings` properties have been removed as they should be set within the `template` property. + +### HealthRequest +- The `level` property is now of type `ClusterHealthLevel` instead of `Level`. + +### HealthResponse +- The `activeShardsPercentAsNumber` property has been corrected to be of type `double` instead of `String`. +- The `taskMaxWaitingInQueueMillis` property has been corrected to be of type `long` instead of `String`. + +### PendingTask +- The `timeInQueue` property has been corrected to be of type `Time` instead of `String`. +- The `timeInQueueMillis` property has been corrected to be of type `long` instead of `int`. + +### RerouteRequest +- The `metric` property is now of type `List` instead of `List`. + +### StateRequest +- The `metric` property is now of type `List` instead of `List`. + +### ClusterIndicesShards +- The `primaries`, `replication` and `total` properties have been corrected to be of type `Integer` instead of `Double`. + +### ClusterProcessCpu +- The `percent` property has been corrected to be of type `double` instead of `int`. + +### FieldTypes +- The `scriptCount` property has been removed as it is not supported by OpenSearch. + +### FieldTypesMappings +- The `runtimeFieldTypes` property has been removed as it is not supported by OpenSearch. + +### OperatingSystemMemoryInfo +- The `freePercent` and `usedPercent` properties have been corrected to be of type `double` instead of `int`. \ No newline at end of file diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java index 2ddfefc198..6e7ffd1e73 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java @@ -42,6 +42,7 @@ import javax.annotation.Nullable; import org.opensearch.client.ApiClient; import org.opensearch.client.opensearch._types.OpenSearchException; +import org.opensearch.client.opensearch.cluster.OpenSearchClusterAsyncClient; import org.opensearch.client.opensearch.core.InfoRequest; import org.opensearch.client.opensearch.core.InfoResponse; import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesAsyncClient; @@ -63,6 +64,10 @@ public OpenSearchAsyncClientBase(OpenSearchTransport transport, @Nullable Transp // ----- Child clients + public OpenSearchClusterAsyncClient cluster() { + return new OpenSearchClusterAsyncClient(this.transport, this.transportOptions); + } + public OpenSearchDanglingIndicesAsyncClient danglingIndices() { return new OpenSearchDanglingIndicesAsyncClient(this.transport, this.transportOptions); } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java index eeedcc19fd..cb845ea0e7 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClientBase.java @@ -41,6 +41,7 @@ import javax.annotation.Nullable; import org.opensearch.client.ApiClient; import org.opensearch.client.opensearch._types.OpenSearchException; +import org.opensearch.client.opensearch.cluster.OpenSearchClusterClient; import org.opensearch.client.opensearch.core.InfoRequest; import org.opensearch.client.opensearch.core.InfoResponse; import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesClient; @@ -62,6 +63,10 @@ public OpenSearchClientBase(OpenSearchTransport transport, @Nullable TransportOp // ----- Child clients + public OpenSearchClusterClient cluster() { + return new OpenSearchClusterClient(this.transport, this.transportOptions); + } + public OpenSearchDanglingIndicesClient danglingIndices() { return new OpenSearchDanglingIndicesClient(this.transport, this.transportOptions); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/PluginStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/PluginStats.java similarity index 60% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/PluginStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/PluginStats.java index 564923a60b..ea8f242165 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/PluginStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/PluginStats.java @@ -30,11 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; import java.util.List; +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; @@ -42,72 +50,93 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: _types.PluginStats @JsonpDeserializable -public class PluginStats implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PluginStats implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final String classname; - private final String description; + @Nullable + private final String customFoldername; - private final String opensearchVersion; + @Nonnull + private final String description; + @Nonnull private final List extendedPlugins; private final boolean hasNativeController; + @Nonnull private final String javaVersion; + @Nullable + private final Boolean licensed; + + @Nonnull private final String name; + @Nonnull + private final String opensearchVersion; + + @Nonnull private final String version; // --------------------------------------------------------------------------------------------- private PluginStats(Builder builder) { - this.classname = ApiTypeHelper.requireNonNull(builder.classname, this, "classname"); + this.customFoldername = builder.customFoldername; this.description = ApiTypeHelper.requireNonNull(builder.description, this, "description"); - this.opensearchVersion = ApiTypeHelper.requireNonNull(builder.opensearchVersion, this, "opensearchVersion"); this.extendedPlugins = ApiTypeHelper.unmodifiableRequired(builder.extendedPlugins, this, "extendedPlugins"); this.hasNativeController = ApiTypeHelper.requireNonNull(builder.hasNativeController, this, "hasNativeController"); this.javaVersion = ApiTypeHelper.requireNonNull(builder.javaVersion, this, "javaVersion"); + this.licensed = builder.licensed; this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.opensearchVersion = ApiTypeHelper.requireNonNull(builder.opensearchVersion, this, "opensearchVersion"); this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); - } - public static PluginStats of(Function> fn) { + public static PluginStats of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code classname} */ + @Nonnull public final String classname() { return this.classname; } /** - * Required - API name: {@code description} + * API name: {@code custom_foldername} */ - public final String description() { - return this.description; + @Nullable + public final String customFoldername() { + return this.customFoldername; } /** - * API name: {@code opensearch_version} + * Required - API name: {@code description} */ - public String opensearchVersion() { - return this.opensearchVersion; + @Nonnull + public final String description() { + return this.description; } /** * Required - API name: {@code extended_plugins} */ + @Nonnull public final List extendedPlugins() { return this.extendedPlugins; } @@ -122,20 +151,39 @@ public final boolean hasNativeController() { /** * Required - API name: {@code java_version} */ + @Nonnull public final String javaVersion() { return this.javaVersion; } + /** + * API name: {@code licensed} + */ + @Nullable + public final Boolean licensed() { + return this.licensed; + } + /** * Required - API name: {@code name} */ + @Nonnull public final String name() { return this.name; } + /** + * Required - API name: {@code opensearch_version} + */ + @Nonnull + public final String opensearchVersion() { + return this.opensearchVersion; + } + /** * Required - API name: {@code version} */ + @Nonnull public final String version() { return this.version; } @@ -143,6 +191,7 @@ public final String version() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -150,91 +199,144 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("classname"); generator.write(this.classname); + if (this.customFoldername != null) { + generator.writeKey("custom_foldername"); + generator.write(this.customFoldername); + } + generator.writeKey("description"); generator.write(this.description); - generator.writeKey("opensearch_version"); - generator.write(this.opensearchVersion); - - if (ApiTypeHelper.isDefined(this.extendedPlugins)) { - generator.writeKey("extended_plugins"); - generator.writeStartArray(); - for (String item0 : this.extendedPlugins) { - generator.write(item0); - - } - generator.writeEnd(); - + generator.writeKey("extended_plugins"); + generator.writeStartArray(); + for (String item0 : this.extendedPlugins) { + generator.write(item0); } + generator.writeEnd(); + generator.writeKey("has_native_controller"); generator.write(this.hasNativeController); generator.writeKey("java_version"); generator.write(this.javaVersion); + if (this.licensed != null) { + generator.writeKey("licensed"); + generator.write(this.licensed); + } + generator.writeKey("name"); generator.write(this.name); + generator.writeKey("opensearch_version"); + generator.write(this.opensearchVersion); + generator.writeKey("version"); generator.write(this.version); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link PluginStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private String classname; - + @Nullable + private String customFoldername; private String description; - - private String opensearchVersion; - private List extendedPlugins; - private Boolean hasNativeController; - private String javaVersion; - + @Nullable + private Boolean licensed; private String name; - + private String opensearchVersion; private String version; + public Builder() {} + + private Builder(PluginStats o) { + this.classname = o.classname; + this.customFoldername = o.customFoldername; + this.description = o.description; + this.extendedPlugins = _listCopy(o.extendedPlugins); + this.hasNativeController = o.hasNativeController; + this.javaVersion = o.javaVersion; + this.licensed = o.licensed; + this.name = o.name; + this.opensearchVersion = o.opensearchVersion; + this.version = o.version; + } + + private Builder(Builder o) { + this.classname = o.classname; + this.customFoldername = o.customFoldername; + this.description = o.description; + this.extendedPlugins = _listCopy(o.extendedPlugins); + this.hasNativeController = o.hasNativeController; + this.javaVersion = o.javaVersion; + this.licensed = o.licensed; + this.name = o.name; + this.opensearchVersion = o.opensearchVersion; + this.version = o.version; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code classname} */ + @Nonnull public final Builder classname(String value) { this.classname = value; return this; } /** - * Required - API name: {@code description} + * API name: {@code custom_foldername} */ - public final Builder description(String value) { - this.description = value; + @Nonnull + public final Builder customFoldername(@Nullable String value) { + this.customFoldername = value; return this; } /** - * Required - API name: {@code opensearch_version} + * Required - API name: {@code description} */ - public final Builder opensearchVersion(String value) { - this.opensearchVersion = value; + @Nonnull + public final Builder description(String value) { + this.description = value; return this; } /** * Required - API name: {@code extended_plugins} + * *

* Adds all elements of list to extendedPlugins. + *

*/ + @Nonnull public final Builder extendedPlugins(List list) { this.extendedPlugins = _listAddAll(this.extendedPlugins, list); return this; @@ -242,9 +344,12 @@ public final Builder extendedPlugins(List list) { /** * Required - API name: {@code extended_plugins} + * *

* Adds one or more values to extendedPlugins. + *

*/ + @Nonnull public final Builder extendedPlugins(String value, String... values) { this.extendedPlugins = _listAdd(this.extendedPlugins, value, values); return this; @@ -253,6 +358,7 @@ public final Builder extendedPlugins(String value, String... values) { /** * Required - API name: {@code has_native_controller} */ + @Nonnull public final Builder hasNativeController(boolean value) { this.hasNativeController = value; return this; @@ -261,22 +367,43 @@ public final Builder hasNativeController(boolean value) { /** * Required - API name: {@code java_version} */ + @Nonnull public final Builder javaVersion(String value) { this.javaVersion = value; return this; } + /** + * API name: {@code licensed} + */ + @Nonnull + public final Builder licensed(@Nullable Boolean value) { + this.licensed = value; + return this; + } + /** * Required - API name: {@code name} */ + @Nonnull public final Builder name(String value) { this.name = value; return this; } + /** + * Required - API name: {@code opensearch_version} + */ + @Nonnull + public final Builder opensearchVersion(String value) { + this.opensearchVersion = value; + return this; + } + /** * Required - API name: {@code version} */ + @Nonnull public final Builder version(String value) { this.version = value; return this; @@ -285,9 +412,10 @@ public final Builder version(String value) { /** * Builds a {@link PluginStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public PluginStats build() { _checkSingleUse(); @@ -306,16 +434,48 @@ public PluginStats build() { ); protected static void setupPluginStatsDeserializer(ObjectDeserializer op) { - op.add(Builder::classname, JsonpDeserializer.stringDeserializer(), "classname"); + op.add(Builder::customFoldername, JsonpDeserializer.stringDeserializer(), "custom_foldername"); op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); - op.add(Builder::opensearchVersion, JsonpDeserializer.stringDeserializer(), "opensearch_version"); op.add(Builder::extendedPlugins, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "extended_plugins"); op.add(Builder::hasNativeController, JsonpDeserializer.booleanDeserializer(), "has_native_controller"); op.add(Builder::javaVersion, JsonpDeserializer.stringDeserializer(), "java_version"); + op.add(Builder::licensed, JsonpDeserializer.booleanDeserializer(), "licensed"); op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::opensearchVersion, JsonpDeserializer.stringDeserializer(), "opensearch_version"); op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.classname.hashCode(); + result = 31 * result + Objects.hashCode(this.customFoldername); + result = 31 * result + this.description.hashCode(); + result = 31 * result + this.extendedPlugins.hashCode(); + result = 31 * result + Boolean.hashCode(this.hasNativeController); + result = 31 * result + this.javaVersion.hashCode(); + result = 31 * result + Objects.hashCode(this.licensed); + result = 31 * result + this.name.hashCode(); + result = 31 * result + this.opensearchVersion.hashCode(); + result = 31 * result + this.version.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PluginStats other = (PluginStats) o; + return this.classname.equals(other.classname) + && Objects.equals(this.customFoldername, other.customFoldername) + && this.description.equals(other.description) + && this.extendedPlugins.equals(other.extendedPlugins) + && this.hasNativeController == other.hasNativeController + && this.javaVersion.equals(other.javaVersion) + && Objects.equals(this.licensed, other.licensed) + && this.name.equals(other.name) + && this.opensearchVersion.equals(other.opensearchVersion) + && this.version.equals(other.version); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/WaitForEvents.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WaitForEvents.java similarity index 84% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/WaitForEvents.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/WaitForEvents.java index e6707e97b6..97bb2a5287 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/WaitForEvents.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/WaitForEvents.java @@ -30,26 +30,32 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: _types.WaitForEvents + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum WaitForEvents implements JsonEnum { - Immediate("immediate"), - - Urgent("urgent"), - High("high"), - Normal("normal"), + Immediate("immediate"), + + Languid("languid"), Low("low"), - Languid("languid"), + Normal("normal"), - ; + Urgent("urgent"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/AllocationExplainRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/AllocationExplainRequest.java similarity index 69% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/AllocationExplainRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/AllocationExplainRequest.java index 9e711de486..82be688d25 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/AllocationExplainRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/AllocationExplainRequest.java @@ -30,12 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import jakarta.json.stream.JsonGenerator; import java.util.HashMap; import java.util.Map; +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; @@ -47,17 +54,23 @@ import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.allocation_explain.Request /** * Provides explanations for shard allocations in the cluster. - * */ @JsonpDeserializable -public class AllocationExplainRequest extends RequestBase implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class AllocationExplainRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + @Nullable private final String currentNode; @@ -79,25 +92,23 @@ public class AllocationExplainRequest extends RequestBase implements PlainJsonSe // --------------------------------------------------------------------------------------------- private AllocationExplainRequest(Builder builder) { - this.currentNode = builder.currentNode; this.includeDiskInfo = builder.includeDiskInfo; this.includeYesDecisions = builder.includeYesDecisions; this.index = builder.index; this.primary = builder.primary; this.shard = builder.shard; - } - public static AllocationExplainRequest of(Function> fn) { + public static AllocationExplainRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Specifies the node ID or the name of the node to only explain a shard that is - * currently located on the specified node. + * Specifies the node ID or the name of the node to only explain a shard that is currently located on the specified node. *

* API name: {@code current_node} + *

*/ @Nullable public final String currentNode() { @@ -105,9 +116,10 @@ public final String currentNode() { } /** - * If true, returns information about disk usage and shard sizes. + * If true, returns information about disk usage and shard sizes. *

* API name: {@code include_disk_info} + *

*/ @Nullable public final Boolean includeDiskInfo() { @@ -115,9 +127,10 @@ public final Boolean includeDiskInfo() { } /** - * If true, returns YES decisions in explanation. + * If true, returns YES decisions in explanation. *

* API name: {@code include_yes_decisions} + *

*/ @Nullable public final Boolean includeYesDecisions() { @@ -125,8 +138,6 @@ public final Boolean includeYesDecisions() { } /** - * Specifies the name of the index that you would like an explanation for. - *

* API name: {@code index} */ @Nullable @@ -135,9 +146,10 @@ public final String index() { } /** - * If true, returns explanation for the primary shard for the given shard ID. + * If true, returns explanation for the primary shard for the given shard ID. *

* API name: {@code primary} + *

*/ @Nullable public final Boolean primary() { @@ -148,6 +160,7 @@ public final Boolean primary() { * Specifies the ID of the shard that you would like an explanation for. *

* API name: {@code shard} + *

*/ @Nullable public final Integer shard() { @@ -157,6 +170,7 @@ public final Integer shard() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -164,101 +178,134 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.currentNode != null) { generator.writeKey("current_node"); generator.write(this.currentNode); - } + if (this.index != null) { generator.writeKey("index"); generator.write(this.index); - } + if (this.primary != null) { generator.writeKey("primary"); generator.write(this.primary); - } + if (this.shard != null) { generator.writeKey("shard"); generator.write(this.shard); - } + } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link AllocationExplainRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private String currentNode; - @Nullable private Boolean includeDiskInfo; - @Nullable private Boolean includeYesDecisions; - @Nullable private String index; - @Nullable private Boolean primary; - @Nullable private Integer shard; + public Builder() {} + + private Builder(AllocationExplainRequest o) { + this.currentNode = o.currentNode; + this.includeDiskInfo = o.includeDiskInfo; + this.includeYesDecisions = o.includeYesDecisions; + this.index = o.index; + this.primary = o.primary; + this.shard = o.shard; + } + + private Builder(Builder o) { + this.currentNode = o.currentNode; + this.includeDiskInfo = o.includeDiskInfo; + this.includeYesDecisions = o.includeYesDecisions; + this.index = o.index; + this.primary = o.primary; + this.shard = o.shard; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Specifies the node ID or the name of the node to only explain a shard that is - * currently located on the specified node. + * Specifies the node ID or the name of the node to only explain a shard that is currently located on the specified node. *

* API name: {@code current_node} + *

*/ + @Nonnull public final Builder currentNode(@Nullable String value) { this.currentNode = value; return this; } /** - * If true, returns information about disk usage and shard sizes. + * If true, returns information about disk usage and shard sizes. *

* API name: {@code include_disk_info} + *

*/ + @Nonnull public final Builder includeDiskInfo(@Nullable Boolean value) { this.includeDiskInfo = value; return this; } /** - * If true, returns YES decisions in explanation. + * If true, returns YES decisions in explanation. *

* API name: {@code include_yes_decisions} + *

*/ + @Nonnull public final Builder includeYesDecisions(@Nullable Boolean value) { this.includeYesDecisions = value; return this; } /** - * Specifies the name of the index that you would like an explanation for. - *

* API name: {@code index} */ + @Nonnull public final Builder index(@Nullable String value) { this.index = value; return this; } /** - * If true, returns explanation for the primary shard for the given shard ID. + * If true, returns explanation for the primary shard for the given shard ID. *

* API name: {@code primary} + *

*/ + @Nonnull public final Builder primary(@Nullable Boolean value) { this.primary = value; return this; @@ -268,7 +315,9 @@ public final Builder primary(@Nullable Boolean value) { * Specifies the ID of the shard that you would like an explanation for. *

* API name: {@code shard} + *

*/ + @Nonnull public final Builder shard(@Nullable Integer value) { this.shard = value; return this; @@ -277,9 +326,10 @@ public final Builder shard(@Nullable Integer value) { /** * Builds a {@link AllocationExplainRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public AllocationExplainRequest build() { _checkSingleUse(); @@ -298,12 +348,10 @@ public AllocationExplainRequest build() { ); protected static void setupAllocationExplainRequestDeserializer(ObjectDeserializer op) { - op.add(Builder::currentNode, JsonpDeserializer.stringDeserializer(), "current_node"); op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); op.add(Builder::primary, JsonpDeserializer.booleanDeserializer(), "primary"); op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard"); - } // --------------------------------------------------------------------------------------------- @@ -312,19 +360,10 @@ protected static void setupAllocationExplainRequestDeserializer(ObjectDeserializ * Endpoint "{@code cluster.allocation_explain}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "POST"; - - }, - + request -> "POST", // Request path - request -> { - return "/_cluster/allocation/explain"; - - }, - + request -> "/_cluster/allocation/explain", // Request parameters request -> { Map params = new HashMap<>(); @@ -335,10 +374,34 @@ protected static void setupAllocationExplainRequestDeserializer(ObjectDeserializ params.put("include_yes_decisions", String.valueOf(request.includeYesDecisions)); } return params; - }, SimpleEndpoint.emptyMap(), true, AllocationExplainResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.currentNode); + result = 31 * result + Objects.hashCode(this.includeDiskInfo); + result = 31 * result + Objects.hashCode(this.includeYesDecisions); + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + Objects.hashCode(this.primary); + result = 31 * result + Objects.hashCode(this.shard); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + AllocationExplainRequest other = (AllocationExplainRequest) o; + return Objects.equals(this.currentNode, other.currentNode) + && Objects.equals(this.includeDiskInfo, other.includeDiskInfo) + && Objects.equals(this.includeYesDecisions, other.includeYesDecisions) + && Objects.equals(this.index, other.index) + && Objects.equals(this.primary, other.primary) + && Objects.equals(this.shard, other.shard); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/AllocationExplainResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/AllocationExplainResponse.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/AllocationExplainResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/AllocationExplainResponse.java index f501708731..3c191d6685 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/AllocationExplainResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/AllocationExplainResponse.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import jakarta.json.stream.JsonGenerator; import java.util.List; +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; @@ -42,6 +49,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.opensearch.cluster.allocation_explain.AllocationDecision; import org.opensearch.client.opensearch.cluster.allocation_explain.ClusterInfo; import org.opensearch.client.opensearch.cluster.allocation_explain.CurrentNode; @@ -49,18 +57,25 @@ import org.opensearch.client.opensearch.cluster.allocation_explain.NodeAllocationExplanation; import org.opensearch.client.opensearch.cluster.allocation_explain.UnassignedInformation; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.allocation_explain.Response @JsonpDeserializable -public class AllocationExplainResponse implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class AllocationExplainResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + @Nullable private final String allocateExplanation; @Nullable - private final String allocationDelay; + private final Time allocationDelay; @Nullable private final Long allocationDelayInMillis; @@ -74,11 +89,13 @@ public class AllocationExplainResponse implements PlainJsonSerializable { @Nullable private final Decision canRebalanceCluster; + @Nonnull private final List canRebalanceClusterDecisions; @Nullable private final Decision canRebalanceToOtherNode; + @Nonnull private final List canRemainDecisions; @Nullable @@ -88,7 +105,7 @@ public class AllocationExplainResponse implements PlainJsonSerializable { private final ClusterInfo clusterInfo; @Nullable - private final String configuredDelay; + private final Time configuredDelay; @Nullable private final Long configuredDelayInMillis; @@ -96,22 +113,28 @@ public class AllocationExplainResponse implements PlainJsonSerializable { @Nullable private final CurrentNode currentNode; + @Nonnull private final String currentState; + @Nonnull private final String index; @Nullable private final String moveExplanation; + @Nonnull private final List nodeAllocationDecisions; + @Nullable + private final String note; + private final boolean primary; @Nullable private final String rebalanceExplanation; @Nullable - private final String remainingDelay; + private final Time remainingDelay; @Nullable private final Long remainingDelayInMillis; @@ -121,13 +144,9 @@ public class AllocationExplainResponse implements PlainJsonSerializable { @Nullable private final UnassignedInformation unassignedInfo; - @Nullable - private final String note; - // --------------------------------------------------------------------------------------------- private AllocationExplainResponse(Builder builder) { - this.allocateExplanation = builder.allocateExplanation; this.allocationDelay = builder.allocationDelay; this.allocationDelayInMillis = builder.allocationDelayInMillis; @@ -146,17 +165,16 @@ private AllocationExplainResponse(Builder builder) { this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); this.moveExplanation = builder.moveExplanation; this.nodeAllocationDecisions = ApiTypeHelper.unmodifiable(builder.nodeAllocationDecisions); + this.note = builder.note; this.primary = ApiTypeHelper.requireNonNull(builder.primary, this, "primary"); this.rebalanceExplanation = builder.rebalanceExplanation; this.remainingDelay = builder.remainingDelay; this.remainingDelayInMillis = builder.remainingDelayInMillis; this.shard = ApiTypeHelper.requireNonNull(builder.shard, this, "shard"); this.unassignedInfo = builder.unassignedInfo; - this.note = builder.note; - } - public static AllocationExplainResponse of(Function> fn) { + public static AllocationExplainResponse of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -172,7 +190,7 @@ public final String allocateExplanation() { * API name: {@code allocation_delay} */ @Nullable - public final String allocationDelay() { + public final Time allocationDelay() { return this.allocationDelay; } @@ -211,6 +229,7 @@ public final Decision canRebalanceCluster() { /** * API name: {@code can_rebalance_cluster_decisions} */ + @Nonnull public final List canRebalanceClusterDecisions() { return this.canRebalanceClusterDecisions; } @@ -226,6 +245,7 @@ public final Decision canRebalanceToOtherNode() { /** * API name: {@code can_remain_decisions} */ + @Nonnull public final List canRemainDecisions() { return this.canRemainDecisions; } @@ -250,7 +270,7 @@ public final ClusterInfo clusterInfo() { * API name: {@code configured_delay} */ @Nullable - public final String configuredDelay() { + public final Time configuredDelay() { return this.configuredDelay; } @@ -273,6 +293,7 @@ public final CurrentNode currentNode() { /** * Required - API name: {@code current_state} */ + @Nonnull public final String currentState() { return this.currentState; } @@ -280,6 +301,7 @@ public final String currentState() { /** * Required - API name: {@code index} */ + @Nonnull public final String index() { return this.index; } @@ -295,10 +317,19 @@ public final String moveExplanation() { /** * API name: {@code node_allocation_decisions} */ + @Nonnull public final List nodeAllocationDecisions() { return this.nodeAllocationDecisions; } + /** + * API name: {@code note} + */ + @Nullable + public final String note() { + return this.note; + } + /** * Required - API name: {@code primary} */ @@ -318,7 +349,7 @@ public final String rebalanceExplanation() { * API name: {@code remaining_delay} */ @Nullable - public final String remainingDelay() { + public final Time remainingDelay() { return this.remainingDelay; } @@ -345,17 +376,10 @@ public final UnassignedInformation unassignedInfo() { return this.unassignedInfo; } - /** - * API name: {@code note} - */ - @Nullable - public final String note() { - return this.note; - } - /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -363,82 +387,84 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.allocateExplanation != null) { generator.writeKey("allocate_explanation"); generator.write(this.allocateExplanation); - } + if (this.allocationDelay != null) { generator.writeKey("allocation_delay"); - generator.write(this.allocationDelay); - + this.allocationDelay.serialize(generator, mapper); } + if (this.allocationDelayInMillis != null) { generator.writeKey("allocation_delay_in_millis"); generator.write(this.allocationDelayInMillis); - } + if (this.canAllocate != null) { generator.writeKey("can_allocate"); this.canAllocate.serialize(generator, mapper); } + if (this.canMoveToOtherNode != null) { generator.writeKey("can_move_to_other_node"); this.canMoveToOtherNode.serialize(generator, mapper); } + if (this.canRebalanceCluster != null) { generator.writeKey("can_rebalance_cluster"); this.canRebalanceCluster.serialize(generator, mapper); } + if (ApiTypeHelper.isDefined(this.canRebalanceClusterDecisions)) { generator.writeKey("can_rebalance_cluster_decisions"); generator.writeStartArray(); for (AllocationDecision item0 : this.canRebalanceClusterDecisions) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } + if (this.canRebalanceToOtherNode != null) { generator.writeKey("can_rebalance_to_other_node"); this.canRebalanceToOtherNode.serialize(generator, mapper); } + if (ApiTypeHelper.isDefined(this.canRemainDecisions)) { generator.writeKey("can_remain_decisions"); generator.writeStartArray(); for (AllocationDecision item0 : this.canRemainDecisions) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } + if (this.canRemainOnCurrentNode != null) { generator.writeKey("can_remain_on_current_node"); this.canRemainOnCurrentNode.serialize(generator, mapper); } + if (this.clusterInfo != null) { generator.writeKey("cluster_info"); this.clusterInfo.serialize(generator, mapper); - } + if (this.configuredDelay != null) { generator.writeKey("configured_delay"); - generator.write(this.configuredDelay); - + this.configuredDelay.serialize(generator, mapper); } + if (this.configuredDelayInMillis != null) { generator.writeKey("configured_delay_in_millis"); generator.write(this.configuredDelayInMillis); - } + if (this.currentNode != null) { generator.writeKey("current_node"); this.currentNode.serialize(generator, mapper); - } + generator.writeKey("current_state"); generator.write(this.currentState); @@ -448,133 +474,181 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.moveExplanation != null) { generator.writeKey("move_explanation"); generator.write(this.moveExplanation); - } + if (ApiTypeHelper.isDefined(this.nodeAllocationDecisions)) { generator.writeKey("node_allocation_decisions"); generator.writeStartArray(); for (NodeAllocationExplanation item0 : this.nodeAllocationDecisions) { item0.serialize(generator, mapper); - } generator.writeEnd(); + } + if (this.note != null) { + generator.writeKey("note"); + generator.write(this.note); } + generator.writeKey("primary"); generator.write(this.primary); if (this.rebalanceExplanation != null) { generator.writeKey("rebalance_explanation"); generator.write(this.rebalanceExplanation); - } + if (this.remainingDelay != null) { generator.writeKey("remaining_delay"); - generator.write(this.remainingDelay); - + this.remainingDelay.serialize(generator, mapper); } + if (this.remainingDelayInMillis != null) { generator.writeKey("remaining_delay_in_millis"); generator.write(this.remainingDelayInMillis); - } + generator.writeKey("shard"); generator.write(this.shard); if (this.unassignedInfo != null) { generator.writeKey("unassigned_info"); this.unassignedInfo.serialize(generator, mapper); - } - if (this.note != null) { - generator.writeKey("note"); - generator.write(this.note); + } - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link AllocationExplainResponse}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private String allocateExplanation; - @Nullable - private String allocationDelay; - + private Time allocationDelay; @Nullable private Long allocationDelayInMillis; - @Nullable private Decision canAllocate; - @Nullable private Decision canMoveToOtherNode; - @Nullable private Decision canRebalanceCluster; - @Nullable private List canRebalanceClusterDecisions; - @Nullable private Decision canRebalanceToOtherNode; - @Nullable private List canRemainDecisions; - @Nullable private Decision canRemainOnCurrentNode; - @Nullable private ClusterInfo clusterInfo; - @Nullable - private String configuredDelay; - + private Time configuredDelay; @Nullable private Long configuredDelayInMillis; - @Nullable private CurrentNode currentNode; - private String currentState; - private String index; - @Nullable private String moveExplanation; - @Nullable private List nodeAllocationDecisions; - + @Nullable + private String note; private Boolean primary; - @Nullable private String rebalanceExplanation; - @Nullable - private String remainingDelay; - + private Time remainingDelay; @Nullable private Long remainingDelayInMillis; - private Integer shard; - @Nullable private UnassignedInformation unassignedInfo; - @Nullable - private String note; + public Builder() {} + + private Builder(AllocationExplainResponse o) { + this.allocateExplanation = o.allocateExplanation; + this.allocationDelay = o.allocationDelay; + this.allocationDelayInMillis = o.allocationDelayInMillis; + this.canAllocate = o.canAllocate; + this.canMoveToOtherNode = o.canMoveToOtherNode; + this.canRebalanceCluster = o.canRebalanceCluster; + this.canRebalanceClusterDecisions = _listCopy(o.canRebalanceClusterDecisions); + this.canRebalanceToOtherNode = o.canRebalanceToOtherNode; + this.canRemainDecisions = _listCopy(o.canRemainDecisions); + this.canRemainOnCurrentNode = o.canRemainOnCurrentNode; + this.clusterInfo = o.clusterInfo; + this.configuredDelay = o.configuredDelay; + this.configuredDelayInMillis = o.configuredDelayInMillis; + this.currentNode = o.currentNode; + this.currentState = o.currentState; + this.index = o.index; + this.moveExplanation = o.moveExplanation; + this.nodeAllocationDecisions = _listCopy(o.nodeAllocationDecisions); + this.note = o.note; + this.primary = o.primary; + this.rebalanceExplanation = o.rebalanceExplanation; + this.remainingDelay = o.remainingDelay; + this.remainingDelayInMillis = o.remainingDelayInMillis; + this.shard = o.shard; + this.unassignedInfo = o.unassignedInfo; + } + + private Builder(Builder o) { + this.allocateExplanation = o.allocateExplanation; + this.allocationDelay = o.allocationDelay; + this.allocationDelayInMillis = o.allocationDelayInMillis; + this.canAllocate = o.canAllocate; + this.canMoveToOtherNode = o.canMoveToOtherNode; + this.canRebalanceCluster = o.canRebalanceCluster; + this.canRebalanceClusterDecisions = _listCopy(o.canRebalanceClusterDecisions); + this.canRebalanceToOtherNode = o.canRebalanceToOtherNode; + this.canRemainDecisions = _listCopy(o.canRemainDecisions); + this.canRemainOnCurrentNode = o.canRemainOnCurrentNode; + this.clusterInfo = o.clusterInfo; + this.configuredDelay = o.configuredDelay; + this.configuredDelayInMillis = o.configuredDelayInMillis; + this.currentNode = o.currentNode; + this.currentState = o.currentState; + this.index = o.index; + this.moveExplanation = o.moveExplanation; + this.nodeAllocationDecisions = _listCopy(o.nodeAllocationDecisions); + this.note = o.note; + this.primary = o.primary; + this.rebalanceExplanation = o.rebalanceExplanation; + this.remainingDelay = o.remainingDelay; + this.remainingDelayInMillis = o.remainingDelayInMillis; + this.shard = o.shard; + this.unassignedInfo = o.unassignedInfo; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * API name: {@code allocate_explanation} */ + @Nonnull public final Builder allocateExplanation(@Nullable String value) { this.allocateExplanation = value; return this; @@ -583,14 +657,24 @@ public final Builder allocateExplanation(@Nullable String value) { /** * API name: {@code allocation_delay} */ - public final Builder allocationDelay(@Nullable String value) { + @Nonnull + public final Builder allocationDelay(@Nullable Time value) { this.allocationDelay = value; return this; } + /** + * API name: {@code allocation_delay} + */ + @Nonnull + public final Builder allocationDelay(Function> fn) { + return allocationDelay(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code allocation_delay_in_millis} */ + @Nonnull public final Builder allocationDelayInMillis(@Nullable Long value) { this.allocationDelayInMillis = value; return this; @@ -599,6 +683,7 @@ public final Builder allocationDelayInMillis(@Nullable Long value) { /** * API name: {@code can_allocate} */ + @Nonnull public final Builder canAllocate(@Nullable Decision value) { this.canAllocate = value; return this; @@ -607,6 +692,7 @@ public final Builder canAllocate(@Nullable Decision value) { /** * API name: {@code can_move_to_other_node} */ + @Nonnull public final Builder canMoveToOtherNode(@Nullable Decision value) { this.canMoveToOtherNode = value; return this; @@ -615,6 +701,7 @@ public final Builder canMoveToOtherNode(@Nullable Decision value) { /** * API name: {@code can_rebalance_cluster} */ + @Nonnull public final Builder canRebalanceCluster(@Nullable Decision value) { this.canRebalanceCluster = value; return this; @@ -622,10 +709,12 @@ public final Builder canRebalanceCluster(@Nullable Decision value) { /** * API name: {@code can_rebalance_cluster_decisions} + * *

- * Adds all elements of list to - * canRebalanceClusterDecisions. + * Adds all elements of list to canRebalanceClusterDecisions. + *

*/ + @Nonnull public final Builder canRebalanceClusterDecisions(List list) { this.canRebalanceClusterDecisions = _listAddAll(this.canRebalanceClusterDecisions, list); return this; @@ -633,9 +722,12 @@ public final Builder canRebalanceClusterDecisions(List list) /** * API name: {@code can_rebalance_cluster_decisions} + * *

* Adds one or more values to canRebalanceClusterDecisions. + *

*/ + @Nonnull public final Builder canRebalanceClusterDecisions(AllocationDecision value, AllocationDecision... values) { this.canRebalanceClusterDecisions = _listAdd(this.canRebalanceClusterDecisions, value, values); return this; @@ -643,10 +735,12 @@ public final Builder canRebalanceClusterDecisions(AllocationDecision value, Allo /** * API name: {@code can_rebalance_cluster_decisions} + * *

- * Adds a value to canRebalanceClusterDecisions using a builder - * lambda. + * Adds a value to canRebalanceClusterDecisions using a builder lambda. + *

*/ + @Nonnull public final Builder canRebalanceClusterDecisions(Function> fn) { return canRebalanceClusterDecisions(fn.apply(new AllocationDecision.Builder()).build()); } @@ -654,6 +748,7 @@ public final Builder canRebalanceClusterDecisions(Function * Adds all elements of list to canRemainDecisions. + *

*/ + @Nonnull public final Builder canRemainDecisions(List list) { this.canRemainDecisions = _listAddAll(this.canRemainDecisions, list); return this; @@ -671,9 +769,12 @@ public final Builder canRemainDecisions(List list) { /** * API name: {@code can_remain_decisions} + * *

* Adds one or more values to canRemainDecisions. + *

*/ + @Nonnull public final Builder canRemainDecisions(AllocationDecision value, AllocationDecision... values) { this.canRemainDecisions = _listAdd(this.canRemainDecisions, value, values); return this; @@ -681,9 +782,12 @@ public final Builder canRemainDecisions(AllocationDecision value, AllocationDeci /** * API name: {@code can_remain_decisions} + * *

* Adds a value to canRemainDecisions using a builder lambda. + *

*/ + @Nonnull public final Builder canRemainDecisions(Function> fn) { return canRemainDecisions(fn.apply(new AllocationDecision.Builder()).build()); } @@ -691,6 +795,7 @@ public final Builder canRemainDecisions(Function> fn) { - return this.clusterInfo(fn.apply(new ClusterInfo.Builder()).build()); + return clusterInfo(fn.apply(new ClusterInfo.Builder()).build()); } /** * API name: {@code configured_delay} */ - public final Builder configuredDelay(@Nullable String value) { + @Nonnull + public final Builder configuredDelay(@Nullable Time value) { this.configuredDelay = value; return this; } + /** + * API name: {@code configured_delay} + */ + @Nonnull + public final Builder configuredDelay(Function> fn) { + return configuredDelay(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code configured_delay_in_millis} */ + @Nonnull public final Builder configuredDelayInMillis(@Nullable Long value) { this.configuredDelayInMillis = value; return this; @@ -730,6 +847,7 @@ public final Builder configuredDelayInMillis(@Nullable Long value) { /** * API name: {@code current_node} */ + @Nonnull public final Builder currentNode(@Nullable CurrentNode value) { this.currentNode = value; return this; @@ -738,13 +856,15 @@ public final Builder currentNode(@Nullable CurrentNode value) { /** * API name: {@code current_node} */ + @Nonnull public final Builder currentNode(Function> fn) { - return this.currentNode(fn.apply(new CurrentNode.Builder()).build()); + return currentNode(fn.apply(new CurrentNode.Builder()).build()); } /** * Required - API name: {@code current_state} */ + @Nonnull public final Builder currentState(String value) { this.currentState = value; return this; @@ -753,6 +873,7 @@ public final Builder currentState(String value) { /** * Required - API name: {@code index} */ + @Nonnull public final Builder index(String value) { this.index = value; return this; @@ -761,6 +882,7 @@ public final Builder index(String value) { /** * API name: {@code move_explanation} */ + @Nonnull public final Builder moveExplanation(@Nullable String value) { this.moveExplanation = value; return this; @@ -768,10 +890,12 @@ public final Builder moveExplanation(@Nullable String value) { /** * API name: {@code node_allocation_decisions} + * *

- * Adds all elements of list to - * nodeAllocationDecisions. + * Adds all elements of list to nodeAllocationDecisions. + *

*/ + @Nonnull public final Builder nodeAllocationDecisions(List list) { this.nodeAllocationDecisions = _listAddAll(this.nodeAllocationDecisions, list); return this; @@ -779,9 +903,12 @@ public final Builder nodeAllocationDecisions(List lis /** * API name: {@code node_allocation_decisions} + * *

* Adds one or more values to nodeAllocationDecisions. + *

*/ + @Nonnull public final Builder nodeAllocationDecisions(NodeAllocationExplanation value, NodeAllocationExplanation... values) { this.nodeAllocationDecisions = _listAdd(this.nodeAllocationDecisions, value, values); return this; @@ -789,18 +916,31 @@ public final Builder nodeAllocationDecisions(NodeAllocationExplanation value, No /** * API name: {@code node_allocation_decisions} + * *

* Adds a value to nodeAllocationDecisions using a builder lambda. + *

*/ + @Nonnull public final Builder nodeAllocationDecisions( Function> fn ) { return nodeAllocationDecisions(fn.apply(new NodeAllocationExplanation.Builder()).build()); } + /** + * API name: {@code note} + */ + @Nonnull + public final Builder note(@Nullable String value) { + this.note = value; + return this; + } + /** * Required - API name: {@code primary} */ + @Nonnull public final Builder primary(boolean value) { this.primary = value; return this; @@ -809,6 +949,7 @@ public final Builder primary(boolean value) { /** * API name: {@code rebalance_explanation} */ + @Nonnull public final Builder rebalanceExplanation(@Nullable String value) { this.rebalanceExplanation = value; return this; @@ -817,14 +958,24 @@ public final Builder rebalanceExplanation(@Nullable String value) { /** * API name: {@code remaining_delay} */ - public final Builder remainingDelay(@Nullable String value) { + @Nonnull + public final Builder remainingDelay(@Nullable Time value) { this.remainingDelay = value; return this; } + /** + * API name: {@code remaining_delay} + */ + @Nonnull + public final Builder remainingDelay(Function> fn) { + return remainingDelay(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code remaining_delay_in_millis} */ + @Nonnull public final Builder remainingDelayInMillis(@Nullable Long value) { this.remainingDelayInMillis = value; return this; @@ -833,6 +984,7 @@ public final Builder remainingDelayInMillis(@Nullable Long value) { /** * Required - API name: {@code shard} */ + @Nonnull public final Builder shard(int value) { this.shard = value; return this; @@ -841,6 +993,7 @@ public final Builder shard(int value) { /** * API name: {@code unassigned_info} */ + @Nonnull public final Builder unassignedInfo(@Nullable UnassignedInformation value) { this.unassignedInfo = value; return this; @@ -849,24 +1002,18 @@ public final Builder unassignedInfo(@Nullable UnassignedInformation value) { /** * API name: {@code unassigned_info} */ + @Nonnull public final Builder unassignedInfo(Function> fn) { - return this.unassignedInfo(fn.apply(new UnassignedInformation.Builder()).build()); - } - - /** - * API name: {@code note} - */ - public final Builder note(@Nullable String value) { - this.note = value; - return this; + return unassignedInfo(fn.apply(new UnassignedInformation.Builder()).build()); } /** * Builds a {@link AllocationExplainResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public AllocationExplainResponse build() { _checkSingleUse(); @@ -885,9 +1032,8 @@ public AllocationExplainResponse build() { ); protected static void setupAllocationExplainResponseDeserializer(ObjectDeserializer op) { - op.add(Builder::allocateExplanation, JsonpDeserializer.stringDeserializer(), "allocate_explanation"); - op.add(Builder::allocationDelay, JsonpDeserializer.stringDeserializer(), "allocation_delay"); + op.add(Builder::allocationDelay, Time._DESERIALIZER, "allocation_delay"); op.add(Builder::allocationDelayInMillis, JsonpDeserializer.longDeserializer(), "allocation_delay_in_millis"); op.add(Builder::canAllocate, Decision._DESERIALIZER, "can_allocate"); op.add(Builder::canMoveToOtherNode, Decision._DESERIALIZER, "can_move_to_other_node"); @@ -901,7 +1047,7 @@ protected static void setupAllocationExplainResponseDeserializer(ObjectDeseriali op.add(Builder::canRemainDecisions, JsonpDeserializer.arrayDeserializer(AllocationDecision._DESERIALIZER), "can_remain_decisions"); op.add(Builder::canRemainOnCurrentNode, Decision._DESERIALIZER, "can_remain_on_current_node"); op.add(Builder::clusterInfo, ClusterInfo._DESERIALIZER, "cluster_info"); - op.add(Builder::configuredDelay, JsonpDeserializer.stringDeserializer(), "configured_delay"); + op.add(Builder::configuredDelay, Time._DESERIALIZER, "configured_delay"); op.add(Builder::configuredDelayInMillis, JsonpDeserializer.longDeserializer(), "configured_delay_in_millis"); op.add(Builder::currentNode, CurrentNode._DESERIALIZER, "current_node"); op.add(Builder::currentState, JsonpDeserializer.stringDeserializer(), "current_state"); @@ -912,14 +1058,75 @@ protected static void setupAllocationExplainResponseDeserializer(ObjectDeseriali JsonpDeserializer.arrayDeserializer(NodeAllocationExplanation._DESERIALIZER), "node_allocation_decisions" ); + op.add(Builder::note, JsonpDeserializer.stringDeserializer(), "note"); op.add(Builder::primary, JsonpDeserializer.booleanDeserializer(), "primary"); op.add(Builder::rebalanceExplanation, JsonpDeserializer.stringDeserializer(), "rebalance_explanation"); - op.add(Builder::remainingDelay, JsonpDeserializer.stringDeserializer(), "remaining_delay"); + op.add(Builder::remainingDelay, Time._DESERIALIZER, "remaining_delay"); op.add(Builder::remainingDelayInMillis, JsonpDeserializer.longDeserializer(), "remaining_delay_in_millis"); op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard"); op.add(Builder::unassignedInfo, UnassignedInformation._DESERIALIZER, "unassigned_info"); - op.add(Builder::note, JsonpDeserializer.stringDeserializer(), "note"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allocateExplanation); + result = 31 * result + Objects.hashCode(this.allocationDelay); + result = 31 * result + Objects.hashCode(this.allocationDelayInMillis); + result = 31 * result + Objects.hashCode(this.canAllocate); + result = 31 * result + Objects.hashCode(this.canMoveToOtherNode); + result = 31 * result + Objects.hashCode(this.canRebalanceCluster); + result = 31 * result + Objects.hashCode(this.canRebalanceClusterDecisions); + result = 31 * result + Objects.hashCode(this.canRebalanceToOtherNode); + result = 31 * result + Objects.hashCode(this.canRemainDecisions); + result = 31 * result + Objects.hashCode(this.canRemainOnCurrentNode); + result = 31 * result + Objects.hashCode(this.clusterInfo); + result = 31 * result + Objects.hashCode(this.configuredDelay); + result = 31 * result + Objects.hashCode(this.configuredDelayInMillis); + result = 31 * result + Objects.hashCode(this.currentNode); + result = 31 * result + this.currentState.hashCode(); + result = 31 * result + this.index.hashCode(); + result = 31 * result + Objects.hashCode(this.moveExplanation); + result = 31 * result + Objects.hashCode(this.nodeAllocationDecisions); + result = 31 * result + Objects.hashCode(this.note); + result = 31 * result + Boolean.hashCode(this.primary); + result = 31 * result + Objects.hashCode(this.rebalanceExplanation); + result = 31 * result + Objects.hashCode(this.remainingDelay); + result = 31 * result + Objects.hashCode(this.remainingDelayInMillis); + result = 31 * result + Integer.hashCode(this.shard); + result = 31 * result + Objects.hashCode(this.unassignedInfo); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + AllocationExplainResponse other = (AllocationExplainResponse) o; + return Objects.equals(this.allocateExplanation, other.allocateExplanation) + && Objects.equals(this.allocationDelay, other.allocationDelay) + && Objects.equals(this.allocationDelayInMillis, other.allocationDelayInMillis) + && Objects.equals(this.canAllocate, other.canAllocate) + && Objects.equals(this.canMoveToOtherNode, other.canMoveToOtherNode) + && Objects.equals(this.canRebalanceCluster, other.canRebalanceCluster) + && Objects.equals(this.canRebalanceClusterDecisions, other.canRebalanceClusterDecisions) + && Objects.equals(this.canRebalanceToOtherNode, other.canRebalanceToOtherNode) + && Objects.equals(this.canRemainDecisions, other.canRemainDecisions) + && Objects.equals(this.canRemainOnCurrentNode, other.canRemainOnCurrentNode) + && Objects.equals(this.clusterInfo, other.clusterInfo) + && Objects.equals(this.configuredDelay, other.configuredDelay) + && Objects.equals(this.configuredDelayInMillis, other.configuredDelayInMillis) + && Objects.equals(this.currentNode, other.currentNode) + && this.currentState.equals(other.currentState) + && this.index.equals(other.index) + && Objects.equals(this.moveExplanation, other.moveExplanation) + && Objects.equals(this.nodeAllocationDecisions, other.nodeAllocationDecisions) + && Objects.equals(this.note, other.note) + && this.primary == other.primary + && Objects.equals(this.rebalanceExplanation, other.rebalanceExplanation) + && Objects.equals(this.remainingDelay, other.remainingDelay) + && Objects.equals(this.remainingDelayInMillis, other.remainingDelayInMillis) + && this.shard == other.shard + && Objects.equals(this.unassignedInfo, other.unassignedInfo); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/ClusterStatsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/ClusterStatsRequest.java new file mode 100644 index 0000000000..12ad974985 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/ClusterStatsRequest.java @@ -0,0 +1,444 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.cluster; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.RequestBase; +import org.opensearch.client.opensearch._types.Time; +import org.opensearch.client.opensearch.cluster.stats.IndexMetric; +import org.opensearch.client.opensearch.cluster.stats.Metric; +import org.opensearch.client.transport.Endpoint; +import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: cluster.stats.Request + +/** + * Returns high-level overview of cluster statistics. + */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterStatsRequest extends RequestBase implements ToCopyableBuilder { + + @Nullable + private final Boolean flatSettings; + + @Nonnull + private final List indexMetric; + + @Nonnull + private final List metric; + + @Nonnull + private final List nodeId; + + @Nullable + private final Time timeout; + + // --------------------------------------------------------------------------------------------- + + private ClusterStatsRequest(Builder builder) { + this.flatSettings = builder.flatSettings; + this.indexMetric = ApiTypeHelper.unmodifiable(builder.indexMetric); + this.metric = ApiTypeHelper.unmodifiable(builder.metric); + this.nodeId = ApiTypeHelper.unmodifiable(builder.nodeId); + this.timeout = builder.timeout; + } + + public static ClusterStatsRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * If true, returns settings in flat format. + *

+ * API name: {@code flat_settings} + *

+ */ + @Nullable + public final Boolean flatSettings() { + return this.flatSettings; + } + + /** + * Limit the information returned for indexes metric to the specific index metrics. It can be used only if indexes (or all) metric is + * specified. + *

+ * API name: {@code index_metric} + *

+ */ + @Nonnull + public final List indexMetric() { + return this.indexMetric; + } + + /** + * Limit the information returned to the specified metrics. + *

+ * API name: {@code metric} + *

+ */ + @Nonnull + public final List metric() { + return this.metric; + } + + /** + * Comma-separated list of node filters used to limit returned information. Defaults to all nodes in the cluster. + *

+ * API name: {@code node_id} + *

+ */ + @Nonnull + public final List nodeId() { + return this.nodeId; + } + + /** + * Period to wait for each node to respond. If a node does not respond before its timeout expires, the response does not include its + * stats. However, timed out nodes are included in the response's _nodes.failed property. Defaults to no timeout. + *

+ * API name: {@code timeout} + *

+ */ + @Nullable + public final Time timeout() { + return this.timeout; + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link ClusterStatsRequest}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Boolean flatSettings; + @Nullable + private List indexMetric; + @Nullable + private List metric; + @Nullable + private List nodeId; + @Nullable + private Time timeout; + + public Builder() {} + + private Builder(ClusterStatsRequest o) { + this.flatSettings = o.flatSettings; + this.indexMetric = _listCopy(o.indexMetric); + this.metric = _listCopy(o.metric); + this.nodeId = _listCopy(o.nodeId); + this.timeout = o.timeout; + } + + private Builder(Builder o) { + this.flatSettings = o.flatSettings; + this.indexMetric = _listCopy(o.indexMetric); + this.metric = _listCopy(o.metric); + this.nodeId = _listCopy(o.nodeId); + this.timeout = o.timeout; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * If true, returns settings in flat format. + *

+ * API name: {@code flat_settings} + *

+ */ + @Nonnull + public final Builder flatSettings(@Nullable Boolean value) { + this.flatSettings = value; + return this; + } + + /** + * Limit the information returned for indexes metric to the specific index metrics. It can be used only if indexes (or all) metric + * is specified. + *

+ * API name: {@code index_metric} + *

+ * + *

+ * Adds all elements of list to indexMetric. + *

+ */ + @Nonnull + public final Builder indexMetric(List list) { + this.indexMetric = _listAddAll(this.indexMetric, list); + return this; + } + + /** + * Limit the information returned for indexes metric to the specific index metrics. It can be used only if indexes (or all) metric + * is specified. + *

+ * API name: {@code index_metric} + *

+ * + *

+ * Adds one or more values to indexMetric. + *

+ */ + @Nonnull + public final Builder indexMetric(IndexMetric value, IndexMetric... values) { + this.indexMetric = _listAdd(this.indexMetric, value, values); + return this; + } + + /** + * Limit the information returned to the specified metrics. + *

+ * API name: {@code metric} + *

+ * + *

+ * Adds all elements of list to metric. + *

+ */ + @Nonnull + public final Builder metric(List list) { + this.metric = _listAddAll(this.metric, list); + return this; + } + + /** + * Limit the information returned to the specified metrics. + *

+ * API name: {@code metric} + *

+ * + *

+ * Adds one or more values to metric. + *

+ */ + @Nonnull + public final Builder metric(Metric value, Metric... values) { + this.metric = _listAdd(this.metric, value, values); + return this; + } + + /** + * Comma-separated list of node filters used to limit returned information. Defaults to all nodes in the cluster. + *

+ * API name: {@code node_id} + *

+ * + *

+ * Adds all elements of list to nodeId. + *

+ */ + @Nonnull + public final Builder nodeId(List list) { + this.nodeId = _listAddAll(this.nodeId, list); + return this; + } + + /** + * Comma-separated list of node filters used to limit returned information. Defaults to all nodes in the cluster. + *

+ * API name: {@code node_id} + *

+ * + *

+ * Adds one or more values to nodeId. + *

+ */ + @Nonnull + public final Builder nodeId(String value, String... values) { + this.nodeId = _listAdd(this.nodeId, value, values); + return this; + } + + /** + * Period to wait for each node to respond. If a node does not respond before its timeout expires, the response does not include its + * stats. However, timed out nodes are included in the response's _nodes.failed property. Defaults to no timeout. + *

+ * API name: {@code timeout} + *

+ */ + @Nonnull + public final Builder timeout(@Nullable Time value) { + this.timeout = value; + return this; + } + + /** + * Period to wait for each node to respond. If a node does not respond before its timeout expires, the response does not include its + * stats. However, timed out nodes are included in the response's _nodes.failed property. Defaults to no timeout. + *

+ * API name: {@code timeout} + *

+ */ + @Nonnull + public final Builder timeout(Function> fn) { + return timeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Builds a {@link ClusterStatsRequest}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public ClusterStatsRequest build() { + _checkSingleUse(); + + return new ClusterStatsRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code cluster.stats}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + // Request method + request -> "GET", + // Request path + request -> { + final int _indexMetric = 1 << 0; + final int _metric = 1 << 1; + final int _nodeId = 1 << 2; + + int propsSet = 0; + + if (ApiTypeHelper.isDefined(request.indexMetric())) propsSet |= _indexMetric; + if (ApiTypeHelper.isDefined(request.metric())) propsSet |= _metric; + if (ApiTypeHelper.isDefined(request.nodeId())) propsSet |= _nodeId; + + if (propsSet == 0) { + return "/_cluster/stats"; + } + if (propsSet == (_metric | _indexMetric | _nodeId)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_cluster/stats/"); + SimpleEndpoint.pathEncode(request.metric.stream().map(v -> v.jsonValue()).collect(Collectors.joining(",")), buf); + buf.append("/"); + SimpleEndpoint.pathEncode(request.indexMetric.stream().map(v -> v.jsonValue()).collect(Collectors.joining(",")), buf); + buf.append("/nodes/"); + SimpleEndpoint.pathEncode(String.join(",", request.nodeId), buf); + return buf.toString(); + } + if (propsSet == (_metric | _nodeId)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_cluster/stats/"); + SimpleEndpoint.pathEncode(request.metric.stream().map(v -> v.jsonValue()).collect(Collectors.joining(",")), buf); + buf.append("/nodes/"); + SimpleEndpoint.pathEncode(String.join(",", request.nodeId), buf); + return buf.toString(); + } + if (propsSet == (_nodeId)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_cluster/stats/nodes/"); + SimpleEndpoint.pathEncode(String.join(",", request.nodeId), buf); + return buf.toString(); + } + + throw SimpleEndpoint.noPathTemplateFound("path"); + }, + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.flatSettings != null) { + params.put("flat_settings", String.valueOf(request.flatSettings)); + } + if (request.timeout != null) { + params.put("timeout", request.timeout._toJsonString()); + } + return params; + }, + SimpleEndpoint.emptyMap(), + false, + ClusterStatsResponse._DESERIALIZER + ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.flatSettings); + result = 31 * result + Objects.hashCode(this.indexMetric); + result = 31 * result + Objects.hashCode(this.metric); + result = 31 * result + Objects.hashCode(this.nodeId); + result = 31 * result + Objects.hashCode(this.timeout); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterStatsRequest other = (ClusterStatsRequest) o; + return Objects.equals(this.flatSettings, other.flatSettings) + && Objects.equals(this.indexMetric, other.indexMetric) + && Objects.equals(this.metric, other.metric) + && Objects.equals(this.nodeId, other.nodeId) + && Objects.equals(this.timeout, other.timeout); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/ClusterStatsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/ClusterStatsResponse.java similarity index 60% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/ClusterStatsResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/ClusterStatsResponse.java index 1eda289d1d..11e321356a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/ClusterStatsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/ClusterStatsResponse.java @@ -30,10 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; 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; @@ -44,20 +52,31 @@ import org.opensearch.client.opensearch.cluster.stats.ClusterNodes; import org.opensearch.client.opensearch.nodes.NodesResponseBase; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.stats.Response @JsonpDeserializable -public class ClusterStatsResponse extends NodesResponseBase { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterStatsResponse extends NodesResponseBase + implements + ToCopyableBuilder { + + @Nonnull private final String clusterName; + @Nonnull private final String clusterUuid; + @Nullable private final ClusterIndices indices; + @Nullable private final ClusterNodes nodes; + @Nonnull private final HealthStatus status; private final long timestamp; @@ -66,17 +85,15 @@ public class ClusterStatsResponse extends NodesResponseBase { private ClusterStatsResponse(Builder builder) { super(builder); - this.clusterName = ApiTypeHelper.requireNonNull(builder.clusterName, this, "clusterName"); this.clusterUuid = ApiTypeHelper.requireNonNull(builder.clusterUuid, this, "clusterUuid"); - this.indices = ApiTypeHelper.requireNonNull(builder.indices, this, "indices"); - this.nodes = ApiTypeHelper.requireNonNull(builder.nodes, this, "nodes"); + this.indices = builder.indices; + this.nodes = builder.nodes; this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); this.timestamp = ApiTypeHelper.requireNonNull(builder.timestamp, this, "timestamp"); - } - public static ClusterStatsResponse of(Function> fn) { + public static ClusterStatsResponse of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -84,7 +101,9 @@ public static ClusterStatsResponse of(Function * API name: {@code cluster_name} + *

*/ + @Nonnull public final String clusterName() { return this.clusterName; } @@ -93,53 +112,57 @@ public final String clusterName() { * Required - Unique identifier for the cluster. *

* API name: {@code cluster_uuid} + *

*/ + @Nonnull public final String clusterUuid() { return this.clusterUuid; } /** - * Required - Contains statistics about indices with shards assigned to selected - * nodes. + * Contains statistics about indices with shards assigned to selected nodes. *

* API name: {@code indices} + *

*/ + @Nullable public final ClusterIndices indices() { return this.indices; } /** - * Required - Contains statistics about nodes selected by the request's node - * filters. + * Contains statistics about nodes selected by the request's node filters. *

* API name: {@code nodes} + *

*/ + @Nullable public final ClusterNodes nodes() { return this.nodes; } /** - * Required - Health status of the cluster, based on the state of its primary - * and replica shards. + * Required - Health status of the cluster, based on the state of its primary and replica shards. *

* API name: {@code status} + *

*/ + @Nonnull public final HealthStatus status() { return this.status; } /** - * Required - Unix timestamp, in milliseconds, of the last time the cluster - * statistics were refreshed. + * Required - Unix timestamp, in milliseconds, for the last time the cluster statistics were refreshed. *

* API name: {@code timestamp} + *

*/ public final long timestamp() { return this.timestamp; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); generator.writeKey("cluster_name"); generator.write(this.clusterName); @@ -147,43 +170,92 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("cluster_uuid"); generator.write(this.clusterUuid); - generator.writeKey("indices"); - this.indices.serialize(generator, mapper); + if (this.indices != null) { + generator.writeKey("indices"); + this.indices.serialize(generator, mapper); + } - generator.writeKey("nodes"); - this.nodes.serialize(generator, mapper); + if (this.nodes != null) { + generator.writeKey("nodes"); + this.nodes.serialize(generator, mapper); + } generator.writeKey("status"); this.status.serialize(generator, mapper); + generator.writeKey("timestamp"); generator.write(this.timestamp); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ClusterStatsResponse}. */ - - public static class Builder extends NodesResponseBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends NodesResponseBase.AbstractBuilder + implements + CopyableBuilder { private String clusterName; - private String clusterUuid; - + @Nullable private ClusterIndices indices; - + @Nullable private ClusterNodes nodes; - private HealthStatus status; - private Long timestamp; + public Builder() {} + + private Builder(ClusterStatsResponse o) { + super(o); + this.clusterName = o.clusterName; + this.clusterUuid = o.clusterUuid; + this.indices = o.indices; + this.nodes = o.nodes; + this.status = o.status; + this.timestamp = o.timestamp; + } + + private Builder(Builder o) { + super(o); + this.clusterName = o.clusterName; + this.clusterUuid = o.clusterUuid; + this.indices = o.indices; + this.nodes = o.nodes; + this.status = o.status; + this.timestamp = o.timestamp; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * Required - Name of the cluster, based on the Cluster name setting setting. *

* API name: {@code cluster_name} + *

*/ + @Nonnull public final Builder clusterName(String value) { this.clusterName = value; return this; @@ -193,87 +265,91 @@ public final Builder clusterName(String value) { * Required - Unique identifier for the cluster. *

* API name: {@code cluster_uuid} + *

*/ + @Nonnull public final Builder clusterUuid(String value) { this.clusterUuid = value; return this; } /** - * Required - Contains statistics about indices with shards assigned to selected - * nodes. + * Contains statistics about indices with shards assigned to selected nodes. *

* API name: {@code indices} + *

*/ - public final Builder indices(ClusterIndices value) { + @Nonnull + public final Builder indices(@Nullable ClusterIndices value) { this.indices = value; return this; } /** - * Required - Contains statistics about indices with shards assigned to selected - * nodes. + * Contains statistics about indices with shards assigned to selected nodes. *

* API name: {@code indices} + *

*/ + @Nonnull public final Builder indices(Function> fn) { - return this.indices(fn.apply(new ClusterIndices.Builder()).build()); + return indices(fn.apply(new ClusterIndices.Builder()).build()); } /** - * Required - Contains statistics about nodes selected by the request's node - * filters. + * Contains statistics about nodes selected by the request's node filters. *

* API name: {@code nodes} + *

*/ - public final Builder nodes(ClusterNodes value) { + @Nonnull + public final Builder nodes(@Nullable ClusterNodes value) { this.nodes = value; return this; } /** - * Required - Contains statistics about nodes selected by the request's node - * filters. + * Contains statistics about nodes selected by the request's node filters. *

* API name: {@code nodes} + *

*/ + @Nonnull public final Builder nodes(Function> fn) { - return this.nodes(fn.apply(new ClusterNodes.Builder()).build()); + return nodes(fn.apply(new ClusterNodes.Builder()).build()); } /** - * Required - Health status of the cluster, based on the state of its primary - * and replica shards. + * Required - Health status of the cluster, based on the state of its primary and replica shards. *

* API name: {@code status} + *

*/ + @Nonnull public final Builder status(HealthStatus value) { this.status = value; return this; } /** - * Required - Unix timestamp, in milliseconds, of the last time the cluster - * statistics were refreshed. + * Required - Unix timestamp, in milliseconds, for the last time the cluster statistics were refreshed. *

* API name: {@code timestamp} + *

*/ + @Nonnull public final Builder timestamp(long value) { this.timestamp = value; return this; } - @Override - protected Builder self() { - return this; - } - /** * Builds a {@link ClusterStatsResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ClusterStatsResponse build() { _checkSingleUse(); @@ -292,14 +368,40 @@ public ClusterStatsResponse build() { ); protected static void setupClusterStatsResponseDeserializer(ObjectDeserializer op) { - NodesResponseBase.setupNodesResponseBaseDeserializer(op); + setupNodesResponseBaseDeserializer(op); op.add(Builder::clusterName, JsonpDeserializer.stringDeserializer(), "cluster_name"); op.add(Builder::clusterUuid, JsonpDeserializer.stringDeserializer(), "cluster_uuid"); op.add(Builder::indices, ClusterIndices._DESERIALIZER, "indices"); op.add(Builder::nodes, ClusterNodes._DESERIALIZER, "nodes"); op.add(Builder::status, HealthStatus._DESERIALIZER, "status"); op.add(Builder::timestamp, JsonpDeserializer.longDeserializer(), "timestamp"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + this.clusterName.hashCode(); + result = 31 * result + this.clusterUuid.hashCode(); + result = 31 * result + Objects.hashCode(this.indices); + result = 31 * result + Objects.hashCode(this.nodes); + result = 31 * result + this.status.hashCode(); + result = 31 * result + Long.hashCode(this.timestamp); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterStatsResponse other = (ClusterStatsResponse) o; + return this.clusterName.equals(other.clusterName) + && this.clusterUuid.equals(other.clusterUuid) + && Objects.equals(this.indices, other.indices) + && Objects.equals(this.nodes, other.nodes) + && this.status.equals(other.status) + && this.timestamp == other.timestamp; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/ComponentTemplate.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/ComponentTemplate.java similarity index 69% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/ComponentTemplate.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/ComponentTemplate.java index a6cce10988..b1f1bdbf16 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/ComponentTemplate.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/ComponentTemplate.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,47 +47,54 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; -// typedef: cluster._types.ComponentTemplate +// typedef: cluster.ComponentTemplate @JsonpDeserializable -public class ComponentTemplate implements PlainJsonSerializable { - private final String name; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ComponentTemplate implements PlainJsonSerializable, ToCopyableBuilder { + @Nonnull private final ComponentTemplateNode componentTemplate; + @Nonnull + private final String name; + // --------------------------------------------------------------------------------------------- private ComponentTemplate(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); this.componentTemplate = ApiTypeHelper.requireNonNull(builder.componentTemplate, this, "componentTemplate"); - + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); } - public static ComponentTemplate of(Function> fn) { + public static ComponentTemplate of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code name} + * Required - API name: {@code component_template} */ - public final String name() { - return this.name; + @Nonnull + public final ComponentTemplateNode componentTemplate() { + return this.componentTemplate; } /** - * Required - API name: {@code component_template} + * Required - API name: {@code name} */ - public final ComponentTemplateNode componentTemplate() { - return this.componentTemplate; + @Nonnull + public final String name() { + return this.name; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,37 +102,55 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("component_template"); + this.componentTemplate.serialize(generator, mapper); generator.writeKey("name"); generator.write(this.name); + } - generator.writeKey("component_template"); - this.componentTemplate.serialize(generator, mapper); + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link ComponentTemplate}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private ComponentTemplateNode componentTemplate; private String name; - private ComponentTemplateNode componentTemplate; + public Builder() {} - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; + private Builder(ComponentTemplate o) { + this.componentTemplate = o.componentTemplate; + this.name = o.name; + } + + private Builder(Builder o) { + this.componentTemplate = o.componentTemplate; + this.name = o.name; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** * Required - API name: {@code component_template} */ + @Nonnull public final Builder componentTemplate(ComponentTemplateNode value) { this.componentTemplate = value; return this; @@ -128,16 +159,27 @@ public final Builder componentTemplate(ComponentTemplateNode value) { /** * Required - API name: {@code component_template} */ + @Nonnull public final Builder componentTemplate(Function> fn) { - return this.componentTemplate(fn.apply(new ComponentTemplateNode.Builder()).build()); + return componentTemplate(fn.apply(new ComponentTemplateNode.Builder()).build()); + } + + /** + * Required - API name: {@code name} + */ + @Nonnull + public final Builder name(String value) { + this.name = value; + return this; } /** * Builds a {@link ComponentTemplate}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ComponentTemplate build() { _checkSingleUse(); @@ -156,10 +198,23 @@ public ComponentTemplate build() { ); protected static void setupComponentTemplateDeserializer(ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); op.add(Builder::componentTemplate, ComponentTemplateNode._DESERIALIZER, "component_template"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.componentTemplate.hashCode(); + result = 31 * result + this.name.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ComponentTemplate other = (ComponentTemplate) o; + return this.componentTemplate.equals(other.componentTemplate) && this.name.equals(other.name); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/ComponentTemplateNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/ComponentTemplateNode.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/ComponentTemplateNode.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/ComponentTemplateNode.java index 1b2273457d..19a28d99d2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/ComponentTemplateNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/ComponentTemplateNode.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import jakarta.json.stream.JsonGenerator; import java.util.Map; +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.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -44,37 +51,53 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; -// typedef: cluster._types.ComponentTemplateNode +// typedef: cluster.ComponentTemplateNode @JsonpDeserializable -public class ComponentTemplateNode implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ComponentTemplateNode + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final Map meta; + + @Nonnull private final ComponentTemplateSummary template; @Nullable private final Long version; - private final Map meta; - // --------------------------------------------------------------------------------------------- private ComponentTemplateNode(Builder builder) { - + this.meta = ApiTypeHelper.unmodifiable(builder.meta); this.template = ApiTypeHelper.requireNonNull(builder.template, this, "template"); this.version = builder.version; - this.meta = ApiTypeHelper.unmodifiable(builder.meta); - } - public static ComponentTemplateNode of(Function> fn) { + public static ComponentTemplateNode of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * API name: {@code _meta} + */ + @Nonnull + public final Map meta() { + return this.meta; + } + /** * Required - API name: {@code template} */ + @Nonnull public final ComponentTemplateSummary template() { return this.template; } @@ -87,16 +110,10 @@ public final Long version() { return this.version; } - /** - * API name: {@code _meta} - */ - public final Map meta() { - return this.meta; - } - /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -104,72 +121,76 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("template"); - this.template.serialize(generator, mapper); - - if (this.version != null) { - generator.writeKey("version"); - generator.write(this.version); - - } if (ApiTypeHelper.isDefined(this.meta)) { generator.writeKey("_meta"); generator.writeStartObject(); for (Map.Entry item0 : this.meta.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + generator.writeKey("template"); + this.template.serialize(generator, mapper); + + if (this.version != null) { + generator.writeKey("version"); + generator.write(this.version); + } } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ComponentTemplateNode}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Map meta; private ComponentTemplateSummary template; - @Nullable private Long version; - @Nullable - private Map meta; + public Builder() {} - /** - * Required - API name: {@code template} - */ - public final Builder template(ComponentTemplateSummary value) { - this.template = value; - return this; + private Builder(ComponentTemplateNode o) { + this.meta = _mapCopy(o.meta); + this.template = o.template; + this.version = o.version; } - /** - * Required - API name: {@code template} - */ - public final Builder template(Function> fn) { - return this.template(fn.apply(new ComponentTemplateSummary.Builder()).build()); + private Builder(Builder o) { + this.meta = _mapCopy(o.meta); + this.template = o.template; + this.version = o.version; } - /** - * API name: {@code version} - */ - public final Builder version(@Nullable Long value) { - this.version = value; - return this; + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** * API name: {@code _meta} + * *

- * Adds all entries of map to meta. + * Adds all elements of map to meta. + *

*/ + @Nonnull public final Builder meta(Map map) { this.meta = _mapPutAll(this.meta, map); return this; @@ -177,20 +198,50 @@ public final Builder meta(Map map) { /** * API name: {@code _meta} + * *

* Adds an entry to meta. + *

*/ + @Nonnull public final Builder meta(String key, JsonData value) { this.meta = _mapPut(this.meta, key, value); return this; } + /** + * Required - API name: {@code template} + */ + @Nonnull + public final Builder template(ComponentTemplateSummary value) { + this.template = value; + return this; + } + + /** + * Required - API name: {@code template} + */ + @Nonnull + public final Builder template(Function> fn) { + return template(fn.apply(new ComponentTemplateSummary.Builder()).build()); + } + + /** + * API name: {@code version} + */ + @Nonnull + public final Builder version(@Nullable Long value) { + this.version = value; + return this; + } + /** * Builds a {@link ComponentTemplateNode}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ComponentTemplateNode build() { _checkSingleUse(); @@ -209,11 +260,25 @@ public ComponentTemplateNode build() { ); protected static void setupComponentTemplateNodeDeserializer(ObjectDeserializer op) { - + op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); op.add(Builder::template, ComponentTemplateSummary._DESERIALIZER, "template"); op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); - op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.meta); + result = 31 * result + this.template.hashCode(); + result = 31 * result + Objects.hashCode(this.version); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ComponentTemplateNode other = (ComponentTemplateNode) o; + return Objects.equals(this.meta, other.meta) && this.template.equals(other.template) && Objects.equals(this.version, other.version); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/ComponentTemplateSummary.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/ComponentTemplateSummary.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/ComponentTemplateSummary.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/ComponentTemplateSummary.java index 3f6006441e..ff0fda7efc 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/ComponentTemplateSummary.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/ComponentTemplateSummary.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import jakarta.json.stream.JsonGenerator; import java.util.Map; +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.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -47,81 +54,93 @@ import org.opensearch.client.opensearch.indices.AliasDefinition; import org.opensearch.client.opensearch.indices.IndexSettings; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; -// typedef: cluster._types.ComponentTemplateSummary +// typedef: cluster.ComponentTemplateSummary @JsonpDeserializable -public class ComponentTemplateSummary implements PlainJsonSerializable { - private final Map meta; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ComponentTemplateSummary + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final Map aliases; @Nullable - private final Long version; + private final TypeMapping mappings; + @Nonnull + private final Map meta; + + @Nonnull private final Map settings; @Nullable - private final TypeMapping mappings; - - private final Map aliases; + private final Long version; // --------------------------------------------------------------------------------------------- private ComponentTemplateSummary(Builder builder) { - + this.aliases = ApiTypeHelper.unmodifiable(builder.aliases); + this.mappings = builder.mappings; this.meta = ApiTypeHelper.unmodifiable(builder.meta); + this.settings = ApiTypeHelper.unmodifiable(builder.settings); this.version = builder.version; - this.settings = ApiTypeHelper.unmodifiableRequired(builder.settings, this, "settings"); - this.mappings = builder.mappings; - this.aliases = ApiTypeHelper.unmodifiable(builder.aliases); - } - public static ComponentTemplateSummary of(Function> fn) { + public static ComponentTemplateSummary of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * API name: {@code _meta} + * API name: {@code aliases} */ - public final Map meta() { - return this.meta; + @Nonnull + public final Map aliases() { + return this.aliases; } /** - * API name: {@code version} + * API name: {@code mappings} */ @Nullable - public final Long version() { - return this.version; + public final TypeMapping mappings() { + return this.mappings; } /** - * Required - API name: {@code settings} + * API name: {@code _meta} */ - public final Map settings() { - return this.settings; + @Nonnull + public final Map meta() { + return this.meta; } /** - * API name: {@code mappings} + * API name: {@code settings} */ - @Nullable - public final TypeMapping mappings() { - return this.mappings; + @Nonnull + public final Map settings() { + return this.settings; } /** - * API name: {@code aliases} + * API name: {@code version} */ - public final Map aliases() { - return this.aliases; + @Nullable + public final Long version() { + return this.version; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -129,6 +148,20 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (ApiTypeHelper.isDefined(this.aliases)) { + generator.writeKey("aliases"); + generator.writeStartObject(); + for (Map.Entry item0 : this.aliases.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + + if (this.mappings != null) { + generator.writeKey("mappings"); + this.mappings.serialize(generator, mapper); + } if (ApiTypeHelper.isDefined(this.meta)) { generator.writeKey("_meta"); @@ -136,174 +169,213 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { for (Map.Entry item0 : this.meta.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } - if (this.version != null) { - generator.writeKey("version"); - generator.write(this.version); - } if (ApiTypeHelper.isDefined(this.settings)) { generator.writeKey("settings"); generator.writeStartObject(); for (Map.Entry item0 : this.settings.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } - if (this.mappings != null) { - generator.writeKey("mappings"); - this.mappings.serialize(generator, mapper); + if (this.version != null) { + generator.writeKey("version"); + generator.write(this.version); } - if (ApiTypeHelper.isDefined(this.aliases)) { - generator.writeKey("aliases"); - generator.writeStartObject(); - for (Map.Entry item0 : this.aliases.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); + } - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link ComponentTemplateSummary}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Map aliases; + @Nullable + private TypeMapping mappings; @Nullable private Map meta; - + @Nullable + private Map settings; @Nullable private Long version; - private Map settings; + public Builder() {} - @Nullable - private TypeMapping mappings; + private Builder(ComponentTemplateSummary o) { + this.aliases = _mapCopy(o.aliases); + this.mappings = o.mappings; + this.meta = _mapCopy(o.meta); + this.settings = _mapCopy(o.settings); + this.version = o.version; + } - @Nullable - private Map aliases; + private Builder(Builder o) { + this.aliases = _mapCopy(o.aliases); + this.mappings = o.mappings; + this.meta = _mapCopy(o.meta); + this.settings = _mapCopy(o.settings); + this.version = o.version; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * API name: {@code _meta} + * API name: {@code aliases} + * *

- * Adds all entries of map to meta. + * Adds all elements of map to aliases. + *

*/ - public final Builder meta(Map map) { - this.meta = _mapPutAll(this.meta, map); + @Nonnull + public final Builder aliases(Map map) { + this.aliases = _mapPutAll(this.aliases, map); return this; } /** - * API name: {@code _meta} + * API name: {@code aliases} + * *

- * Adds an entry to meta. + * Adds an entry to aliases. + *

*/ - public final Builder meta(String key, JsonData value) { - this.meta = _mapPut(this.meta, key, value); + @Nonnull + public final Builder aliases(String key, AliasDefinition value) { + this.aliases = _mapPut(this.aliases, key, value); return this; } /** - * API name: {@code version} + * API name: {@code aliases} + * + *

+ * Adds a value to aliases using a builder lambda. + *

*/ - public final Builder version(@Nullable Long value) { - this.version = value; - return this; + @Nonnull + public final Builder aliases(String key, Function> fn) { + return aliases(key, fn.apply(new AliasDefinition.Builder()).build()); } /** - * Required - API name: {@code settings} - *

- * Adds all entries of map to settings. + * API name: {@code mappings} */ - public final Builder settings(Map map) { - this.settings = _mapPutAll(this.settings, map); + @Nonnull + public final Builder mappings(@Nullable TypeMapping value) { + this.mappings = value; return this; } /** - * Required - API name: {@code settings} - *

- * Adds an entry to settings. + * API name: {@code mappings} */ - public final Builder settings(String key, IndexSettings value) { - this.settings = _mapPut(this.settings, key, value); - return this; + @Nonnull + public final Builder mappings(Function> fn) { + return mappings(fn.apply(new TypeMapping.Builder()).build()); } /** - * Required - API name: {@code settings} + * API name: {@code _meta} + * *

- * Adds an entry to settings using a builder lambda. + * Adds all elements of map to meta. + *

*/ - public final Builder settings(String key, Function> fn) { - return settings(key, fn.apply(new IndexSettings.Builder()).build()); + @Nonnull + public final Builder meta(Map map) { + this.meta = _mapPutAll(this.meta, map); + return this; } /** - * API name: {@code mappings} + * API name: {@code _meta} + * + *

+ * Adds an entry to meta. + *

*/ - public final Builder mappings(@Nullable TypeMapping value) { - this.mappings = value; + @Nonnull + public final Builder meta(String key, JsonData value) { + this.meta = _mapPut(this.meta, key, value); return this; } /** - * API name: {@code mappings} + * API name: {@code settings} + * + *

+ * Adds all elements of map to settings. + *

*/ - public final Builder mappings(Function> fn) { - return this.mappings(fn.apply(new TypeMapping.Builder()).build()); + @Nonnull + public final Builder settings(Map map) { + this.settings = _mapPutAll(this.settings, map); + return this; } /** - * API name: {@code aliases} + * API name: {@code settings} + * *

- * Adds all entries of map to aliases. + * Adds an entry to settings. + *

*/ - public final Builder aliases(Map map) { - this.aliases = _mapPutAll(this.aliases, map); + @Nonnull + public final Builder settings(String key, IndexSettings value) { + this.settings = _mapPut(this.settings, key, value); return this; } /** - * API name: {@code aliases} + * API name: {@code settings} + * *

- * Adds an entry to aliases. + * Adds a value to settings using a builder lambda. + *

*/ - public final Builder aliases(String key, AliasDefinition value) { - this.aliases = _mapPut(this.aliases, key, value); - return this; + @Nonnull + public final Builder settings(String key, Function> fn) { + return settings(key, fn.apply(new IndexSettings.Builder()).build()); } /** - * API name: {@code aliases} - *

- * Adds an entry to aliases using a builder lambda. + * API name: {@code version} */ - public final Builder aliases(String key, Function> fn) { - return aliases(key, fn.apply(new AliasDefinition.Builder()).build()); + @Nonnull + public final Builder version(@Nullable Long value) { + this.version = value; + return this; } /** * Builds a {@link ComponentTemplateSummary}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ComponentTemplateSummary build() { _checkSingleUse(); @@ -322,13 +394,33 @@ public ComponentTemplateSummary build() { ); protected static void setupComponentTemplateSummaryDeserializer(ObjectDeserializer op) { - + op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(AliasDefinition._DESERIALIZER), "aliases"); + op.add(Builder::mappings, TypeMapping._DESERIALIZER, "mappings"); op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); - op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); op.add(Builder::settings, JsonpDeserializer.stringMapDeserializer(IndexSettings._DESERIALIZER), "settings"); - op.add(Builder::mappings, TypeMapping._DESERIALIZER, "mappings"); - op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(AliasDefinition._DESERIALIZER), "aliases"); + op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.aliases); + result = 31 * result + Objects.hashCode(this.mappings); + result = 31 * result + Objects.hashCode(this.meta); + result = 31 * result + Objects.hashCode(this.settings); + result = 31 * result + Objects.hashCode(this.version); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ComponentTemplateSummary other = (ComponentTemplateSummary) o; + return Objects.equals(this.aliases, other.aliases) + && Objects.equals(this.mappings, other.mappings) + && Objects.equals(this.meta, other.meta) + && Objects.equals(this.settings, other.settings) + && Objects.equals(this.version, other.version); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/DeleteComponentTemplateRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/DeleteComponentTemplateRequest.java similarity index 57% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/DeleteComponentTemplateRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/DeleteComponentTemplateRequest.java index 043dae54fc..8e0ec5708b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/DeleteComponentTemplateRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/DeleteComponentTemplateRequest.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import java.util.HashMap; import java.util.Map; +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.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; @@ -42,24 +49,29 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.delete_component_template.Request /** - * Deletes a component template - * + * Deletes a component template. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteComponentTemplateRequest extends RequestBase + implements + ToCopyableBuilder { -public class DeleteComponentTemplateRequest extends RequestBase { - @Deprecated @Nullable - private final Time masterTimeout; + private final Time clusterManagerTimeout; + @Deprecated @Nullable - private final Time clusterManagerTimeout; + private final Time masterTimeout; + @Nonnull private final String name; @Nullable @@ -68,52 +80,58 @@ public class DeleteComponentTemplateRequest extends RequestBase { // --------------------------------------------------------------------------------------------- private DeleteComponentTemplateRequest(Builder builder) { - - this.masterTimeout = builder.masterTimeout; this.clusterManagerTimeout = builder.clusterManagerTimeout; + this.masterTimeout = builder.masterTimeout; this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); this.timeout = builder.timeout; - } - public static DeleteComponentTemplateRequest of(Function> fn) { + public static DeleteComponentTemplateRequest of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Specify timeout for connection to master + * Operation timeout for connection to cluster-manager node. *

- * API name: {@code master_timeout} + * API name: {@code cluster_manager_timeout} + *

*/ - @Deprecated @Nullable - public final Time masterTimeout() { - return this.masterTimeout; + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; } /** - * Specify timeout for connection to cluster-manager + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

- * API name: {@code cluster_manager_timeout} + * API name: {@code master_timeout} + *

*/ + @Deprecated @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; + public final Time masterTimeout() { + return this.masterTimeout; } /** - * Required - The name of the template + * Required - Name of the component template to delete. Wildcard (*) expressions are supported. *

* API name: {@code name} + *

*/ + @Nonnull public final String name() { return this.name; } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -122,98 +140,143 @@ public final Time timeout() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link DeleteComponentTemplateRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Deprecated - @Nullable - private Time masterTimeout; - + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Time clusterManagerTimeout; - + @Nullable + private Time masterTimeout; private String name; - @Nullable private Time timeout; + public Builder() {} + + private Builder(DeleteComponentTemplateRequest o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.masterTimeout = o.masterTimeout; + this.name = o.name; + this.timeout = o.timeout; + } + + private Builder(Builder o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.masterTimeout = o.masterTimeout; + this.name = o.name; + this.timeout = o.timeout; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Specify timeout for connection to master + * Operation timeout for connection to cluster-manager node. *

- * API name: {@code master_timeout} + * API name: {@code cluster_manager_timeout} + *

*/ - @Deprecated - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = value; + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; return this; } /** - * Specify timeout for connection to master + * Operation timeout for connection to cluster-manager node. *

- * API name: {@code master_timeout} + * API name: {@code cluster_manager_timeout} + *

*/ - @Deprecated - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); } /** - * Specify timeout for connection to cluster-manager + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

- * API name: {@code cluster_manager_timeout} + * API name: {@code master_timeout} + *

*/ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; + @Deprecated + @Nonnull + public final Builder masterTimeout(@Nullable Time value) { + this.masterTimeout = value; return this; } /** - * Specify timeout for connection to cluster-manager + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

- * API name: {@code cluster_manager_timeout} + * API name: {@code master_timeout} + *

*/ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + @Deprecated + @Nonnull + public final Builder masterTimeout(Function> fn) { + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** - * Required - The name of the template + * Required - Name of the component template to delete. Wildcard (*) expressions are supported. *

* API name: {@code name} + *

*/ + @Nonnull public final Builder name(String value) { this.name = value; return this; } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(@Nullable Time value) { this.timeout = value; return this; } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** * Builds a {@link DeleteComponentTemplateRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DeleteComponentTemplateRequest build() { _checkSingleUse(); @@ -228,49 +291,52 @@ public DeleteComponentTemplateRequest build() { */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "DELETE"; - - }, - + request -> "DELETE", // Request path request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_component_template"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/_component_template/"); + SimpleEndpoint.pathEncode(request.name, buf); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } if (request.timeout != null) { params.put("timeout", request.timeout._toJsonString()); } return params; - }, SimpleEndpoint.emptyMap(), false, DeleteComponentTemplateResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + this.name.hashCode(); + result = 31 * result + Objects.hashCode(this.timeout); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DeleteComponentTemplateRequest other = (DeleteComponentTemplateRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && this.name.equals(other.name) + && Objects.equals(this.timeout, other.timeout); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/DeleteComponentTemplateResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/DeleteComponentTemplateResponse.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/DeleteComponentTemplateResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/DeleteComponentTemplateResponse.java index 4b37536fbc..1a10fd0750 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/DeleteComponentTemplateResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/DeleteComponentTemplateResponse.java @@ -30,41 +30,82 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.delete_component_template.Response @JsonpDeserializable -public class DeleteComponentTemplateResponse extends AcknowledgedResponseBase { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteComponentTemplateResponse extends AcknowledgedResponseBase + implements + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private DeleteComponentTemplateResponse(Builder builder) { super(builder); - } - public static DeleteComponentTemplateResponse of(Function> fn) { + public static DeleteComponentTemplateResponse of( + Function> fn + ) { return fn.apply(new Builder()).build(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link DeleteComponentTemplateResponse}. */ - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { + + public Builder() {} + + private Builder(DeleteComponentTemplateResponse o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + @Override + @Nonnull protected Builder self() { return this; } @@ -72,9 +113,10 @@ protected Builder self() { /** * Builds a {@link DeleteComponentTemplateResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DeleteComponentTemplateResponse build() { _checkSingleUse(); @@ -93,8 +135,22 @@ public DeleteComponentTemplateResponse build() { ); protected static void setupDeleteComponentTemplateResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + setupAcknowledgedResponseBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/DeleteVotingConfigExclusionsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/DeleteVotingConfigExclusionsRequest.java similarity index 58% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/DeleteVotingConfigExclusionsRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/DeleteVotingConfigExclusionsRequest.java index fcf952f4bf..5fd9c2ac0a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/DeleteVotingConfigExclusionsRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/DeleteVotingConfigExclusionsRequest.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import java.util.HashMap; import java.util.Map; +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.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; @@ -42,41 +49,43 @@ import org.opensearch.client.transport.endpoints.BooleanEndpoint; import org.opensearch.client.transport.endpoints.BooleanResponse; import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.delete_voting_config_exclusions.Request /** * Clears cluster voting config exclusions. - * */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteVotingConfigExclusionsRequest extends RequestBase + implements + ToCopyableBuilder { -public class DeleteVotingConfigExclusionsRequest extends RequestBase { @Nullable private final Boolean waitForRemoval; // --------------------------------------------------------------------------------------------- private DeleteVotingConfigExclusionsRequest(Builder builder) { - this.waitForRemoval = builder.waitForRemoval; - } - public static DeleteVotingConfigExclusionsRequest of(Function> fn) { + public static DeleteVotingConfigExclusionsRequest of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Specifies whether to wait for all excluded nodes to be removed from the - * cluster before clearing the voting configuration exclusions list. Defaults to - * true, meaning that all excluded nodes must be removed from the cluster before - * this API takes any action. If set to false then the voting configuration - * exclusions list is cleared even if some excluded nodes are still in the - * cluster. + * Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration exclusions + * list. Defaults to true, meaning that all excluded nodes must be removed from the cluster before this API takes any action. If set to + * false then the voting configuration exclusions list is cleared even if some excluded nodes are still in the cluster. *

* API name: {@code wait_for_removal} + *

*/ @Nullable public final Boolean waitForRemoval() { @@ -85,24 +94,50 @@ public final Boolean waitForRemoval() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link DeleteVotingConfigExclusionsRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Boolean waitForRemoval; + public Builder() {} + + private Builder(DeleteVotingConfigExclusionsRequest o) { + this.waitForRemoval = o.waitForRemoval; + } + + private Builder(Builder o) { + this.waitForRemoval = o.waitForRemoval; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Specifies whether to wait for all excluded nodes to be removed from the - * cluster before clearing the voting configuration exclusions list. Defaults to - * true, meaning that all excluded nodes must be removed from the cluster before - * this API takes any action. If set to false then the voting configuration - * exclusions list is cleared even if some excluded nodes are still in the - * cluster. + * Specifies whether to wait for all excluded nodes to be removed from the cluster before clearing the voting configuration + * exclusions list. Defaults to true, meaning that all excluded nodes must be removed from the cluster before this API takes any + * action. If set to false then the voting configuration exclusions list is cleared even if some excluded nodes are + * still in the cluster. *

* API name: {@code wait_for_removal} + *

*/ + @Nonnull public final Builder waitForRemoval(@Nullable Boolean value) { this.waitForRemoval = value; return this; @@ -111,9 +146,10 @@ public final Builder waitForRemoval(@Nullable Boolean value) { /** * Builds a {@link DeleteVotingConfigExclusionsRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DeleteVotingConfigExclusionsRequest build() { _checkSingleUse(); @@ -127,20 +163,10 @@ public DeleteVotingConfigExclusionsRequest build() { * Endpoint "{@code cluster.delete_voting_config_exclusions}". */ public static final Endpoint _ENDPOINT = new BooleanEndpoint<>( - "opensearch/cluster.delete_voting_config_exclusions", - // Request method - request -> { - return "DELETE"; - - }, - + request -> "DELETE", // Request path - request -> { - return "/_cluster/voting_config_exclusions"; - - }, - + request -> "/_cluster/voting_config_exclusions", // Request parameters request -> { Map params = new HashMap<>(); @@ -148,10 +174,22 @@ public DeleteVotingConfigExclusionsRequest build() { params.put("wait_for_removal", String.valueOf(request.waitForRemoval)); } return params; - }, - SimpleEndpoint.emptyMap(), - false, - null + SimpleEndpoint.emptyMap() ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.waitForRemoval); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DeleteVotingConfigExclusionsRequest other = (DeleteVotingConfigExclusionsRequest) o; + return Objects.equals(this.waitForRemoval, other.waitForRemoval); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/ExistsComponentTemplateRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/ExistsComponentTemplateRequest.java similarity index 57% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/ExistsComponentTemplateRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/ExistsComponentTemplateRequest.java index ba84b76951..914e5a2313 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/ExistsComponentTemplateRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/ExistsComponentTemplateRequest.java @@ -30,13 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import java.util.HashMap; -import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; -import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; @@ -46,17 +51,24 @@ import org.opensearch.client.transport.endpoints.BooleanResponse; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.exists_component_template.Request /** - * Returns information about whether a particular component template exist - * + * Returns information about whether a particular component template exist. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ExistsComponentTemplateRequest extends RequestBase + implements + ToCopyableBuilder { + + @Nullable + private final Time clusterManagerTimeout; -public class ExistsComponentTemplateRequest extends RequestBase { @Nullable private final Boolean local; @@ -64,31 +76,41 @@ public class ExistsComponentTemplateRequest extends RequestBase { @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - - private final List name; + @Nonnull + private final String name; // --------------------------------------------------------------------------------------------- private ExistsComponentTemplateRequest(Builder builder) { - + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.local = builder.local; this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; - this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); - + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); } - public static ExistsComponentTemplateRequest of(Function> fn) { + public static ExistsComponentTemplateRequest of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * If true, the request retrieves information from the local node only. Defaults - * to false, which means information is retrieved from the cluster-manager node. + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * If true, the request retrieves information from the local node only. Defaults to false, which means information is + * retrieved from the cluster-manager node. *

* API name: {@code local} + *

*/ @Nullable public final Boolean local() { @@ -96,10 +118,11 @@ public final Boolean local() { } /** - * Period to wait for a connection to the master node. If no response is - * received before the timeout expires, the request fails and returns an error. + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -108,132 +131,145 @@ public final Time masterTimeout() { } /** - * Period to wait for a connection to the cluster-manager node. If no response is - * received before the timeout expires, the request fails and returns an error. - *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } - - /** - * Required - Comma-separated list of component template names used to limit the - * request. Wildcard (*) expressions are supported. + * Required - Name of the component template to check existence of. Wildcard (*) expressions are supported. *

* API name: {@code name} + *

*/ - public final List name() { + @Nonnull + public final String name() { return this.name; } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ExistsComponentTemplateRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Time clusterManagerTimeout; @Nullable private Boolean local; - - @Deprecated @Nullable private Time masterTimeout; + private String name; - @Nullable - private Time clusterManagerTimeout; + public Builder() {} - private List name; + private Builder(ExistsComponentTemplateRequest o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.local = o.local; + this.masterTimeout = o.masterTimeout; + this.name = o.name; + } - /** - * If true, the request retrieves information from the local node only. Defaults - * to false, which means information is retrieved from the cluster-manager node. - *

- * API name: {@code local} - */ - public final Builder local(@Nullable Boolean value) { - this.local = value; - return this; + private Builder(Builder o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.local = o.local; + this.masterTimeout = o.masterTimeout; + this.name = o.name; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** - * Period to wait for a connection to the master node. If no response is - * received before the timeout expires, the request fails and returns an error. + * Operation timeout for connection to cluster-manager node. *

- * API name: {@code master_timeout} + * API name: {@code cluster_manager_timeout} + *

*/ - @Deprecated - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = value; + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; return this; } /** - * Period to wait for a connection to the master node. If no response is - * received before the timeout expires, the request fails and returns an error. + * Operation timeout for connection to cluster-manager node. *

- * API name: {@code master_timeout} + * API name: {@code cluster_manager_timeout} + *

*/ - @Deprecated - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); } /** - * Period to wait for a connection to the cluster-manager node. If no response is - * received before the timeout expires, the request fails and returns an error. + * If true, the request retrieves information from the local node only. Defaults to false, which means information is + * retrieved from the cluster-manager node. *

- * API name: {@code cluster_manager_timeout} + * API name: {@code local} + *

*/ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; + @Nonnull + public final Builder local(@Nullable Boolean value) { + this.local = value; return this; } /** - * Period to wait for a connection to the cluster-manager node. If no response is - * received before the timeout expires, the request fails and returns an error. + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

- * API name: {@code cluster_manager_timeout} + * API name: {@code master_timeout} + *

*/ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + @Deprecated + @Nonnull + public final Builder masterTimeout(@Nullable Time value) { + this.masterTimeout = value; + return this; } /** - * Required - Comma-separated list of component template names used to limit the - * request. Wildcard (*) expressions are supported. + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

- * API name: {@code name} - *

- * Adds all elements of list to name. + * API name: {@code master_timeout} + *

*/ - public final Builder name(List list) { - this.name = _listAddAll(this.name, list); - return this; + @Deprecated + @Nonnull + public final Builder masterTimeout(Function> fn) { + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** - * Required - Comma-separated list of component template names used to limit the - * request. Wildcard (*) expressions are supported. + * Required - Name of the component template to check existence of. Wildcard (*) expressions are supported. *

* API name: {@code name} - *

- * Adds one or more values to name. + *

*/ - public final Builder name(String value, String... values) { - this.name = _listAdd(this.name, value, values); + @Nonnull + public final Builder name(String value) { + this.name = value; return this; } /** * Builds a {@link ExistsComponentTemplateRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ExistsComponentTemplateRequest build() { _checkSingleUse(); @@ -247,50 +283,50 @@ public ExistsComponentTemplateRequest build() { * Endpoint "{@code cluster.exists_component_template}". */ public static final Endpoint _ENDPOINT = new BooleanEndpoint<>( - "opensearch/cluster.exists_component_template", - // Request method - request -> { - return "HEAD"; - - }, - + request -> "HEAD", // Request path request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_component_template"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/_component_template/"); + SimpleEndpoint.pathEncode(request.name, buf); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } if (request.local != null) { params.put("local", String.valueOf(request.local)); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } return params; - }, - SimpleEndpoint.emptyMap(), - false, - null + SimpleEndpoint.emptyMap() ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.local); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + this.name.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ExistsComponentTemplateRequest other = (ExistsComponentTemplateRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.local, other.local) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && this.name.equals(other.name); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/GetClusterSettingsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/GetClusterSettingsRequest.java similarity index 59% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/GetClusterSettingsRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/GetClusterSettingsRequest.java index af3bd90d05..a8624547b1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/GetClusterSettingsRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/GetClusterSettingsRequest.java @@ -30,28 +30,42 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import java.util.HashMap; import java.util.Map; +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.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.opensearch._types.Time; import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.get_settings.Request /** * Returns cluster settings. - * */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetClusterSettingsRequest extends RequestBase + implements + ToCopyableBuilder { + + @Nullable + private final Time clusterManagerTimeout; -public class GetClusterSettingsRequest extends RequestBase { @Nullable private final Boolean flatSettings; @@ -62,32 +76,39 @@ public class GetClusterSettingsRequest extends RequestBase { @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - @Nullable private final Time timeout; // --------------------------------------------------------------------------------------------- private GetClusterSettingsRequest(Builder builder) { - + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.flatSettings = builder.flatSettings; this.includeDefaults = builder.includeDefaults; this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.timeout = builder.timeout; - } - public static GetClusterSettingsRequest of(Function> fn) { + public static GetClusterSettingsRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Return settings in flat format (default: false) + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * If true, returns settings in flat format. *

* API name: {@code flat_settings} + *

*/ @Nullable public final Boolean flatSettings() { @@ -95,9 +116,10 @@ public final Boolean flatSettings() { } /** - * Whether to return all default clusters setting. + * If true, returns default cluster settings from the local node. *

* API name: {@code include_defaults} + *

*/ @Nullable public final Boolean includeDefaults() { @@ -105,9 +127,11 @@ public final Boolean includeDefaults() { } /** - * Explicit operation timeout for connection to master node + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -116,19 +140,10 @@ public final Time masterTimeout() { } /** - * Explicit operation timeout for connection to cluster-manager node - *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } - - /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -137,112 +152,160 @@ public final Time timeout() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link GetClusterSettingsRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Time clusterManagerTimeout; @Nullable private Boolean flatSettings; - @Nullable private Boolean includeDefaults; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - @Nullable private Time timeout; + public Builder() {} + + private Builder(GetClusterSettingsRequest o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.flatSettings = o.flatSettings; + this.includeDefaults = o.includeDefaults; + this.masterTimeout = o.masterTimeout; + this.timeout = o.timeout; + } + + private Builder(Builder o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.flatSettings = o.flatSettings; + this.includeDefaults = o.includeDefaults; + this.masterTimeout = o.masterTimeout; + this.timeout = o.timeout; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Return settings in flat format (default: false) + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; + return this; + } + + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * If true, returns settings in flat format. *

* API name: {@code flat_settings} + *

*/ + @Nonnull public final Builder flatSettings(@Nullable Boolean value) { this.flatSettings = value; return this; } /** - * Whether to return all default clusters setting. + * If true, returns default cluster settings from the local node. *

* API name: {@code include_defaults} + *

*/ + @Nonnull public final Builder includeDefaults(@Nullable Boolean value) { this.includeDefaults = value; return this; } /** - * Explicit operation timeout for connection to master node + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(@Nullable Time value) { this.masterTimeout = value; return this; } /** - * Explicit operation timeout for connection to master node + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** - * Explicit operation timeout for connection to cluster-manager node - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; - return this; - } - - /** - * Explicit operation timeout for connection to cluster-manager node - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(@Nullable Time value) { this.timeout = value; return this; } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** * Builds a {@link GetClusterSettingsRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public GetClusterSettingsRequest build() { _checkSingleUse(); @@ -256,25 +319,13 @@ public GetClusterSettingsRequest build() { * Endpoint "{@code cluster.get_settings}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "GET"; - - }, - + request -> "GET", // Request path - request -> { - return "/_cluster/settings"; - - }, - + request -> "/_cluster/settings", // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } @@ -284,14 +335,39 @@ public GetClusterSettingsRequest build() { if (request.includeDefaults != null) { params.put("include_defaults", String.valueOf(request.includeDefaults)); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } if (request.timeout != null) { params.put("timeout", request.timeout._toJsonString()); } return params; - }, SimpleEndpoint.emptyMap(), false, GetClusterSettingsResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.flatSettings); + result = 31 * result + Objects.hashCode(this.includeDefaults); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.timeout); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetClusterSettingsRequest other = (GetClusterSettingsRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.flatSettings, other.flatSettings) + && Objects.equals(this.includeDefaults, other.includeDefaults) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.timeout, other.timeout); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/GetClusterSettingsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/GetClusterSettingsResponse.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/GetClusterSettingsResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/GetClusterSettingsResponse.java index 98824bdf2c..112652826f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/GetClusterSettingsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/GetClusterSettingsResponse.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import jakarta.json.stream.JsonGenerator; import java.util.Map; +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.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -44,36 +51,55 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.get_settings.Response @JsonpDeserializable -public class GetClusterSettingsResponse implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetClusterSettingsResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final Map defaults; + + @Nonnull private final Map persistent; + @Nonnull private final Map transient_; - private final Map defaults; - // --------------------------------------------------------------------------------------------- private GetClusterSettingsResponse(Builder builder) { - + this.defaults = ApiTypeHelper.unmodifiable(builder.defaults); this.persistent = ApiTypeHelper.unmodifiableRequired(builder.persistent, this, "persistent"); this.transient_ = ApiTypeHelper.unmodifiableRequired(builder.transient_, this, "transient_"); - this.defaults = ApiTypeHelper.unmodifiable(builder.defaults); - } - public static GetClusterSettingsResponse of(Function> fn) { + public static GetClusterSettingsResponse of( + Function> fn + ) { return fn.apply(new Builder()).build(); } + /** + * API name: {@code defaults} + */ + @Nonnull + public final Map defaults() { + return this.defaults; + } + /** * Required - API name: {@code persistent} */ + @Nonnull public final Map persistent() { return this.persistent; } @@ -81,20 +107,15 @@ public final Map persistent() { /** * Required - API name: {@code transient} */ + @Nonnull public final Map transient_() { return this.transient_; } - /** - * API name: {@code defaults} - */ - public final Map defaults() { - return this.defaults; - } - /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -102,62 +123,109 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.persistent)) { - generator.writeKey("persistent"); - generator.writeStartObject(); - for (Map.Entry item0 : this.persistent.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.transient_)) { - generator.writeKey("transient"); - generator.writeStartObject(); - for (Map.Entry item0 : this.transient_.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } if (ApiTypeHelper.isDefined(this.defaults)) { generator.writeKey("defaults"); generator.writeStartObject(); for (Map.Entry item0 : this.defaults.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); + } + generator.writeKey("persistent"); + generator.writeStartObject(); + for (Map.Entry item0 : this.persistent.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); } + generator.writeEnd(); + generator.writeKey("transient"); + generator.writeStartObject(); + for (Map.Entry item0 : this.transient_.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link GetClusterSettingsResponse}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Map defaults; private Map persistent; - private Map transient_; - @Nullable - private Map defaults; + public Builder() {} + + private Builder(GetClusterSettingsResponse o) { + this.defaults = _mapCopy(o.defaults); + this.persistent = _mapCopy(o.persistent); + this.transient_ = _mapCopy(o.transient_); + } + + private Builder(Builder o) { + this.defaults = _mapCopy(o.defaults); + this.persistent = _mapCopy(o.persistent); + this.transient_ = _mapCopy(o.transient_); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code defaults} + * + *

+ * Adds all elements of map to defaults. + *

+ */ + @Nonnull + public final Builder defaults(Map map) { + this.defaults = _mapPutAll(this.defaults, map); + return this; + } + + /** + * API name: {@code defaults} + * + *

+ * Adds an entry to defaults. + *

+ */ + @Nonnull + public final Builder defaults(String key, JsonData value) { + this.defaults = _mapPut(this.defaults, key, value); + return this; + } /** * Required - API name: {@code persistent} + * *

- * Adds all entries of map to persistent. + * Adds all elements of map to persistent. + *

*/ + @Nonnull public final Builder persistent(Map map) { this.persistent = _mapPutAll(this.persistent, map); return this; @@ -165,9 +233,12 @@ public final Builder persistent(Map map) { /** * Required - API name: {@code persistent} + * *

* Adds an entry to persistent. + *

*/ + @Nonnull public final Builder persistent(String key, JsonData value) { this.persistent = _mapPut(this.persistent, key, value); return this; @@ -175,9 +246,12 @@ public final Builder persistent(String key, JsonData value) { /** * Required - API name: {@code transient} + * *

- * Adds all entries of map to transient_. + * Adds all elements of map to transient_. + *

*/ + @Nonnull public final Builder transient_(Map map) { this.transient_ = _mapPutAll(this.transient_, map); return this; @@ -185,40 +259,24 @@ public final Builder transient_(Map map) { /** * Required - API name: {@code transient} + * *

* Adds an entry to transient_. + *

*/ + @Nonnull public final Builder transient_(String key, JsonData value) { this.transient_ = _mapPut(this.transient_, key, value); return this; } - /** - * API name: {@code defaults} - *

- * Adds all entries of map to defaults. - */ - public final Builder defaults(Map map) { - this.defaults = _mapPutAll(this.defaults, map); - return this; - } - - /** - * API name: {@code defaults} - *

- * Adds an entry to defaults. - */ - public final Builder defaults(String key, JsonData value) { - this.defaults = _mapPut(this.defaults, key, value); - return this; - } - /** * Builds a {@link GetClusterSettingsResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public GetClusterSettingsResponse build() { _checkSingleUse(); @@ -237,11 +295,27 @@ public GetClusterSettingsResponse build() { ); protected static void setupGetClusterSettingsResponseDeserializer(ObjectDeserializer op) { - + op.add(Builder::defaults, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "defaults"); op.add(Builder::persistent, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "persistent"); op.add(Builder::transient_, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "transient"); - op.add(Builder::defaults, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "defaults"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.defaults); + result = 31 * result + this.persistent.hashCode(); + result = 31 * result + this.transient_.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetClusterSettingsResponse other = (GetClusterSettingsResponse) o; + return Objects.equals(this.defaults, other.defaults) + && this.persistent.equals(other.persistent) + && this.transient_.equals(other.transient_); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/GetComponentTemplateRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/GetComponentTemplateRequest.java similarity index 59% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/GetComponentTemplateRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/GetComponentTemplateRequest.java index ba1794d05a..2d60437705 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/GetComponentTemplateRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/GetComponentTemplateRequest.java @@ -30,28 +30,42 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import java.util.HashMap; import java.util.Map; +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.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.opensearch._types.Time; import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.get_component_template.Request /** - * Returns one or more component templates - * + * Returns one or more component templates. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetComponentTemplateRequest extends RequestBase + implements + ToCopyableBuilder { + + @Nullable + private final Time clusterManagerTimeout; -public class GetComponentTemplateRequest extends RequestBase { @Nullable private final Boolean flatSettings; @@ -62,30 +76,41 @@ public class GetComponentTemplateRequest extends RequestBase { @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - @Nullable private final String name; // --------------------------------------------------------------------------------------------- private GetComponentTemplateRequest(Builder builder) { - + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.flatSettings = builder.flatSettings; this.local = builder.local; this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.name = builder.name; - } - public static GetComponentTemplateRequest of(Function> fn) { + public static GetComponentTemplateRequest of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * If true, returns settings in flat format. + *

* API name: {@code flat_settings} + *

*/ @Nullable public final Boolean flatSettings() { @@ -93,10 +118,11 @@ public final Boolean flatSettings() { } /** - * Return local information, do not retrieve the state from master node - * (default: false) + * If true, the request retrieves information from the local node only. If false, information is retrieved + * from the cluster-manager node. *

* API name: {@code local} + *

*/ @Nullable public final Boolean local() { @@ -104,9 +130,11 @@ public final Boolean local() { } /** - * Explicit operation timeout for connection to master node + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -115,19 +143,10 @@ public final Time masterTimeout() { } /** - * Explicit operation timeout for connection to cluster-manager node - *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } - - /** - * The comma separated names of the component templates + * Name of the component template to retrieve. Wildcard (*) expressions are supported. *

* API name: {@code name} + *

*/ @Nullable public final String name() { @@ -136,91 +155,138 @@ public final String name() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link GetComponentTemplateRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Time clusterManagerTimeout; @Nullable private Boolean flatSettings; - @Nullable private Boolean local; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - @Nullable private String name; + public Builder() {} + + private Builder(GetComponentTemplateRequest o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.flatSettings = o.flatSettings; + this.local = o.local; + this.masterTimeout = o.masterTimeout; + this.name = o.name; + } + + private Builder(Builder o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.flatSettings = o.flatSettings; + this.local = o.local; + this.masterTimeout = o.masterTimeout; + this.name = o.name; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; + return this; + } + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * If true, returns settings in flat format. + *

* API name: {@code flat_settings} + *

*/ + @Nonnull public final Builder flatSettings(@Nullable Boolean value) { this.flatSettings = value; return this; } /** - * Return local information, do not retrieve the state from master node - * (default: false) + * If true, the request retrieves information from the local node only. If false, information is retrieved + * from the cluster-manager node. *

* API name: {@code local} + *

*/ + @Nonnull public final Builder local(@Nullable Boolean value) { this.local = value; return this; } /** - * Explicit operation timeout for connection to master node + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(@Nullable Time value) { this.masterTimeout = value; return this; } /** - * Explicit operation timeout for connection to master node + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** - * Explicit operation timeout for connection to cluster-manager node - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; - return this; - } - - /** - * Explicit operation timeout for connection to cluster-manager node - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * The comma separated names of the component templates + * Name of the component template to retrieve. Wildcard (*) expressions are supported. *

* API name: {@code name} + *

*/ + @Nonnull public final Builder name(@Nullable String value) { this.name = value; return this; @@ -229,9 +295,10 @@ public final Builder name(@Nullable String value) { /** * Builds a {@link GetComponentTemplateRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public GetComponentTemplateRequest build() { _checkSingleUse(); @@ -245,13 +312,8 @@ public GetComponentTemplateRequest build() { * Endpoint "{@code cluster.get_component_template}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "GET"; - - }, - + request -> "GET", // Request path request -> { final int _name = 1 << 0; @@ -261,27 +323,20 @@ public GetComponentTemplateRequest build() { if (request.name() != null) propsSet |= _name; if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_component_template"); - return buf.toString(); + return "/_component_template"; } if (propsSet == (_name)) { StringBuilder buf = new StringBuilder(); - buf.append("/_component_template"); - buf.append("/"); + buf.append("/_component_template/"); SimpleEndpoint.pathEncode(request.name, buf); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } @@ -291,11 +346,36 @@ public GetComponentTemplateRequest build() { if (request.local != null) { params.put("local", String.valueOf(request.local)); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } return params; - }, SimpleEndpoint.emptyMap(), false, GetComponentTemplateResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.flatSettings); + result = 31 * result + Objects.hashCode(this.local); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.name); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetComponentTemplateRequest other = (GetComponentTemplateRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.flatSettings, other.flatSettings) + && Objects.equals(this.local, other.local) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.name, other.name); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/GetComponentTemplateResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/GetComponentTemplateResponse.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/GetComponentTemplateResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/GetComponentTemplateResponse.java index 8cd177d19c..3fe60c9430 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/GetComponentTemplateResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/GetComponentTemplateResponse.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,30 +48,39 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.get_component_template.Response @JsonpDeserializable -public class GetComponentTemplateResponse implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetComponentTemplateResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull private final List componentTemplates; // --------------------------------------------------------------------------------------------- private GetComponentTemplateResponse(Builder builder) { - this.componentTemplates = ApiTypeHelper.unmodifiableRequired(builder.componentTemplates, this, "componentTemplates"); - } - public static GetComponentTemplateResponse of(Function> fn) { + public static GetComponentTemplateResponse of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code component_templates} */ + @Nonnull public final List componentTemplates() { return this.componentTemplates; } @@ -73,6 +88,7 @@ public final List componentTemplates() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -80,34 +96,57 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.componentTemplates)) { - generator.writeKey("component_templates"); - generator.writeStartArray(); - for (ComponentTemplate item0 : this.componentTemplates) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("component_templates"); + generator.writeStartArray(); + for (ComponentTemplate item0 : this.componentTemplates) { + item0.serialize(generator, mapper); } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link GetComponentTemplateResponse}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private List componentTemplates; + public Builder() {} + + private Builder(GetComponentTemplateResponse o) { + this.componentTemplates = _listCopy(o.componentTemplates); + } + + private Builder(Builder o) { + this.componentTemplates = _listCopy(o.componentTemplates); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code component_templates} + * *

* Adds all elements of list to componentTemplates. + *

*/ + @Nonnull public final Builder componentTemplates(List list) { this.componentTemplates = _listAddAll(this.componentTemplates, list); return this; @@ -115,9 +154,12 @@ public final Builder componentTemplates(List list) { /** * Required - API name: {@code component_templates} + * *

* Adds one or more values to componentTemplates. + *

*/ + @Nonnull public final Builder componentTemplates(ComponentTemplate value, ComponentTemplate... values) { this.componentTemplates = _listAdd(this.componentTemplates, value, values); return this; @@ -125,9 +167,12 @@ public final Builder componentTemplates(ComponentTemplate value, ComponentTempla /** * Required - API name: {@code component_templates} + * *

* Adds a value to componentTemplates using a builder lambda. + *

*/ + @Nonnull public final Builder componentTemplates(Function> fn) { return componentTemplates(fn.apply(new ComponentTemplate.Builder()).build()); } @@ -135,9 +180,10 @@ public final Builder componentTemplates(Function op) { - op.add(Builder::componentTemplates, JsonpDeserializer.arrayDeserializer(ComponentTemplate._DESERIALIZER), "component_templates"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.componentTemplates.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetComponentTemplateResponse other = (GetComponentTemplateResponse) o; + return this.componentTemplates.equals(other.componentTemplates); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/HealthRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/HealthRequest.java similarity index 57% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/HealthRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/HealthRequest.java index 76bb75032c..a01c427fdd 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/HealthRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/HealthRequest.java @@ -30,42 +30,59 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.ExpandWildcard; import org.opensearch.client.opensearch._types.HealthStatus; -import org.opensearch.client.opensearch._types.Level; import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.opensearch._types.Time; import org.opensearch.client.opensearch._types.WaitForActiveShards; import org.opensearch.client.opensearch._types.WaitForEvents; +import org.opensearch.client.opensearch.cluster.health.ClusterHealthLevel; import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.health.Request /** * Returns basic information about the health of the cluster. - * */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class HealthRequest extends RequestBase implements ToCopyableBuilder { + + @Nullable + private final String awarenessAttribute; + + @Nullable + private final Time clusterManagerTimeout; -public class HealthRequest extends RequestBase { + @Nonnull private final List expandWildcards; + @Nonnull private final List index; @Nullable - private final Level level; + private final ClusterHealthLevel level; @Nullable private final Boolean local; @@ -74,9 +91,6 @@ public class HealthRequest extends RequestBase { @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - @Nullable private final Time timeout; @@ -101,13 +115,13 @@ public class HealthRequest extends RequestBase { // --------------------------------------------------------------------------------------------- private HealthRequest(Builder builder) { - + this.awarenessAttribute = builder.awarenessAttribute; + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); this.index = ApiTypeHelper.unmodifiable(builder.index); this.level = builder.level; this.local = builder.local; this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.timeout = builder.timeout; this.waitForActiveShards = builder.waitForActiveShards; this.waitForEvents = builder.waitForEvents; @@ -115,50 +129,74 @@ private HealthRequest(Builder builder) { this.waitForNoRelocatingShards = builder.waitForNoRelocatingShards; this.waitForNodes = builder.waitForNodes; this.waitForStatus = builder.waitForStatus; - } - public static HealthRequest of(Function> fn) { + public static HealthRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * The awareness attribute for which the health is required. + *

+ * API name: {@code awareness_attribute} + *

+ */ + @Nullable + public final String awarenessAttribute() { + return this.awarenessAttribute; + } + + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * Whether to expand wildcard expression to concrete indexes that are open, closed or both. *

* API name: {@code expand_wildcards} + *

*/ + @Nonnull public final List expandWildcards() { return this.expandWildcards; } /** - * Comma-separated list of data streams, indices, and index aliases used to - * limit the request. Wildcard expressions (*) are supported. To target all data - * streams and indices in a cluster, omit this parameter or use _all or *. + * Comma-separated list of data streams, indexes, and index aliases used to limit the request. Wildcard expressions (*) are supported. + * To target all data streams and indexes in a cluster, omit this parameter or use _all or *. *

* API name: {@code index} + *

*/ + @Nonnull public final List index() { return this.index; } /** - * Can be one of cluster, indices or shards. Controls the details level of the - * health information returned. + * Can be one of cluster, indexes or shards. Controls the details level of the health information returned. *

* API name: {@code level} + *

*/ @Nullable - public final Level level() { + public final ClusterHealthLevel level() { return this.level; } /** - * If true, the request retrieves information from the local node only. Defaults - * to false, which means information is retrieved from the cluster-manager node. + * If true, the request retrieves information from the local node only. Defaults to false, which means information is + * retrieved from the cluster-manager node. *

* API name: {@code local} + *

*/ @Nullable public final Boolean local() { @@ -166,10 +204,11 @@ public final Boolean local() { } /** - * Period to wait for a connection to the master node. If no response is - * received before the timeout expires, the request fails and returns an error. + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -178,21 +217,10 @@ public final Time masterTimeout() { } /** - * Period to wait for a connection to the cluster-manager node. If no response is - * received before the timeout expires, the request fails and returns an error. - *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } - - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -200,10 +228,10 @@ public final Time timeout() { } /** - * A number controlling to how many active shards to wait for, all to wait for - * all shards in the cluster to be active, or 0 to not wait. + * A number controlling to how many active shards to wait for, all to wait for all shards in the cluster to be active, or 0 to not wait. *

* API name: {@code wait_for_active_shards} + *

*/ @Nullable public final WaitForActiveShards waitForActiveShards() { @@ -211,10 +239,11 @@ public final WaitForActiveShards waitForActiveShards() { } /** - * Can be one of immediate, urgent, high, normal, low, languid. Wait until all - * currently queued events with the given priority are processed. + * Can be one of immediate, urgent, high, normal, low, languid. Wait until all currently queued events with the given priority are + * processed. *

* API name: {@code wait_for_events} + *

*/ @Nullable public final WaitForEvents waitForEvents() { @@ -222,11 +251,11 @@ public final WaitForEvents waitForEvents() { } /** - * A boolean value which controls whether to wait (until the timeout provided) - * for the cluster to have no shard initializations. Defaults to false, which - * means it will not wait for initializing shards. + * A Boolean value which controls whether to wait (until the timeout provided) for the cluster to have no shard initializations. + * Defaults to false, which means it will not wait for initializing shards. *

* API name: {@code wait_for_no_initializing_shards} + *

*/ @Nullable public final Boolean waitForNoInitializingShards() { @@ -234,11 +263,11 @@ public final Boolean waitForNoInitializingShards() { } /** - * A boolean value which controls whether to wait (until the timeout provided) - * for the cluster to have no shard relocations. Defaults to false, which means - * it will not wait for relocating shards. + * A Boolean value which controls whether to wait (until the timeout provided) for the cluster to have no shard relocations. Defaults to + * false, which means it will not wait for relocating shards. *

* API name: {@code wait_for_no_relocating_shards} + *

*/ @Nullable public final Boolean waitForNoRelocatingShards() { @@ -246,11 +275,11 @@ public final Boolean waitForNoRelocatingShards() { } /** - * The request waits until the specified number N of nodes is available. It also - * accepts >=N, <=N, >N and <N. Alternatively, it is possible to use - * ge(N), le(N), gt(N) and lt(N) notation. + * The request waits until the specified number N of nodes is available. It also accepts >=N, <=N, >N and <N. Alternatively, + * it is possible to use ge(N), le(N), gt(N) and lt(N) notation. *

* API name: {@code wait_for_nodes} + *

*/ @Nullable public final String waitForNodes() { @@ -258,11 +287,11 @@ public final String waitForNodes() { } /** - * One of green, yellow or red. Will wait (until the timeout provided) until the - * status of the cluster changes to the one provided or better, i.e. green > - * yellow > red. By default, will not wait for any status. + * One of green, yellow or red. Will wait (until the timeout provided) until the status of the cluster changes to the one provided or + * better, i.e. green > yellow > red. By default, will not wait for any status. *

* API name: {@code wait_for_status} + *

*/ @Nullable public final HealthStatus waitForStatus() { @@ -271,267 +300,353 @@ public final HealthStatus waitForStatus() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link HealthRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String awarenessAttribute; + @Nullable + private Time clusterManagerTimeout; @Nullable private List expandWildcards; - @Nullable private List index; - @Nullable - private Level level; - + private ClusterHealthLevel level; @Nullable private Boolean local; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - @Nullable private Time timeout; - @Nullable private WaitForActiveShards waitForActiveShards; - @Nullable private WaitForEvents waitForEvents; - @Nullable private Boolean waitForNoInitializingShards; - @Nullable private Boolean waitForNoRelocatingShards; - @Nullable private String waitForNodes; - @Nullable private HealthStatus waitForStatus; + public Builder() {} + + private Builder(HealthRequest o) { + this.awarenessAttribute = o.awarenessAttribute; + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.expandWildcards = _listCopy(o.expandWildcards); + this.index = _listCopy(o.index); + this.level = o.level; + this.local = o.local; + this.masterTimeout = o.masterTimeout; + this.timeout = o.timeout; + this.waitForActiveShards = o.waitForActiveShards; + this.waitForEvents = o.waitForEvents; + this.waitForNoInitializingShards = o.waitForNoInitializingShards; + this.waitForNoRelocatingShards = o.waitForNoRelocatingShards; + this.waitForNodes = o.waitForNodes; + this.waitForStatus = o.waitForStatus; + } + + private Builder(Builder o) { + this.awarenessAttribute = o.awarenessAttribute; + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.expandWildcards = _listCopy(o.expandWildcards); + this.index = _listCopy(o.index); + this.level = o.level; + this.local = o.local; + this.masterTimeout = o.masterTimeout; + this.timeout = o.timeout; + this.waitForActiveShards = o.waitForActiveShards; + this.waitForEvents = o.waitForEvents; + this.waitForNoInitializingShards = o.waitForNoInitializingShards; + this.waitForNoRelocatingShards = o.waitForNoRelocatingShards; + this.waitForNodes = o.waitForNodes; + this.waitForStatus = o.waitForStatus; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * The awareness attribute for which the health is required. + *

+ * API name: {@code awareness_attribute} + *

+ */ + @Nonnull + public final Builder awarenessAttribute(@Nullable String value) { + this.awarenessAttribute = value; + return this; + } + + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; + return this; + } + + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Whether to expand wildcard expression to concrete indexes that are open, closed or both. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds all elements of list to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(List list) { this.expandWildcards = _listAddAll(this.expandWildcards, list); return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Whether to expand wildcard expression to concrete indexes that are open, closed or both. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds one or more values to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { this.expandWildcards = _listAdd(this.expandWildcards, value, values); return this; } /** - * Comma-separated list of data streams, indices, and index aliases used to - * limit the request. Wildcard expressions (*) are supported. To target all data - * streams and indices in a cluster, omit this parameter or use _all or *. + * Comma-separated list of data streams, indexes, and index aliases used to limit the request. Wildcard expressions (*) are + * supported. To target all data streams and indexes in a cluster, omit this parameter or use _all or *. *

* API name: {@code index} + *

+ * *

* Adds all elements of list to index. + *

*/ + @Nonnull public final Builder index(List list) { this.index = _listAddAll(this.index, list); return this; } /** - * Comma-separated list of data streams, indices, and index aliases used to - * limit the request. Wildcard expressions (*) are supported. To target all data - * streams and indices in a cluster, omit this parameter or use _all or *. + * Comma-separated list of data streams, indexes, and index aliases used to limit the request. Wildcard expressions (*) are + * supported. To target all data streams and indexes in a cluster, omit this parameter or use _all or *. *

* API name: {@code index} + *

+ * *

* Adds one or more values to index. + *

*/ + @Nonnull public final Builder index(String value, String... values) { this.index = _listAdd(this.index, value, values); return this; } /** - * Can be one of cluster, indices or shards. Controls the details level of the - * health information returned. + * Can be one of cluster, indexes or shards. Controls the details level of the health information returned. *

* API name: {@code level} + *

*/ - public final Builder level(@Nullable Level value) { + @Nonnull + public final Builder level(@Nullable ClusterHealthLevel value) { this.level = value; return this; } /** - * If true, the request retrieves information from the local node only. Defaults - * to false, which means information is retrieved from the cluster-manager node. + * If true, the request retrieves information from the local node only. Defaults to false, which means information is + * retrieved from the cluster-manager node. *

* API name: {@code local} + *

*/ + @Nonnull public final Builder local(@Nullable Boolean value) { this.local = value; return this; } /** - * Period to wait for a connection to the master node. If no response is - * received before the timeout expires, the request fails and returns an error. + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(@Nullable Time value) { this.masterTimeout = value; return this; } /** - * Period to wait for a connection to the master node. If no response is - * received before the timeout expires, the request fails and returns an error. + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Period to wait for a connection to the cluster-manager node. If no response is - * received before the timeout expires, the request fails and returns an error. - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; - return this; + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** - * Period to wait for a connection to the cluster-manager node. If no response is - * received before the timeout expires, the request fails and returns an error. - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(@Nullable Time value) { this.timeout = value; return this; } /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** - * A number controlling to how many active shards to wait for, all to wait for - * all shards in the cluster to be active, or 0 to not wait. + * A number controlling to how many active shards to wait for, all to wait for all shards in the cluster to be active, or 0 to not + * wait. *

* API name: {@code wait_for_active_shards} + *

*/ + @Nonnull public final Builder waitForActiveShards(@Nullable WaitForActiveShards value) { this.waitForActiveShards = value; return this; } /** - * A number controlling to how many active shards to wait for, all to wait for - * all shards in the cluster to be active, or 0 to not wait. + * A number controlling to how many active shards to wait for, all to wait for all shards in the cluster to be active, or 0 to not + * wait. *

* API name: {@code wait_for_active_shards} + *

*/ + @Nonnull public final Builder waitForActiveShards(Function> fn) { - return this.waitForActiveShards(fn.apply(new WaitForActiveShards.Builder()).build()); + return waitForActiveShards(fn.apply(new WaitForActiveShards.Builder()).build()); } /** - * Can be one of immediate, urgent, high, normal, low, languid. Wait until all - * currently queued events with the given priority are processed. + * Can be one of immediate, urgent, high, normal, low, languid. Wait until all currently queued events with the given priority are + * processed. *

* API name: {@code wait_for_events} + *

*/ + @Nonnull public final Builder waitForEvents(@Nullable WaitForEvents value) { this.waitForEvents = value; return this; } /** - * A boolean value which controls whether to wait (until the timeout provided) - * for the cluster to have no shard initializations. Defaults to false, which - * means it will not wait for initializing shards. + * A Boolean value which controls whether to wait (until the timeout provided) for the cluster to have no shard initializations. + * Defaults to false, which means it will not wait for initializing shards. *

* API name: {@code wait_for_no_initializing_shards} + *

*/ + @Nonnull public final Builder waitForNoInitializingShards(@Nullable Boolean value) { this.waitForNoInitializingShards = value; return this; } /** - * A boolean value which controls whether to wait (until the timeout provided) - * for the cluster to have no shard relocations. Defaults to false, which means - * it will not wait for relocating shards. + * A Boolean value which controls whether to wait (until the timeout provided) for the cluster to have no shard relocations. + * Defaults to false, which means it will not wait for relocating shards. *

* API name: {@code wait_for_no_relocating_shards} + *

*/ + @Nonnull public final Builder waitForNoRelocatingShards(@Nullable Boolean value) { this.waitForNoRelocatingShards = value; return this; } /** - * The request waits until the specified number N of nodes is available. It also - * accepts >=N, <=N, >N and <N. Alternatively, it is possible to use - * ge(N), le(N), gt(N) and lt(N) notation. + * The request waits until the specified number N of nodes is available. It also accepts >=N, <=N, >N and <N. + * Alternatively, it is possible to use ge(N), le(N), gt(N) and lt(N) notation. *

* API name: {@code wait_for_nodes} + *

*/ + @Nonnull public final Builder waitForNodes(@Nullable String value) { this.waitForNodes = value; return this; } /** - * One of green, yellow or red. Will wait (until the timeout provided) until the - * status of the cluster changes to the one provided or better, i.e. green > - * yellow > red. By default, will not wait for any status. + * One of green, yellow or red. Will wait (until the timeout provided) until the status of the cluster changes to the one provided + * or better, i.e. green > yellow > red. By default, will not wait for any status. *

* API name: {@code wait_for_status} + *

*/ + @Nonnull public final Builder waitForStatus(@Nullable HealthStatus value) { this.waitForStatus = value; return this; @@ -540,9 +655,10 @@ public final Builder waitForStatus(@Nullable HealthStatus value) { /** * Builds a {@link HealthRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public HealthRequest build() { _checkSingleUse(); @@ -556,13 +672,8 @@ public HealthRequest build() { * Endpoint "{@code cluster.health}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "GET"; - - }, - + request -> "GET", // Request path request -> { final int _index = 1 << 0; @@ -572,28 +683,22 @@ public HealthRequest build() { if (ApiTypeHelper.isDefined(request.index())) propsSet |= _index; if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_cluster"); - buf.append("/health"); - return buf.toString(); + return "/_cluster/health"; } if (propsSet == (_index)) { StringBuilder buf = new StringBuilder(); - buf.append("/_cluster"); - buf.append("/health"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); + buf.append("/_cluster/health/"); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); + if (request.awarenessAttribute != null) { + params.put("awareness_attribute", request.awarenessAttribute); } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); @@ -604,35 +709,78 @@ public HealthRequest build() { if (request.level != null) { params.put("level", request.level.jsonValue()); } - if (request.waitForEvents != null) { - params.put("wait_for_events", request.waitForEvents.jsonValue()); + if (request.local != null) { + params.put("local", String.valueOf(request.local)); } - if (request.waitForNoInitializingShards != null) { - params.put("wait_for_no_initializing_shards", String.valueOf(request.waitForNoInitializingShards)); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); } - if (request.waitForStatus != null) { - params.put("wait_for_status", request.waitForStatus.jsonValue()); + if (request.timeout != null) { + params.put("timeout", request.timeout._toJsonString()); } if (request.waitForActiveShards != null) { params.put("wait_for_active_shards", request.waitForActiveShards._toJsonString()); } - if (request.waitForNodes != null) { - params.put("wait_for_nodes", request.waitForNodes); + if (request.waitForEvents != null) { + params.put("wait_for_events", request.waitForEvents.jsonValue()); + } + if (request.waitForNoInitializingShards != null) { + params.put("wait_for_no_initializing_shards", String.valueOf(request.waitForNoInitializingShards)); } if (request.waitForNoRelocatingShards != null) { params.put("wait_for_no_relocating_shards", String.valueOf(request.waitForNoRelocatingShards)); } - if (request.local != null) { - params.put("local", String.valueOf(request.local)); + if (request.waitForNodes != null) { + params.put("wait_for_nodes", request.waitForNodes); } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); + if (request.waitForStatus != null) { + params.put("wait_for_status", request.waitForStatus.jsonValue()); } return params; - }, SimpleEndpoint.emptyMap(), false, HealthResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.awarenessAttribute); + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.expandWildcards); + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + Objects.hashCode(this.level); + result = 31 * result + Objects.hashCode(this.local); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.timeout); + result = 31 * result + Objects.hashCode(this.waitForActiveShards); + result = 31 * result + Objects.hashCode(this.waitForEvents); + result = 31 * result + Objects.hashCode(this.waitForNoInitializingShards); + result = 31 * result + Objects.hashCode(this.waitForNoRelocatingShards); + result = 31 * result + Objects.hashCode(this.waitForNodes); + result = 31 * result + Objects.hashCode(this.waitForStatus); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + HealthRequest other = (HealthRequest) o; + return Objects.equals(this.awarenessAttribute, other.awarenessAttribute) + && Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.expandWildcards, other.expandWildcards) + && Objects.equals(this.index, other.index) + && Objects.equals(this.level, other.level) + && Objects.equals(this.local, other.local) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.timeout, other.timeout) + && Objects.equals(this.waitForActiveShards, other.waitForActiveShards) + && Objects.equals(this.waitForEvents, other.waitForEvents) + && Objects.equals(this.waitForNoInitializingShards, other.waitForNoInitializingShards) + && Objects.equals(this.waitForNoRelocatingShards, other.waitForNoRelocatingShards) + && Objects.equals(this.waitForNodes, other.waitForNodes) + && Objects.equals(this.waitForStatus, other.waitForStatus); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/HealthResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/HealthResponse.java similarity index 50% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/HealthResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/HealthResponse.java index 9f015f4acc..f6d70d6429 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/HealthResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/HealthResponse.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import jakarta.json.stream.JsonGenerator; import java.util.Map; +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; @@ -43,25 +50,45 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.HealthStatus; +import org.opensearch.client.opensearch._types.Time; +import org.opensearch.client.opensearch.cluster.health.AwarenessAttributeStats; import org.opensearch.client.opensearch.cluster.health.IndexHealthStats; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.health.Response @JsonpDeserializable -public class HealthResponse implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class HealthResponse implements PlainJsonSerializable, ToCopyableBuilder { + private final int activePrimaryShards; private final int activeShards; - private final String activeShardsPercentAsNumber; + @Nullable + private final String activeShardsPercent; + + private final double activeShardsPercentAsNumber; + @Nonnull + private final Map awarenessAttributes; + + @Nonnull private final String clusterName; private final int delayedUnassignedShards; + @Nullable + private final Boolean discoveredClusterManager; + + @Nullable + private final Boolean discoveredMaster; + + @Nonnull private final Map indices; private final int initializingShards; @@ -76,9 +103,13 @@ public class HealthResponse implements PlainJsonSerializable { private final int relocatingShards; + @Nonnull private final HealthStatus status; - private final String taskMaxWaitingInQueueMillis; + @Nullable + private final Time taskMaxWaitingInQueue; + + private final long taskMaxWaitingInQueueMillis; private final boolean timedOut; @@ -87,16 +118,19 @@ public class HealthResponse implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private HealthResponse(Builder builder) { - this.activePrimaryShards = ApiTypeHelper.requireNonNull(builder.activePrimaryShards, this, "activePrimaryShards"); this.activeShards = ApiTypeHelper.requireNonNull(builder.activeShards, this, "activeShards"); + this.activeShardsPercent = builder.activeShardsPercent; this.activeShardsPercentAsNumber = ApiTypeHelper.requireNonNull( builder.activeShardsPercentAsNumber, this, "activeShardsPercentAsNumber" ); + this.awarenessAttributes = ApiTypeHelper.unmodifiable(builder.awarenessAttributes); this.clusterName = ApiTypeHelper.requireNonNull(builder.clusterName, this, "clusterName"); this.delayedUnassignedShards = ApiTypeHelper.requireNonNull(builder.delayedUnassignedShards, this, "delayedUnassignedShards"); + this.discoveredClusterManager = builder.discoveredClusterManager; + this.discoveredMaster = builder.discoveredMaster; this.indices = ApiTypeHelper.unmodifiable(builder.indices); this.initializingShards = ApiTypeHelper.requireNonNull(builder.initializingShards, this, "initializingShards"); this.numberOfDataNodes = ApiTypeHelper.requireNonNull(builder.numberOfDataNodes, this, "numberOfDataNodes"); @@ -105,6 +139,7 @@ private HealthResponse(Builder builder) { this.numberOfPendingTasks = ApiTypeHelper.requireNonNull(builder.numberOfPendingTasks, this, "numberOfPendingTasks"); this.relocatingShards = ApiTypeHelper.requireNonNull(builder.relocatingShards, this, "relocatingShards"); this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + this.taskMaxWaitingInQueue = builder.taskMaxWaitingInQueue; this.taskMaxWaitingInQueueMillis = ApiTypeHelper.requireNonNull( builder.taskMaxWaitingInQueueMillis, this, @@ -112,10 +147,9 @@ private HealthResponse(Builder builder) { ); this.timedOut = ApiTypeHelper.requireNonNull(builder.timedOut, this, "timedOut"); this.unassignedShards = ApiTypeHelper.requireNonNull(builder.unassignedShards, this, "unassignedShards"); - } - public static HealthResponse of(Function> fn) { + public static HealthResponse of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -123,6 +157,7 @@ public static HealthResponse of(Function> * Required - The number of active primary shards. *

* API name: {@code active_primary_shards} + *

*/ public final int activePrimaryShards() { return this.activePrimaryShards; @@ -132,43 +167,82 @@ public final int activePrimaryShards() { * Required - The total number of active primary and replica shards. *

* API name: {@code active_shards} + *

*/ public final int activeShards() { return this.activeShards; } /** - * Required - The ratio of active shards in the cluster expressed as a - * percentage. - *

- * API name: {@code active_shards_percent_as_number} + * API name: {@code active_shards_percent} + */ + @Nullable + public final String activeShardsPercent() { + return this.activeShardsPercent; + } + + /** + * Required - API name: {@code active_shards_percent_as_number} */ - public final String activeShardsPercentAsNumber() { + public final double activeShardsPercentAsNumber() { return this.activeShardsPercentAsNumber; } /** - * Required - The name of the cluster. + * Cluster health information for each awareness attribute. *

- * API name: {@code cluster_name} + * API name: {@code awareness_attributes} + *

+ */ + @Nonnull + public final Map awarenessAttributes() { + return this.awarenessAttributes; + } + + /** + * Required - API name: {@code cluster_name} */ + @Nonnull public final String clusterName() { return this.clusterName; } /** - * Required - The number of shards whose allocation has been delayed by the - * timeout settings. + * Required - The number of shards whose allocation has been delayed by the timeout settings. *

* API name: {@code delayed_unassigned_shards} + *

*/ public final int delayedUnassignedShards() { return this.delayedUnassignedShards; } + /** + * True if the cluster-manager node has been discovered. + *

+ * API name: {@code discovered_cluster_manager} + *

+ */ + @Nullable + public final Boolean discoveredClusterManager() { + return this.discoveredClusterManager; + } + + /** + * True if the cluster-manager node has been discovered. + *

+ * API name: {@code discovered_master} + *

+ */ + @Nullable + public final Boolean discoveredMaster() { + return this.discoveredMaster; + } + /** * API name: {@code indices} */ + @Nonnull public final Map indices() { return this.indices; } @@ -177,6 +251,7 @@ public final Map indices() { * Required - The number of shards that are under initialization. *

* API name: {@code initializing_shards} + *

*/ public final int initializingShards() { return this.initializingShards; @@ -186,13 +261,17 @@ public final int initializingShards() { * Required - The number of nodes that are dedicated data nodes. *

* API name: {@code number_of_data_nodes} + *

*/ public final int numberOfDataNodes() { return this.numberOfDataNodes; } /** - * Required - API name: {@code number_of_in_flight_fetch} + * Required - The number of unfinished fetches. + *

+ * API name: {@code number_of_in_flight_fetch} + *

*/ public final int numberOfInFlightFetch() { return this.numberOfInFlightFetch; @@ -202,16 +281,17 @@ public final int numberOfInFlightFetch() { * Required - The number of nodes within the cluster. *

* API name: {@code number_of_nodes} + *

*/ public final int numberOfNodes() { return this.numberOfNodes; } /** - * Required - The number of cluster-level changes that have not yet been - * executed. + * Required - The number of cluster-level changes that have not yet been executed. *

* API name: {@code number_of_pending_tasks} + *

*/ public final int numberOfPendingTasks() { return this.numberOfPendingTasks; @@ -221,6 +301,7 @@ public final int numberOfPendingTasks() { * Required - The number of shards that are under relocation. *

* API name: {@code relocating_shards} + *

*/ public final int relocatingShards() { return this.relocatingShards; @@ -229,25 +310,32 @@ public final int relocatingShards() { /** * Required - API name: {@code status} */ + @Nonnull public final HealthStatus status() { return this.status; } /** - * Required - The time expressed in milliseconds since the earliest initiated - * task is waiting for being performed. - *

- * API name: {@code task_max_waiting_in_queue_millis} + * API name: {@code task_max_waiting_in_queue} */ - public final String taskMaxWaitingInQueueMillis() { + @Nullable + public final Time taskMaxWaitingInQueue() { + return this.taskMaxWaitingInQueue; + } + + /** + * Required - API name: {@code task_max_waiting_in_queue_millis} + */ + public final long taskMaxWaitingInQueueMillis() { return this.taskMaxWaitingInQueueMillis; } /** - * Required - If false the response returned within the period of time that is - * specified by the timeout parameter (30s by default) + * Required - If false the response returned within the period of time that is specified by the timeout parameter + * (30s by default). *

* API name: {@code timed_out} + *

*/ public final boolean timedOut() { return this.timedOut; @@ -257,6 +345,7 @@ public final boolean timedOut() { * Required - The number of shards that are not allocated. *

* API name: {@code unassigned_shards} + *

*/ public final int unassignedShards() { return this.unassignedShards; @@ -265,6 +354,7 @@ public final int unassignedShards() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -272,33 +362,56 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("active_primary_shards"); generator.write(this.activePrimaryShards); generator.writeKey("active_shards"); generator.write(this.activeShards); + if (this.activeShardsPercent != null) { + generator.writeKey("active_shards_percent"); + generator.write(this.activeShardsPercent); + } + generator.writeKey("active_shards_percent_as_number"); generator.write(this.activeShardsPercentAsNumber); + if (ApiTypeHelper.isDefined(this.awarenessAttributes)) { + generator.writeKey("awareness_attributes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.awarenessAttributes.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); + } + generator.writeKey("cluster_name"); generator.write(this.clusterName); generator.writeKey("delayed_unassigned_shards"); generator.write(this.delayedUnassignedShards); + if (this.discoveredClusterManager != null) { + generator.writeKey("discovered_cluster_manager"); + generator.write(this.discoveredClusterManager); + } + + if (this.discoveredMaster != null) { + generator.writeKey("discovered_master"); + generator.write(this.discoveredMaster); + } + if (ApiTypeHelper.isDefined(this.indices)) { generator.writeKey("indices"); generator.writeStartObject(); for (Map.Entry item0 : this.indices.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + generator.writeKey("initializing_shards"); generator.write(this.initializingShards); @@ -319,6 +432,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("status"); this.status.serialize(generator, mapper); + + if (this.taskMaxWaitingInQueue != null) { + generator.writeKey("task_max_waiting_in_queue"); + this.taskMaxWaitingInQueue.serialize(generator, mapper); + } + generator.writeKey("task_max_waiting_in_queue_millis"); generator.write(this.taskMaxWaitingInQueueMillis); @@ -327,54 +446,116 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("unassigned_shards"); generator.write(this.unassignedShards); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link HealthResponse}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Integer activePrimaryShards; - private Integer activeShards; - - private String activeShardsPercentAsNumber; - + @Nullable + private String activeShardsPercent; + private Double activeShardsPercentAsNumber; + @Nullable + private Map awarenessAttributes; private String clusterName; - private Integer delayedUnassignedShards; - + @Nullable + private Boolean discoveredClusterManager; + @Nullable + private Boolean discoveredMaster; @Nullable private Map indices; - private Integer initializingShards; - private Integer numberOfDataNodes; - private Integer numberOfInFlightFetch; - private Integer numberOfNodes; - private Integer numberOfPendingTasks; - private Integer relocatingShards; - private HealthStatus status; + @Nullable + private Time taskMaxWaitingInQueue; + private Long taskMaxWaitingInQueueMillis; + private Boolean timedOut; + private Integer unassignedShards; - private String taskMaxWaitingInQueueMillis; + public Builder() {} + + private Builder(HealthResponse o) { + this.activePrimaryShards = o.activePrimaryShards; + this.activeShards = o.activeShards; + this.activeShardsPercent = o.activeShardsPercent; + this.activeShardsPercentAsNumber = o.activeShardsPercentAsNumber; + this.awarenessAttributes = _mapCopy(o.awarenessAttributes); + this.clusterName = o.clusterName; + this.delayedUnassignedShards = o.delayedUnassignedShards; + this.discoveredClusterManager = o.discoveredClusterManager; + this.discoveredMaster = o.discoveredMaster; + this.indices = _mapCopy(o.indices); + this.initializingShards = o.initializingShards; + this.numberOfDataNodes = o.numberOfDataNodes; + this.numberOfInFlightFetch = o.numberOfInFlightFetch; + this.numberOfNodes = o.numberOfNodes; + this.numberOfPendingTasks = o.numberOfPendingTasks; + this.relocatingShards = o.relocatingShards; + this.status = o.status; + this.taskMaxWaitingInQueue = o.taskMaxWaitingInQueue; + this.taskMaxWaitingInQueueMillis = o.taskMaxWaitingInQueueMillis; + this.timedOut = o.timedOut; + this.unassignedShards = o.unassignedShards; + } - private Boolean timedOut; + private Builder(Builder o) { + this.activePrimaryShards = o.activePrimaryShards; + this.activeShards = o.activeShards; + this.activeShardsPercent = o.activeShardsPercent; + this.activeShardsPercentAsNumber = o.activeShardsPercentAsNumber; + this.awarenessAttributes = _mapCopy(o.awarenessAttributes); + this.clusterName = o.clusterName; + this.delayedUnassignedShards = o.delayedUnassignedShards; + this.discoveredClusterManager = o.discoveredClusterManager; + this.discoveredMaster = o.discoveredMaster; + this.indices = _mapCopy(o.indices); + this.initializingShards = o.initializingShards; + this.numberOfDataNodes = o.numberOfDataNodes; + this.numberOfInFlightFetch = o.numberOfInFlightFetch; + this.numberOfNodes = o.numberOfNodes; + this.numberOfPendingTasks = o.numberOfPendingTasks; + this.relocatingShards = o.relocatingShards; + this.status = o.status; + this.taskMaxWaitingInQueue = o.taskMaxWaitingInQueue; + this.taskMaxWaitingInQueueMillis = o.taskMaxWaitingInQueueMillis; + this.timedOut = o.timedOut; + this.unassignedShards = o.unassignedShards; + } - private Integer unassignedShards; + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * Required - The number of active primary shards. *

* API name: {@code active_primary_shards} + *

*/ + @Nonnull public final Builder activePrimaryShards(int value) { this.activePrimaryShards = value; return this; @@ -384,49 +565,135 @@ public final Builder activePrimaryShards(int value) { * Required - The total number of active primary and replica shards. *

* API name: {@code active_shards} + *

*/ + @Nonnull public final Builder activeShards(int value) { this.activeShards = value; return this; } /** - * Required - The ratio of active shards in the cluster expressed as a - * percentage. - *

- * API name: {@code active_shards_percent_as_number} + * API name: {@code active_shards_percent} + */ + @Nonnull + public final Builder activeShardsPercent(@Nullable String value) { + this.activeShardsPercent = value; + return this; + } + + /** + * Required - API name: {@code active_shards_percent_as_number} */ - public final Builder activeShardsPercentAsNumber(String value) { + @Nonnull + public final Builder activeShardsPercentAsNumber(double value) { this.activeShardsPercentAsNumber = value; return this; } /** - * Required - The name of the cluster. + * Cluster health information for each awareness attribute. + *

+ * API name: {@code awareness_attributes} + *

+ * + *

+ * Adds all elements of map to awarenessAttributes. + *

+ */ + @Nonnull + public final Builder awarenessAttributes(Map map) { + this.awarenessAttributes = _mapPutAll(this.awarenessAttributes, map); + return this; + } + + /** + * Cluster health information for each awareness attribute. *

- * API name: {@code cluster_name} + * API name: {@code awareness_attributes} + *

+ * + *

+ * Adds an entry to awarenessAttributes. + *

*/ + @Nonnull + public final Builder awarenessAttributes(String key, AwarenessAttributeStats value) { + this.awarenessAttributes = _mapPut(this.awarenessAttributes, key, value); + return this; + } + + /** + * Cluster health information for each awareness attribute. + *

+ * API name: {@code awareness_attributes} + *

+ * + *

+ * Adds a value to awarenessAttributes using a builder lambda. + *

+ */ + @Nonnull + public final Builder awarenessAttributes( + String key, + Function> fn + ) { + return awarenessAttributes(key, fn.apply(new AwarenessAttributeStats.Builder()).build()); + } + + /** + * Required - API name: {@code cluster_name} + */ + @Nonnull public final Builder clusterName(String value) { this.clusterName = value; return this; } /** - * Required - The number of shards whose allocation has been delayed by the - * timeout settings. + * Required - The number of shards whose allocation has been delayed by the timeout settings. *

* API name: {@code delayed_unassigned_shards} + *

*/ + @Nonnull public final Builder delayedUnassignedShards(int value) { this.delayedUnassignedShards = value; return this; } + /** + * True if the cluster-manager node has been discovered. + *

+ * API name: {@code discovered_cluster_manager} + *

+ */ + @Nonnull + public final Builder discoveredClusterManager(@Nullable Boolean value) { + this.discoveredClusterManager = value; + return this; + } + + /** + * True if the cluster-manager node has been discovered. + *

+ * API name: {@code discovered_master} + *

+ */ + @Nonnull + public final Builder discoveredMaster(@Nullable Boolean value) { + this.discoveredMaster = value; + return this; + } + /** * API name: {@code indices} + * *

- * Adds all entries of map to indices. + * Adds all elements of map to indices. + *

*/ + @Nonnull public final Builder indices(Map map) { this.indices = _mapPutAll(this.indices, map); return this; @@ -434,9 +701,12 @@ public final Builder indices(Map map) { /** * API name: {@code indices} + * *

* Adds an entry to indices. + *

*/ + @Nonnull public final Builder indices(String key, IndexHealthStats value) { this.indices = _mapPut(this.indices, key, value); return this; @@ -444,9 +714,12 @@ public final Builder indices(String key, IndexHealthStats value) { /** * API name: {@code indices} + * *

- * Adds an entry to indices using a builder lambda. + * Adds a value to indices using a builder lambda. + *

*/ + @Nonnull public final Builder indices(String key, Function> fn) { return indices(key, fn.apply(new IndexHealthStats.Builder()).build()); } @@ -455,7 +728,9 @@ public final Builder indices(String key, Function * API name: {@code initializing_shards} + *

*/ + @Nonnull public final Builder initializingShards(int value) { this.initializingShards = value; return this; @@ -465,15 +740,21 @@ public final Builder initializingShards(int value) { * Required - The number of nodes that are dedicated data nodes. *

* API name: {@code number_of_data_nodes} + *

*/ + @Nonnull public final Builder numberOfDataNodes(int value) { this.numberOfDataNodes = value; return this; } /** - * Required - API name: {@code number_of_in_flight_fetch} + * Required - The number of unfinished fetches. + *

+ * API name: {@code number_of_in_flight_fetch} + *

*/ + @Nonnull public final Builder numberOfInFlightFetch(int value) { this.numberOfInFlightFetch = value; return this; @@ -483,18 +764,21 @@ public final Builder numberOfInFlightFetch(int value) { * Required - The number of nodes within the cluster. *

* API name: {@code number_of_nodes} + *

*/ + @Nonnull public final Builder numberOfNodes(int value) { this.numberOfNodes = value; return this; } /** - * Required - The number of cluster-level changes that have not yet been - * executed. + * Required - The number of cluster-level changes that have not yet been executed. *

* API name: {@code number_of_pending_tasks} + *

*/ + @Nonnull public final Builder numberOfPendingTasks(int value) { this.numberOfPendingTasks = value; return this; @@ -504,7 +788,9 @@ public final Builder numberOfPendingTasks(int value) { * Required - The number of shards that are under relocation. *

* API name: {@code relocating_shards} + *

*/ + @Nonnull public final Builder relocatingShards(int value) { this.relocatingShards = value; return this; @@ -513,28 +799,46 @@ public final Builder relocatingShards(int value) { /** * Required - API name: {@code status} */ + @Nonnull public final Builder status(HealthStatus value) { this.status = value; return this; } /** - * Required - The time expressed in milliseconds since the earliest initiated - * task is waiting for being performed. - *

- * API name: {@code task_max_waiting_in_queue_millis} + * API name: {@code task_max_waiting_in_queue} + */ + @Nonnull + public final Builder taskMaxWaitingInQueue(@Nullable Time value) { + this.taskMaxWaitingInQueue = value; + return this; + } + + /** + * API name: {@code task_max_waiting_in_queue} */ - public final Builder taskMaxWaitingInQueueMillis(String value) { + @Nonnull + public final Builder taskMaxWaitingInQueue(Function> fn) { + return taskMaxWaitingInQueue(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - API name: {@code task_max_waiting_in_queue_millis} + */ + @Nonnull + public final Builder taskMaxWaitingInQueueMillis(long value) { this.taskMaxWaitingInQueueMillis = value; return this; } /** - * Required - If false the response returned within the period of time that is - * specified by the timeout parameter (30s by default) + * Required - If false the response returned within the period of time that is specified by the timeout parameter + * (30s by default). *

* API name: {@code timed_out} + *

*/ + @Nonnull public final Builder timedOut(boolean value) { this.timedOut = value; return this; @@ -544,7 +848,9 @@ public final Builder timedOut(boolean value) { * Required - The number of shards that are not allocated. *

* API name: {@code unassigned_shards} + *

*/ + @Nonnull public final Builder unassignedShards(int value) { this.unassignedShards = value; return this; @@ -553,9 +859,10 @@ public final Builder unassignedShards(int value) { /** * Builds a {@link HealthResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public HealthResponse build() { _checkSingleUse(); @@ -574,12 +881,19 @@ public HealthResponse build() { ); protected static void setupHealthResponseDeserializer(ObjectDeserializer op) { - op.add(Builder::activePrimaryShards, JsonpDeserializer.integerDeserializer(), "active_primary_shards"); op.add(Builder::activeShards, JsonpDeserializer.integerDeserializer(), "active_shards"); - op.add(Builder::activeShardsPercentAsNumber, JsonpDeserializer.stringDeserializer(), "active_shards_percent_as_number"); + op.add(Builder::activeShardsPercent, JsonpDeserializer.stringDeserializer(), "active_shards_percent"); + op.add(Builder::activeShardsPercentAsNumber, JsonpDeserializer.doubleDeserializer(), "active_shards_percent_as_number"); + op.add( + Builder::awarenessAttributes, + JsonpDeserializer.stringMapDeserializer(AwarenessAttributeStats._DESERIALIZER), + "awareness_attributes" + ); op.add(Builder::clusterName, JsonpDeserializer.stringDeserializer(), "cluster_name"); op.add(Builder::delayedUnassignedShards, JsonpDeserializer.integerDeserializer(), "delayed_unassigned_shards"); + op.add(Builder::discoveredClusterManager, JsonpDeserializer.booleanDeserializer(), "discovered_cluster_manager"); + op.add(Builder::discoveredMaster, JsonpDeserializer.booleanDeserializer(), "discovered_master"); op.add(Builder::indices, JsonpDeserializer.stringMapDeserializer(IndexHealthStats._DESERIALIZER), "indices"); op.add(Builder::initializingShards, JsonpDeserializer.integerDeserializer(), "initializing_shards"); op.add(Builder::numberOfDataNodes, JsonpDeserializer.integerDeserializer(), "number_of_data_nodes"); @@ -588,10 +902,64 @@ protected static void setupHealthResponseDeserializer(ObjectDeserializer { - public OpenSearchClusterAsyncClient(OpenSearchTransport transport) { super(transport, null); } @@ -67,30 +70,17 @@ public OpenSearchClusterAsyncClient withTransportOptions(@Nullable TransportOpti /** * Provides explanations for shard allocations in the cluster. - * - * */ - public CompletableFuture allocationExplain(AllocationExplainRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - AllocationExplainRequest, - AllocationExplainResponse, - ErrorResponse>) AllocationExplainRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, AllocationExplainRequest._ENDPOINT, this.transportOptions); } /** * Provides explanations for shard allocations in the cluster. * - * @param fn - * a function that initializes a builder to create the - * {@link AllocationExplainRequest} - * + * @param fn a function that initializes a builder to create the {@link AllocationExplainRequest} */ - public final CompletableFuture allocationExplain( Function> fn ) throws IOException, OpenSearchException { @@ -99,46 +89,26 @@ public final CompletableFuture allocationExplain( /** * Provides explanations for shard allocations in the cluster. - * - * */ - - public CompletableFuture allocationExplain() throws IOException, OpenSearchException { - return this.transport.performRequestAsync( - new AllocationExplainRequest.Builder().build(), - AllocationExplainRequest._ENDPOINT, - this.transportOptions - ); + public final CompletableFuture allocationExplain() throws IOException, OpenSearchException { + return allocationExplain(new AllocationExplainRequest.Builder().build()); } // ----- Endpoint: cluster.delete_component_template /** - * Deletes a component template - * - * + * Deletes a component template. */ - public CompletableFuture deleteComponentTemplate(DeleteComponentTemplateRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DeleteComponentTemplateRequest, - DeleteComponentTemplateResponse, - ErrorResponse>) DeleteComponentTemplateRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, DeleteComponentTemplateRequest._ENDPOINT, this.transportOptions); } /** - * Deletes a component template - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteComponentTemplateRequest} + * Deletes a component template. * + * @param fn a function that initializes a builder to create the {@link DeleteComponentTemplateRequest} */ - public final CompletableFuture deleteComponentTemplate( Function> fn ) throws IOException, OpenSearchException { @@ -149,30 +119,17 @@ public final CompletableFuture deleteComponentT /** * Clears cluster voting config exclusions. - * - * */ - public CompletableFuture deleteVotingConfigExclusions(DeleteVotingConfigExclusionsRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DeleteVotingConfigExclusionsRequest, - BooleanResponse, - ErrorResponse>) DeleteVotingConfigExclusionsRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, DeleteVotingConfigExclusionsRequest._ENDPOINT, this.transportOptions); } /** * Clears cluster voting config exclusions. * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteVotingConfigExclusionsRequest} - * + * @param fn a function that initializes a builder to create the {@link DeleteVotingConfigExclusionsRequest} */ - public final CompletableFuture deleteVotingConfigExclusions( Function> fn ) throws IOException, OpenSearchException { @@ -181,46 +138,26 @@ public final CompletableFuture deleteVotingConfigExclusions( /** * Clears cluster voting config exclusions. - * - * */ - - public CompletableFuture deleteVotingConfigExclusions() throws IOException, OpenSearchException { - return this.transport.performRequestAsync( - new DeleteVotingConfigExclusionsRequest.Builder().build(), - DeleteVotingConfigExclusionsRequest._ENDPOINT, - this.transportOptions - ); + public final CompletableFuture deleteVotingConfigExclusions() throws IOException, OpenSearchException { + return deleteVotingConfigExclusions(new DeleteVotingConfigExclusionsRequest.Builder().build()); } // ----- Endpoint: cluster.exists_component_template /** - * Returns information about whether a particular component template exist - * - * + * Returns information about whether a particular component template exist. */ - public CompletableFuture existsComponentTemplate(ExistsComponentTemplateRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - ExistsComponentTemplateRequest, - BooleanResponse, - ErrorResponse>) ExistsComponentTemplateRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, ExistsComponentTemplateRequest._ENDPOINT, this.transportOptions); } /** - * Returns information about whether a particular component template exist - * - * @param fn - * a function that initializes a builder to create the - * {@link ExistsComponentTemplateRequest} + * Returns information about whether a particular component template exist. * + * @param fn a function that initializes a builder to create the {@link ExistsComponentTemplateRequest} */ - public final CompletableFuture existsComponentTemplate( Function> fn ) throws IOException, OpenSearchException { @@ -230,31 +167,18 @@ public final CompletableFuture existsComponentTemplate( // ----- Endpoint: cluster.get_component_template /** - * Returns one or more component templates - * - * + * Returns one or more component templates. */ - public CompletableFuture getComponentTemplate(GetComponentTemplateRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - GetComponentTemplateRequest, - GetComponentTemplateResponse, - ErrorResponse>) GetComponentTemplateRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, GetComponentTemplateRequest._ENDPOINT, this.transportOptions); } /** - * Returns one or more component templates - * - * @param fn - * a function that initializes a builder to create the - * {@link GetComponentTemplateRequest} + * Returns one or more component templates. * + * @param fn a function that initializes a builder to create the {@link GetComponentTemplateRequest} */ - public final CompletableFuture getComponentTemplate( Function> fn ) throws IOException, OpenSearchException { @@ -262,47 +186,27 @@ public final CompletableFuture getComponentTemplat } /** - * Returns one or more component templates - * - * + * Returns one or more component templates. */ - - public CompletableFuture getComponentTemplate() throws IOException, OpenSearchException { - return this.transport.performRequestAsync( - new GetComponentTemplateRequest.Builder().build(), - GetComponentTemplateRequest._ENDPOINT, - this.transportOptions - ); + public final CompletableFuture getComponentTemplate() throws IOException, OpenSearchException { + return getComponentTemplate(new GetComponentTemplateRequest.Builder().build()); } // ----- Endpoint: cluster.get_settings /** * Returns cluster settings. - * - * */ - public CompletableFuture getSettings(GetClusterSettingsRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - GetClusterSettingsRequest, - GetClusterSettingsResponse, - ErrorResponse>) GetClusterSettingsRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, GetClusterSettingsRequest._ENDPOINT, this.transportOptions); } /** * Returns cluster settings. * - * @param fn - * a function that initializes a builder to create the - * {@link GetClusterSettingsRequest} - * + * @param fn a function that initializes a builder to create the {@link GetClusterSettingsRequest} */ - public final CompletableFuture getSettings( Function> fn ) throws IOException, OpenSearchException { @@ -311,45 +215,25 @@ public final CompletableFuture getSettings( /** * Returns cluster settings. - * - * */ - - public CompletableFuture getSettings() throws IOException, OpenSearchException { - return this.transport.performRequestAsync( - new GetClusterSettingsRequest.Builder().build(), - GetClusterSettingsRequest._ENDPOINT, - this.transportOptions - ); + public final CompletableFuture getSettings() throws IOException, OpenSearchException { + return getSettings(new GetClusterSettingsRequest.Builder().build()); } // ----- Endpoint: cluster.health /** * Returns basic information about the health of the cluster. - * - * */ - public CompletableFuture health(HealthRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - HealthRequest, - HealthResponse, - ErrorResponse>) HealthRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, HealthRequest._ENDPOINT, this.transportOptions); } /** * Returns basic information about the health of the cluster. * - * @param fn - * a function that initializes a builder to create the - * {@link HealthRequest} - * + * @param fn a function that initializes a builder to create the {@link HealthRequest} */ - public final CompletableFuture health(Function> fn) throws IOException, OpenSearchException { return health(fn.apply(new HealthRequest.Builder()).build()); @@ -357,43 +241,27 @@ public final CompletableFuture health(Function health() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(new HealthRequest.Builder().build(), HealthRequest._ENDPOINT, this.transportOptions); + public final CompletableFuture health() throws IOException, OpenSearchException { + return health(new HealthRequest.Builder().build()); } // ----- Endpoint: cluster.pending_tasks /** - * Returns a list of any cluster-level changes (e.g. create index, update - * mapping, allocate or fail shard) which have not yet been executed. - * - * + * Returns a list of any cluster-level changes (e.g. create index, update mapping, allocate or fail shard) which have not yet been + * executed. */ - public CompletableFuture pendingTasks(PendingTasksRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - PendingTasksRequest, - PendingTasksResponse, - ErrorResponse>) PendingTasksRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, PendingTasksRequest._ENDPOINT, this.transportOptions); } /** - * Returns a list of any cluster-level changes (e.g. create index, update - * mapping, allocate or fail shard) which have not yet been executed. - * - * @param fn - * a function that initializes a builder to create the - * {@link PendingTasksRequest} + * Returns a list of any cluster-level changes (e.g. create index, update mapping, allocate or fail shard) which have not yet been + * executed. * + * @param fn a function that initializes a builder to create the {@link PendingTasksRequest} */ - public final CompletableFuture pendingTasks( Function> fn ) throws IOException, OpenSearchException { @@ -401,48 +269,28 @@ public final CompletableFuture pendingTasks( } /** - * Returns a list of any cluster-level changes (e.g. create index, update - * mapping, allocate or fail shard) which have not yet been executed. - * - * + * Returns a list of any cluster-level changes (e.g. create index, update mapping, allocate or fail shard) which have not yet been + * executed. */ - - public CompletableFuture pendingTasks() throws IOException, OpenSearchException { - return this.transport.performRequestAsync( - new PendingTasksRequest.Builder().build(), - PendingTasksRequest._ENDPOINT, - this.transportOptions - ); + public final CompletableFuture pendingTasks() throws IOException, OpenSearchException { + return pendingTasks(new PendingTasksRequest.Builder().build()); } // ----- Endpoint: cluster.post_voting_config_exclusions /** * Updates the cluster voting config exclusions by node ids or node names. - * - * */ - public CompletableFuture postVotingConfigExclusions(PostVotingConfigExclusionsRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - PostVotingConfigExclusionsRequest, - BooleanResponse, - ErrorResponse>) PostVotingConfigExclusionsRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, PostVotingConfigExclusionsRequest._ENDPOINT, this.transportOptions); } /** * Updates the cluster voting config exclusions by node ids or node names. * - * @param fn - * a function that initializes a builder to create the - * {@link PostVotingConfigExclusionsRequest} - * + * @param fn a function that initializes a builder to create the {@link PostVotingConfigExclusionsRequest} */ - public final CompletableFuture postVotingConfigExclusions( Function> fn ) throws IOException, OpenSearchException { @@ -451,46 +299,26 @@ public final CompletableFuture postVotingConfigExclusions( /** * Updates the cluster voting config exclusions by node ids or node names. - * - * */ - - public CompletableFuture postVotingConfigExclusions() throws IOException, OpenSearchException { - return this.transport.performRequestAsync( - new PostVotingConfigExclusionsRequest.Builder().build(), - PostVotingConfigExclusionsRequest._ENDPOINT, - this.transportOptions - ); + public final CompletableFuture postVotingConfigExclusions() throws IOException, OpenSearchException { + return postVotingConfigExclusions(new PostVotingConfigExclusionsRequest.Builder().build()); } // ----- Endpoint: cluster.put_component_template /** - * Creates or updates a component template - * - * + * Creates or updates a component template. */ - public CompletableFuture putComponentTemplate(PutComponentTemplateRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - PutComponentTemplateRequest, - PutComponentTemplateResponse, - ErrorResponse>) PutComponentTemplateRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, PutComponentTemplateRequest._ENDPOINT, this.transportOptions); } /** - * Creates or updates a component template - * - * @param fn - * a function that initializes a builder to create the - * {@link PutComponentTemplateRequest} + * Creates or updates a component template. * + * @param fn a function that initializes a builder to create the {@link PutComponentTemplateRequest} */ - public final CompletableFuture putComponentTemplate( Function> fn ) throws IOException, OpenSearchException { @@ -501,30 +329,17 @@ public final CompletableFuture putComponentTemplat /** * Updates the cluster settings. - * - * */ - public CompletableFuture putSettings(PutClusterSettingsRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - PutClusterSettingsRequest, - PutClusterSettingsResponse, - ErrorResponse>) PutClusterSettingsRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, PutClusterSettingsRequest._ENDPOINT, this.transportOptions); } /** * Updates the cluster settings. * - * @param fn - * a function that initializes a builder to create the - * {@link PutClusterSettingsRequest} - * + * @param fn a function that initializes a builder to create the {@link PutClusterSettingsRequest} */ - public final CompletableFuture putSettings( Function> fn ) throws IOException, OpenSearchException { @@ -533,24 +348,15 @@ public final CompletableFuture putSettings( /** * Updates the cluster settings. - * - * */ - - public CompletableFuture putSettings() throws IOException, OpenSearchException { - return this.transport.performRequestAsync( - new PutClusterSettingsRequest.Builder().build(), - PutClusterSettingsRequest._ENDPOINT, - this.transportOptions - ); + public final CompletableFuture putSettings() throws IOException, OpenSearchException { + return putSettings(new PutClusterSettingsRequest.Builder().build()); } // ----- Endpoint: cluster.remote_info /** * Returns the information about configured remote clusters. - * - * */ public CompletableFuture remoteInfo() throws IOException, OpenSearchException { return this.transport.performRequestAsync(RemoteInfoRequest._INSTANCE, RemoteInfoRequest._ENDPOINT, this.transportOptions); @@ -560,29 +366,16 @@ public CompletableFuture remoteInfo() throws IOException, Op /** * Allows to manually change the allocation of individual shards in the cluster. - * - * */ - public CompletableFuture reroute(RerouteRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - RerouteRequest, - RerouteResponse, - ErrorResponse>) RerouteRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, RerouteRequest._ENDPOINT, this.transportOptions); } /** * Allows to manually change the allocation of individual shards in the cluster. * - * @param fn - * a function that initializes a builder to create the - * {@link RerouteRequest} - * + * @param fn a function that initializes a builder to create the {@link RerouteRequest} */ - public final CompletableFuture reroute(Function> fn) throws IOException, OpenSearchException { return reroute(fn.apply(new RerouteRequest.Builder()).build()); @@ -590,41 +383,25 @@ public final CompletableFuture reroute(Function reroute() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(new RerouteRequest.Builder().build(), RerouteRequest._ENDPOINT, this.transportOptions); + public final CompletableFuture reroute() throws IOException, OpenSearchException { + return reroute(new RerouteRequest.Builder().build()); } // ----- Endpoint: cluster.state /** * Returns a comprehensive information about the state of the cluster. - * - * */ - public CompletableFuture state(StateRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - StateRequest, - StateResponse, - ErrorResponse>) StateRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, StateRequest._ENDPOINT, this.transportOptions); } /** * Returns a comprehensive information about the state of the cluster. * - * @param fn - * a function that initializes a builder to create the - * {@link StateRequest} - * + * @param fn a function that initializes a builder to create the {@link StateRequest} */ - public final CompletableFuture state(Function> fn) throws IOException, OpenSearchException { return state(fn.apply(new StateRequest.Builder()).build()); @@ -632,41 +409,25 @@ public final CompletableFuture state(Function state() throws IOException, OpenSearchException { - return this.transport.performRequestAsync(new StateRequest.Builder().build(), StateRequest._ENDPOINT, this.transportOptions); + public final CompletableFuture state() throws IOException, OpenSearchException { + return state(new StateRequest.Builder().build()); } // ----- Endpoint: cluster.stats /** * Returns high-level overview of cluster statistics. - * - * */ - public CompletableFuture stats(ClusterStatsRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - ClusterStatsRequest, - ClusterStatsResponse, - ErrorResponse>) ClusterStatsRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + return this.transport.performRequestAsync(request, ClusterStatsRequest._ENDPOINT, this.transportOptions); } /** * Returns high-level overview of cluster statistics. * - * @param fn - * a function that initializes a builder to create the - * {@link ClusterStatsRequest} - * + * @param fn a function that initializes a builder to create the {@link ClusterStatsRequest} */ - public final CompletableFuture stats(Function> fn) throws IOException, OpenSearchException { return stats(fn.apply(new ClusterStatsRequest.Builder()).build()); @@ -674,16 +435,8 @@ public final CompletableFuture stats(Function stats() throws IOException, OpenSearchException { - return this.transport.performRequestAsync( - new ClusterStatsRequest.Builder().build(), - ClusterStatsRequest._ENDPOINT, - this.transportOptions - ); + public final CompletableFuture stats() throws IOException, OpenSearchException { + return stats(new ClusterStatsRequest.Builder().build()); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterClient.java similarity index 51% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterClient.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterClient.java index 1b1efae0ad..a8e946665b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterClient.java @@ -30,15 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import java.io.IOException; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.ApiClient; -import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.OpenSearchException; -import org.opensearch.client.transport.JsonEndpoint; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; import org.opensearch.client.transport.endpoints.BooleanResponse; @@ -47,8 +50,8 @@ /** * Client for the cluster namespace. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") public class OpenSearchClusterClient extends ApiClient { - public OpenSearchClusterClient(OpenSearchTransport transport) { super(transport, null); } @@ -66,29 +69,16 @@ public OpenSearchClusterClient withTransportOptions(@Nullable TransportOptions t /** * Provides explanations for shard allocations in the cluster. - * - * */ - public AllocationExplainResponse allocationExplain(AllocationExplainRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - AllocationExplainRequest, - AllocationExplainResponse, - ErrorResponse>) AllocationExplainRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, AllocationExplainRequest._ENDPOINT, this.transportOptions); } /** * Provides explanations for shard allocations in the cluster. * - * @param fn - * a function that initializes a builder to create the - * {@link AllocationExplainRequest} - * + * @param fn a function that initializes a builder to create the {@link AllocationExplainRequest} */ - public final AllocationExplainResponse allocationExplain( Function> fn ) throws IOException, OpenSearchException { @@ -97,46 +87,26 @@ public final AllocationExplainResponse allocationExplain( /** * Provides explanations for shard allocations in the cluster. - * - * */ - - public AllocationExplainResponse allocationExplain() throws IOException, OpenSearchException { - return this.transport.performRequest( - new AllocationExplainRequest.Builder().build(), - AllocationExplainRequest._ENDPOINT, - this.transportOptions - ); + public final AllocationExplainResponse allocationExplain() throws IOException, OpenSearchException { + return allocationExplain(new AllocationExplainRequest.Builder().build()); } // ----- Endpoint: cluster.delete_component_template /** - * Deletes a component template - * - * + * Deletes a component template. */ - public DeleteComponentTemplateResponse deleteComponentTemplate(DeleteComponentTemplateRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DeleteComponentTemplateRequest, - DeleteComponentTemplateResponse, - ErrorResponse>) DeleteComponentTemplateRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, DeleteComponentTemplateRequest._ENDPOINT, this.transportOptions); } /** - * Deletes a component template - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteComponentTemplateRequest} + * Deletes a component template. * + * @param fn a function that initializes a builder to create the {@link DeleteComponentTemplateRequest} */ - public final DeleteComponentTemplateResponse deleteComponentTemplate( Function> fn ) throws IOException, OpenSearchException { @@ -147,30 +117,17 @@ public final DeleteComponentTemplateResponse deleteComponentTemplate( /** * Clears cluster voting config exclusions. - * - * */ - public BooleanResponse deleteVotingConfigExclusions(DeleteVotingConfigExclusionsRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DeleteVotingConfigExclusionsRequest, - BooleanResponse, - ErrorResponse>) DeleteVotingConfigExclusionsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, DeleteVotingConfigExclusionsRequest._ENDPOINT, this.transportOptions); } /** * Clears cluster voting config exclusions. * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteVotingConfigExclusionsRequest} - * + * @param fn a function that initializes a builder to create the {@link DeleteVotingConfigExclusionsRequest} */ - public final BooleanResponse deleteVotingConfigExclusions( Function> fn ) throws IOException, OpenSearchException { @@ -179,45 +136,25 @@ public final BooleanResponse deleteVotingConfigExclusions( /** * Clears cluster voting config exclusions. - * - * */ - - public BooleanResponse deleteVotingConfigExclusions() throws IOException, OpenSearchException { - return this.transport.performRequest( - new DeleteVotingConfigExclusionsRequest.Builder().build(), - DeleteVotingConfigExclusionsRequest._ENDPOINT, - this.transportOptions - ); + public final BooleanResponse deleteVotingConfigExclusions() throws IOException, OpenSearchException { + return deleteVotingConfigExclusions(new DeleteVotingConfigExclusionsRequest.Builder().build()); } // ----- Endpoint: cluster.exists_component_template /** - * Returns information about whether a particular component template exist - * - * + * Returns information about whether a particular component template exist. */ - public BooleanResponse existsComponentTemplate(ExistsComponentTemplateRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - ExistsComponentTemplateRequest, - BooleanResponse, - ErrorResponse>) ExistsComponentTemplateRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, ExistsComponentTemplateRequest._ENDPOINT, this.transportOptions); } /** - * Returns information about whether a particular component template exist - * - * @param fn - * a function that initializes a builder to create the - * {@link ExistsComponentTemplateRequest} + * Returns information about whether a particular component template exist. * + * @param fn a function that initializes a builder to create the {@link ExistsComponentTemplateRequest} */ - public final BooleanResponse existsComponentTemplate( Function> fn ) throws IOException, OpenSearchException { @@ -227,30 +164,17 @@ public final BooleanResponse existsComponentTemplate( // ----- Endpoint: cluster.get_component_template /** - * Returns one or more component templates - * - * + * Returns one or more component templates. */ - public GetComponentTemplateResponse getComponentTemplate(GetComponentTemplateRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - GetComponentTemplateRequest, - GetComponentTemplateResponse, - ErrorResponse>) GetComponentTemplateRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, GetComponentTemplateRequest._ENDPOINT, this.transportOptions); } /** - * Returns one or more component templates - * - * @param fn - * a function that initializes a builder to create the - * {@link GetComponentTemplateRequest} + * Returns one or more component templates. * + * @param fn a function that initializes a builder to create the {@link GetComponentTemplateRequest} */ - public final GetComponentTemplateResponse getComponentTemplate( Function> fn ) throws IOException, OpenSearchException { @@ -258,46 +182,26 @@ public final GetComponentTemplateResponse getComponentTemplate( } /** - * Returns one or more component templates - * - * + * Returns one or more component templates. */ - - public GetComponentTemplateResponse getComponentTemplate() throws IOException, OpenSearchException { - return this.transport.performRequest( - new GetComponentTemplateRequest.Builder().build(), - GetComponentTemplateRequest._ENDPOINT, - this.transportOptions - ); + public final GetComponentTemplateResponse getComponentTemplate() throws IOException, OpenSearchException { + return getComponentTemplate(new GetComponentTemplateRequest.Builder().build()); } // ----- Endpoint: cluster.get_settings /** * Returns cluster settings. - * - * */ - public GetClusterSettingsResponse getSettings(GetClusterSettingsRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - GetClusterSettingsRequest, - GetClusterSettingsResponse, - ErrorResponse>) GetClusterSettingsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, GetClusterSettingsRequest._ENDPOINT, this.transportOptions); } /** * Returns cluster settings. * - * @param fn - * a function that initializes a builder to create the - * {@link GetClusterSettingsRequest} - * + * @param fn a function that initializes a builder to create the {@link GetClusterSettingsRequest} */ - public final GetClusterSettingsResponse getSettings( Function> fn ) throws IOException, OpenSearchException { @@ -306,45 +210,25 @@ public final GetClusterSettingsResponse getSettings( /** * Returns cluster settings. - * - * */ - - public GetClusterSettingsResponse getSettings() throws IOException, OpenSearchException { - return this.transport.performRequest( - new GetClusterSettingsRequest.Builder().build(), - GetClusterSettingsRequest._ENDPOINT, - this.transportOptions - ); + public final GetClusterSettingsResponse getSettings() throws IOException, OpenSearchException { + return getSettings(new GetClusterSettingsRequest.Builder().build()); } // ----- Endpoint: cluster.health /** * Returns basic information about the health of the cluster. - * - * */ - public HealthResponse health(HealthRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - HealthRequest, - HealthResponse, - ErrorResponse>) HealthRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, HealthRequest._ENDPOINT, this.transportOptions); } /** * Returns basic information about the health of the cluster. * - * @param fn - * a function that initializes a builder to create the - * {@link HealthRequest} - * + * @param fn a function that initializes a builder to create the {@link HealthRequest} */ - public final HealthResponse health(Function> fn) throws IOException, OpenSearchException { return health(fn.apply(new HealthRequest.Builder()).build()); @@ -352,90 +236,54 @@ public final HealthResponse health(Function endpoint = (JsonEndpoint< - PendingTasksRequest, - PendingTasksResponse, - ErrorResponse>) PendingTasksRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, PendingTasksRequest._ENDPOINT, this.transportOptions); } /** - * Returns a list of any cluster-level changes (e.g. create index, update - * mapping, allocate or fail shard) which have not yet been executed. - * - * @param fn - * a function that initializes a builder to create the - * {@link PendingTasksRequest} + * Returns a list of any cluster-level changes (e.g. create index, update mapping, allocate or fail shard) which have not yet been + * executed. * + * @param fn a function that initializes a builder to create the {@link PendingTasksRequest} */ - public final PendingTasksResponse pendingTasks(Function> fn) throws IOException, OpenSearchException { return pendingTasks(fn.apply(new PendingTasksRequest.Builder()).build()); } /** - * Returns a list of any cluster-level changes (e.g. create index, update - * mapping, allocate or fail shard) which have not yet been executed. - * - * + * Returns a list of any cluster-level changes (e.g. create index, update mapping, allocate or fail shard) which have not yet been + * executed. */ - - public PendingTasksResponse pendingTasks() throws IOException, OpenSearchException { - return this.transport.performRequest( - new PendingTasksRequest.Builder().build(), - PendingTasksRequest._ENDPOINT, - this.transportOptions - ); + public final PendingTasksResponse pendingTasks() throws IOException, OpenSearchException { + return pendingTasks(new PendingTasksRequest.Builder().build()); } // ----- Endpoint: cluster.post_voting_config_exclusions /** * Updates the cluster voting config exclusions by node ids or node names. - * - * */ - public BooleanResponse postVotingConfigExclusions(PostVotingConfigExclusionsRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - PostVotingConfigExclusionsRequest, - BooleanResponse, - ErrorResponse>) PostVotingConfigExclusionsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, PostVotingConfigExclusionsRequest._ENDPOINT, this.transportOptions); } /** * Updates the cluster voting config exclusions by node ids or node names. * - * @param fn - * a function that initializes a builder to create the - * {@link PostVotingConfigExclusionsRequest} - * + * @param fn a function that initializes a builder to create the {@link PostVotingConfigExclusionsRequest} */ - public final BooleanResponse postVotingConfigExclusions( Function> fn ) throws IOException, OpenSearchException { @@ -444,45 +292,25 @@ public final BooleanResponse postVotingConfigExclusions( /** * Updates the cluster voting config exclusions by node ids or node names. - * - * */ - - public BooleanResponse postVotingConfigExclusions() throws IOException, OpenSearchException { - return this.transport.performRequest( - new PostVotingConfigExclusionsRequest.Builder().build(), - PostVotingConfigExclusionsRequest._ENDPOINT, - this.transportOptions - ); + public final BooleanResponse postVotingConfigExclusions() throws IOException, OpenSearchException { + return postVotingConfigExclusions(new PostVotingConfigExclusionsRequest.Builder().build()); } // ----- Endpoint: cluster.put_component_template /** - * Creates or updates a component template - * - * + * Creates or updates a component template. */ - public PutComponentTemplateResponse putComponentTemplate(PutComponentTemplateRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - PutComponentTemplateRequest, - PutComponentTemplateResponse, - ErrorResponse>) PutComponentTemplateRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, PutComponentTemplateRequest._ENDPOINT, this.transportOptions); } /** - * Creates or updates a component template - * - * @param fn - * a function that initializes a builder to create the - * {@link PutComponentTemplateRequest} + * Creates or updates a component template. * + * @param fn a function that initializes a builder to create the {@link PutComponentTemplateRequest} */ - public final PutComponentTemplateResponse putComponentTemplate( Function> fn ) throws IOException, OpenSearchException { @@ -493,29 +321,16 @@ public final PutComponentTemplateResponse putComponentTemplate( /** * Updates the cluster settings. - * - * */ - public PutClusterSettingsResponse putSettings(PutClusterSettingsRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - PutClusterSettingsRequest, - PutClusterSettingsResponse, - ErrorResponse>) PutClusterSettingsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, PutClusterSettingsRequest._ENDPOINT, this.transportOptions); } /** * Updates the cluster settings. * - * @param fn - * a function that initializes a builder to create the - * {@link PutClusterSettingsRequest} - * + * @param fn a function that initializes a builder to create the {@link PutClusterSettingsRequest} */ - public final PutClusterSettingsResponse putSettings( Function> fn ) throws IOException, OpenSearchException { @@ -524,24 +339,15 @@ public final PutClusterSettingsResponse putSettings( /** * Updates the cluster settings. - * - * */ - - public PutClusterSettingsResponse putSettings() throws IOException, OpenSearchException { - return this.transport.performRequest( - new PutClusterSettingsRequest.Builder().build(), - PutClusterSettingsRequest._ENDPOINT, - this.transportOptions - ); + public final PutClusterSettingsResponse putSettings() throws IOException, OpenSearchException { + return putSettings(new PutClusterSettingsRequest.Builder().build()); } // ----- Endpoint: cluster.remote_info /** * Returns the information about configured remote clusters. - * - * */ public RemoteInfoResponse remoteInfo() throws IOException, OpenSearchException { return this.transport.performRequest(RemoteInfoRequest._INSTANCE, RemoteInfoRequest._ENDPOINT, this.transportOptions); @@ -551,29 +357,16 @@ public RemoteInfoResponse remoteInfo() throws IOException, OpenSearchException { /** * Allows to manually change the allocation of individual shards in the cluster. - * - * */ - public RerouteResponse reroute(RerouteRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - RerouteRequest, - RerouteResponse, - ErrorResponse>) RerouteRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, RerouteRequest._ENDPOINT, this.transportOptions); } /** * Allows to manually change the allocation of individual shards in the cluster. * - * @param fn - * a function that initializes a builder to create the - * {@link RerouteRequest} - * + * @param fn a function that initializes a builder to create the {@link RerouteRequest} */ - public final RerouteResponse reroute(Function> fn) throws IOException, OpenSearchException { return reroute(fn.apply(new RerouteRequest.Builder()).build()); @@ -581,41 +374,25 @@ public final RerouteResponse reroute(Function endpoint = (JsonEndpoint< - StateRequest, - StateResponse, - ErrorResponse>) StateRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, StateRequest._ENDPOINT, this.transportOptions); } /** * Returns a comprehensive information about the state of the cluster. * - * @param fn - * a function that initializes a builder to create the - * {@link StateRequest} - * + * @param fn a function that initializes a builder to create the {@link StateRequest} */ - public final StateResponse state(Function> fn) throws IOException, OpenSearchException { return state(fn.apply(new StateRequest.Builder()).build()); @@ -623,41 +400,25 @@ public final StateResponse state(Function endpoint = (JsonEndpoint< - ClusterStatsRequest, - ClusterStatsResponse, - ErrorResponse>) ClusterStatsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); + return this.transport.performRequest(request, ClusterStatsRequest._ENDPOINT, this.transportOptions); } /** * Returns high-level overview of cluster statistics. * - * @param fn - * a function that initializes a builder to create the - * {@link ClusterStatsRequest} - * + * @param fn a function that initializes a builder to create the {@link ClusterStatsRequest} */ - public final ClusterStatsResponse stats(Function> fn) throws IOException, OpenSearchException { return stats(fn.apply(new ClusterStatsRequest.Builder()).build()); @@ -665,16 +426,8 @@ public final ClusterStatsResponse stats(Function { + + @Nullable + private final Time clusterManagerTimeout; -public class PendingTasksRequest extends RequestBase { @Nullable private final Boolean local; @@ -60,28 +71,35 @@ public class PendingTasksRequest extends RequestBase { @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - // --------------------------------------------------------------------------------------------- private PendingTasksRequest(Builder builder) { - + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.local = builder.local; this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; - } - public static PendingTasksRequest of(Function> fn) { + public static PendingTasksRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Return local information, do not retrieve the state from cluster-manager node - * (default: false) + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * If true, the request retrieves information from the local node only. If false, information is retrieved + * from the cluster-manager node. *

* API name: {@code local} + *

*/ @Nullable public final Boolean local() { @@ -89,9 +107,11 @@ public final Boolean local() { } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -99,90 +119,120 @@ public final Time masterTimeout() { return this.masterTimeout; } - /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link PendingTasksRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Time clusterManagerTimeout; @Nullable private Boolean local; - - @Deprecated @Nullable private Time masterTimeout; - @Nullable - private Time clusterManagerTimeout; + public Builder() {} + + private Builder(PendingTasksRequest o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.local = o.local; + this.masterTimeout = o.masterTimeout; + } + + private Builder(Builder o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.local = o.local; + this.masterTimeout = o.masterTimeout; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * Return local information, do not retrieve the state from cluster-manager node - * (default: false) + * Operation timeout for connection to cluster-manager node. *

- * API name: {@code local} + * API name: {@code cluster_manager_timeout} + *

*/ - public final Builder local(@Nullable Boolean value) { - this.local = value; + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; return this; } /** - * Specify timeout for connection to master + * Operation timeout for connection to cluster-manager node. *

- * API name: {@code master_timeout} + * API name: {@code cluster_manager_timeout} + *

*/ - @Deprecated - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = value; - return this; + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); } /** - * Specify timeout for connection to master + * If true, the request retrieves information from the local node only. If false, information is retrieved + * from the cluster-manager node. *

- * API name: {@code master_timeout} + * API name: {@code local} + *

*/ - @Deprecated - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); + @Nonnull + public final Builder local(@Nullable Boolean value) { + this.local = value; + return this; } /** - * Specify timeout for connection to cluster-manager + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

- * API name: {@code cluster_manager_timeout} + * API name: {@code master_timeout} + *

*/ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; + @Deprecated + @Nonnull + public final Builder masterTimeout(@Nullable Time value) { + this.masterTimeout = value; return this; } /** - * Specify timeout for connection to cluster-manager + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

- * API name: {@code cluster_manager_timeout} + * API name: {@code master_timeout} + *

*/ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + @Deprecated + @Nonnull + public final Builder masterTimeout(Function> fn) { + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** * Builds a {@link PendingTasksRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public PendingTasksRequest build() { _checkSingleUse(); @@ -196,36 +246,45 @@ public PendingTasksRequest build() { * Endpoint "{@code cluster.pending_tasks}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "GET"; - - }, - + request -> "GET", // Request path - request -> { - return "/_cluster/pending_tasks"; - - }, - + request -> "/_cluster/pending_tasks", // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } if (request.local != null) { params.put("local", String.valueOf(request.local)); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } return params; - }, SimpleEndpoint.emptyMap(), false, PendingTasksResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.local); + result = 31 * result + Objects.hashCode(this.masterTimeout); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PendingTasksRequest other = (PendingTasksRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.local, other.local) + && Objects.equals(this.masterTimeout, other.masterTimeout); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PendingTasksResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/PendingTasksResponse.java similarity index 69% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/PendingTasksResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/PendingTasksResponse.java index b18098343b..a27c684bf6 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PendingTasksResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/PendingTasksResponse.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -43,30 +49,34 @@ import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch.cluster.pending_tasks.PendingTask; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.pending_tasks.Response @JsonpDeserializable -public class PendingTasksResponse implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PendingTasksResponse implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final List tasks; // --------------------------------------------------------------------------------------------- private PendingTasksResponse(Builder builder) { - this.tasks = ApiTypeHelper.unmodifiableRequired(builder.tasks, this, "tasks"); - } - public static PendingTasksResponse of(Function> fn) { + public static PendingTasksResponse of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code tasks} */ + @Nonnull public final List tasks() { return this.tasks; } @@ -74,6 +84,7 @@ public final List tasks() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -81,34 +92,57 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.tasks)) { - generator.writeKey("tasks"); - generator.writeStartArray(); - for (PendingTask item0 : this.tasks) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("tasks"); + generator.writeStartArray(); + for (PendingTask item0 : this.tasks) { + item0.serialize(generator, mapper); } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link PendingTasksResponse}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private List tasks; + public Builder() {} + + private Builder(PendingTasksResponse o) { + this.tasks = _listCopy(o.tasks); + } + + private Builder(Builder o) { + this.tasks = _listCopy(o.tasks); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code tasks} + * *

* Adds all elements of list to tasks. + *

*/ + @Nonnull public final Builder tasks(List list) { this.tasks = _listAddAll(this.tasks, list); return this; @@ -116,9 +150,12 @@ public final Builder tasks(List list) { /** * Required - API name: {@code tasks} + * *

* Adds one or more values to tasks. + *

*/ + @Nonnull public final Builder tasks(PendingTask value, PendingTask... values) { this.tasks = _listAdd(this.tasks, value, values); return this; @@ -126,9 +163,12 @@ public final Builder tasks(PendingTask value, PendingTask... values) { /** * Required - API name: {@code tasks} + * *

* Adds a value to tasks using a builder lambda. + *

*/ + @Nonnull public final Builder tasks(Function> fn) { return tasks(fn.apply(new PendingTask.Builder()).build()); } @@ -136,9 +176,10 @@ public final Builder tasks(Function op) { - op.add(Builder::tasks, JsonpDeserializer.arrayDeserializer(PendingTask._DESERIALIZER), "tasks"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.tasks.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PendingTasksResponse other = (PendingTasksResponse) o; + return this.tasks.equals(other.tasks); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PostVotingConfigExclusionsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/PostVotingConfigExclusionsRequest.java similarity index 60% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/PostVotingConfigExclusionsRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/PostVotingConfigExclusionsRequest.java index 7aa47b4bdf..79ca2c4a67 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PostVotingConfigExclusionsRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/PostVotingConfigExclusionsRequest.java @@ -30,13 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; -import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; @@ -46,19 +52,25 @@ import org.opensearch.client.transport.endpoints.BooleanResponse; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.post_voting_config_exclusions.Request /** * Updates the cluster voting config exclusions by node ids or node names. - * */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PostVotingConfigExclusionsRequest extends RequestBase + implements + ToCopyableBuilder { -public class PostVotingConfigExclusionsRequest extends RequestBase { + @Nonnull private final List nodeIds; + @Nonnull private final List nodeNames; @Nullable @@ -67,44 +79,47 @@ public class PostVotingConfigExclusionsRequest extends RequestBase { // --------------------------------------------------------------------------------------------- private PostVotingConfigExclusionsRequest(Builder builder) { - this.nodeIds = ApiTypeHelper.unmodifiable(builder.nodeIds); this.nodeNames = ApiTypeHelper.unmodifiable(builder.nodeNames); this.timeout = builder.timeout; - } - public static PostVotingConfigExclusionsRequest of(Function> fn) { + public static PostVotingConfigExclusionsRequest of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * A comma-separated list of the persistent ids of the nodes to exclude from the - * voting configuration. If specified, you may not also specify node_names. + * A comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not also + * specify node_names. *

* API name: {@code node_ids} + *

*/ + @Nonnull public final List nodeIds() { return this.nodeIds; } /** - * A comma-separated list of the names of the nodes to exclude from the voting - * configuration. If specified, you may not also specify node_ids. + * A comma-separated list of the names of the nodes to exclude from the voting configuration. If specified, you may not also specify + * node_ids. *

* API name: {@code node_names} + *

*/ + @Nonnull public final List nodeNames() { return this.nodeNames; } /** - * When adding a voting configuration exclusion, the API waits for the specified - * nodes to be excluded from the voting configuration before returning. If the - * timeout expires before the appropriate condition is satisfied, the request - * fails and returns an error. + * When adding a voting configuration exclusion, the API waits for the specified nodes to be excluded from the voting configuration + * before returning. If the timeout expires before the appropriate condition is satisfied, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -113,103 +128,148 @@ public final Time timeout() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link PostVotingConfigExclusionsRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private List nodeIds; - @Nullable private List nodeNames; - @Nullable private Time timeout; + public Builder() {} + + private Builder(PostVotingConfigExclusionsRequest o) { + this.nodeIds = _listCopy(o.nodeIds); + this.nodeNames = _listCopy(o.nodeNames); + this.timeout = o.timeout; + } + + private Builder(Builder o) { + this.nodeIds = _listCopy(o.nodeIds); + this.nodeNames = _listCopy(o.nodeNames); + this.timeout = o.timeout; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * A comma-separated list of the persistent ids of the nodes to exclude from the - * voting configuration. If specified, you may not also specify node_names. + * A comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not + * also specify node_names. *

* API name: {@code node_ids} + *

+ * *

* Adds all elements of list to nodeIds. + *

*/ + @Nonnull public final Builder nodeIds(List list) { this.nodeIds = _listAddAll(this.nodeIds, list); return this; } /** - * A comma-separated list of the persistent ids of the nodes to exclude from the - * voting configuration. If specified, you may not also specify node_names. + * A comma-separated list of the persistent ids of the nodes to exclude from the voting configuration. If specified, you may not + * also specify node_names. *

* API name: {@code node_ids} + *

+ * *

* Adds one or more values to nodeIds. + *

*/ + @Nonnull public final Builder nodeIds(String value, String... values) { this.nodeIds = _listAdd(this.nodeIds, value, values); return this; } /** - * A comma-separated list of the names of the nodes to exclude from the voting - * configuration. If specified, you may not also specify node_ids. + * A comma-separated list of the names of the nodes to exclude from the voting configuration. If specified, you may not also specify + * node_ids. *

* API name: {@code node_names} + *

+ * *

* Adds all elements of list to nodeNames. + *

*/ + @Nonnull public final Builder nodeNames(List list) { this.nodeNames = _listAddAll(this.nodeNames, list); return this; } /** - * A comma-separated list of the names of the nodes to exclude from the voting - * configuration. If specified, you may not also specify node_ids. + * A comma-separated list of the names of the nodes to exclude from the voting configuration. If specified, you may not also specify + * node_ids. *

* API name: {@code node_names} + *

+ * *

* Adds one or more values to nodeNames. + *

*/ + @Nonnull public final Builder nodeNames(String value, String... values) { this.nodeNames = _listAdd(this.nodeNames, value, values); return this; } /** - * When adding a voting configuration exclusion, the API waits for the specified - * nodes to be excluded from the voting configuration before returning. If the - * timeout expires before the appropriate condition is satisfied, the request - * fails and returns an error. + * When adding a voting configuration exclusion, the API waits for the specified nodes to be excluded from the voting configuration + * before returning. If the timeout expires before the appropriate condition is satisfied, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(@Nullable Time value) { this.timeout = value; return this; } /** - * When adding a voting configuration exclusion, the API waits for the specified - * nodes to be excluded from the voting configuration before returning. If the - * timeout expires before the appropriate condition is satisfied, the request - * fails and returns an error. + * When adding a voting configuration exclusion, the API waits for the specified nodes to be excluded from the voting configuration + * before returning. If the timeout expires before the appropriate condition is satisfied, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** * Builds a {@link PostVotingConfigExclusionsRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public PostVotingConfigExclusionsRequest build() { _checkSingleUse(); @@ -223,37 +283,43 @@ public PostVotingConfigExclusionsRequest build() { * Endpoint "{@code cluster.post_voting_config_exclusions}". */ public static final Endpoint _ENDPOINT = new BooleanEndpoint<>( - "opensearch/cluster.post_voting_config_exclusions", - // Request method - request -> { - return "POST"; - - }, - + request -> "POST", // Request path - request -> { - return "/_cluster/voting_config_exclusions"; - - }, - + request -> "/_cluster/voting_config_exclusions", // Request parameters request -> { Map params = new HashMap<>(); - if (ApiTypeHelper.isDefined(request.nodeNames)) { - params.put("node_names", request.nodeNames.stream().map(v -> v).collect(Collectors.joining(","))); - } if (ApiTypeHelper.isDefined(request.nodeIds)) { - params.put("node_ids", request.nodeIds.stream().map(v -> v).collect(Collectors.joining(","))); + params.put("node_ids", String.join(",", request.nodeIds)); + } + if (ApiTypeHelper.isDefined(request.nodeNames)) { + params.put("node_names", String.join(",", request.nodeNames)); } if (request.timeout != null) { params.put("timeout", request.timeout._toJsonString()); } return params; - }, - SimpleEndpoint.emptyMap(), - false, - null + SimpleEndpoint.emptyMap() ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.nodeIds); + result = 31 * result + Objects.hashCode(this.nodeNames); + result = 31 * result + Objects.hashCode(this.timeout); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PostVotingConfigExclusionsRequest other = (PostVotingConfigExclusionsRequest) o; + return Objects.equals(this.nodeIds, other.nodeIds) + && Objects.equals(this.nodeNames, other.nodeNames) + && Objects.equals(this.timeout, other.timeout); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PutClusterSettingsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/PutClusterSettingsRequest.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/PutClusterSettingsRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/PutClusterSettingsRequest.java index 54583b5631..dce1c4be27 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PutClusterSettingsRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/PutClusterSettingsRequest.java @@ -30,12 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import jakarta.json.stream.JsonGenerator; import java.util.HashMap; import java.util.Map; +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.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -50,17 +57,26 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.put_settings.Request /** * Updates the cluster settings. - * */ @JsonpDeserializable -public class PutClusterSettingsRequest extends RequestBase implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PutClusterSettingsRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final Time clusterManagerTimeout; + @Nullable private final Boolean flatSettings; @@ -68,67 +84,68 @@ public class PutClusterSettingsRequest extends RequestBase implements PlainJsonS @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - + @Nonnull private final Map persistent; @Nullable private final Time timeout; + @Nonnull private final Map transient_; // --------------------------------------------------------------------------------------------- private PutClusterSettingsRequest(Builder builder) { - + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.flatSettings = builder.flatSettings; this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.persistent = ApiTypeHelper.unmodifiable(builder.persistent); this.timeout = builder.timeout; this.transient_ = ApiTypeHelper.unmodifiable(builder.transient_); - } - public static PutClusterSettingsRequest of(Function> fn) { + public static PutClusterSettingsRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Return settings in flat format (default: false) + * Operation timeout for connection to cluster-manager node. *

- * API name: {@code flat_settings} + * API name: {@code cluster_manager_timeout} + *

*/ @Nullable - public final Boolean flatSettings() { - return this.flatSettings; + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; } /** - * Explicit operation timeout for connection to master node + * Return settings in flat format. *

- * API name: {@code master_timeout} + * API name: {@code flat_settings} + *

*/ - @Deprecated @Nullable - public final Time masterTimeout() { - return this.masterTimeout; + public final Boolean flatSettings() { + return this.flatSettings; } /** * Explicit operation timeout for connection to cluster-manager node *

- * API name: {@code cluster_manager_timeout} + * API name: {@code master_timeout} + *

*/ + @Deprecated @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; + public final Time masterTimeout() { + return this.masterTimeout; } /** * API name: {@code persistent} */ + @Nonnull public final Map persistent() { return this.persistent; } @@ -137,6 +154,7 @@ public final Map persistent() { * Explicit operation timeout *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -146,6 +164,7 @@ public final Time timeout() { /** * API name: {@code transient} */ + @Nonnull public final Map transient_() { return this.transient_; } @@ -153,6 +172,7 @@ public final Map transient_() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -160,111 +180,150 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.persistent)) { generator.writeKey("persistent"); generator.writeStartObject(); for (Map.Entry item0 : this.persistent.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + if (ApiTypeHelper.isDefined(this.transient_)) { generator.writeKey("transient"); generator.writeStartObject(); for (Map.Entry item0 : this.transient_.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link PutClusterSettingsRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Time clusterManagerTimeout; @Nullable private Boolean flatSettings; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - @Nullable private Map persistent; - @Nullable private Time timeout; - @Nullable private Map transient_; + public Builder() {} + + private Builder(PutClusterSettingsRequest o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.flatSettings = o.flatSettings; + this.masterTimeout = o.masterTimeout; + this.persistent = _mapCopy(o.persistent); + this.timeout = o.timeout; + this.transient_ = _mapCopy(o.transient_); + } + + private Builder(Builder o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.flatSettings = o.flatSettings; + this.masterTimeout = o.masterTimeout; + this.persistent = _mapCopy(o.persistent); + this.timeout = o.timeout; + this.transient_ = _mapCopy(o.transient_); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Return settings in flat format (default: false) + * Operation timeout for connection to cluster-manager node. *

- * API name: {@code flat_settings} + * API name: {@code cluster_manager_timeout} + *

*/ - public final Builder flatSettings(@Nullable Boolean value) { - this.flatSettings = value; + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; return this; } /** - * Explicit operation timeout for connection to master node + * Operation timeout for connection to cluster-manager node. *

- * API name: {@code master_timeout} + * API name: {@code cluster_manager_timeout} + *

*/ - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = value; - return this; + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); } /** - * Explicit operation timeout for connection to master node + * Return settings in flat format. *

- * API name: {@code master_timeout} + * API name: {@code flat_settings} + *

*/ - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); + @Nonnull + public final Builder flatSettings(@Nullable Boolean value) { + this.flatSettings = value; + return this; } /** * Explicit operation timeout for connection to cluster-manager node *

- * API name: {@code cluster_manager_timeout} + * API name: {@code master_timeout} + *

*/ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; + @Deprecated + @Nonnull + public final Builder masterTimeout(@Nullable Time value) { + this.masterTimeout = value; return this; } /** * Explicit operation timeout for connection to cluster-manager node *

- * API name: {@code cluster_manager_timeout} + * API name: {@code master_timeout} + *

*/ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + @Deprecated + @Nonnull + public final Builder masterTimeout(Function> fn) { + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** * API name: {@code persistent} + * *

- * Adds all entries of map to persistent. + * Adds all elements of map to persistent. + *

*/ + @Nonnull public final Builder persistent(Map map) { this.persistent = _mapPutAll(this.persistent, map); return this; @@ -272,9 +331,12 @@ public final Builder persistent(Map map) { /** * API name: {@code persistent} + * *

* Adds an entry to persistent. + *

*/ + @Nonnull public final Builder persistent(String key, JsonData value) { this.persistent = _mapPut(this.persistent, key, value); return this; @@ -284,7 +346,9 @@ public final Builder persistent(String key, JsonData value) { * Explicit operation timeout *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(@Nullable Time value) { this.timeout = value; return this; @@ -294,16 +358,21 @@ public final Builder timeout(@Nullable Time value) { * Explicit operation timeout *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** * API name: {@code transient} + * *

- * Adds all entries of map to transient_. + * Adds all elements of map to transient_. + *

*/ + @Nonnull public final Builder transient_(Map map) { this.transient_ = _mapPutAll(this.transient_, map); return this; @@ -311,9 +380,12 @@ public final Builder transient_(Map map) { /** * API name: {@code transient} + * *

* Adds an entry to transient_. + *

*/ + @Nonnull public final Builder transient_(String key, JsonData value) { this.transient_ = _mapPut(this.transient_, key, value); return this; @@ -322,9 +394,10 @@ public final Builder transient_(String key, JsonData value) { /** * Builds a {@link PutClusterSettingsRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public PutClusterSettingsRequest build() { _checkSingleUse(); @@ -343,10 +416,8 @@ public PutClusterSettingsRequest build() { ); protected static void setupPutClusterSettingsRequestDeserializer(ObjectDeserializer op) { - op.add(Builder::persistent, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "persistent"); op.add(Builder::transient_, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "transient"); - } // --------------------------------------------------------------------------------------------- @@ -355,39 +426,54 @@ protected static void setupPutClusterSettingsRequestDeserializer(ObjectDeseriali * Endpoint "{@code cluster.put_settings}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "PUT"; - - }, - + request -> "PUT", // Request path - request -> { - return "/_cluster/settings"; - - }, - + request -> "/_cluster/settings", // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } if (request.flatSettings != null) { params.put("flat_settings", String.valueOf(request.flatSettings)); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } if (request.timeout != null) { params.put("timeout", request.timeout._toJsonString()); } return params; - }, SimpleEndpoint.emptyMap(), true, PutClusterSettingsResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.flatSettings); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.persistent); + result = 31 * result + Objects.hashCode(this.timeout); + result = 31 * result + Objects.hashCode(this.transient_); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PutClusterSettingsRequest other = (PutClusterSettingsRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.flatSettings, other.flatSettings) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.persistent, other.persistent) + && Objects.equals(this.timeout, other.timeout) + && Objects.equals(this.transient_, other.transient_); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PutClusterSettingsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/PutClusterSettingsResponse.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/PutClusterSettingsResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/PutClusterSettingsResponse.java index c97ea2c6f7..f40015bec3 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PutClusterSettingsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/PutClusterSettingsResponse.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import jakarta.json.stream.JsonGenerator; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -43,30 +49,39 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.put_settings.Response @JsonpDeserializable -public class PutClusterSettingsResponse implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PutClusterSettingsResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + private final boolean acknowledged; + @Nonnull private final Map persistent; + @Nonnull private final Map transient_; // --------------------------------------------------------------------------------------------- private PutClusterSettingsResponse(Builder builder) { - this.acknowledged = ApiTypeHelper.requireNonNull(builder.acknowledged, this, "acknowledged"); this.persistent = ApiTypeHelper.unmodifiableRequired(builder.persistent, this, "persistent"); this.transient_ = ApiTypeHelper.unmodifiableRequired(builder.transient_, this, "transient_"); - } - public static PutClusterSettingsResponse of(Function> fn) { + public static PutClusterSettingsResponse of( + Function> fn + ) { return fn.apply(new Builder()).build(); } @@ -80,6 +95,7 @@ public final boolean acknowledged() { /** * Required - API name: {@code persistent} */ + @Nonnull public final Map persistent() { return this.persistent; } @@ -87,6 +103,7 @@ public final Map persistent() { /** * Required - API name: {@code transient} */ + @Nonnull public final Map transient_() { return this.transient_; } @@ -94,6 +111,7 @@ public final Map transient_() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -101,51 +119,71 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("acknowledged"); generator.write(this.acknowledged); - if (ApiTypeHelper.isDefined(this.persistent)) { - generator.writeKey("persistent"); - generator.writeStartObject(); - for (Map.Entry item0 : this.persistent.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("persistent"); + generator.writeStartObject(); + for (Map.Entry item0 : this.persistent.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); } - if (ApiTypeHelper.isDefined(this.transient_)) { - generator.writeKey("transient"); - generator.writeStartObject(); - for (Map.Entry item0 : this.transient_.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); + generator.writeEnd(); + generator.writeKey("transient"); + generator.writeStartObject(); + for (Map.Entry item0 : this.transient_.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link PutClusterSettingsResponse}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Boolean acknowledged; - private Map persistent; - private Map transient_; + public Builder() {} + + private Builder(PutClusterSettingsResponse o) { + this.acknowledged = o.acknowledged; + this.persistent = _mapCopy(o.persistent); + this.transient_ = _mapCopy(o.transient_); + } + + private Builder(Builder o) { + this.acknowledged = o.acknowledged; + this.persistent = _mapCopy(o.persistent); + this.transient_ = _mapCopy(o.transient_); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code acknowledged} */ + @Nonnull public final Builder acknowledged(boolean value) { this.acknowledged = value; return this; @@ -153,9 +191,12 @@ public final Builder acknowledged(boolean value) { /** * Required - API name: {@code persistent} + * *

- * Adds all entries of map to persistent. + * Adds all elements of map to persistent. + *

*/ + @Nonnull public final Builder persistent(Map map) { this.persistent = _mapPutAll(this.persistent, map); return this; @@ -163,9 +204,12 @@ public final Builder persistent(Map map) { /** * Required - API name: {@code persistent} + * *

* Adds an entry to persistent. + *

*/ + @Nonnull public final Builder persistent(String key, JsonData value) { this.persistent = _mapPut(this.persistent, key, value); return this; @@ -173,9 +217,12 @@ public final Builder persistent(String key, JsonData value) { /** * Required - API name: {@code transient} + * *

- * Adds all entries of map to transient_. + * Adds all elements of map to transient_. + *

*/ + @Nonnull public final Builder transient_(Map map) { this.transient_ = _mapPutAll(this.transient_, map); return this; @@ -183,9 +230,12 @@ public final Builder transient_(Map map) { /** * Required - API name: {@code transient} + * *

* Adds an entry to transient_. + *

*/ + @Nonnull public final Builder transient_(String key, JsonData value) { this.transient_ = _mapPut(this.transient_, key, value); return this; @@ -194,9 +244,10 @@ public final Builder transient_(String key, JsonData value) { /** * Builds a {@link PutClusterSettingsResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public PutClusterSettingsResponse build() { _checkSingleUse(); @@ -215,11 +266,27 @@ public PutClusterSettingsResponse build() { ); protected static void setupPutClusterSettingsResponseDeserializer(ObjectDeserializer op) { - op.add(Builder::acknowledged, JsonpDeserializer.booleanDeserializer(), "acknowledged"); op.add(Builder::persistent, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "persistent"); op.add(Builder::transient_, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "transient"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Boolean.hashCode(this.acknowledged); + result = 31 * result + this.persistent.hashCode(); + result = 31 * result + this.transient_.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PutClusterSettingsResponse other = (PutClusterSettingsResponse) o; + return this.acknowledged == other.acknowledged + && this.persistent.equals(other.persistent) + && this.transient_.equals(other.transient_); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PutComponentTemplateRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/PutComponentTemplateRequest.java similarity index 52% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/PutComponentTemplateRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/PutComponentTemplateRequest.java index 4e336f9fff..6d39894842 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PutComponentTemplateRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/PutComponentTemplateRequest.java @@ -30,12 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import jakarta.json.stream.JsonGenerator; import java.util.HashMap; import java.util.Map; +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.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -47,91 +54,105 @@ import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.opensearch._types.Time; -import org.opensearch.client.opensearch._types.mapping.TypeMapping; -import org.opensearch.client.opensearch.indices.AliasDefinition; -import org.opensearch.client.opensearch.indices.IndexSettings; import org.opensearch.client.opensearch.indices.IndexState; import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.put_component_template.Request /** - * Creates or updates a component template - * + * Creates or updates a component template. */ @JsonpDeserializable -public class PutComponentTemplateRequest extends RequestBase implements PlainJsonSerializable { - private final Map meta; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PutComponentTemplateRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { - private final Map aliases; + @Nullable + private final Boolean allowAutoCreate; @Nullable - private final Boolean create; + private final Time clusterManagerTimeout; @Nullable - private final TypeMapping mappings; + private final Boolean create; @Deprecated @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; + @Nonnull + private final Map meta; + @Nonnull private final String name; - @Nullable - private final IndexSettings settings; - + @Nonnull private final IndexState template; + @Nullable + private final Time timeout; + @Nullable private final Long version; // --------------------------------------------------------------------------------------------- private PutComponentTemplateRequest(Builder builder) { - - this.meta = ApiTypeHelper.unmodifiable(builder.meta); - this.aliases = ApiTypeHelper.unmodifiable(builder.aliases); + this.allowAutoCreate = builder.allowAutoCreate; + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.create = builder.create; - this.mappings = builder.mappings; this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; + this.meta = ApiTypeHelper.unmodifiable(builder.meta); this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.settings = builder.settings; this.template = ApiTypeHelper.requireNonNull(builder.template, this, "template"); + this.timeout = builder.timeout; this.version = builder.version; - } - public static PutComponentTemplateRequest of(Function> fn) { + public static PutComponentTemplateRequest of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * API name: {@code _meta} + * This setting overrides the value of the action.auto_create_index cluster setting. If set to true in a + * template, then indexes can be automatically created using that template even if auto-creation of indexes is disabled using + * actions.auto_create_index. If set to false then data streams matching the template must always be + * explicitly created. + *

+ * API name: {@code allow_auto_create} + *

*/ - public final Map meta() { - return this.meta; + @Nullable + public final Boolean allowAutoCreate() { + return this.allowAutoCreate; } /** - * API name: {@code aliases} + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

*/ - public final Map aliases() { - return this.aliases; + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; } /** - * Whether the index template should only be added if new or can also replace an - * existing one + * If true, this request cannot replace or update existing component templates. *

* API name: {@code create} + *

*/ @Nullable public final Boolean create() { @@ -139,17 +160,11 @@ public final Boolean create() { } /** - * API name: {@code mappings} - */ - @Nullable - public final TypeMapping mappings() { - return this.mappings; - } - - /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -158,37 +173,44 @@ public final Time masterTimeout() { } /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} + * API name: {@code _meta} */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; + @Nonnull + public final Map meta() { + return this.meta; } /** - * Required - The name of the template + * Required - Name of the component template to create. OpenSearch includes the following built-in component templates: + * logs-mappings; + * 'logs-settings; metrics-mappings; metrics-settings;synthetics-mapping; synthetics-settings. OpenSearch Agent uses these templates to configure backing indexes for its data streams. If you use OpenSearch Agent and want to overwrite one of these templates, set the versionfor your replacement template higher than the current version. If you don't use OpenSearch Agent and want to disable all built-in component and index templates, setstack.templates.enabledtofalse` + * using the cluster update settings API. *

* API name: {@code name} + *

*/ + @Nonnull public final String name() { return this.name; } /** - * API name: {@code settings} + * Required - API name: {@code template} */ - @Nullable - public final IndexSettings settings() { - return this.settings; + @Nonnull + public final IndexState template() { + return this.template; } /** - * Required - API name: {@code template} + * Operation timeout. + *

+ * API name: {@code timeout} + *

*/ - public final IndexState template() { - return this.template; + @Nullable + public final Time timeout() { + return this.timeout; } /** @@ -202,6 +224,7 @@ public final Long version() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -209,6 +232,10 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.allowAutoCreate != null) { + generator.writeKey("allow_auto_create"); + generator.write(this.allowAutoCreate); + } if (ApiTypeHelper.isDefined(this.meta)) { generator.writeKey("_meta"); @@ -216,237 +243,246 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { for (Map.Entry item0 : this.meta.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.aliases)) { - generator.writeKey("aliases"); - generator.writeStartObject(); - for (Map.Entry item0 : this.aliases.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - - } - if (this.mappings != null) { - generator.writeKey("mappings"); - this.mappings.serialize(generator, mapper); - } - if (this.settings != null) { - generator.writeKey("settings"); - this.settings.serialize(generator, mapper); - } generator.writeKey("template"); this.template.serialize(generator, mapper); if (this.version != null) { generator.writeKey("version"); generator.write(this.version); - } + } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link PutComponentTemplateRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable - private Map meta; - + private Boolean allowAutoCreate; @Nullable - private Map aliases; - + private Time clusterManagerTimeout; @Nullable private Boolean create; - - @Nullable - private TypeMapping mappings; - - @Deprecated @Nullable private Time masterTimeout; - @Nullable - private Time clusterManagerTimeout; - + private Map meta; private String name; - - @Nullable - private IndexSettings settings; - private IndexState template; - + @Nullable + private Time timeout; @Nullable private Long version; - /** - * API name: {@code _meta} - *

- * Adds all entries of map to meta. - */ - public final Builder meta(Map map) { - this.meta = _mapPutAll(this.meta, map); - return this; + public Builder() {} + + private Builder(PutComponentTemplateRequest o) { + this.allowAutoCreate = o.allowAutoCreate; + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.create = o.create; + this.masterTimeout = o.masterTimeout; + this.meta = _mapCopy(o.meta); + this.name = o.name; + this.template = o.template; + this.timeout = o.timeout; + this.version = o.version; } - /** - * API name: {@code _meta} - *

- * Adds an entry to meta. - */ - public final Builder meta(String key, JsonData value) { - this.meta = _mapPut(this.meta, key, value); - return this; + private Builder(Builder o) { + this.allowAutoCreate = o.allowAutoCreate; + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.create = o.create; + this.masterTimeout = o.masterTimeout; + this.meta = _mapCopy(o.meta); + this.name = o.name; + this.template = o.template; + this.timeout = o.timeout; + this.version = o.version; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** - * API name: {@code aliases} + * This setting overrides the value of the action.auto_create_index cluster setting. If set to true in a + * template, then indexes can be automatically created using that template even if auto-creation of indexes is disabled using + * actions.auto_create_index. If set to false then data streams matching the template must always be + * explicitly created. *

- * Adds all entries of map to aliases. + * API name: {@code allow_auto_create} + *

*/ - public final Builder aliases(Map map) { - this.aliases = _mapPutAll(this.aliases, map); + @Nonnull + public final Builder allowAutoCreate(@Nullable Boolean value) { + this.allowAutoCreate = value; return this; } /** - * API name: {@code aliases} + * Operation timeout for connection to cluster-manager node. *

- * Adds an entry to aliases. + * API name: {@code cluster_manager_timeout} + *

*/ - public final Builder aliases(String key, AliasDefinition value) { - this.aliases = _mapPut(this.aliases, key, value); + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; return this; } /** - * API name: {@code aliases} + * Operation timeout for connection to cluster-manager node. *

- * Adds an entry to aliases using a builder lambda. + * API name: {@code cluster_manager_timeout} + *

*/ - public final Builder aliases(String key, Function> fn) { - return aliases(key, fn.apply(new AliasDefinition.Builder()).build()); + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); } /** - * Whether the index template should only be added if new or can also replace an - * existing one + * If true, this request cannot replace or update existing component templates. *

* API name: {@code create} + *

*/ + @Nonnull public final Builder create(@Nullable Boolean value) { this.create = value; return this; } /** - * API name: {@code mappings} - */ - public final Builder mappings(@Nullable TypeMapping value) { - this.mappings = value; - return this; - } - - /** - * API name: {@code mappings} - */ - public final Builder mappings(Function> fn) { - return this.mappings(fn.apply(new TypeMapping.Builder()).build()); - } - - /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(@Nullable Time value) { this.masterTimeout = value; return this; } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** - * Specify timeout for connection to cluster-manager + * API name: {@code _meta} + * *

- * API name: {@code cluster_manager_timeout} + * Adds all elements of map to meta. + *

*/ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; + @Nonnull + public final Builder meta(Map map) { + this.meta = _mapPutAll(this.meta, map); return this; } /** - * Specify timeout for connection to cluster-manager + * API name: {@code _meta} + * *

- * API name: {@code cluster_manager_timeout} + * Adds an entry to meta. + *

*/ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + @Nonnull + public final Builder meta(String key, JsonData value) { + this.meta = _mapPut(this.meta, key, value); + return this; } /** - * Required - The name of the template + * Required - Name of the component template to create. OpenSearch includes the following built-in component templates: + * logs-mappings; + * 'logs-settings; metrics-mappings; metrics-settings;synthetics-mapping; synthetics-settings. OpenSearch Agent uses these templates to configure backing indexes for its data streams. If you use OpenSearch Agent and want to overwrite one of these templates, set the versionfor your replacement template higher than the current version. If you don't use OpenSearch Agent and want to disable all built-in component and index templates, setstack.templates.enabledtofalse` + * using the cluster update settings API. *

* API name: {@code name} + *

*/ + @Nonnull public final Builder name(String value) { this.name = value; return this; } /** - * API name: {@code settings} + * Required - API name: {@code template} */ - public final Builder settings(@Nullable IndexSettings value) { - this.settings = value; + @Nonnull + public final Builder template(IndexState value) { + this.template = value; return this; } /** - * API name: {@code settings} + * Required - API name: {@code template} */ - public final Builder settings(Function> fn) { - return this.settings(fn.apply(new IndexSettings.Builder()).build()); + @Nonnull + public final Builder template(Function> fn) { + return template(fn.apply(new IndexState.Builder()).build()); } /** - * Required - API name: {@code template} + * Operation timeout. + *

+ * API name: {@code timeout} + *

*/ - public final Builder template(IndexState value) { - this.template = value; + @Nonnull + public final Builder timeout(@Nullable Time value) { + this.timeout = value; return this; } /** - * Required - API name: {@code template} + * Operation timeout. + *

+ * API name: {@code timeout} + *

*/ - public final Builder template(Function> fn) { - return this.template(fn.apply(new IndexState.Builder()).build()); + @Nonnull + public final Builder timeout(Function> fn) { + return timeout(fn.apply(new Time.Builder()).build()); } /** * API name: {@code version} */ + @Nonnull public final Builder version(@Nullable Long value) { this.version = value; return this; @@ -455,9 +491,10 @@ public final Builder version(@Nullable Long value) { /** * Builds a {@link PutComponentTemplateRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public PutComponentTemplateRequest build() { _checkSingleUse(); @@ -476,14 +513,10 @@ public PutComponentTemplateRequest build() { ); protected static void setupPutComponentTemplateRequestDeserializer(ObjectDeserializer op) { - + op.add(Builder::allowAutoCreate, JsonpDeserializer.booleanDeserializer(), "allow_auto_create"); op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); - op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(AliasDefinition._DESERIALIZER), "aliases"); - op.add(Builder::mappings, TypeMapping._DESERIALIZER, "mappings"); - op.add(Builder::settings, IndexSettings._DESERIALIZER, "settings"); op.add(Builder::template, IndexState._DESERIALIZER, "template"); op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); - } // --------------------------------------------------------------------------------------------- @@ -492,49 +525,65 @@ protected static void setupPutComponentTemplateRequestDeserializer(ObjectDeseria * Endpoint "{@code cluster.put_component_template}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "PUT"; - - }, - + request -> "PUT", // Request path request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_component_template"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/_component_template/"); + SimpleEndpoint.pathEncode(request.name, buf); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { - params.put("cluster_manager", request.clusterManagerTimeout._toJsonString()); + params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } if (request.create != null) { params.put("create", String.valueOf(request.create)); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } + if (request.timeout != null) { + params.put("timeout", request.timeout._toJsonString()); + } return params; - }, SimpleEndpoint.emptyMap(), true, PutComponentTemplateResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allowAutoCreate); + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.create); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.meta); + result = 31 * result + this.name.hashCode(); + result = 31 * result + this.template.hashCode(); + result = 31 * result + Objects.hashCode(this.timeout); + result = 31 * result + Objects.hashCode(this.version); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PutComponentTemplateRequest other = (PutComponentTemplateRequest) o; + return Objects.equals(this.allowAutoCreate, other.allowAutoCreate) + && Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.create, other.create) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.meta, other.meta) + && this.name.equals(other.name) + && this.template.equals(other.template) + && Objects.equals(this.timeout, other.timeout) + && Objects.equals(this.version, other.version); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PutComponentTemplateResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/PutComponentTemplateResponse.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/PutComponentTemplateResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/PutComponentTemplateResponse.java index 7e882b0d08..328a886490 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PutComponentTemplateResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/PutComponentTemplateResponse.java @@ -30,41 +30,82 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.put_component_template.Response @JsonpDeserializable -public class PutComponentTemplateResponse extends AcknowledgedResponseBase { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PutComponentTemplateResponse extends AcknowledgedResponseBase + implements + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private PutComponentTemplateResponse(Builder builder) { super(builder); - } - public static PutComponentTemplateResponse of(Function> fn) { + public static PutComponentTemplateResponse of( + Function> fn + ) { return fn.apply(new Builder()).build(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link PutComponentTemplateResponse}. */ - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { + + public Builder() {} + + private Builder(PutComponentTemplateResponse o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + @Override + @Nonnull protected Builder self() { return this; } @@ -72,9 +113,10 @@ protected Builder self() { /** * Builds a {@link PutComponentTemplateResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public PutComponentTemplateResponse build() { _checkSingleUse(); @@ -93,8 +135,22 @@ public PutComponentTemplateResponse build() { ); protected static void setupPutComponentTemplateResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + setupAcknowledgedResponseBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/RemoteInfoRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/RemoteInfoRequest.java similarity index 75% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/RemoteInfoRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/RemoteInfoRequest.java index d0cbf8fa0a..f1c36b07a2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/RemoteInfoRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/RemoteInfoRequest.java @@ -30,9 +30,13 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; -import java.util.Collections; +import javax.annotation.Generated; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.transport.Endpoint; @@ -41,12 +45,9 @@ // typedef: cluster.remote_info.Request /** - * The cluster remote info API allows you to retrieve all of the configured - * remote cluster information. It returns connection and endpoint information - * keyed by the configured remote cluster alias. - * + * Returns the information about configured remote clusters. */ - +@Generated("org.opensearch.client.codegen.CodeGenerator") public class RemoteInfoRequest extends RequestBase { public RemoteInfoRequest() {} @@ -61,26 +62,27 @@ public RemoteInfoRequest() {} * Endpoint "{@code cluster.remote_info}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "GET"; - - }, - + request -> "GET", // Request path - request -> { - return "/_remote/info"; - - }, - + request -> "/_remote/info", // Request parameters - request -> { - return Collections.emptyMap(); - - }, + SimpleEndpoint.emptyMap(), SimpleEndpoint.emptyMap(), false, RemoteInfoResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/RemoteInfoResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/RemoteInfoResponse.java similarity index 83% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/RemoteInfoResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/RemoteInfoResponse.java index b9940b0717..7ea986bafa 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/RemoteInfoResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/RemoteInfoResponse.java @@ -30,9 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; @@ -44,15 +50,15 @@ // typedef: cluster.remote_info.Response @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class RemoteInfoResponse extends DictionaryResponse { // --------------------------------------------------------------------------------------------- private RemoteInfoResponse(Builder builder) { super(builder); - } - public static RemoteInfoResponse of(Function> fn) { + public static RemoteInfoResponse of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -61,11 +67,11 @@ public static RemoteInfoResponse of(Function implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -73,8 +79,7 @@ protected Builder self() { /** * Builds a {@link RemoteInfoResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public RemoteInfoResponse build() { _checkSingleUse(); @@ -96,8 +101,6 @@ public RemoteInfoResponse build() { ); protected static void setupRemoteInfoResponseDeserializer(ObjectDeserializer op) { - DictionaryResponse.setupDictionaryResponseDeserializer(op, JsonpDeserializer.stringDeserializer(), ClusterRemoteInfo._DESERIALIZER); - + setupDictionaryResponseDeserializer(op, JsonpDeserializer.stringDeserializer(), ClusterRemoteInfo._DESERIALIZER); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/RerouteRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/RerouteRequest.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/RerouteRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/RerouteRequest.java index 29891c0aa0..434bb33491 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/RerouteRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/RerouteRequest.java @@ -30,14 +30,21 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import jakarta.json.stream.JsonGenerator; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -48,21 +55,32 @@ import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.opensearch._types.Time; +import org.opensearch.client.opensearch.cluster.reroute.ClusterRerouteMetric; import org.opensearch.client.opensearch.cluster.reroute.Command; import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.reroute.Request /** * Allows to manually change the allocation of individual shards in the cluster. - * */ @JsonpDeserializable -public class RerouteRequest extends RequestBase implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RerouteRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final Time clusterManagerTimeout; + + @Nonnull private final List commands; @Nullable @@ -75,10 +93,8 @@ public class RerouteRequest extends RequestBase implements PlainJsonSerializable @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - - private final List metric; + @Nonnull + private final List metric; @Nullable private final Boolean retryFailed; @@ -89,36 +105,47 @@ public class RerouteRequest extends RequestBase implements PlainJsonSerializable // --------------------------------------------------------------------------------------------- private RerouteRequest(Builder builder) { - + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.commands = ApiTypeHelper.unmodifiable(builder.commands); this.dryRun = builder.dryRun; this.explain = builder.explain; this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.metric = ApiTypeHelper.unmodifiable(builder.metric); this.retryFailed = builder.retryFailed; this.timeout = builder.timeout; - } - public static RerouteRequest of(Function> fn) { + public static RerouteRequest of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + /** * Defines the commands to perform. *

* API name: {@code commands} + *

*/ + @Nonnull public final List commands() { return this.commands; } /** - * If true, then the request simulates the operation only and returns the - * resulting state. + * If true, then the request simulates the operation only and returns the resulting state. *

* API name: {@code dry_run} + *

*/ @Nullable public final Boolean dryRun() { @@ -126,10 +153,10 @@ public final Boolean dryRun() { } /** - * If true, then the response contains an explanation of why the commands can or - * cannot be executed. + * If true, then the response contains an explanation of why the commands can or cannot be executed. *

* API name: {@code explain} + *

*/ @Nullable public final Boolean explain() { @@ -137,10 +164,11 @@ public final Boolean explain() { } /** - * Period to wait for a connection to the master node. If no response is - * received before the timeout expires, the request fails and returns an error. + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -148,31 +176,22 @@ public final Time masterTimeout() { return this.masterTimeout; } - /** - * Period to wait for a connection to the cluster-manager node. If no response is - * received before the timeout expires, the request fails and returns an error. - *

- * API name: {@code cluster_amanger_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } - /** * Limits the information returned to the specified metrics. *

* API name: {@code metric} + *

*/ - public final List metric() { + @Nonnull + public final List metric() { return this.metric; } /** - * If true, then retries allocation of shards that are blocked due to too many - * subsequent allocation failures. + * If true, then retries allocation of shards that are blocked due to too many subsequent allocation failures. *

* API name: {@code retry_failed} + *

*/ @Nullable public final Boolean retryFailed() { @@ -180,10 +199,10 @@ public final Boolean retryFailed() { } /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -193,6 +212,7 @@ public final Time timeout() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -200,59 +220,113 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.commands)) { generator.writeKey("commands"); generator.writeStartArray(); for (Command item0 : this.commands) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } + } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link RerouteRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Time clusterManagerTimeout; @Nullable private List commands; - @Nullable private Boolean dryRun; - @Nullable private Boolean explain; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - @Nullable - private List metric; - + private List metric; @Nullable private Boolean retryFailed; - @Nullable private Time timeout; + public Builder() {} + + private Builder(RerouteRequest o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.commands = _listCopy(o.commands); + this.dryRun = o.dryRun; + this.explain = o.explain; + this.masterTimeout = o.masterTimeout; + this.metric = _listCopy(o.metric); + this.retryFailed = o.retryFailed; + this.timeout = o.timeout; + } + + private Builder(Builder o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.commands = _listCopy(o.commands); + this.dryRun = o.dryRun; + this.explain = o.explain; + this.masterTimeout = o.masterTimeout; + this.metric = _listCopy(o.metric); + this.retryFailed = o.retryFailed; + this.timeout = o.timeout; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; + return this; + } + + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + /** * Defines the commands to perform. *

* API name: {@code commands} + *

+ * *

* Adds all elements of list to commands. + *

*/ + @Nonnull public final Builder commands(List list) { this.commands = _listAddAll(this.commands, list); return this; @@ -262,9 +336,13 @@ public final Builder commands(List list) { * Defines the commands to perform. *

* API name: {@code commands} + *

+ * *

* Adds one or more values to commands. + *

*/ + @Nonnull public final Builder commands(Command value, Command... values) { this.commands = _listAdd(this.commands, value, values); return this; @@ -274,87 +352,80 @@ public final Builder commands(Command value, Command... values) { * Defines the commands to perform. *

* API name: {@code commands} + *

+ * *

* Adds a value to commands using a builder lambda. + *

*/ + @Nonnull public final Builder commands(Function> fn) { return commands(fn.apply(new Command.Builder()).build()); } /** - * If true, then the request simulates the operation only and returns the - * resulting state. + * If true, then the request simulates the operation only and returns the resulting state. *

* API name: {@code dry_run} + *

*/ + @Nonnull public final Builder dryRun(@Nullable Boolean value) { this.dryRun = value; return this; } /** - * If true, then the response contains an explanation of why the commands can or - * cannot be executed. + * If true, then the response contains an explanation of why the commands can or cannot be executed. *

* API name: {@code explain} + *

*/ + @Nonnull public final Builder explain(@Nullable Boolean value) { this.explain = value; return this; } /** - * Period to wait for a connection to the master node. If no response is - * received before the timeout expires, the request fails and returns an error. + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(@Nullable Time value) { this.masterTimeout = value; return this; } /** - * Period to wait for a connection to the master node. If no response is - * received before the timeout expires, the request fails and returns an error. + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Period to wait for a connection to the cluster-manager node. If no response is - * received before the timeout expires, the request fails and returns an error. - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; - return this; - } - - /** - * Period to wait for a connection to the cluster-manager node. If no response is - * received before the timeout expires, the request fails and returns an error. - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** * Limits the information returned to the specified metrics. *

* API name: {@code metric} + *

+ * *

* Adds all elements of list to metric. + *

*/ - public final Builder metric(List list) { + @Nonnull + public final Builder metric(List list) { this.metric = _listAddAll(this.metric, list); return this; } @@ -363,52 +434,60 @@ public final Builder metric(List list) { * Limits the information returned to the specified metrics. *

* API name: {@code metric} + *

+ * *

* Adds one or more values to metric. + *

*/ - public final Builder metric(String value, String... values) { + @Nonnull + public final Builder metric(ClusterRerouteMetric value, ClusterRerouteMetric... values) { this.metric = _listAdd(this.metric, value, values); return this; } /** - * If true, then retries allocation of shards that are blocked due to too many - * subsequent allocation failures. + * If true, then retries allocation of shards that are blocked due to too many subsequent allocation failures. *

* API name: {@code retry_failed} + *

*/ + @Nonnull public final Builder retryFailed(@Nullable Boolean value) { this.retryFailed = value; return this; } /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(@Nullable Time value) { this.timeout = value; return this; } /** - * Period to wait for a response. If no response is received before the timeout - * expires, the request fails and returns an error. + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** * Builds a {@link RerouteRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RerouteRequest build() { _checkSingleUse(); @@ -427,9 +506,7 @@ public RerouteRequest build() { ); protected static void setupRerouteRequestDeserializer(ObjectDeserializer op) { - op.add(Builder::commands, JsonpDeserializer.arrayDeserializer(Command._DESERIALIZER), "commands"); - } // --------------------------------------------------------------------------------------------- @@ -438,48 +515,67 @@ protected static void setupRerouteRequestDeserializer(ObjectDeserializer _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "POST"; - - }, - + request -> "POST", // Request path - request -> { - return "/_cluster/reroute"; - - }, - + request -> "/_cluster/reroute", // Request parameters request -> { Map params = new HashMap<>(); + if (request.clusterManagerTimeout != null) { + params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); + } + if (request.dryRun != null) { + params.put("dry_run", String.valueOf(request.dryRun)); + } if (request.explain != null) { params.put("explain", String.valueOf(request.explain)); } if (request.masterTimeout != null) { params.put("master_timeout", request.masterTimeout._toJsonString()); } - if (request.clusterManagerTimeout != null) { - params.put("cluster_mamager_timeout", request.clusterManagerTimeout._toJsonString()); - } if (ApiTypeHelper.isDefined(request.metric)) { - params.put("metric", request.metric.stream().map(v -> v).collect(Collectors.joining(","))); + params.put("metric", request.metric.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); } - if (request.dryRun != null) { - params.put("dry_run", String.valueOf(request.dryRun)); + if (request.retryFailed != null) { + params.put("retry_failed", String.valueOf(request.retryFailed)); } if (request.timeout != null) { params.put("timeout", request.timeout._toJsonString()); } - if (request.retryFailed != null) { - params.put("retry_failed", String.valueOf(request.retryFailed)); - } return params; - }, SimpleEndpoint.emptyMap(), true, RerouteResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.commands); + result = 31 * result + Objects.hashCode(this.dryRun); + result = 31 * result + Objects.hashCode(this.explain); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.metric); + result = 31 * result + Objects.hashCode(this.retryFailed); + result = 31 * result + Objects.hashCode(this.timeout); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RerouteRequest other = (RerouteRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.commands, other.commands) + && Objects.equals(this.dryRun, other.dryRun) + && Objects.equals(this.explain, other.explain) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.metric, other.metric) + && Objects.equals(this.retryFailed, other.retryFailed) + && Objects.equals(this.timeout, other.timeout); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/RerouteResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/RerouteResponse.java similarity index 60% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/RerouteResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/RerouteResponse.java index db40d31915..00c1c9eac6 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/RerouteResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/RerouteResponse.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import jakarta.json.stream.JsonGenerator; import java.util.List; +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.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -42,94 +49,132 @@ 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.AcknowledgedResponseBase; import org.opensearch.client.opensearch.cluster.reroute.RerouteExplanation; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.reroute.Response @JsonpDeserializable -public class RerouteResponse implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RerouteResponse extends AcknowledgedResponseBase implements ToCopyableBuilder { + + @Nonnull private final List explanations; + @Nullable private final JsonData state; // --------------------------------------------------------------------------------------------- private RerouteResponse(Builder builder) { - + super(builder); this.explanations = ApiTypeHelper.unmodifiable(builder.explanations); - this.state = ApiTypeHelper.requireNonNull(builder.state, this, "state"); - + this.state = builder.state; } - public static RerouteResponse of(Function> fn) { + public static RerouteResponse of(Function> fn) { return fn.apply(new Builder()).build(); } /** * API name: {@code explanations} */ + @Nonnull public final List explanations() { return this.explanations; } /** - * Required - There aren't any guarantees on the output/structure of the raw - * cluster state. Here you will find the internal representation of the cluster, - * which can differ from the external representation. + * There aren't any guarantees on the output/structure of the raw cluster state. Here you will find the internal representation of the + * cluster, which can differ from the external representation. *

* API name: {@code state} + *

*/ + @Nullable public final JsonData state() { return this.state; } - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - + super.serializeInternal(generator, mapper); if (ApiTypeHelper.isDefined(this.explanations)) { generator.writeKey("explanations"); generator.writeStartArray(); for (RerouteExplanation item0 : this.explanations) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } - generator.writeKey("state"); - this.state.serialize(generator, mapper); + if (this.state != null) { + generator.writeKey("state"); + this.state.serialize(generator, mapper); + } } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RerouteResponse}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + CopyableBuilder { @Nullable private List explanations; - + @Nullable private JsonData state; + public Builder() {} + + private Builder(RerouteResponse o) { + super(o); + this.explanations = _listCopy(o.explanations); + this.state = o.state; + } + + private Builder(Builder o) { + super(o); + this.explanations = _listCopy(o.explanations); + this.state = o.state; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + @Override + @Nonnull + protected Builder self() { + return this; + } + /** * API name: {@code explanations} + * *

* Adds all elements of list to explanations. + *

*/ + @Nonnull public final Builder explanations(List list) { this.explanations = _listAddAll(this.explanations, list); return this; @@ -137,9 +182,12 @@ public final Builder explanations(List list) { /** * API name: {@code explanations} + * *

* Adds one or more values to explanations. + *

*/ + @Nonnull public final Builder explanations(RerouteExplanation value, RerouteExplanation... values) { this.explanations = _listAdd(this.explanations, value, values); return this; @@ -147,21 +195,25 @@ public final Builder explanations(RerouteExplanation value, RerouteExplanation.. /** * API name: {@code explanations} + * *

* Adds a value to explanations using a builder lambda. + *

*/ + @Nonnull public final Builder explanations(Function> fn) { return explanations(fn.apply(new RerouteExplanation.Builder()).build()); } /** - * Required - There aren't any guarantees on the output/structure of the raw - * cluster state. Here you will find the internal representation of the cluster, - * which can differ from the external representation. + * There aren't any guarantees on the output/structure of the raw cluster state. Here you will find the internal representation of + * the cluster, which can differ from the external representation. *

* API name: {@code state} + *

*/ - public final Builder state(JsonData value) { + @Nonnull + public final Builder state(@Nullable JsonData value) { this.state = value; return this; } @@ -169,9 +221,10 @@ public final Builder state(JsonData value) { /** * Builds a {@link RerouteResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RerouteResponse build() { _checkSingleUse(); @@ -190,10 +243,27 @@ public RerouteResponse build() { ); protected static void setupRerouteResponseDeserializer(ObjectDeserializer op) { - + setupAcknowledgedResponseBaseDeserializer(op); op.add(Builder::explanations, JsonpDeserializer.arrayDeserializer(RerouteExplanation._DESERIALIZER), "explanations"); op.add(Builder::state, JsonData._DESERIALIZER, "state"); + } + @Override + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.explanations); + result = 31 * result + Objects.hashCode(this.state); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RerouteResponse other = (RerouteResponse) o; + return Objects.equals(this.explanations, other.explanations) && Objects.equals(this.state, other.state); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/StateRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/StateRequest.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/StateRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/StateRequest.java index dc34bce34e..6eb5b900d4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/StateRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/StateRequest.java @@ -30,35 +30,49 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.ExpandWildcard; import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.opensearch._types.Time; +import org.opensearch.client.opensearch.cluster.state.ClusterStateMetric; import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.state.Request /** * Returns a comprehensive information about the state of the cluster. - * */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class StateRequest extends RequestBase implements ToCopyableBuilder { -public class StateRequest extends RequestBase { @Nullable private final Boolean allowNoIndices; + @Nullable + private final Time clusterManagerTimeout; + + @Nonnull private final List expandWildcards; @Nullable @@ -67,6 +81,7 @@ public class StateRequest extends RequestBase { @Nullable private final Boolean ignoreUnavailable; + @Nonnull private final List index; @Nullable @@ -76,10 +91,8 @@ public class StateRequest extends RequestBase { @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - - private final List metric; + @Nonnull + private final List metric; @Nullable private final Long waitForMetadataVersion; @@ -90,31 +103,29 @@ public class StateRequest extends RequestBase { // --------------------------------------------------------------------------------------------- private StateRequest(Builder builder) { - this.allowNoIndices = builder.allowNoIndices; + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); this.flatSettings = builder.flatSettings; this.ignoreUnavailable = builder.ignoreUnavailable; this.index = ApiTypeHelper.unmodifiable(builder.index); this.local = builder.local; this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.metric = ApiTypeHelper.unmodifiable(builder.metric); this.waitForMetadataVersion = builder.waitForMetadataVersion; this.waitForTimeout = builder.waitForTimeout; - } - public static StateRequest of(Function> fn) { + public static StateRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * Whether to ignore if a wildcard indexes expression resolves into no concrete indexes. (This includes _all string or when + * no indexes have been specified) *

* API name: {@code allow_no_indices} + *

*/ @Nullable public final Boolean allowNoIndices() { @@ -122,19 +133,32 @@ public final Boolean allowNoIndices() { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * Whether to expand wildcard expression to concrete indexes that are open, closed or both. *

* API name: {@code expand_wildcards} + *

*/ + @Nonnull public final List expandWildcards() { return this.expandWildcards; } /** - * Return settings in flat format (default: false) + * Return settings in flat format. *

* API name: {@code flat_settings} + *

*/ @Nullable public final Boolean flatSettings() { @@ -142,10 +166,10 @@ public final Boolean flatSettings() { } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * Whether specified concrete indexes should be ignored when unavailable (missing or closed) *

* API name: {@code ignore_unavailable} + *

*/ @Nullable public final Boolean ignoreUnavailable() { @@ -153,20 +177,21 @@ public final Boolean ignoreUnavailable() { } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * A comma-separated list of index names; use _all or empty string to perform the operation on all indexes *

* API name: {@code index} + *

*/ + @Nonnull public final List index() { return this.index; } /** - * Return local information, do not retrieve the state from cluster-manager node - * (default: false) + * Return local information, do not retrieve the state from cluster-manager node. *

* API name: {@code local} + *

*/ @Nullable public final Boolean local() { @@ -174,9 +199,10 @@ public final Boolean local() { } /** - * Specify timeout for connection to master + * Specify timeout for connection to cluster manager. *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -184,30 +210,22 @@ public final Time masterTimeout() { return this.masterTimeout; } - /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } - /** * Limit the information returned to the specified metrics *

* API name: {@code metric} + *

*/ - public final List metric() { + @Nonnull + public final List metric() { return this.metric; } /** - * Wait for the metadata version to be equal or greater than the specified - * metadata version + * Wait for the metadata version to be equal or greater than the specified metadata version. *

* API name: {@code wait_for_metadata_version} + *

*/ @Nullable public final Long waitForMetadataVersion() { @@ -215,9 +233,10 @@ public final Long waitForMetadataVersion() { } /** - * The maximum time to wait for wait_for_metadata_version before timing out + * The maximum time to wait for wait_for_metadata_version before timing out. *

* API name: {@code wait_for_timeout} + *

*/ @Nullable public final Time waitForTimeout() { @@ -226,189 +245,253 @@ public final Time waitForTimeout() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link StateRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Boolean allowNoIndices; - + @Nullable + private Time clusterManagerTimeout; @Nullable private List expandWildcards; - @Nullable private Boolean flatSettings; - @Nullable private Boolean ignoreUnavailable; - @Nullable private List index; - @Nullable private Boolean local; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - @Nullable - private List metric; - + private List metric; @Nullable private Long waitForMetadataVersion; - @Nullable private Time waitForTimeout; + public Builder() {} + + private Builder(StateRequest o) { + this.allowNoIndices = o.allowNoIndices; + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.expandWildcards = _listCopy(o.expandWildcards); + this.flatSettings = o.flatSettings; + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.local = o.local; + this.masterTimeout = o.masterTimeout; + this.metric = _listCopy(o.metric); + this.waitForMetadataVersion = o.waitForMetadataVersion; + this.waitForTimeout = o.waitForTimeout; + } + + private Builder(Builder o) { + this.allowNoIndices = o.allowNoIndices; + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.expandWildcards = _listCopy(o.expandWildcards); + this.flatSettings = o.flatSettings; + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.local = o.local; + this.masterTimeout = o.masterTimeout; + this.metric = _listCopy(o.metric); + this.waitForMetadataVersion = o.waitForMetadataVersion; + this.waitForTimeout = o.waitForTimeout; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * Whether to ignore if a wildcard indexes expression resolves into no concrete indexes. (This includes _all string or + * when no indexes have been specified) *

* API name: {@code allow_no_indices} + *

*/ + @Nonnull public final Builder allowNoIndices(@Nullable Boolean value) { this.allowNoIndices = value; return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; + return this; + } + + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Whether to expand wildcard expression to concrete indexes that are open, closed or both. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds all elements of list to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(List list) { this.expandWildcards = _listAddAll(this.expandWildcards, list); return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Whether to expand wildcard expression to concrete indexes that are open, closed or both. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds one or more values to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { this.expandWildcards = _listAdd(this.expandWildcards, value, values); return this; } /** - * Return settings in flat format (default: false) + * Return settings in flat format. *

* API name: {@code flat_settings} + *

*/ + @Nonnull public final Builder flatSettings(@Nullable Boolean value) { this.flatSettings = value; return this; } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * Whether specified concrete indexes should be ignored when unavailable (missing or closed) *

* API name: {@code ignore_unavailable} + *

*/ + @Nonnull public final Builder ignoreUnavailable(@Nullable Boolean value) { this.ignoreUnavailable = value; return this; } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * A comma-separated list of index names; use _all or empty string to perform the operation on all indexes *

* API name: {@code index} + *

+ * *

* Adds all elements of list to index. + *

*/ + @Nonnull public final Builder index(List list) { this.index = _listAddAll(this.index, list); return this; } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * A comma-separated list of index names; use _all or empty string to perform the operation on all indexes *

* API name: {@code index} + *

+ * *

* Adds one or more values to index. + *

*/ + @Nonnull public final Builder index(String value, String... values) { this.index = _listAdd(this.index, value, values); return this; } /** - * Return local information, do not retrieve the state from cluster-manager node - * (default: false) + * Return local information, do not retrieve the state from cluster-manager node. *

* API name: {@code local} + *

*/ + @Nonnull public final Builder local(@Nullable Boolean value) { this.local = value; return this; } /** - * Specify timeout for connection to master + * Specify timeout for connection to cluster manager. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(@Nullable Time value) { this.masterTimeout = value; return this; } /** - * Specify timeout for connection to master + * Specify timeout for connection to cluster manager. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; - return this; - } - - /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** * Limit the information returned to the specified metrics *

* API name: {@code metric} + *

+ * *

* Adds all elements of list to metric. + *

*/ - public final Builder metric(List list) { + @Nonnull + public final Builder metric(List list) { this.metric = _listAddAll(this.metric, list); return this; } @@ -417,50 +500,60 @@ public final Builder metric(List list) { * Limit the information returned to the specified metrics *

* API name: {@code metric} + *

+ * *

* Adds one or more values to metric. + *

*/ - public final Builder metric(String value, String... values) { + @Nonnull + public final Builder metric(ClusterStateMetric value, ClusterStateMetric... values) { this.metric = _listAdd(this.metric, value, values); return this; } /** - * Wait for the metadata version to be equal or greater than the specified - * metadata version + * Wait for the metadata version to be equal or greater than the specified metadata version. *

* API name: {@code wait_for_metadata_version} + *

*/ + @Nonnull public final Builder waitForMetadataVersion(@Nullable Long value) { this.waitForMetadataVersion = value; return this; } /** - * The maximum time to wait for wait_for_metadata_version before timing out + * The maximum time to wait for wait_for_metadata_version before timing out. *

* API name: {@code wait_for_timeout} + *

*/ + @Nonnull public final Builder waitForTimeout(@Nullable Time value) { this.waitForTimeout = value; return this; } /** - * The maximum time to wait for wait_for_metadata_version before timing out + * The maximum time to wait for wait_for_metadata_version before timing out. *

* API name: {@code wait_for_timeout} + *

*/ + @Nonnull public final Builder waitForTimeout(Function> fn) { - return this.waitForTimeout(fn.apply(new Time.Builder()).build()); + return waitForTimeout(fn.apply(new Time.Builder()).build()); } /** * Builds a {@link StateRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public StateRequest build() { _checkSingleUse(); @@ -474,86 +567,107 @@ public StateRequest build() { * Endpoint "{@code cluster.state}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "GET"; - - }, - + request -> "GET", // Request path request -> { - final int _metric = 1 << 0; - final int _index = 1 << 1; + final int _index = 1 << 0; + final int _metric = 1 << 1; int propsSet = 0; - if (ApiTypeHelper.isDefined(request.metric())) propsSet |= _metric; if (ApiTypeHelper.isDefined(request.index())) propsSet |= _index; + if (ApiTypeHelper.isDefined(request.metric())) propsSet |= _metric; if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_cluster"); - buf.append("/state"); - return buf.toString(); + return "/_cluster/state"; } if (propsSet == (_metric)) { StringBuilder buf = new StringBuilder(); - buf.append("/_cluster"); - buf.append("/state"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.metric.stream().map(v -> v).collect(Collectors.joining(",")), buf); + buf.append("/_cluster/state/"); + SimpleEndpoint.pathEncode(request.metric.stream().map(v -> v.jsonValue()).collect(Collectors.joining(",")), buf); return buf.toString(); } if (propsSet == (_metric | _index)) { StringBuilder buf = new StringBuilder(); - buf.append("/_cluster"); - buf.append("/state"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.metric.stream().map(v -> v).collect(Collectors.joining(",")), buf); + buf.append("/_cluster/state/"); + SimpleEndpoint.pathEncode(request.metric.stream().map(v -> v.jsonValue()).collect(Collectors.joining(",")), buf); buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); + if (request.allowNoIndices != null) { + params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } - if (request.flatSettings != null) { - params.put("flat_settings", String.valueOf(request.flatSettings)); - } if (ApiTypeHelper.isDefined(request.expandWildcards)) { params.put("expand_wildcards", request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); } + if (request.flatSettings != null) { + params.put("flat_settings", String.valueOf(request.flatSettings)); + } if (request.ignoreUnavailable != null) { params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); } - if (request.waitForTimeout != null) { - params.put("wait_for_timeout", request.waitForTimeout._toJsonString()); + if (request.local != null) { + params.put("local", String.valueOf(request.local)); } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); } if (request.waitForMetadataVersion != null) { params.put("wait_for_metadata_version", String.valueOf(request.waitForMetadataVersion)); } - if (request.local != null) { - params.put("local", String.valueOf(request.local)); + if (request.waitForTimeout != null) { + params.put("wait_for_timeout", request.waitForTimeout._toJsonString()); } return params; - }, SimpleEndpoint.emptyMap(), false, StateResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allowNoIndices); + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.expandWildcards); + result = 31 * result + Objects.hashCode(this.flatSettings); + result = 31 * result + Objects.hashCode(this.ignoreUnavailable); + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + Objects.hashCode(this.local); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.metric); + result = 31 * result + Objects.hashCode(this.waitForMetadataVersion); + result = 31 * result + Objects.hashCode(this.waitForTimeout); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + StateRequest other = (StateRequest) o; + return Objects.equals(this.allowNoIndices, other.allowNoIndices) + && Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.expandWildcards, other.expandWildcards) + && Objects.equals(this.flatSettings, other.flatSettings) + && Objects.equals(this.ignoreUnavailable, other.ignoreUnavailable) + && Objects.equals(this.index, other.index) + && Objects.equals(this.local, other.local) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.metric, other.metric) + && Objects.equals(this.waitForMetadataVersion, other.waitForMetadataVersion) + && Objects.equals(this.waitForTimeout, other.waitForTimeout); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/StateResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/StateResponse.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/StateResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/StateResponse.java index 5d69fe5a67..f074c7fc0f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/StateResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/StateResponse.java @@ -30,42 +30,48 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonData; -import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.state.Response -@JsonpDeserializable -public class StateResponse implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class StateResponse implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final JsonData valueBody; // --------------------------------------------------------------------------------------------- private StateResponse(Builder builder) { - this.valueBody = ApiTypeHelper.requireNonNull(builder.valueBody, this, "valueBody"); - } - public static StateResponse of(Function> fn) { + public static StateResponse of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - Response value. - *

- * API name: {@code _value_body} */ + @Nonnull public final JsonData valueBody() { return this.valueBody; } @@ -73,25 +79,50 @@ public final JsonData valueBody() { /** * Serialize this value to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { this.valueBody.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link StateResponse}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private JsonData valueBody; + public Builder() {} + + private Builder(StateResponse o) { + this.valueBody = o.valueBody; + } + + private Builder(Builder o) { + this.valueBody = o.valueBody; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - Response value. - *

- * API name: {@code _value_body} */ + @Nonnull public final Builder valueBody(JsonData value) { this.valueBody = value; return this; @@ -100,9 +131,10 @@ public final Builder valueBody(JsonData value) { /** * Builds a {@link StateResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public StateResponse build() { _checkSingleUse(); @@ -110,16 +142,29 @@ public StateResponse build() { } } + // --------------------------------------------------------------------------------------------- + public static final JsonpDeserializer _DESERIALIZER = createStateResponseDeserializer(); protected static JsonpDeserializer createStateResponseDeserializer() { - JsonpDeserializer valueDeserializer = JsonData._DESERIALIZER; - return JsonpDeserializer.of( valueDeserializer.acceptedEvents(), (parser, mapper) -> new Builder().valueBody(valueDeserializer.deserialize(parser, mapper)).build() ); } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.valueBody.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/AllocationDecision.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/AllocationDecision.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/AllocationDecision.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/AllocationDecision.java index 94be4c0e0f..2e242f181c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/AllocationDecision.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/AllocationDecision.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.allocation_explain; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,36 +47,42 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.allocation_explain.AllocationDecision @JsonpDeserializable -public class AllocationDecision implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class AllocationDecision implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final String decider; + @Nonnull private final AllocationExplainDecision decision; + @Nonnull private final String explanation; // --------------------------------------------------------------------------------------------- private AllocationDecision(Builder builder) { - this.decider = ApiTypeHelper.requireNonNull(builder.decider, this, "decider"); this.decision = ApiTypeHelper.requireNonNull(builder.decision, this, "decision"); this.explanation = ApiTypeHelper.requireNonNull(builder.explanation, this, "explanation"); - } - public static AllocationDecision of(Function> fn) { + public static AllocationDecision of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code decider} */ + @Nonnull public final String decider() { return this.decider; } @@ -78,6 +90,7 @@ public final String decider() { /** * Required - API name: {@code decision} */ + @Nonnull public final AllocationExplainDecision decision() { return this.decision; } @@ -85,6 +98,7 @@ public final AllocationExplainDecision decision() { /** * Required - API name: {@code explanation} */ + @Nonnull public final String explanation() { return this.explanation; } @@ -92,6 +106,7 @@ public final String explanation() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -99,33 +114,61 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("decider"); generator.write(this.decider); generator.writeKey("decision"); this.decision.serialize(generator, mapper); + generator.writeKey("explanation"); generator.write(this.explanation); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link AllocationDecision}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private String decider; - private AllocationExplainDecision decision; - private String explanation; + public Builder() {} + + private Builder(AllocationDecision o) { + this.decider = o.decider; + this.decision = o.decision; + this.explanation = o.explanation; + } + + private Builder(Builder o) { + this.decider = o.decider; + this.decision = o.decision; + this.explanation = o.explanation; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code decider} */ + @Nonnull public final Builder decider(String value) { this.decider = value; return this; @@ -134,6 +177,7 @@ public final Builder decider(String value) { /** * Required - API name: {@code decision} */ + @Nonnull public final Builder decision(AllocationExplainDecision value) { this.decision = value; return this; @@ -142,6 +186,7 @@ public final Builder decision(AllocationExplainDecision value) { /** * Required - API name: {@code explanation} */ + @Nonnull public final Builder explanation(String value) { this.explanation = value; return this; @@ -150,9 +195,10 @@ public final Builder explanation(String value) { /** * Builds a {@link AllocationDecision}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public AllocationDecision build() { _checkSingleUse(); @@ -171,11 +217,25 @@ public AllocationDecision build() { ); protected static void setupAllocationDecisionDeserializer(ObjectDeserializer op) { - op.add(Builder::decider, JsonpDeserializer.stringDeserializer(), "decider"); op.add(Builder::decision, AllocationExplainDecision._DESERIALIZER, "decision"); op.add(Builder::explanation, JsonpDeserializer.stringDeserializer(), "explanation"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.decider.hashCode(); + result = 31 * result + this.decision.hashCode(); + result = 31 * result + this.explanation.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + AllocationDecision other = (AllocationDecision) o; + return this.decider.equals(other.decider) && this.decision.equals(other.decision) && this.explanation.equals(other.explanation); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/AllocationExplainDecision.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/AllocationExplainDecision.java similarity index 84% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/AllocationExplainDecision.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/AllocationExplainDecision.java index 31a7cabdcc..a764feea04 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/AllocationExplainDecision.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/AllocationExplainDecision.java @@ -30,22 +30,28 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.allocation_explain; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: cluster.allocation_explain.AllocationExplainDecision + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum AllocationExplainDecision implements JsonEnum { - No("NO"), + Always("ALWAYS"), - Yes("YES"), + No("NO"), Throttle("THROTTLE"), - Always("ALWAYS"), - - ; + Yes("YES"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/AllocationStore.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/AllocationStore.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/AllocationStore.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/AllocationStore.java index c6f43fb968..40597b4d82 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/AllocationStore.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/AllocationStore.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.allocation_explain; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,13 +47,18 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.allocation_explain.AllocationStore @JsonpDeserializable -public class AllocationStore implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class AllocationStore implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final String allocationId; private final boolean found; @@ -58,28 +69,28 @@ public class AllocationStore implements PlainJsonSerializable { private final boolean matchingSyncId; + @Nonnull private final String storeException; // --------------------------------------------------------------------------------------------- private AllocationStore(Builder builder) { - this.allocationId = ApiTypeHelper.requireNonNull(builder.allocationId, this, "allocationId"); this.found = ApiTypeHelper.requireNonNull(builder.found, this, "found"); this.inSync = ApiTypeHelper.requireNonNull(builder.inSync, this, "inSync"); this.matchingSizeInBytes = ApiTypeHelper.requireNonNull(builder.matchingSizeInBytes, this, "matchingSizeInBytes"); this.matchingSyncId = ApiTypeHelper.requireNonNull(builder.matchingSyncId, this, "matchingSyncId"); this.storeException = ApiTypeHelper.requireNonNull(builder.storeException, this, "storeException"); - } - public static AllocationStore of(Function> fn) { + public static AllocationStore of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code allocation_id} */ + @Nonnull public final String allocationId() { return this.allocationId; } @@ -115,6 +126,7 @@ public final boolean matchingSyncId() { /** * Required - API name: {@code store_exception} */ + @Nonnull public final String storeException() { return this.storeException; } @@ -122,6 +134,7 @@ public final String storeException() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -129,7 +142,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("allocation_id"); generator.write(this.allocationId); @@ -147,31 +159,62 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("store_exception"); generator.write(this.storeException); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link AllocationStore}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private String allocationId; - private Boolean found; - private Boolean inSync; - private Long matchingSizeInBytes; - private Boolean matchingSyncId; - private String storeException; + public Builder() {} + + private Builder(AllocationStore o) { + this.allocationId = o.allocationId; + this.found = o.found; + this.inSync = o.inSync; + this.matchingSizeInBytes = o.matchingSizeInBytes; + this.matchingSyncId = o.matchingSyncId; + this.storeException = o.storeException; + } + + private Builder(Builder o) { + this.allocationId = o.allocationId; + this.found = o.found; + this.inSync = o.inSync; + this.matchingSizeInBytes = o.matchingSizeInBytes; + this.matchingSyncId = o.matchingSyncId; + this.storeException = o.storeException; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code allocation_id} */ + @Nonnull public final Builder allocationId(String value) { this.allocationId = value; return this; @@ -180,6 +223,7 @@ public final Builder allocationId(String value) { /** * Required - API name: {@code found} */ + @Nonnull public final Builder found(boolean value) { this.found = value; return this; @@ -188,6 +232,7 @@ public final Builder found(boolean value) { /** * Required - API name: {@code in_sync} */ + @Nonnull public final Builder inSync(boolean value) { this.inSync = value; return this; @@ -196,6 +241,7 @@ public final Builder inSync(boolean value) { /** * Required - API name: {@code matching_size_in_bytes} */ + @Nonnull public final Builder matchingSizeInBytes(long value) { this.matchingSizeInBytes = value; return this; @@ -204,6 +250,7 @@ public final Builder matchingSizeInBytes(long value) { /** * Required - API name: {@code matching_sync_id} */ + @Nonnull public final Builder matchingSyncId(boolean value) { this.matchingSyncId = value; return this; @@ -212,6 +259,7 @@ public final Builder matchingSyncId(boolean value) { /** * Required - API name: {@code store_exception} */ + @Nonnull public final Builder storeException(String value) { this.storeException = value; return this; @@ -220,9 +268,10 @@ public final Builder storeException(String value) { /** * Builds a {@link AllocationStore}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public AllocationStore build() { _checkSingleUse(); @@ -241,14 +290,36 @@ public AllocationStore build() { ); protected static void setupAllocationStoreDeserializer(ObjectDeserializer op) { - op.add(Builder::allocationId, JsonpDeserializer.stringDeserializer(), "allocation_id"); op.add(Builder::found, JsonpDeserializer.booleanDeserializer(), "found"); op.add(Builder::inSync, JsonpDeserializer.booleanDeserializer(), "in_sync"); op.add(Builder::matchingSizeInBytes, JsonpDeserializer.longDeserializer(), "matching_size_in_bytes"); op.add(Builder::matchingSyncId, JsonpDeserializer.booleanDeserializer(), "matching_sync_id"); op.add(Builder::storeException, JsonpDeserializer.stringDeserializer(), "store_exception"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.allocationId.hashCode(); + result = 31 * result + Boolean.hashCode(this.found); + result = 31 * result + Boolean.hashCode(this.inSync); + result = 31 * result + Long.hashCode(this.matchingSizeInBytes); + result = 31 * result + Boolean.hashCode(this.matchingSyncId); + result = 31 * result + this.storeException.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + AllocationStore other = (AllocationStore) o; + return this.allocationId.equals(other.allocationId) + && this.found == other.found + && this.inSync == other.inSync + && this.matchingSizeInBytes == other.matchingSizeInBytes + && this.matchingSyncId == other.matchingSyncId + && this.storeException.equals(other.storeException); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/ClusterInfo.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/ClusterInfo.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/ClusterInfo.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/ClusterInfo.java index 4419571b76..1464539c82 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/ClusterInfo.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/ClusterInfo.java @@ -30,12 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.allocation_explain; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.Map; +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; @@ -44,56 +51,66 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.allocation_explain.ClusterInfo @JsonpDeserializable -public class ClusterInfo implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterInfo implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final Map nodes; - private final Map shardSizes; + @Nonnull + private final List reservedSizes; + @Nonnull private final Map shardDataSetSizes; + @Nonnull private final Map shardPaths; - private final List reservedSizes; + @Nonnull + private final Map shardSizes; // --------------------------------------------------------------------------------------------- private ClusterInfo(Builder builder) { - this.nodes = ApiTypeHelper.unmodifiableRequired(builder.nodes, this, "nodes"); - this.shardSizes = ApiTypeHelper.unmodifiableRequired(builder.shardSizes, this, "shardSizes"); + this.reservedSizes = ApiTypeHelper.unmodifiableRequired(builder.reservedSizes, this, "reservedSizes"); this.shardDataSetSizes = ApiTypeHelper.unmodifiable(builder.shardDataSetSizes); this.shardPaths = ApiTypeHelper.unmodifiableRequired(builder.shardPaths, this, "shardPaths"); - this.reservedSizes = ApiTypeHelper.unmodifiableRequired(builder.reservedSizes, this, "reservedSizes"); - + this.shardSizes = ApiTypeHelper.unmodifiableRequired(builder.shardSizes, this, "shardSizes"); } - public static ClusterInfo of(Function> fn) { + public static ClusterInfo of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code nodes} */ + @Nonnull public final Map nodes() { return this.nodes; } /** - * Required - API name: {@code shard_sizes} + * Required - API name: {@code reserved_sizes} */ - public final Map shardSizes() { - return this.shardSizes; + @Nonnull + public final List reservedSizes() { + return this.reservedSizes; } /** * API name: {@code shard_data_set_sizes} */ + @Nonnull public final Map shardDataSetSizes() { return this.shardDataSetSizes; } @@ -101,20 +118,23 @@ public final Map shardDataSetSizes() { /** * Required - API name: {@code shard_paths} */ + @Nonnull public final Map shardPaths() { return this.shardPaths; } /** - * Required - API name: {@code reserved_sizes} + * Required - API name: {@code shard_sizes} */ - public final List reservedSizes() { - return this.reservedSizes; + @Nonnull + public final Map shardSizes() { + return this.shardSizes; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -122,87 +142,104 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.nodes)) { - generator.writeKey("nodes"); - generator.writeStartObject(); - for (Map.Entry item0 : this.nodes.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("nodes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.nodes.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); } - if (ApiTypeHelper.isDefined(this.shardSizes)) { - generator.writeKey("shard_sizes"); - generator.writeStartObject(); - for (Map.Entry item0 : this.shardSizes.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); + generator.writeEnd(); + generator.writeKey("reserved_sizes"); + generator.writeStartArray(); + for (ReservedSize item0 : this.reservedSizes) { + item0.serialize(generator, mapper); } + generator.writeEnd(); + if (ApiTypeHelper.isDefined(this.shardDataSetSizes)) { generator.writeKey("shard_data_set_sizes"); generator.writeStartObject(); for (Map.Entry item0 : this.shardDataSetSizes.entrySet()) { generator.writeKey(item0.getKey()); generator.write(item0.getValue()); - } generator.writeEnd(); - } - if (ApiTypeHelper.isDefined(this.shardPaths)) { - generator.writeKey("shard_paths"); - generator.writeStartObject(); - for (Map.Entry item0 : this.shardPaths.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); + generator.writeKey("shard_paths"); + generator.writeStartObject(); + for (Map.Entry item0 : this.shardPaths.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); } - if (ApiTypeHelper.isDefined(this.reservedSizes)) { - generator.writeKey("reserved_sizes"); - generator.writeStartArray(); - for (ReservedSize item0 : this.reservedSizes) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); + generator.writeEnd(); + generator.writeKey("shard_sizes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.shardSizes.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ClusterInfo}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Map nodes; - - private Map shardSizes; - + private List reservedSizes; @Nullable private Map shardDataSetSizes; - private Map shardPaths; + private Map shardSizes; - private List reservedSizes; + public Builder() {} + + private Builder(ClusterInfo o) { + this.nodes = _mapCopy(o.nodes); + this.reservedSizes = _listCopy(o.reservedSizes); + this.shardDataSetSizes = _mapCopy(o.shardDataSetSizes); + this.shardPaths = _mapCopy(o.shardPaths); + this.shardSizes = _mapCopy(o.shardSizes); + } + + private Builder(Builder o) { + this.nodes = _mapCopy(o.nodes); + this.reservedSizes = _listCopy(o.reservedSizes); + this.shardDataSetSizes = _mapCopy(o.shardDataSetSizes); + this.shardPaths = _mapCopy(o.shardPaths); + this.shardSizes = _mapCopy(o.shardSizes); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * Required - API name: {@code nodes} + * *

- * Adds all entries of map to nodes. + * Adds all elements of map to nodes. + *

*/ + @Nonnull public final Builder nodes(Map map) { this.nodes = _mapPutAll(this.nodes, map); return this; @@ -210,9 +247,12 @@ public final Builder nodes(Map map) { /** * Required - API name: {@code nodes} + * *

* Adds an entry to nodes. + *

*/ + @Nonnull public final Builder nodes(String key, NodeDiskUsage value) { this.nodes = _mapPut(this.nodes, key, value); return this; @@ -220,38 +260,62 @@ public final Builder nodes(String key, NodeDiskUsage value) { /** * Required - API name: {@code nodes} + * *

- * Adds an entry to nodes using a builder lambda. + * Adds a value to nodes using a builder lambda. + *

*/ + @Nonnull public final Builder nodes(String key, Function> fn) { return nodes(key, fn.apply(new NodeDiskUsage.Builder()).build()); } /** - * Required - API name: {@code shard_sizes} + * Required - API name: {@code reserved_sizes} + * *

- * Adds all entries of map to shardSizes. + * Adds all elements of list to reservedSizes. + *

*/ - public final Builder shardSizes(Map map) { - this.shardSizes = _mapPutAll(this.shardSizes, map); + @Nonnull + public final Builder reservedSizes(List list) { + this.reservedSizes = _listAddAll(this.reservedSizes, list); return this; } /** - * Required - API name: {@code shard_sizes} + * Required - API name: {@code reserved_sizes} + * *

- * Adds an entry to shardSizes. + * Adds one or more values to reservedSizes. + *

*/ - public final Builder shardSizes(String key, Long value) { - this.shardSizes = _mapPut(this.shardSizes, key, value); + @Nonnull + public final Builder reservedSizes(ReservedSize value, ReservedSize... values) { + this.reservedSizes = _listAdd(this.reservedSizes, value, values); return this; } + /** + * Required - API name: {@code reserved_sizes} + * + *

+ * Adds a value to reservedSizes using a builder lambda. + *

+ */ + @Nonnull + public final Builder reservedSizes(Function> fn) { + return reservedSizes(fn.apply(new ReservedSize.Builder()).build()); + } + /** * API name: {@code shard_data_set_sizes} + * *

- * Adds all entries of map to shardDataSetSizes. + * Adds all elements of map to shardDataSetSizes. + *

*/ + @Nonnull public final Builder shardDataSetSizes(Map map) { this.shardDataSetSizes = _mapPutAll(this.shardDataSetSizes, map); return this; @@ -259,9 +323,12 @@ public final Builder shardDataSetSizes(Map map) { /** * API name: {@code shard_data_set_sizes} + * *

* Adds an entry to shardDataSetSizes. + *

*/ + @Nonnull public final Builder shardDataSetSizes(String key, String value) { this.shardDataSetSizes = _mapPut(this.shardDataSetSizes, key, value); return this; @@ -269,9 +336,12 @@ public final Builder shardDataSetSizes(String key, String value) { /** * Required - API name: {@code shard_paths} + * *

- * Adds all entries of map to shardPaths. + * Adds all elements of map to shardPaths. + *

*/ + @Nonnull public final Builder shardPaths(Map map) { this.shardPaths = _mapPutAll(this.shardPaths, map); return this; @@ -279,49 +349,50 @@ public final Builder shardPaths(Map map) { /** * Required - API name: {@code shard_paths} + * *

* Adds an entry to shardPaths. + *

*/ + @Nonnull public final Builder shardPaths(String key, String value) { this.shardPaths = _mapPut(this.shardPaths, key, value); return this; } /** - * Required - API name: {@code reserved_sizes} + * Required - API name: {@code shard_sizes} + * *

- * Adds all elements of list to reservedSizes. + * Adds all elements of map to shardSizes. + *

*/ - public final Builder reservedSizes(List list) { - this.reservedSizes = _listAddAll(this.reservedSizes, list); + @Nonnull + public final Builder shardSizes(Map map) { + this.shardSizes = _mapPutAll(this.shardSizes, map); return this; } /** - * Required - API name: {@code reserved_sizes} + * Required - API name: {@code shard_sizes} + * *

- * Adds one or more values to reservedSizes. + * Adds an entry to shardSizes. + *

*/ - public final Builder reservedSizes(ReservedSize value, ReservedSize... values) { - this.reservedSizes = _listAdd(this.reservedSizes, value, values); + @Nonnull + public final Builder shardSizes(String key, String value) { + this.shardSizes = _mapPut(this.shardSizes, key, value); return this; } - /** - * Required - API name: {@code reserved_sizes} - *

- * Adds a value to reservedSizes using a builder lambda. - */ - public final Builder reservedSizes(Function> fn) { - return reservedSizes(fn.apply(new ReservedSize.Builder()).build()); - } - /** * Builds a {@link ClusterInfo}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ClusterInfo build() { _checkSingleUse(); @@ -340,17 +411,37 @@ public ClusterInfo build() { ); protected static void setupClusterInfoDeserializer(ObjectDeserializer op) { - op.add(Builder::nodes, JsonpDeserializer.stringMapDeserializer(NodeDiskUsage._DESERIALIZER), "nodes"); - op.add(Builder::shardSizes, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.longDeserializer()), "shard_sizes"); + op.add(Builder::reservedSizes, JsonpDeserializer.arrayDeserializer(ReservedSize._DESERIALIZER), "reserved_sizes"); op.add( Builder::shardDataSetSizes, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "shard_data_set_sizes" ); op.add(Builder::shardPaths, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "shard_paths"); - op.add(Builder::reservedSizes, JsonpDeserializer.arrayDeserializer(ReservedSize._DESERIALIZER), "reserved_sizes"); + op.add(Builder::shardSizes, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "shard_sizes"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.nodes.hashCode(); + result = 31 * result + this.reservedSizes.hashCode(); + result = 31 * result + Objects.hashCode(this.shardDataSetSizes); + result = 31 * result + this.shardPaths.hashCode(); + result = 31 * result + this.shardSizes.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterInfo other = (ClusterInfo) o; + return this.nodes.equals(other.nodes) + && this.reservedSizes.equals(other.reservedSizes) + && Objects.equals(this.shardDataSetSizes, other.shardDataSetSizes) + && this.shardPaths.equals(other.shardPaths) + && this.shardSizes.equals(other.shardSizes); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/CurrentNode.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/CurrentNode.java similarity index 69% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/CurrentNode.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/CurrentNode.java index 441340aaa4..55d99fa11c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/CurrentNode.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/CurrentNode.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.allocation_explain; import jakarta.json.stream.JsonGenerator; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,19 +48,27 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.allocation_explain.CurrentNode @JsonpDeserializable -public class CurrentNode implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CurrentNode implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final Map attributes; + + @Nonnull private final String id; + @Nonnull private final String name; - private final Map attributes; - + @Nonnull private final String transportAddress; private final int weightRanking; @@ -62,22 +76,29 @@ public class CurrentNode implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private CurrentNode(Builder builder) { - + this.attributes = ApiTypeHelper.unmodifiableRequired(builder.attributes, this, "attributes"); this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.attributes = ApiTypeHelper.unmodifiableRequired(builder.attributes, this, "attributes"); this.transportAddress = ApiTypeHelper.requireNonNull(builder.transportAddress, this, "transportAddress"); this.weightRanking = ApiTypeHelper.requireNonNull(builder.weightRanking, this, "weightRanking"); - } - public static CurrentNode of(Function> fn) { + public static CurrentNode of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * Required - API name: {@code attributes} + */ + @Nonnull + public final Map attributes() { + return this.attributes; + } + /** * Required - API name: {@code id} */ + @Nonnull public final String id() { return this.id; } @@ -85,20 +106,15 @@ public final String id() { /** * Required - API name: {@code name} */ + @Nonnull public final String name() { return this.name; } - /** - * Required - API name: {@code attributes} - */ - public final Map attributes() { - return this.attributes; - } - /** * Required - API name: {@code transport_address} */ + @Nonnull public final String transportAddress() { return this.transportAddress; } @@ -113,6 +129,7 @@ public final int weightRanking() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -120,6 +137,13 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("attributes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.attributes.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + } + generator.writeEnd(); generator.writeKey("id"); generator.write(this.id); @@ -127,63 +151,68 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("name"); generator.write(this.name); - if (ApiTypeHelper.isDefined(this.attributes)) { - generator.writeKey("attributes"); - generator.writeStartObject(); - for (Map.Entry item0 : this.attributes.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); - - } generator.writeKey("transport_address"); generator.write(this.transportAddress); generator.writeKey("weight_ranking"); generator.write(this.weightRanking); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link CurrentNode}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private Map attributes; private String id; - private String name; - - private Map attributes; - private String transportAddress; - private Integer weightRanking; - /** - * Required - API name: {@code id} - */ - public final Builder id(String value) { - this.id = value; - return this; + public Builder() {} + + private Builder(CurrentNode o) { + this.attributes = _mapCopy(o.attributes); + this.id = o.id; + this.name = o.name; + this.transportAddress = o.transportAddress; + this.weightRanking = o.weightRanking; } - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; + private Builder(Builder o) { + this.attributes = _mapCopy(o.attributes); + this.id = o.id; + this.name = o.name; + this.transportAddress = o.transportAddress; + this.weightRanking = o.weightRanking; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** * Required - API name: {@code attributes} + * *

- * Adds all entries of map to attributes. + * Adds all elements of map to attributes. + *

*/ + @Nonnull public final Builder attributes(Map map) { this.attributes = _mapPutAll(this.attributes, map); return this; @@ -191,17 +220,39 @@ public final Builder attributes(Map map) { /** * Required - API name: {@code attributes} + * *

* Adds an entry to attributes. + *

*/ + @Nonnull public final Builder attributes(String key, String value) { this.attributes = _mapPut(this.attributes, key, value); return this; } + /** + * Required - API name: {@code id} + */ + @Nonnull + public final Builder id(String value) { + this.id = value; + return this; + } + + /** + * Required - API name: {@code name} + */ + @Nonnull + public final Builder name(String value) { + this.name = value; + return this; + } + /** * Required - API name: {@code transport_address} */ + @Nonnull public final Builder transportAddress(String value) { this.transportAddress = value; return this; @@ -210,6 +261,7 @@ public final Builder transportAddress(String value) { /** * Required - API name: {@code weight_ranking} */ + @Nonnull public final Builder weightRanking(int value) { this.weightRanking = value; return this; @@ -218,9 +270,10 @@ public final Builder weightRanking(int value) { /** * Builds a {@link CurrentNode}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public CurrentNode build() { _checkSingleUse(); @@ -239,13 +292,33 @@ public CurrentNode build() { ); protected static void setupCurrentNodeDeserializer(ObjectDeserializer op) { - + op.add(Builder::attributes, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "attributes"); op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::attributes, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "attributes"); op.add(Builder::transportAddress, JsonpDeserializer.stringDeserializer(), "transport_address"); op.add(Builder::weightRanking, JsonpDeserializer.integerDeserializer(), "weight_ranking"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.attributes.hashCode(); + result = 31 * result + this.id.hashCode(); + result = 31 * result + this.name.hashCode(); + result = 31 * result + this.transportAddress.hashCode(); + result = 31 * result + Integer.hashCode(this.weightRanking); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CurrentNode other = (CurrentNode) o; + return this.attributes.equals(other.attributes) + && this.id.equals(other.id) + && this.name.equals(other.name) + && this.transportAddress.equals(other.transportAddress) + && this.weightRanking == other.weightRanking; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/Decision.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/Decision.java similarity index 85% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/Decision.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/Decision.java index 6d152438b2..0145ded795 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/Decision.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/Decision.java @@ -30,30 +30,36 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.allocation_explain; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: cluster.allocation_explain.Decision + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum Decision implements JsonEnum { - Yes("yes"), - - No("no"), - - WorseBalance("worse_balance"), - - Throttled("throttled"), + AllocationDelayed("allocation_delayed"), AwaitingInfo("awaiting_info"), - AllocationDelayed("allocation_delayed"), + No("no"), + + NoAttempt("no_attempt"), NoValidShardCopy("no_valid_shard_copy"), - NoAttempt("no_attempt"), + Throttled("throttled"), + + WorseBalance("worse_balance"), - ; + Yes("yes"); private final String jsonValue; diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/DiskUsage.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/DiskUsage.java similarity index 57% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/DiskUsage.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/DiskUsage.java index 3b061ba5f0..cbfdbd92f7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/DiskUsage.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/DiskUsage.java @@ -30,10 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.allocation_explain; 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; @@ -41,75 +49,115 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.allocation_explain.DiskUsage @JsonpDeserializable -public class DiskUsage implements PlainJsonSerializable { - private final String path; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DiskUsage implements PlainJsonSerializable, ToCopyableBuilder { - private final long totalBytes; - - private final long usedBytes; + @Nullable + private final String free; private final long freeBytes; private final double freeDiskPercent; + @Nonnull + private final String path; + + @Nullable + private final String total; + + private final long totalBytes; + + @Nullable + private final String used; + + private final long usedBytes; + private final double usedDiskPercent; // --------------------------------------------------------------------------------------------- private DiskUsage(Builder builder) { - + this.free = builder.free; + this.freeBytes = ApiTypeHelper.requireNonNull(builder.freeBytes, this, "freeBytes"); + this.freeDiskPercent = ApiTypeHelper.requireNonNull(builder.freeDiskPercent, this, "freeDiskPercent"); this.path = ApiTypeHelper.requireNonNull(builder.path, this, "path"); + this.total = builder.total; this.totalBytes = ApiTypeHelper.requireNonNull(builder.totalBytes, this, "totalBytes"); + this.used = builder.used; this.usedBytes = ApiTypeHelper.requireNonNull(builder.usedBytes, this, "usedBytes"); - this.freeBytes = ApiTypeHelper.requireNonNull(builder.freeBytes, this, "freeBytes"); - this.freeDiskPercent = ApiTypeHelper.requireNonNull(builder.freeDiskPercent, this, "freeDiskPercent"); this.usedDiskPercent = ApiTypeHelper.requireNonNull(builder.usedDiskPercent, this, "usedDiskPercent"); - } - public static DiskUsage of(Function> fn) { + public static DiskUsage of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * API name: {@code free} + */ + @Nullable + public final String free() { + return this.free; + } + + /** + * Required - API name: {@code free_bytes} + */ + public final long freeBytes() { + return this.freeBytes; + } + + /** + * Required - API name: {@code free_disk_percent} + */ + public final double freeDiskPercent() { + return this.freeDiskPercent; + } + /** * Required - API name: {@code path} */ + @Nonnull public final String path() { return this.path; } /** - * Required - API name: {@code total_bytes} + * API name: {@code total} */ - public final long totalBytes() { - return this.totalBytes; + @Nullable + public final String total() { + return this.total; } /** - * Required - API name: {@code used_bytes} + * Required - API name: {@code total_bytes} */ - public final long usedBytes() { - return this.usedBytes; + public final long totalBytes() { + return this.totalBytes; } /** - * Required - API name: {@code free_bytes} + * API name: {@code used} */ - public final long freeBytes() { - return this.freeBytes; + @Nullable + public final String used() { + return this.used; } /** - * Required - API name: {@code free_disk_percent} + * Required - API name: {@code used_bytes} */ - public final double freeDiskPercent() { - return this.freeDiskPercent; + public final long usedBytes() { + return this.usedBytes; } /** @@ -122,6 +170,7 @@ public final double usedDiskPercent() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -129,89 +178,178 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.free != null) { + generator.writeKey("free"); + generator.write(this.free); + } + + generator.writeKey("free_bytes"); + generator.write(this.freeBytes); + + generator.writeKey("free_disk_percent"); + generator.write(this.freeDiskPercent); generator.writeKey("path"); generator.write(this.path); + if (this.total != null) { + generator.writeKey("total"); + generator.write(this.total); + } + generator.writeKey("total_bytes"); generator.write(this.totalBytes); + if (this.used != null) { + generator.writeKey("used"); + generator.write(this.used); + } + generator.writeKey("used_bytes"); generator.write(this.usedBytes); - generator.writeKey("free_bytes"); - generator.write(this.freeBytes); - - generator.writeKey("free_disk_percent"); - generator.write(this.freeDiskPercent); - generator.writeKey("used_disk_percent"); generator.write(this.usedDiskPercent); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link DiskUsage}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String free; + private Long freeBytes; + private Double freeDiskPercent; private String path; - + @Nullable + private String total; private Long totalBytes; - + @Nullable + private String used; private Long usedBytes; + private Double usedDiskPercent; - private Long freeBytes; + public Builder() {} + + private Builder(DiskUsage o) { + this.free = o.free; + this.freeBytes = o.freeBytes; + this.freeDiskPercent = o.freeDiskPercent; + this.path = o.path; + this.total = o.total; + this.totalBytes = o.totalBytes; + this.used = o.used; + this.usedBytes = o.usedBytes; + this.usedDiskPercent = o.usedDiskPercent; + } - private Double freeDiskPercent; + private Builder(Builder o) { + this.free = o.free; + this.freeBytes = o.freeBytes; + this.freeDiskPercent = o.freeDiskPercent; + this.path = o.path; + this.total = o.total; + this.totalBytes = o.totalBytes; + this.used = o.used; + this.usedBytes = o.usedBytes; + this.usedDiskPercent = o.usedDiskPercent; + } - private Double usedDiskPercent; + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code free} + */ + @Nonnull + public final Builder free(@Nullable String value) { + this.free = value; + return this; + } + + /** + * Required - API name: {@code free_bytes} + */ + @Nonnull + public final Builder freeBytes(long value) { + this.freeBytes = value; + return this; + } + + /** + * Required - API name: {@code free_disk_percent} + */ + @Nonnull + public final Builder freeDiskPercent(double value) { + this.freeDiskPercent = value; + return this; + } /** * Required - API name: {@code path} */ + @Nonnull public final Builder path(String value) { this.path = value; return this; } /** - * Required - API name: {@code total_bytes} + * API name: {@code total} */ - public final Builder totalBytes(long value) { - this.totalBytes = value; + @Nonnull + public final Builder total(@Nullable String value) { + this.total = value; return this; } /** - * Required - API name: {@code used_bytes} + * Required - API name: {@code total_bytes} */ - public final Builder usedBytes(long value) { - this.usedBytes = value; + @Nonnull + public final Builder totalBytes(long value) { + this.totalBytes = value; return this; } /** - * Required - API name: {@code free_bytes} + * API name: {@code used} */ - public final Builder freeBytes(long value) { - this.freeBytes = value; + @Nonnull + public final Builder used(@Nullable String value) { + this.used = value; return this; } /** - * Required - API name: {@code free_disk_percent} + * Required - API name: {@code used_bytes} */ - public final Builder freeDiskPercent(double value) { - this.freeDiskPercent = value; + @Nonnull + public final Builder usedBytes(long value) { + this.usedBytes = value; return this; } /** * Required - API name: {@code used_disk_percent} */ + @Nonnull public final Builder usedDiskPercent(double value) { this.usedDiskPercent = value; return this; @@ -220,9 +358,10 @@ public final Builder usedDiskPercent(double value) { /** * Builds a {@link DiskUsage}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DiskUsage build() { _checkSingleUse(); @@ -241,14 +380,45 @@ public DiskUsage build() { ); protected static void setupDiskUsageDeserializer(ObjectDeserializer op) { - + op.add(Builder::free, JsonpDeserializer.stringDeserializer(), "free"); + op.add(Builder::freeBytes, JsonpDeserializer.longDeserializer(), "free_bytes"); + op.add(Builder::freeDiskPercent, JsonpDeserializer.doubleDeserializer(), "free_disk_percent"); op.add(Builder::path, JsonpDeserializer.stringDeserializer(), "path"); + op.add(Builder::total, JsonpDeserializer.stringDeserializer(), "total"); op.add(Builder::totalBytes, JsonpDeserializer.longDeserializer(), "total_bytes"); + op.add(Builder::used, JsonpDeserializer.stringDeserializer(), "used"); op.add(Builder::usedBytes, JsonpDeserializer.longDeserializer(), "used_bytes"); - op.add(Builder::freeBytes, JsonpDeserializer.longDeserializer(), "free_bytes"); - op.add(Builder::freeDiskPercent, JsonpDeserializer.doubleDeserializer(), "free_disk_percent"); op.add(Builder::usedDiskPercent, JsonpDeserializer.doubleDeserializer(), "used_disk_percent"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.free); + result = 31 * result + Long.hashCode(this.freeBytes); + result = 31 * result + Double.hashCode(this.freeDiskPercent); + result = 31 * result + this.path.hashCode(); + result = 31 * result + Objects.hashCode(this.total); + result = 31 * result + Long.hashCode(this.totalBytes); + result = 31 * result + Objects.hashCode(this.used); + result = 31 * result + Long.hashCode(this.usedBytes); + result = 31 * result + Double.hashCode(this.usedDiskPercent); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DiskUsage other = (DiskUsage) o; + return Objects.equals(this.free, other.free) + && this.freeBytes == other.freeBytes + && this.freeDiskPercent == other.freeDiskPercent + && this.path.equals(other.path) + && Objects.equals(this.total, other.total) + && this.totalBytes == other.totalBytes + && Objects.equals(this.used, other.used) + && this.usedBytes == other.usedBytes + && this.usedDiskPercent == other.usedDiskPercent; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/NodeAllocationExplanation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/NodeAllocationExplanation.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/NodeAllocationExplanation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/NodeAllocationExplanation.java index 79c7783b31..97f031b238 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/NodeAllocationExplanation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/NodeAllocationExplanation.java @@ -30,12 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.allocation_explain; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.Map; +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; @@ -44,34 +51,47 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.allocation_explain.NodeAllocationExplanation @JsonpDeserializable -public class NodeAllocationExplanation implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class NodeAllocationExplanation + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull private final List deciders; + @Nonnull private final Map nodeAttributes; + @Nonnull private final Decision nodeDecision; + @Nonnull private final String nodeId; + @Nonnull private final String nodeName; @Nullable private final AllocationStore store; + @Nonnull private final String transportAddress; - private final int weightRanking; + @Nullable + private final Integer weightRanking; // --------------------------------------------------------------------------------------------- private NodeAllocationExplanation(Builder builder) { - this.deciders = ApiTypeHelper.unmodifiableRequired(builder.deciders, this, "deciders"); this.nodeAttributes = ApiTypeHelper.unmodifiableRequired(builder.nodeAttributes, this, "nodeAttributes"); this.nodeDecision = ApiTypeHelper.requireNonNull(builder.nodeDecision, this, "nodeDecision"); @@ -79,17 +99,17 @@ private NodeAllocationExplanation(Builder builder) { this.nodeName = ApiTypeHelper.requireNonNull(builder.nodeName, this, "nodeName"); this.store = builder.store; this.transportAddress = ApiTypeHelper.requireNonNull(builder.transportAddress, this, "transportAddress"); - this.weightRanking = ApiTypeHelper.requireNonNull(builder.weightRanking, this, "weightRanking"); - + this.weightRanking = builder.weightRanking; } - public static NodeAllocationExplanation of(Function> fn) { + public static NodeAllocationExplanation of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code deciders} */ + @Nonnull public final List deciders() { return this.deciders; } @@ -97,6 +117,7 @@ public final List deciders() { /** * Required - API name: {@code node_attributes} */ + @Nonnull public final Map nodeAttributes() { return this.nodeAttributes; } @@ -104,6 +125,7 @@ public final Map nodeAttributes() { /** * Required - API name: {@code node_decision} */ + @Nonnull public final Decision nodeDecision() { return this.nodeDecision; } @@ -111,6 +133,7 @@ public final Decision nodeDecision() { /** * Required - API name: {@code node_id} */ + @Nonnull public final String nodeId() { return this.nodeId; } @@ -118,6 +141,7 @@ public final String nodeId() { /** * Required - API name: {@code node_name} */ + @Nonnull public final String nodeName() { return this.nodeName; } @@ -133,20 +157,23 @@ public final AllocationStore store() { /** * Required - API name: {@code transport_address} */ + @Nonnull public final String transportAddress() { return this.transportAddress; } /** - * Required - API name: {@code weight_ranking} + * API name: {@code weight_ranking} */ - public final int weightRanking() { + @Nullable + public final Integer weightRanking() { return this.weightRanking; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -154,30 +181,24 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.deciders)) { - generator.writeKey("deciders"); - generator.writeStartArray(); - for (AllocationDecision item0 : this.deciders) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("deciders"); + generator.writeStartArray(); + for (AllocationDecision item0 : this.deciders) { + item0.serialize(generator, mapper); } - if (ApiTypeHelper.isDefined(this.nodeAttributes)) { - generator.writeKey("node_attributes"); - generator.writeStartObject(); - for (Map.Entry item0 : this.nodeAttributes.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); + generator.writeEnd(); + generator.writeKey("node_attributes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.nodeAttributes.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); } + generator.writeEnd(); + generator.writeKey("node_decision"); this.nodeDecision.serialize(generator, mapper); + generator.writeKey("node_id"); generator.write(this.nodeId); @@ -187,45 +208,83 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { if (this.store != null) { generator.writeKey("store"); this.store.serialize(generator, mapper); - } + generator.writeKey("transport_address"); generator.write(this.transportAddress); - generator.writeKey("weight_ranking"); - generator.write(this.weightRanking); - + if (this.weightRanking != null) { + generator.writeKey("weight_ranking"); + generator.write(this.weightRanking); + } } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link NodeAllocationExplanation}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private List deciders; - private Map nodeAttributes; - private Decision nodeDecision; - private String nodeId; - private String nodeName; - @Nullable private AllocationStore store; - private String transportAddress; - + @Nullable private Integer weightRanking; + public Builder() {} + + private Builder(NodeAllocationExplanation o) { + this.deciders = _listCopy(o.deciders); + this.nodeAttributes = _mapCopy(o.nodeAttributes); + this.nodeDecision = o.nodeDecision; + this.nodeId = o.nodeId; + this.nodeName = o.nodeName; + this.store = o.store; + this.transportAddress = o.transportAddress; + this.weightRanking = o.weightRanking; + } + + private Builder(Builder o) { + this.deciders = _listCopy(o.deciders); + this.nodeAttributes = _mapCopy(o.nodeAttributes); + this.nodeDecision = o.nodeDecision; + this.nodeId = o.nodeId; + this.nodeName = o.nodeName; + this.store = o.store; + this.transportAddress = o.transportAddress; + this.weightRanking = o.weightRanking; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code deciders} + * *

* Adds all elements of list to deciders. + *

*/ + @Nonnull public final Builder deciders(List list) { this.deciders = _listAddAll(this.deciders, list); return this; @@ -233,9 +292,12 @@ public final Builder deciders(List list) { /** * Required - API name: {@code deciders} + * *

* Adds one or more values to deciders. + *

*/ + @Nonnull public final Builder deciders(AllocationDecision value, AllocationDecision... values) { this.deciders = _listAdd(this.deciders, value, values); return this; @@ -243,18 +305,24 @@ public final Builder deciders(AllocationDecision value, AllocationDecision... va /** * Required - API name: {@code deciders} + * *

* Adds a value to deciders using a builder lambda. + *

*/ + @Nonnull public final Builder deciders(Function> fn) { return deciders(fn.apply(new AllocationDecision.Builder()).build()); } /** * Required - API name: {@code node_attributes} + * *

- * Adds all entries of map to nodeAttributes. + * Adds all elements of map to nodeAttributes. + *

*/ + @Nonnull public final Builder nodeAttributes(Map map) { this.nodeAttributes = _mapPutAll(this.nodeAttributes, map); return this; @@ -262,9 +330,12 @@ public final Builder nodeAttributes(Map map) { /** * Required - API name: {@code node_attributes} + * *

* Adds an entry to nodeAttributes. + *

*/ + @Nonnull public final Builder nodeAttributes(String key, String value) { this.nodeAttributes = _mapPut(this.nodeAttributes, key, value); return this; @@ -273,6 +344,7 @@ public final Builder nodeAttributes(String key, String value) { /** * Required - API name: {@code node_decision} */ + @Nonnull public final Builder nodeDecision(Decision value) { this.nodeDecision = value; return this; @@ -281,6 +353,7 @@ public final Builder nodeDecision(Decision value) { /** * Required - API name: {@code node_id} */ + @Nonnull public final Builder nodeId(String value) { this.nodeId = value; return this; @@ -289,6 +362,7 @@ public final Builder nodeId(String value) { /** * Required - API name: {@code node_name} */ + @Nonnull public final Builder nodeName(String value) { this.nodeName = value; return this; @@ -297,6 +371,7 @@ public final Builder nodeName(String value) { /** * API name: {@code store} */ + @Nonnull public final Builder store(@Nullable AllocationStore value) { this.store = value; return this; @@ -305,22 +380,25 @@ public final Builder store(@Nullable AllocationStore value) { /** * API name: {@code store} */ + @Nonnull public final Builder store(Function> fn) { - return this.store(fn.apply(new AllocationStore.Builder()).build()); + return store(fn.apply(new AllocationStore.Builder()).build()); } /** * Required - API name: {@code transport_address} */ + @Nonnull public final Builder transportAddress(String value) { this.transportAddress = value; return this; } /** - * Required - API name: {@code weight_ranking} + * API name: {@code weight_ranking} */ - public final Builder weightRanking(int value) { + @Nonnull + public final Builder weightRanking(@Nullable Integer value) { this.weightRanking = value; return this; } @@ -328,9 +406,10 @@ public final Builder weightRanking(int value) { /** * Builds a {@link NodeAllocationExplanation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public NodeAllocationExplanation build() { _checkSingleUse(); @@ -349,7 +428,6 @@ public NodeAllocationExplanation build() { ); protected static void setupNodeAllocationExplanationDeserializer(ObjectDeserializer op) { - op.add(Builder::deciders, JsonpDeserializer.arrayDeserializer(AllocationDecision._DESERIALIZER), "deciders"); op.add(Builder::nodeAttributes, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "node_attributes"); op.add(Builder::nodeDecision, Decision._DESERIALIZER, "node_decision"); @@ -358,7 +436,34 @@ protected static void setupNodeAllocationExplanationDeserializer(ObjectDeseriali op.add(Builder::store, AllocationStore._DESERIALIZER, "store"); op.add(Builder::transportAddress, JsonpDeserializer.stringDeserializer(), "transport_address"); op.add(Builder::weightRanking, JsonpDeserializer.integerDeserializer(), "weight_ranking"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.deciders.hashCode(); + result = 31 * result + this.nodeAttributes.hashCode(); + result = 31 * result + this.nodeDecision.hashCode(); + result = 31 * result + this.nodeId.hashCode(); + result = 31 * result + this.nodeName.hashCode(); + result = 31 * result + Objects.hashCode(this.store); + result = 31 * result + this.transportAddress.hashCode(); + result = 31 * result + Objects.hashCode(this.weightRanking); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + NodeAllocationExplanation other = (NodeAllocationExplanation) o; + return this.deciders.equals(other.deciders) + && this.nodeAttributes.equals(other.nodeAttributes) + && this.nodeDecision.equals(other.nodeDecision) + && this.nodeId.equals(other.nodeId) + && this.nodeName.equals(other.nodeName) + && Objects.equals(this.store, other.store) + && this.transportAddress.equals(other.transportAddress) + && Objects.equals(this.weightRanking, other.weightRanking); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/NodeDiskUsage.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/NodeDiskUsage.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/NodeDiskUsage.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/NodeDiskUsage.java index 7baacdeb83..a4f5ae523d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/NodeDiskUsage.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/NodeDiskUsage.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.allocation_explain; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,43 +47,42 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.allocation_explain.NodeDiskUsage @JsonpDeserializable -public class NodeDiskUsage implements PlainJsonSerializable { - private final String nodeName; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class NodeDiskUsage implements PlainJsonSerializable, ToCopyableBuilder { + @Nonnull private final DiskUsage leastAvailable; + @Nonnull private final DiskUsage mostAvailable; + @Nonnull + private final String nodeName; + // --------------------------------------------------------------------------------------------- private NodeDiskUsage(Builder builder) { - - this.nodeName = ApiTypeHelper.requireNonNull(builder.nodeName, this, "nodeName"); this.leastAvailable = ApiTypeHelper.requireNonNull(builder.leastAvailable, this, "leastAvailable"); this.mostAvailable = ApiTypeHelper.requireNonNull(builder.mostAvailable, this, "mostAvailable"); - + this.nodeName = ApiTypeHelper.requireNonNull(builder.nodeName, this, "nodeName"); } - public static NodeDiskUsage of(Function> fn) { + public static NodeDiskUsage of(Function> fn) { return fn.apply(new Builder()).build(); } - /** - * Required - API name: {@code node_name} - */ - public final String nodeName() { - return this.nodeName; - } - /** * Required - API name: {@code least_available} */ + @Nonnull public final DiskUsage leastAvailable() { return this.leastAvailable; } @@ -85,13 +90,23 @@ public final DiskUsage leastAvailable() { /** * Required - API name: {@code most_available} */ + @Nonnull public final DiskUsage mostAvailable() { return this.mostAvailable; } + /** + * Required - API name: {@code node_name} + */ + @Nonnull + public final String nodeName() { + return this.nodeName; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -99,42 +114,61 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("node_name"); - generator.write(this.nodeName); - generator.writeKey("least_available"); this.leastAvailable.serialize(generator, mapper); generator.writeKey("most_available"); this.mostAvailable.serialize(generator, mapper); + generator.writeKey("node_name"); + generator.write(this.nodeName); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link NodeDiskUsage}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private DiskUsage leastAvailable; + private DiskUsage mostAvailable; private String nodeName; - private DiskUsage leastAvailable; + public Builder() {} - private DiskUsage mostAvailable; + private Builder(NodeDiskUsage o) { + this.leastAvailable = o.leastAvailable; + this.mostAvailable = o.mostAvailable; + this.nodeName = o.nodeName; + } - /** - * Required - API name: {@code node_name} - */ - public final Builder nodeName(String value) { - this.nodeName = value; - return this; + private Builder(Builder o) { + this.leastAvailable = o.leastAvailable; + this.mostAvailable = o.mostAvailable; + this.nodeName = o.nodeName; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** * Required - API name: {@code least_available} */ + @Nonnull public final Builder leastAvailable(DiskUsage value) { this.leastAvailable = value; return this; @@ -143,13 +177,15 @@ public final Builder leastAvailable(DiskUsage value) { /** * Required - API name: {@code least_available} */ + @Nonnull public final Builder leastAvailable(Function> fn) { - return this.leastAvailable(fn.apply(new DiskUsage.Builder()).build()); + return leastAvailable(fn.apply(new DiskUsage.Builder()).build()); } /** * Required - API name: {@code most_available} */ + @Nonnull public final Builder mostAvailable(DiskUsage value) { this.mostAvailable = value; return this; @@ -158,16 +194,27 @@ public final Builder mostAvailable(DiskUsage value) { /** * Required - API name: {@code most_available} */ + @Nonnull public final Builder mostAvailable(Function> fn) { - return this.mostAvailable(fn.apply(new DiskUsage.Builder()).build()); + return mostAvailable(fn.apply(new DiskUsage.Builder()).build()); + } + + /** + * Required - API name: {@code node_name} + */ + @Nonnull + public final Builder nodeName(String value) { + this.nodeName = value; + return this; } /** * Builds a {@link NodeDiskUsage}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public NodeDiskUsage build() { _checkSingleUse(); @@ -186,11 +233,27 @@ public NodeDiskUsage build() { ); protected static void setupNodeDiskUsageDeserializer(ObjectDeserializer op) { - - op.add(Builder::nodeName, JsonpDeserializer.stringDeserializer(), "node_name"); op.add(Builder::leastAvailable, DiskUsage._DESERIALIZER, "least_available"); op.add(Builder::mostAvailable, DiskUsage._DESERIALIZER, "most_available"); + op.add(Builder::nodeName, JsonpDeserializer.stringDeserializer(), "node_name"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.leastAvailable.hashCode(); + result = 31 * result + this.mostAvailable.hashCode(); + result = 31 * result + this.nodeName.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + NodeDiskUsage other = (NodeDiskUsage) o; + return this.leastAvailable.equals(other.leastAvailable) + && this.mostAvailable.equals(other.mostAvailable) + && this.nodeName.equals(other.nodeName); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/ReservedSize.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/ReservedSize.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/ReservedSize.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/ReservedSize.java index 45fee7fb15..ead5bacf16 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/ReservedSize.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/ReservedSize.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.allocation_explain; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,39 +48,45 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.allocation_explain.ReservedSize @JsonpDeserializable -public class ReservedSize implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ReservedSize implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final String nodeId; + @Nonnull private final String path; - private final long total; - + @Nonnull private final List shards; + private final long total; + // --------------------------------------------------------------------------------------------- private ReservedSize(Builder builder) { - this.nodeId = ApiTypeHelper.requireNonNull(builder.nodeId, this, "nodeId"); this.path = ApiTypeHelper.requireNonNull(builder.path, this, "path"); - this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); this.shards = ApiTypeHelper.unmodifiableRequired(builder.shards, this, "shards"); - + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); } - public static ReservedSize of(Function> fn) { + public static ReservedSize of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code node_id} */ + @Nonnull public final String nodeId() { return this.nodeId; } @@ -82,27 +94,30 @@ public final String nodeId() { /** * Required - API name: {@code path} */ + @Nonnull public final String path() { return this.path; } /** - * Required - API name: {@code total} + * Required - API name: {@code shards} */ - public final long total() { - return this.total; + @Nonnull + public final List shards() { + return this.shards; } /** - * Required - API name: {@code shards} + * Required - API name: {@code total} */ - public final List shards() { - return this.shards; + public final long total() { + return this.total; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -110,47 +125,71 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("node_id"); generator.write(this.nodeId); generator.writeKey("path"); generator.write(this.path); + generator.writeKey("shards"); + generator.writeStartArray(); + for (String item0 : this.shards) { + generator.write(item0); + } + generator.writeEnd(); + generator.writeKey("total"); generator.write(this.total); + } - if (ApiTypeHelper.isDefined(this.shards)) { - generator.writeKey("shards"); - generator.writeStartArray(); - for (String item0 : this.shards) { - generator.write(item0); - - } - generator.writeEnd(); - - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link ReservedSize}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private String nodeId; - private String path; - + private List shards; private Long total; - private List shards; + public Builder() {} + + private Builder(ReservedSize o) { + this.nodeId = o.nodeId; + this.path = o.path; + this.shards = _listCopy(o.shards); + this.total = o.total; + } + + private Builder(Builder o) { + this.nodeId = o.nodeId; + this.path = o.path; + this.shards = _listCopy(o.shards); + this.total = o.total; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * Required - API name: {@code node_id} */ + @Nonnull public final Builder nodeId(String value) { this.nodeId = value; return this; @@ -159,24 +198,20 @@ public final Builder nodeId(String value) { /** * Required - API name: {@code path} */ + @Nonnull public final Builder path(String value) { this.path = value; return this; } - /** - * Required - API name: {@code total} - */ - public final Builder total(long value) { - this.total = value; - return this; - } - /** * Required - API name: {@code shards} + * *

* Adds all elements of list to shards. + *

*/ + @Nonnull public final Builder shards(List list) { this.shards = _listAddAll(this.shards, list); return this; @@ -184,20 +219,33 @@ public final Builder shards(List list) { /** * Required - API name: {@code shards} + * *

* Adds one or more values to shards. + *

*/ + @Nonnull public final Builder shards(String value, String... values) { this.shards = _listAdd(this.shards, value, values); return this; } + /** + * Required - API name: {@code total} + */ + @Nonnull + public final Builder total(long value) { + this.total = value; + return this; + } + /** * Builds a {@link ReservedSize}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ReservedSize build() { _checkSingleUse(); @@ -216,12 +264,30 @@ public ReservedSize build() { ); protected static void setupReservedSizeDeserializer(ObjectDeserializer op) { - op.add(Builder::nodeId, JsonpDeserializer.stringDeserializer(), "node_id"); op.add(Builder::path, JsonpDeserializer.stringDeserializer(), "path"); - op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); op.add(Builder::shards, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "shards"); + op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.nodeId.hashCode(); + result = 31 * result + this.path.hashCode(); + result = 31 * result + this.shards.hashCode(); + result = 31 * result + Long.hashCode(this.total); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ReservedSize other = (ReservedSize) o; + return this.nodeId.equals(other.nodeId) + && this.path.equals(other.path) + && this.shards.equals(other.shards) + && this.total == other.total; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/UnassignedInformation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/UnassignedInformation.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/UnassignedInformation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/UnassignedInformation.java index 918f22ce28..a7b751ca0c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/UnassignedInformation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/UnassignedInformation.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.allocation_explain; 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; @@ -42,19 +49,28 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.allocation_explain.UnassignedInformation @JsonpDeserializable -public class UnassignedInformation implements PlainJsonSerializable { - private final String at; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class UnassignedInformation + implements + PlainJsonSerializable, + ToCopyableBuilder { @Nullable - private final String lastAllocationStatus; + private final String allocationStatus; - private final UnassignedInformationReason reason; + @Nonnull + private final String at; + + @Nullable + private final Boolean delayed; @Nullable private final String details; @@ -63,49 +79,49 @@ public class UnassignedInformation implements PlainJsonSerializable { private final Integer failedAllocationAttempts; @Nullable - private final Boolean delayed; + private final String lastAllocationStatus; - @Nullable - private final String allocationStatus; + @Nonnull + private final UnassignedInformationReason reason; // --------------------------------------------------------------------------------------------- private UnassignedInformation(Builder builder) { - + this.allocationStatus = builder.allocationStatus; this.at = ApiTypeHelper.requireNonNull(builder.at, this, "at"); - this.lastAllocationStatus = builder.lastAllocationStatus; - this.reason = ApiTypeHelper.requireNonNull(builder.reason, this, "reason"); + this.delayed = builder.delayed; this.details = builder.details; this.failedAllocationAttempts = builder.failedAllocationAttempts; - this.delayed = builder.delayed; - this.allocationStatus = builder.allocationStatus; - + this.lastAllocationStatus = builder.lastAllocationStatus; + this.reason = ApiTypeHelper.requireNonNull(builder.reason, this, "reason"); } - public static UnassignedInformation of(Function> fn) { + public static UnassignedInformation of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code at} + * API name: {@code allocation_status} */ - public final String at() { - return this.at; + @Nullable + public final String allocationStatus() { + return this.allocationStatus; } /** - * API name: {@code last_allocation_status} + * Required - API name: {@code at} */ - @Nullable - public final String lastAllocationStatus() { - return this.lastAllocationStatus; + @Nonnull + public final String at() { + return this.at; } /** - * Required - API name: {@code reason} + * API name: {@code delayed} */ - public final UnassignedInformationReason reason() { - return this.reason; + @Nullable + public final Boolean delayed() { + return this.delayed; } /** @@ -125,24 +141,25 @@ public final Integer failedAllocationAttempts() { } /** - * API name: {@code delayed} + * API name: {@code last_allocation_status} */ @Nullable - public final Boolean delayed() { - return this.delayed; + public final String lastAllocationStatus() { + return this.lastAllocationStatus; } /** - * API name: {@code allocation_status} + * Required - API name: {@code reason} */ - @Nullable - public final String allocationStatus() { - return this.allocationStatus; + @Nonnull + public final UnassignedInformationReason reason() { + return this.reason; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -150,93 +167,127 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.allocationStatus != null) { + generator.writeKey("allocation_status"); + generator.write(this.allocationStatus); + } generator.writeKey("at"); generator.write(this.at); - if (this.lastAllocationStatus != null) { - generator.writeKey("last_allocation_status"); - generator.write(this.lastAllocationStatus); - + if (this.delayed != null) { + generator.writeKey("delayed"); + generator.write(this.delayed); } - generator.writeKey("reason"); - this.reason.serialize(generator, mapper); + if (this.details != null) { generator.writeKey("details"); generator.write(this.details); - } + if (this.failedAllocationAttempts != null) { generator.writeKey("failed_allocation_attempts"); generator.write(this.failedAllocationAttempts); - } - if (this.delayed != null) { - generator.writeKey("delayed"); - generator.write(this.delayed); - - } - if (this.allocationStatus != null) { - generator.writeKey("allocation_status"); - generator.write(this.allocationStatus); + if (this.lastAllocationStatus != null) { + generator.writeKey("last_allocation_status"); + generator.write(this.lastAllocationStatus); } + generator.writeKey("reason"); + this.reason.serialize(generator, mapper); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link UnassignedInformation}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String allocationStatus; private String at; - @Nullable - private String lastAllocationStatus; - - private UnassignedInformationReason reason; - + private Boolean delayed; @Nullable private String details; - @Nullable private Integer failedAllocationAttempts; - @Nullable - private Boolean delayed; + private String lastAllocationStatus; + private UnassignedInformationReason reason; - @Nullable - private String allocationStatus; + public Builder() {} + + private Builder(UnassignedInformation o) { + this.allocationStatus = o.allocationStatus; + this.at = o.at; + this.delayed = o.delayed; + this.details = o.details; + this.failedAllocationAttempts = o.failedAllocationAttempts; + this.lastAllocationStatus = o.lastAllocationStatus; + this.reason = o.reason; + } + + private Builder(Builder o) { + this.allocationStatus = o.allocationStatus; + this.at = o.at; + this.delayed = o.delayed; + this.details = o.details; + this.failedAllocationAttempts = o.failedAllocationAttempts; + this.lastAllocationStatus = o.lastAllocationStatus; + this.reason = o.reason; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * Required - API name: {@code at} + * API name: {@code allocation_status} */ - public final Builder at(String value) { - this.at = value; + @Nonnull + public final Builder allocationStatus(@Nullable String value) { + this.allocationStatus = value; return this; } /** - * API name: {@code last_allocation_status} + * Required - API name: {@code at} */ - public final Builder lastAllocationStatus(@Nullable String value) { - this.lastAllocationStatus = value; + @Nonnull + public final Builder at(String value) { + this.at = value; return this; } /** - * Required - API name: {@code reason} + * API name: {@code delayed} */ - public final Builder reason(UnassignedInformationReason value) { - this.reason = value; + @Nonnull + public final Builder delayed(@Nullable Boolean value) { + this.delayed = value; return this; } /** * API name: {@code details} */ + @Nonnull public final Builder details(@Nullable String value) { this.details = value; return this; @@ -245,33 +296,37 @@ public final Builder details(@Nullable String value) { /** * API name: {@code failed_allocation_attempts} */ + @Nonnull public final Builder failedAllocationAttempts(@Nullable Integer value) { this.failedAllocationAttempts = value; return this; } /** - * API name: {@code delayed} + * API name: {@code last_allocation_status} */ - public final Builder delayed(@Nullable Boolean value) { - this.delayed = value; + @Nonnull + public final Builder lastAllocationStatus(@Nullable String value) { + this.lastAllocationStatus = value; return this; } /** - * API name: {@code allocation_status} + * Required - API name: {@code reason} */ - public final Builder allocationStatus(@Nullable String value) { - this.allocationStatus = value; + @Nonnull + public final Builder reason(UnassignedInformationReason value) { + this.reason = value; return this; } /** * Builds a {@link UnassignedInformation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public UnassignedInformation build() { _checkSingleUse(); @@ -290,15 +345,39 @@ public UnassignedInformation build() { ); protected static void setupUnassignedInformationDeserializer(ObjectDeserializer op) { - + op.add(Builder::allocationStatus, JsonpDeserializer.stringDeserializer(), "allocation_status"); op.add(Builder::at, JsonpDeserializer.stringDeserializer(), "at"); - op.add(Builder::lastAllocationStatus, JsonpDeserializer.stringDeserializer(), "last_allocation_status"); - op.add(Builder::reason, UnassignedInformationReason._DESERIALIZER, "reason"); + op.add(Builder::delayed, JsonpDeserializer.booleanDeserializer(), "delayed"); op.add(Builder::details, JsonpDeserializer.stringDeserializer(), "details"); op.add(Builder::failedAllocationAttempts, JsonpDeserializer.integerDeserializer(), "failed_allocation_attempts"); - op.add(Builder::delayed, JsonpDeserializer.booleanDeserializer(), "delayed"); - op.add(Builder::allocationStatus, JsonpDeserializer.stringDeserializer(), "allocation_status"); + op.add(Builder::lastAllocationStatus, JsonpDeserializer.stringDeserializer(), "last_allocation_status"); + op.add(Builder::reason, UnassignedInformationReason._DESERIALIZER, "reason"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allocationStatus); + result = 31 * result + this.at.hashCode(); + result = 31 * result + Objects.hashCode(this.delayed); + result = 31 * result + Objects.hashCode(this.details); + result = 31 * result + Objects.hashCode(this.failedAllocationAttempts); + result = 31 * result + Objects.hashCode(this.lastAllocationStatus); + result = 31 * result + this.reason.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + UnassignedInformation other = (UnassignedInformation) o; + return Objects.equals(this.allocationStatus, other.allocationStatus) + && this.at.equals(other.at) + && Objects.equals(this.delayed, other.delayed) + && Objects.equals(this.details, other.details) + && Objects.equals(this.failedAllocationAttempts, other.failedAllocationAttempts) + && Objects.equals(this.lastAllocationStatus, other.lastAllocationStatus) + && this.reason.equals(other.reason); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/UnassignedInformationReason.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/UnassignedInformationReason.java similarity index 86% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/UnassignedInformationReason.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/UnassignedInformationReason.java index 4c8ba850ed..21aae7d629 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/allocation_explain/UnassignedInformationReason.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/allocation_explain/UnassignedInformationReason.java @@ -30,44 +30,50 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.allocation_explain; +import javax.annotation.Generated; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; +// typedef: cluster.allocation_explain.UnassignedInformationReason + @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public enum UnassignedInformationReason implements JsonEnum { - IndexCreated("INDEX_CREATED"), + AllocationFailed("ALLOCATION_FAILED"), ClusterRecovered("CLUSTER_RECOVERED"), - IndexReopened("INDEX_REOPENED"), - DanglingIndexImported("DANGLING_INDEX_IMPORTED"), - NewIndexRestored("NEW_INDEX_RESTORED"), - ExistingIndexRestored("EXISTING_INDEX_RESTORED"), - ReplicaAdded("REPLICA_ADDED"), + ForcedEmptyPrimary("FORCED_EMPTY_PRIMARY"), - AllocationFailed("ALLOCATION_FAILED"), + IndexCreated("INDEX_CREATED"), - NodeLeft("NODE_LEFT"), + IndexReopened("INDEX_REOPENED"), - RerouteCancelled("REROUTE_CANCELLED"), + ManualAllocation("MANUAL_ALLOCATION"), - Reinitialized("REINITIALIZED"), + NewIndexRestored("NEW_INDEX_RESTORED"), - ReallocatedReplica("REALLOCATED_REPLICA"), + NodeLeft("NODE_LEFT"), PrimaryFailed("PRIMARY_FAILED"), - ForcedEmptyPrimary("FORCED_EMPTY_PRIMARY"), + ReallocatedReplica("REALLOCATED_REPLICA"), - ManualAllocation("MANUAL_ALLOCATION"), + Reinitialized("REINITIALIZED"), + + ReplicaAdded("REPLICA_ADDED"), - ; + RerouteCancelled("REROUTE_CANCELLED"); private final String jsonValue; diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/health/AwarenessAttributeStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/health/AwarenessAttributeStats.java new file mode 100644 index 0000000000..3263b4466e --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/health/AwarenessAttributeStats.java @@ -0,0 +1,355 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.cluster.health; + +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.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: cluster.health.AwarenessAttributeStats + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class AwarenessAttributeStats + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final Integer activeShards; + + @Nullable + private final Integer dataNodes; + + @Nullable + private final Integer initializingShards; + + @Nullable + private final Integer relocatingShards; + + @Nullable + private final Integer unassignedShards; + + @Nullable + private final Integer weight; + + // --------------------------------------------------------------------------------------------- + + private AwarenessAttributeStats(Builder builder) { + this.activeShards = builder.activeShards; + this.dataNodes = builder.dataNodes; + this.initializingShards = builder.initializingShards; + this.relocatingShards = builder.relocatingShards; + this.unassignedShards = builder.unassignedShards; + this.weight = builder.weight; + } + + public static AwarenessAttributeStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code active_shards} + */ + @Nullable + public final Integer activeShards() { + return this.activeShards; + } + + /** + * API name: {@code data_nodes} + */ + @Nullable + public final Integer dataNodes() { + return this.dataNodes; + } + + /** + * API name: {@code initializing_shards} + */ + @Nullable + public final Integer initializingShards() { + return this.initializingShards; + } + + /** + * API name: {@code relocating_shards} + */ + @Nullable + public final Integer relocatingShards() { + return this.relocatingShards; + } + + /** + * API name: {@code unassigned_shards} + */ + @Nullable + public final Integer unassignedShards() { + return this.unassignedShards; + } + + /** + * API name: {@code weight} + */ + @Nullable + public final Integer weight() { + return this.weight; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.activeShards != null) { + generator.writeKey("active_shards"); + generator.write(this.activeShards); + } + + if (this.dataNodes != null) { + generator.writeKey("data_nodes"); + generator.write(this.dataNodes); + } + + if (this.initializingShards != null) { + generator.writeKey("initializing_shards"); + generator.write(this.initializingShards); + } + + if (this.relocatingShards != null) { + generator.writeKey("relocating_shards"); + generator.write(this.relocatingShards); + } + + if (this.unassignedShards != null) { + generator.writeKey("unassigned_shards"); + generator.write(this.unassignedShards); + } + + if (this.weight != null) { + generator.writeKey("weight"); + generator.write(this.weight); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link AwarenessAttributeStats}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Integer activeShards; + @Nullable + private Integer dataNodes; + @Nullable + private Integer initializingShards; + @Nullable + private Integer relocatingShards; + @Nullable + private Integer unassignedShards; + @Nullable + private Integer weight; + + public Builder() {} + + private Builder(AwarenessAttributeStats o) { + this.activeShards = o.activeShards; + this.dataNodes = o.dataNodes; + this.initializingShards = o.initializingShards; + this.relocatingShards = o.relocatingShards; + this.unassignedShards = o.unassignedShards; + this.weight = o.weight; + } + + private Builder(Builder o) { + this.activeShards = o.activeShards; + this.dataNodes = o.dataNodes; + this.initializingShards = o.initializingShards; + this.relocatingShards = o.relocatingShards; + this.unassignedShards = o.unassignedShards; + this.weight = o.weight; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code active_shards} + */ + @Nonnull + public final Builder activeShards(@Nullable Integer value) { + this.activeShards = value; + return this; + } + + /** + * API name: {@code data_nodes} + */ + @Nonnull + public final Builder dataNodes(@Nullable Integer value) { + this.dataNodes = value; + return this; + } + + /** + * API name: {@code initializing_shards} + */ + @Nonnull + public final Builder initializingShards(@Nullable Integer value) { + this.initializingShards = value; + return this; + } + + /** + * API name: {@code relocating_shards} + */ + @Nonnull + public final Builder relocatingShards(@Nullable Integer value) { + this.relocatingShards = value; + return this; + } + + /** + * API name: {@code unassigned_shards} + */ + @Nonnull + public final Builder unassignedShards(@Nullable Integer value) { + this.unassignedShards = value; + return this; + } + + /** + * API name: {@code weight} + */ + @Nonnull + public final Builder weight(@Nullable Integer value) { + this.weight = value; + return this; + } + + /** + * Builds a {@link AwarenessAttributeStats}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public AwarenessAttributeStats build() { + _checkSingleUse(); + + return new AwarenessAttributeStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link AwarenessAttributeStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + AwarenessAttributeStats::setupAwarenessAttributeStatsDeserializer + ); + + protected static void setupAwarenessAttributeStatsDeserializer(ObjectDeserializer op) { + op.add(Builder::activeShards, JsonpDeserializer.integerDeserializer(), "active_shards"); + op.add(Builder::dataNodes, JsonpDeserializer.integerDeserializer(), "data_nodes"); + op.add(Builder::initializingShards, JsonpDeserializer.integerDeserializer(), "initializing_shards"); + op.add(Builder::relocatingShards, JsonpDeserializer.integerDeserializer(), "relocating_shards"); + op.add(Builder::unassignedShards, JsonpDeserializer.integerDeserializer(), "unassigned_shards"); + op.add(Builder::weight, JsonpDeserializer.integerDeserializer(), "weight"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.activeShards); + result = 31 * result + Objects.hashCode(this.dataNodes); + result = 31 * result + Objects.hashCode(this.initializingShards); + result = 31 * result + Objects.hashCode(this.relocatingShards); + result = 31 * result + Objects.hashCode(this.unassignedShards); + result = 31 * result + Objects.hashCode(this.weight); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + AwarenessAttributeStats other = (AwarenessAttributeStats) o; + return Objects.equals(this.activeShards, other.activeShards) + && Objects.equals(this.dataNodes, other.dataNodes) + && Objects.equals(this.initializingShards, other.initializingShards) + && Objects.equals(this.relocatingShards, other.relocatingShards) + && Objects.equals(this.unassignedShards, other.unassignedShards) + && Objects.equals(this.weight, other.weight); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/DeleteVotingConfigExclusionsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/health/ClusterHealthLevel.java similarity index 53% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/DeleteVotingConfigExclusionsResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/health/ClusterHealthLevel.java index 92e0f78d12..d4259d26f5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/DeleteVotingConfigExclusionsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/health/ClusterHealthLevel.java @@ -30,22 +30,38 @@ * GitHub history for details. */ -package org.opensearch.client.opensearch.cluster; +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- -import org.opensearch.client.json.JsonpDeserializer; +package org.opensearch.client.opensearch.cluster.health; -// typedef: cluster.delete_voting_config_exclusions.Response +import javax.annotation.Generated; +import org.opensearch.client.json.JsonEnum; +import org.opensearch.client.json.JsonpDeserializable; -public class DeleteVotingConfigExclusionsResponse { - public DeleteVotingConfigExclusionsResponse() {} +// typedef: cluster.health.Level - /** - * Singleton instance for {@link DeleteVotingConfigExclusionsResponse}. - */ - public static final DeleteVotingConfigExclusionsResponse _INSTANCE = new DeleteVotingConfigExclusionsResponse(); +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public enum ClusterHealthLevel implements JsonEnum { + AwarenessAttributes("awareness_attributes"), - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.fixedValue( - DeleteVotingConfigExclusionsResponse._INSTANCE - ); + Cluster("cluster"), + Indices("indices"), + + Shards("shards"); + + private final String jsonValue; + + ClusterHealthLevel(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(ClusterHealthLevel.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/health/IndexHealthStats.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/health/IndexHealthStats.java similarity index 72% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/health/IndexHealthStats.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/health/IndexHealthStats.java index 84dc76af02..c4b36a3ec8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/health/IndexHealthStats.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/health/IndexHealthStats.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.health; import jakarta.json.stream.JsonGenerator; import java.util.Map; +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; @@ -44,13 +51,17 @@ import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.HealthStatus; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.health.IndexHealthStats @JsonpDeserializable -public class IndexHealthStats implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class IndexHealthStats implements PlainJsonSerializable, ToCopyableBuilder { + private final int activePrimaryShards; private final int activeShards; @@ -63,8 +74,10 @@ public class IndexHealthStats implements PlainJsonSerializable { private final int relocatingShards; + @Nonnull private final Map shards; + @Nonnull private final HealthStatus status; private final int unassignedShards; @@ -72,7 +85,6 @@ public class IndexHealthStats implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private IndexHealthStats(Builder builder) { - this.activePrimaryShards = ApiTypeHelper.requireNonNull(builder.activePrimaryShards, this, "activePrimaryShards"); this.activeShards = ApiTypeHelper.requireNonNull(builder.activeShards, this, "activeShards"); this.initializingShards = ApiTypeHelper.requireNonNull(builder.initializingShards, this, "initializingShards"); @@ -82,10 +94,9 @@ private IndexHealthStats(Builder builder) { this.shards = ApiTypeHelper.unmodifiable(builder.shards); this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); this.unassignedShards = ApiTypeHelper.requireNonNull(builder.unassignedShards, this, "unassignedShards"); - } - public static IndexHealthStats of(Function> fn) { + public static IndexHealthStats of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -134,6 +145,7 @@ public final int relocatingShards() { /** * API name: {@code shards} */ + @Nonnull public final Map shards() { return this.shards; } @@ -141,6 +153,7 @@ public final Map shards() { /** * Required - API name: {@code status} */ + @Nonnull public final HealthStatus status() { return this.status; } @@ -155,6 +168,7 @@ public final int unassignedShards() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -162,7 +176,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("active_primary_shards"); generator.write(this.activePrimaryShards); @@ -187,47 +200,81 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { for (Map.Entry item0 : this.shards.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + generator.writeKey("status"); this.status.serialize(generator, mapper); + generator.writeKey("unassigned_shards"); generator.write(this.unassignedShards); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link IndexHealthStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Integer activePrimaryShards; - private Integer activeShards; - private Integer initializingShards; - private Integer numberOfReplicas; - private Integer numberOfShards; - private Integer relocatingShards; - @Nullable private Map shards; - private HealthStatus status; - private Integer unassignedShards; + public Builder() {} + + private Builder(IndexHealthStats o) { + this.activePrimaryShards = o.activePrimaryShards; + this.activeShards = o.activeShards; + this.initializingShards = o.initializingShards; + this.numberOfReplicas = o.numberOfReplicas; + this.numberOfShards = o.numberOfShards; + this.relocatingShards = o.relocatingShards; + this.shards = _mapCopy(o.shards); + this.status = o.status; + this.unassignedShards = o.unassignedShards; + } + + private Builder(Builder o) { + this.activePrimaryShards = o.activePrimaryShards; + this.activeShards = o.activeShards; + this.initializingShards = o.initializingShards; + this.numberOfReplicas = o.numberOfReplicas; + this.numberOfShards = o.numberOfShards; + this.relocatingShards = o.relocatingShards; + this.shards = _mapCopy(o.shards); + this.status = o.status; + this.unassignedShards = o.unassignedShards; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code active_primary_shards} */ + @Nonnull public final Builder activePrimaryShards(int value) { this.activePrimaryShards = value; return this; @@ -236,6 +283,7 @@ public final Builder activePrimaryShards(int value) { /** * Required - API name: {@code active_shards} */ + @Nonnull public final Builder activeShards(int value) { this.activeShards = value; return this; @@ -244,6 +292,7 @@ public final Builder activeShards(int value) { /** * Required - API name: {@code initializing_shards} */ + @Nonnull public final Builder initializingShards(int value) { this.initializingShards = value; return this; @@ -252,6 +301,7 @@ public final Builder initializingShards(int value) { /** * Required - API name: {@code number_of_replicas} */ + @Nonnull public final Builder numberOfReplicas(int value) { this.numberOfReplicas = value; return this; @@ -260,6 +310,7 @@ public final Builder numberOfReplicas(int value) { /** * Required - API name: {@code number_of_shards} */ + @Nonnull public final Builder numberOfShards(int value) { this.numberOfShards = value; return this; @@ -268,6 +319,7 @@ public final Builder numberOfShards(int value) { /** * Required - API name: {@code relocating_shards} */ + @Nonnull public final Builder relocatingShards(int value) { this.relocatingShards = value; return this; @@ -275,9 +327,12 @@ public final Builder relocatingShards(int value) { /** * API name: {@code shards} + * *

- * Adds all entries of map to shards. + * Adds all elements of map to shards. + *

*/ + @Nonnull public final Builder shards(Map map) { this.shards = _mapPutAll(this.shards, map); return this; @@ -285,9 +340,12 @@ public final Builder shards(Map map) { /** * API name: {@code shards} + * *

* Adds an entry to shards. + *

*/ + @Nonnull public final Builder shards(String key, ShardHealthStats value) { this.shards = _mapPut(this.shards, key, value); return this; @@ -295,9 +353,12 @@ public final Builder shards(String key, ShardHealthStats value) { /** * API name: {@code shards} + * *

- * Adds an entry to shards using a builder lambda. + * Adds a value to shards using a builder lambda. + *

*/ + @Nonnull public final Builder shards(String key, Function> fn) { return shards(key, fn.apply(new ShardHealthStats.Builder()).build()); } @@ -305,6 +366,7 @@ public final Builder shards(String key, Function op) { - op.add(Builder::activePrimaryShards, JsonpDeserializer.integerDeserializer(), "active_primary_shards"); op.add(Builder::activeShards, JsonpDeserializer.integerDeserializer(), "active_shards"); op.add(Builder::initializingShards, JsonpDeserializer.integerDeserializer(), "initializing_shards"); @@ -352,7 +415,36 @@ protected static void setupIndexHealthStatsDeserializer(ObjectDeserializer { + private final int activeShards; private final int initializingShards; @@ -57,6 +67,7 @@ public class ShardHealthStats implements PlainJsonSerializable { private final int relocatingShards; + @Nonnull private final HealthStatus status; private final int unassignedShards; @@ -64,17 +75,15 @@ public class ShardHealthStats implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private ShardHealthStats(Builder builder) { - this.activeShards = ApiTypeHelper.requireNonNull(builder.activeShards, this, "activeShards"); this.initializingShards = ApiTypeHelper.requireNonNull(builder.initializingShards, this, "initializingShards"); this.primaryActive = ApiTypeHelper.requireNonNull(builder.primaryActive, this, "primaryActive"); this.relocatingShards = ApiTypeHelper.requireNonNull(builder.relocatingShards, this, "relocatingShards"); this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); this.unassignedShards = ApiTypeHelper.requireNonNull(builder.unassignedShards, this, "unassignedShards"); - } - public static ShardHealthStats of(Function> fn) { + public static ShardHealthStats of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -109,6 +118,7 @@ public final int relocatingShards() { /** * Required - API name: {@code status} */ + @Nonnull public final HealthStatus status() { return this.status; } @@ -123,6 +133,7 @@ public final int unassignedShards() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -130,7 +141,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("active_shards"); generator.write(this.activeShards); @@ -145,33 +155,65 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("status"); this.status.serialize(generator, mapper); + generator.writeKey("unassigned_shards"); generator.write(this.unassignedShards); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ShardHealthStats}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Integer activeShards; - private Integer initializingShards; - private Boolean primaryActive; - private Integer relocatingShards; - private HealthStatus status; - private Integer unassignedShards; + public Builder() {} + + private Builder(ShardHealthStats o) { + this.activeShards = o.activeShards; + this.initializingShards = o.initializingShards; + this.primaryActive = o.primaryActive; + this.relocatingShards = o.relocatingShards; + this.status = o.status; + this.unassignedShards = o.unassignedShards; + } + + private Builder(Builder o) { + this.activeShards = o.activeShards; + this.initializingShards = o.initializingShards; + this.primaryActive = o.primaryActive; + this.relocatingShards = o.relocatingShards; + this.status = o.status; + this.unassignedShards = o.unassignedShards; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code active_shards} */ + @Nonnull public final Builder activeShards(int value) { this.activeShards = value; return this; @@ -180,6 +222,7 @@ public final Builder activeShards(int value) { /** * Required - API name: {@code initializing_shards} */ + @Nonnull public final Builder initializingShards(int value) { this.initializingShards = value; return this; @@ -188,6 +231,7 @@ public final Builder initializingShards(int value) { /** * Required - API name: {@code primary_active} */ + @Nonnull public final Builder primaryActive(boolean value) { this.primaryActive = value; return this; @@ -196,6 +240,7 @@ public final Builder primaryActive(boolean value) { /** * Required - API name: {@code relocating_shards} */ + @Nonnull public final Builder relocatingShards(int value) { this.relocatingShards = value; return this; @@ -204,6 +249,7 @@ public final Builder relocatingShards(int value) { /** * Required - API name: {@code status} */ + @Nonnull public final Builder status(HealthStatus value) { this.status = value; return this; @@ -212,6 +258,7 @@ public final Builder status(HealthStatus value) { /** * Required - API name: {@code unassigned_shards} */ + @Nonnull public final Builder unassignedShards(int value) { this.unassignedShards = value; return this; @@ -220,9 +267,10 @@ public final Builder unassignedShards(int value) { /** * Builds a {@link ShardHealthStats}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ShardHealthStats build() { _checkSingleUse(); @@ -241,14 +289,36 @@ public ShardHealthStats build() { ); protected static void setupShardHealthStatsDeserializer(ObjectDeserializer op) { - op.add(Builder::activeShards, JsonpDeserializer.integerDeserializer(), "active_shards"); op.add(Builder::initializingShards, JsonpDeserializer.integerDeserializer(), "initializing_shards"); op.add(Builder::primaryActive, JsonpDeserializer.booleanDeserializer(), "primary_active"); op.add(Builder::relocatingShards, JsonpDeserializer.integerDeserializer(), "relocating_shards"); op.add(Builder::status, HealthStatus._DESERIALIZER, "status"); op.add(Builder::unassignedShards, JsonpDeserializer.integerDeserializer(), "unassigned_shards"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Integer.hashCode(this.activeShards); + result = 31 * result + Integer.hashCode(this.initializingShards); + result = 31 * result + Boolean.hashCode(this.primaryActive); + result = 31 * result + Integer.hashCode(this.relocatingShards); + result = 31 * result + this.status.hashCode(); + result = 31 * result + Integer.hashCode(this.unassignedShards); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ShardHealthStats other = (ShardHealthStats) o; + return this.activeShards == other.activeShards + && this.initializingShards == other.initializingShards + && this.primaryActive == other.primaryActive + && this.relocatingShards == other.relocatingShards + && this.status.equals(other.status) + && this.unassignedShards == other.unassignedShards; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/pending_tasks/PendingTask.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/pending_tasks/PendingTask.java similarity index 51% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/pending_tasks/PendingTask.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/pending_tasks/PendingTask.java index b9cf4b6b60..2daff26ef2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/pending_tasks/PendingTask.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/pending_tasks/PendingTask.java @@ -30,98 +30,129 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.pending_tasks; 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; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.pending_tasks.PendingTask @JsonpDeserializable -public class PendingTask implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PendingTask implements PlainJsonSerializable, ToCopyableBuilder { + private final boolean executing; private final int insertOrder; + @Nonnull private final String priority; + @Nonnull private final String source; - private final String timeInQueue; + @Nullable + private final Time timeInQueue; - private final int timeInQueueMillis; + private final long timeInQueueMillis; // --------------------------------------------------------------------------------------------- private PendingTask(Builder builder) { - this.executing = ApiTypeHelper.requireNonNull(builder.executing, this, "executing"); this.insertOrder = ApiTypeHelper.requireNonNull(builder.insertOrder, this, "insertOrder"); this.priority = ApiTypeHelper.requireNonNull(builder.priority, this, "priority"); this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source"); - this.timeInQueue = ApiTypeHelper.requireNonNull(builder.timeInQueue, this, "timeInQueue"); + this.timeInQueue = builder.timeInQueue; this.timeInQueueMillis = ApiTypeHelper.requireNonNull(builder.timeInQueueMillis, this, "timeInQueueMillis"); - } - public static PendingTask of(Function> fn) { + public static PendingTask of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code executing} + * Required - Indicates whether the pending tasks are currently executing or not. + *

+ * API name: {@code executing} + *

*/ public final boolean executing() { return this.executing; } /** - * Required - API name: {@code insert_order} + * Required - The number that represents when the task has been inserted into the task queue. + *

+ * API name: {@code insert_order} + *

*/ public final int insertOrder() { return this.insertOrder; } /** - * Required - API name: {@code priority} + * Required - The priority of the pending task. The valid priorities in descending priority order are: IMMEDIATE > + * URGENT > HIGH > NORMAL > LOW > LANGUID. + *

+ * API name: {@code priority} + *

*/ + @Nonnull public final String priority() { return this.priority; } /** - * Required - API name: {@code source} + * Required - A general description of the cluster task that may include a reason and origin. + *

+ * API name: {@code source} + *

*/ + @Nonnull public final String source() { return this.source; } /** - * Required - API name: {@code time_in_queue} + * API name: {@code time_in_queue} */ - public final String timeInQueue() { + @Nullable + public final Time timeInQueue() { return this.timeInQueue; } /** * Required - API name: {@code time_in_queue_millis} */ - public final int timeInQueueMillis() { + public final long timeInQueueMillis() { return this.timeInQueueMillis; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -129,7 +160,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("executing"); generator.write(this.executing); @@ -142,77 +172,137 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("source"); generator.write(this.source); - generator.writeKey("time_in_queue"); - generator.write(this.timeInQueue); + if (this.timeInQueue != null) { + generator.writeKey("time_in_queue"); + this.timeInQueue.serialize(generator, mapper); + } generator.writeKey("time_in_queue_millis"); generator.write(this.timeInQueueMillis); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link PendingTask}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Boolean executing; - private Integer insertOrder; - private String priority; - private String source; + @Nullable + private Time timeInQueue; + private Long timeInQueueMillis; + + public Builder() {} + + private Builder(PendingTask o) { + this.executing = o.executing; + this.insertOrder = o.insertOrder; + this.priority = o.priority; + this.source = o.source; + this.timeInQueue = o.timeInQueue; + this.timeInQueueMillis = o.timeInQueueMillis; + } - private String timeInQueue; + private Builder(Builder o) { + this.executing = o.executing; + this.insertOrder = o.insertOrder; + this.priority = o.priority; + this.source = o.source; + this.timeInQueue = o.timeInQueue; + this.timeInQueueMillis = o.timeInQueueMillis; + } - private Integer timeInQueueMillis; + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * Required - API name: {@code executing} + * Required - Indicates whether the pending tasks are currently executing or not. + *

+ * API name: {@code executing} + *

*/ + @Nonnull public final Builder executing(boolean value) { this.executing = value; return this; } /** - * Required - API name: {@code insert_order} + * Required - The number that represents when the task has been inserted into the task queue. + *

+ * API name: {@code insert_order} + *

*/ + @Nonnull public final Builder insertOrder(int value) { this.insertOrder = value; return this; } /** - * Required - API name: {@code priority} + * Required - The priority of the pending task. The valid priorities in descending priority order are: IMMEDIATE > + * URGENT > HIGH > NORMAL > LOW > LANGUID. + *

+ * API name: {@code priority} + *

*/ + @Nonnull public final Builder priority(String value) { this.priority = value; return this; } /** - * Required - API name: {@code source} + * Required - A general description of the cluster task that may include a reason and origin. + *

+ * API name: {@code source} + *

*/ + @Nonnull public final Builder source(String value) { this.source = value; return this; } /** - * Required - API name: {@code time_in_queue} + * API name: {@code time_in_queue} */ - public final Builder timeInQueue(String value) { + @Nonnull + public final Builder timeInQueue(@Nullable Time value) { this.timeInQueue = value; return this; } + /** + * API name: {@code time_in_queue} + */ + @Nonnull + public final Builder timeInQueue(Function> fn) { + return timeInQueue(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code time_in_queue_millis} */ - public final Builder timeInQueueMillis(int value) { + @Nonnull + public final Builder timeInQueueMillis(long value) { this.timeInQueueMillis = value; return this; } @@ -220,9 +310,10 @@ public final Builder timeInQueueMillis(int value) { /** * Builds a {@link PendingTask}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public PendingTask build() { _checkSingleUse(); @@ -241,14 +332,36 @@ public PendingTask build() { ); protected static void setupPendingTaskDeserializer(ObjectDeserializer op) { - op.add(Builder::executing, JsonpDeserializer.booleanDeserializer(), "executing"); op.add(Builder::insertOrder, JsonpDeserializer.integerDeserializer(), "insert_order"); op.add(Builder::priority, JsonpDeserializer.stringDeserializer(), "priority"); op.add(Builder::source, JsonpDeserializer.stringDeserializer(), "source"); - op.add(Builder::timeInQueue, JsonpDeserializer.stringDeserializer(), "time_in_queue"); - op.add(Builder::timeInQueueMillis, JsonpDeserializer.integerDeserializer(), "time_in_queue_millis"); + op.add(Builder::timeInQueue, Time._DESERIALIZER, "time_in_queue"); + op.add(Builder::timeInQueueMillis, JsonpDeserializer.longDeserializer(), "time_in_queue_millis"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Boolean.hashCode(this.executing); + result = 31 * result + Integer.hashCode(this.insertOrder); + result = 31 * result + this.priority.hashCode(); + result = 31 * result + this.source.hashCode(); + result = 31 * result + Objects.hashCode(this.timeInQueue); + result = 31 * result + Long.hashCode(this.timeInQueueMillis); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PendingTask other = (PendingTask) o; + return this.executing == other.executing + && this.insertOrder == other.insertOrder + && this.priority.equals(other.priority) + && this.source.equals(other.source) + && Objects.equals(this.timeInQueue, other.timeInQueue) + && this.timeInQueueMillis == other.timeInQueueMillis; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/remote_info/ClusterRemoteInfo.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/remote_info/ClusterRemoteInfo.java similarity index 76% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/remote_info/ClusterRemoteInfo.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/remote_info/ClusterRemoteInfo.java index c0a3f47549..b40fdaa4a4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/remote_info/ClusterRemoteInfo.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/remote_info/ClusterRemoteInfo.java @@ -30,17 +30,24 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.remote_info; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonEnum; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.JsonpSerializable; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; @@ -50,21 +57,14 @@ // typedef: cluster.remote_info.ClusterRemoteInfo @JsonpDeserializable -public class ClusterRemoteInfo implements TaggedUnion, JsonpSerializable { - - /** - * {@link ClusterRemoteInfo} variant kinds. - */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterRemoteInfo implements TaggedUnion, PlainJsonSerializable { /** * {@link ClusterRemoteInfo} variant kinds. */ - public enum Kind implements JsonEnum { Proxy("proxy"), - - Sniff("sniff"), - - ; + Sniff("sniff"); private final String jsonValue; @@ -72,10 +72,10 @@ public enum Kind implements JsonEnum { this.jsonValue = jsonValue; } + @Override public String jsonValue() { - return this.jsonValue; + return jsonValue; } - } private final Kind _kind; @@ -92,20 +92,16 @@ public final ClusterRemoteInfoVariant _get() { } public ClusterRemoteInfo(ClusterRemoteInfoVariant value) { - this._kind = ApiTypeHelper.requireNonNull(value._clusterRemoteInfoKind(), this, ""); this._value = ApiTypeHelper.requireNonNull(value, this, ""); - } private ClusterRemoteInfo(Builder builder) { - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - } - public static ClusterRemoteInfo of(Function> fn) { + public static ClusterRemoteInfo of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -119,8 +115,7 @@ public boolean isProxy() { /** * Get the {@code proxy} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code proxy} kind. + * @throws IllegalStateException if the current variant is not the {@code proxy} kind. */ public ClusterRemoteProxyInfo proxy() { return TaggedUnionUtils.get(this, Kind.Proxy); @@ -136,8 +131,7 @@ public boolean isSniff() { /** * Get the {@code sniff} variant value. * - * @throws IllegalStateException - * if the current variant is not of the {@code sniff} kind. + * @throws IllegalStateException if the current variant is not the {@code sniff} kind. */ public ClusterRemoteSniffInfo sniff() { return TaggedUnionUtils.get(this, Kind.Sniff); @@ -145,15 +139,30 @@ public ClusterRemoteSniffInfo sniff() { @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { - mapper.serialize(_value, generator); + } + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); } public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Kind _kind; private ClusterRemoteInfoVariant _value; + public Builder() {} + + private Builder(ClusterRemoteInfo o) { + this._kind = o._kind; + this._value = o._value; + } + public ObjectBuilder proxy(ClusterRemoteProxyInfo v) { this._kind = Kind.Proxy; this._value = v; @@ -174,20 +183,17 @@ public ObjectBuilder sniff(Function op) { - op.add(Builder::proxy, ClusterRemoteProxyInfo._DESERIALIZER, "proxy"); op.add(Builder::sniff, ClusterRemoteSniffInfo._DESERIALIZER, "sniff"); - op.setTypeProperty("mode", null); - } public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( @@ -195,4 +201,20 @@ protected static void setupClusterRemoteInfoDeserializer(ObjectDeserializer { + private final boolean connected; + @Nonnull private final Time initialConnectTimeout; - private final boolean skipUnavailable; + private final int maxProxySocketConnections; + private final int numProxySocketsConnected; + + @Nonnull private final String proxyAddress; + @Nonnull private final String serverName; - private final int numProxySocketsConnected; - - private final int maxProxySocketConnections; + private final boolean skipUnavailable; // --------------------------------------------------------------------------------------------- private ClusterRemoteProxyInfo(Builder builder) { - this.connected = ApiTypeHelper.requireNonNull(builder.connected, this, "connected"); this.initialConnectTimeout = ApiTypeHelper.requireNonNull(builder.initialConnectTimeout, this, "initialConnectTimeout"); - this.skipUnavailable = ApiTypeHelper.requireNonNull(builder.skipUnavailable, this, "skipUnavailable"); + this.maxProxySocketConnections = ApiTypeHelper.requireNonNull(builder.maxProxySocketConnections, this, "maxProxySocketConnections"); + this.numProxySocketsConnected = ApiTypeHelper.requireNonNull(builder.numProxySocketsConnected, this, "numProxySocketsConnected"); this.proxyAddress = ApiTypeHelper.requireNonNull(builder.proxyAddress, this, "proxyAddress"); this.serverName = ApiTypeHelper.requireNonNull(builder.serverName, this, "serverName"); - this.numProxySocketsConnected = ApiTypeHelper.requireNonNull(builder.numProxySocketsConnected, this, "numProxySocketsConnected"); - this.maxProxySocketConnections = ApiTypeHelper.requireNonNull(builder.maxProxySocketConnections, this, "maxProxySocketConnections"); - + this.skipUnavailable = ApiTypeHelper.requireNonNull(builder.skipUnavailable, this, "skipUnavailable"); } - public static ClusterRemoteProxyInfo of(Function> fn) { + public static ClusterRemoteProxyInfo of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * ClusterRemoteInfo variant kind. + * {@link ClusterRemoteInfo} variant kind. */ @Override public ClusterRemoteInfo.Kind _clusterRemoteInfoKind() { @@ -99,20 +114,29 @@ public final boolean connected() { /** * Required - API name: {@code initial_connect_timeout} */ + @Nonnull public final Time initialConnectTimeout() { return this.initialConnectTimeout; } /** - * Required - API name: {@code skip_unavailable} + * Required - API name: {@code max_proxy_socket_connections} */ - public final boolean skipUnavailable() { - return this.skipUnavailable; + public final int maxProxySocketConnections() { + return this.maxProxySocketConnections; + } + + /** + * Required - API name: {@code num_proxy_sockets_connected} + */ + public final int numProxySocketsConnected() { + return this.numProxySocketsConnected; } /** * Required - API name: {@code proxy_address} */ + @Nonnull public final String proxyAddress() { return this.proxyAddress; } @@ -120,27 +144,22 @@ public final String proxyAddress() { /** * Required - API name: {@code server_name} */ + @Nonnull public final String serverName() { return this.serverName; } /** - * Required - API name: {@code num_proxy_sockets_connected} - */ - public final int numProxySocketsConnected() { - return this.numProxySocketsConnected; - } - - /** - * Required - API name: {@code max_proxy_socket_connections} + * Required - API name: {@code skip_unavailable} */ - public final int maxProxySocketConnections() { - return this.maxProxySocketConnections; + public final boolean skipUnavailable() { + return this.skipUnavailable; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -148,17 +167,18 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("mode", "proxy"); - generator.writeKey("connected"); generator.write(this.connected); generator.writeKey("initial_connect_timeout"); this.initialConnectTimeout.serialize(generator, mapper); - generator.writeKey("skip_unavailable"); - generator.write(this.skipUnavailable); + generator.writeKey("max_proxy_socket_connections"); + generator.write(this.maxProxySocketConnections); + + generator.writeKey("num_proxy_sockets_connected"); + generator.write(this.numProxySocketsConnected); generator.writeKey("proxy_address"); generator.write(this.proxyAddress); @@ -166,38 +186,67 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("server_name"); generator.write(this.serverName); - generator.writeKey("num_proxy_sockets_connected"); - generator.write(this.numProxySocketsConnected); + generator.writeKey("skip_unavailable"); + generator.write(this.skipUnavailable); + } - generator.writeKey("max_proxy_socket_connections"); - generator.write(this.maxProxySocketConnections); + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link ClusterRemoteProxyInfo}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Boolean connected; - private Time initialConnectTimeout; - + private Integer maxProxySocketConnections; + private Integer numProxySocketsConnected; + private String proxyAddress; + private String serverName; private Boolean skipUnavailable; - private String proxyAddress; + public Builder() {} - private String serverName; + private Builder(ClusterRemoteProxyInfo o) { + this.connected = o.connected; + this.initialConnectTimeout = o.initialConnectTimeout; + this.maxProxySocketConnections = o.maxProxySocketConnections; + this.numProxySocketsConnected = o.numProxySocketsConnected; + this.proxyAddress = o.proxyAddress; + this.serverName = o.serverName; + this.skipUnavailable = o.skipUnavailable; + } - private Integer numProxySocketsConnected; + private Builder(Builder o) { + this.connected = o.connected; + this.initialConnectTimeout = o.initialConnectTimeout; + this.maxProxySocketConnections = o.maxProxySocketConnections; + this.numProxySocketsConnected = o.numProxySocketsConnected; + this.proxyAddress = o.proxyAddress; + this.serverName = o.serverName; + this.skipUnavailable = o.skipUnavailable; + } - private Integer maxProxySocketConnections; + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * Required - API name: {@code connected} */ + @Nonnull public final Builder connected(boolean value) { this.connected = value; return this; @@ -206,6 +255,7 @@ public final Builder connected(boolean value) { /** * Required - API name: {@code initial_connect_timeout} */ + @Nonnull public final Builder initialConnectTimeout(Time value) { this.initialConnectTimeout = value; return this; @@ -214,21 +264,33 @@ public final Builder initialConnectTimeout(Time value) { /** * Required - API name: {@code initial_connect_timeout} */ + @Nonnull public final Builder initialConnectTimeout(Function> fn) { - return this.initialConnectTimeout(fn.apply(new Time.Builder()).build()); + return initialConnectTimeout(fn.apply(new Time.Builder()).build()); } /** - * Required - API name: {@code skip_unavailable} + * Required - API name: {@code max_proxy_socket_connections} */ - public final Builder skipUnavailable(boolean value) { - this.skipUnavailable = value; + @Nonnull + public final Builder maxProxySocketConnections(int value) { + this.maxProxySocketConnections = value; + return this; + } + + /** + * Required - API name: {@code num_proxy_sockets_connected} + */ + @Nonnull + public final Builder numProxySocketsConnected(int value) { + this.numProxySocketsConnected = value; return this; } /** * Required - API name: {@code proxy_address} */ + @Nonnull public final Builder proxyAddress(String value) { this.proxyAddress = value; return this; @@ -237,33 +299,28 @@ public final Builder proxyAddress(String value) { /** * Required - API name: {@code server_name} */ + @Nonnull public final Builder serverName(String value) { this.serverName = value; return this; } /** - * Required - API name: {@code num_proxy_sockets_connected} - */ - public final Builder numProxySocketsConnected(int value) { - this.numProxySocketsConnected = value; - return this; - } - - /** - * Required - API name: {@code max_proxy_socket_connections} + * Required - API name: {@code skip_unavailable} */ - public final Builder maxProxySocketConnections(int value) { - this.maxProxySocketConnections = value; + @Nonnull + public final Builder skipUnavailable(boolean value) { + this.skipUnavailable = value; return this; } /** * Builds a {@link ClusterRemoteProxyInfo}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ClusterRemoteProxyInfo build() { _checkSingleUse(); @@ -282,16 +339,41 @@ public ClusterRemoteProxyInfo build() { ); protected static void setupClusterRemoteProxyInfoDeserializer(ObjectDeserializer op) { - op.add(Builder::connected, JsonpDeserializer.booleanDeserializer(), "connected"); op.add(Builder::initialConnectTimeout, Time._DESERIALIZER, "initial_connect_timeout"); - op.add(Builder::skipUnavailable, JsonpDeserializer.booleanDeserializer(), "skip_unavailable"); + op.add(Builder::maxProxySocketConnections, JsonpDeserializer.integerDeserializer(), "max_proxy_socket_connections"); + op.add(Builder::numProxySocketsConnected, JsonpDeserializer.integerDeserializer(), "num_proxy_sockets_connected"); op.add(Builder::proxyAddress, JsonpDeserializer.stringDeserializer(), "proxy_address"); op.add(Builder::serverName, JsonpDeserializer.stringDeserializer(), "server_name"); - op.add(Builder::numProxySocketsConnected, JsonpDeserializer.integerDeserializer(), "num_proxy_sockets_connected"); - op.add(Builder::maxProxySocketConnections, JsonpDeserializer.integerDeserializer(), "max_proxy_socket_connections"); + op.add(Builder::skipUnavailable, JsonpDeserializer.booleanDeserializer(), "skip_unavailable"); op.ignore("mode"); } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Boolean.hashCode(this.connected); + result = 31 * result + this.initialConnectTimeout.hashCode(); + result = 31 * result + Integer.hashCode(this.maxProxySocketConnections); + result = 31 * result + Integer.hashCode(this.numProxySocketsConnected); + result = 31 * result + this.proxyAddress.hashCode(); + result = 31 * result + this.serverName.hashCode(); + result = 31 * result + Boolean.hashCode(this.skipUnavailable); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterRemoteProxyInfo other = (ClusterRemoteProxyInfo) o; + return this.connected == other.connected + && this.initialConnectTimeout.equals(other.initialConnectTimeout) + && this.maxProxySocketConnections == other.maxProxySocketConnections + && this.numProxySocketsConnected == other.numProxySocketsConnected + && this.proxyAddress.equals(other.proxyAddress) + && this.serverName.equals(other.serverName) + && this.skipUnavailable == other.skipUnavailable; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/remote_info/ClusterRemoteSniffInfo.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/remote_info/ClusterRemoteSniffInfo.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/remote_info/ClusterRemoteSniffInfo.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/remote_info/ClusterRemoteSniffInfo.java index 3dbadf63d4..accb7e248d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/remote_info/ClusterRemoteSniffInfo.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/remote_info/ClusterRemoteSniffInfo.java @@ -30,57 +30,71 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.remote_info; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.JsonpSerializable; 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; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.remote_info.ClusterRemoteSniffInfo @JsonpDeserializable -public class ClusterRemoteSniffInfo implements ClusterRemoteInfoVariant, JsonpSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterRemoteSniffInfo + implements + ClusterRemoteInfoVariant, + PlainJsonSerializable, + ToCopyableBuilder { + private final boolean connected; + @Nonnull + private final Time initialConnectTimeout; + private final int maxConnectionsPerCluster; private final long numNodesConnected; - private final Time initialConnectTimeout; + @Nonnull + private final List seeds; private final boolean skipUnavailable; - private final List seeds; - // --------------------------------------------------------------------------------------------- private ClusterRemoteSniffInfo(Builder builder) { - this.connected = ApiTypeHelper.requireNonNull(builder.connected, this, "connected"); + this.initialConnectTimeout = ApiTypeHelper.requireNonNull(builder.initialConnectTimeout, this, "initialConnectTimeout"); this.maxConnectionsPerCluster = ApiTypeHelper.requireNonNull(builder.maxConnectionsPerCluster, this, "maxConnectionsPerCluster"); this.numNodesConnected = ApiTypeHelper.requireNonNull(builder.numNodesConnected, this, "numNodesConnected"); - this.initialConnectTimeout = ApiTypeHelper.requireNonNull(builder.initialConnectTimeout, this, "initialConnectTimeout"); - this.skipUnavailable = ApiTypeHelper.requireNonNull(builder.skipUnavailable, this, "skipUnavailable"); this.seeds = ApiTypeHelper.unmodifiableRequired(builder.seeds, this, "seeds"); - + this.skipUnavailable = ApiTypeHelper.requireNonNull(builder.skipUnavailable, this, "skipUnavailable"); } - public static ClusterRemoteSniffInfo of(Function> fn) { + public static ClusterRemoteSniffInfo of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * ClusterRemoteInfo variant kind. + * {@link ClusterRemoteInfo} variant kind. */ @Override public ClusterRemoteInfo.Kind _clusterRemoteInfoKind() { @@ -94,6 +108,14 @@ public final boolean connected() { return this.connected; } + /** + * Required - API name: {@code initial_connect_timeout} + */ + @Nonnull + public final Time initialConnectTimeout() { + return this.initialConnectTimeout; + } + /** * Required - API name: {@code max_connections_per_cluster} */ @@ -109,10 +131,11 @@ public final long numNodesConnected() { } /** - * Required - API name: {@code initial_connect_timeout} + * Required - API name: {@code seeds} */ - public final Time initialConnectTimeout() { - return this.initialConnectTimeout; + @Nonnull + public final List seeds() { + return this.seeds; } /** @@ -122,16 +145,10 @@ public final boolean skipUnavailable() { return this.skipUnavailable; } - /** - * Required - API name: {@code seeds} - */ - public final List seeds() { - return this.seeds; - } - /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -139,83 +156,93 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.write("mode", "sniff"); - generator.writeKey("connected"); generator.write(this.connected); + generator.writeKey("initial_connect_timeout"); + this.initialConnectTimeout.serialize(generator, mapper); + generator.writeKey("max_connections_per_cluster"); generator.write(this.maxConnectionsPerCluster); generator.writeKey("num_nodes_connected"); generator.write(this.numNodesConnected); - generator.writeKey("initial_connect_timeout"); - this.initialConnectTimeout.serialize(generator, mapper); + generator.writeKey("seeds"); + generator.writeStartArray(); + for (String item0 : this.seeds) { + generator.write(item0); + } + generator.writeEnd(); generator.writeKey("skip_unavailable"); generator.write(this.skipUnavailable); + } - if (ApiTypeHelper.isDefined(this.seeds)) { - generator.writeKey("seeds"); - generator.writeStartArray(); - for (String item0 : this.seeds) { - generator.write(item0); - - } - generator.writeEnd(); - - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link ClusterRemoteSniffInfo}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Boolean connected; - + private Time initialConnectTimeout; private Integer maxConnectionsPerCluster; - private Long numNodesConnected; - - private Time initialConnectTimeout; - + private List seeds; private Boolean skipUnavailable; - private List seeds; + public Builder() {} - /** - * Required - API name: {@code connected} - */ - public final Builder connected(boolean value) { - this.connected = value; - return this; + private Builder(ClusterRemoteSniffInfo o) { + this.connected = o.connected; + this.initialConnectTimeout = o.initialConnectTimeout; + this.maxConnectionsPerCluster = o.maxConnectionsPerCluster; + this.numNodesConnected = o.numNodesConnected; + this.seeds = _listCopy(o.seeds); + this.skipUnavailable = o.skipUnavailable; } - /** - * Required - API name: {@code max_connections_per_cluster} - */ - public final Builder maxConnectionsPerCluster(int value) { - this.maxConnectionsPerCluster = value; - return this; + private Builder(Builder o) { + this.connected = o.connected; + this.initialConnectTimeout = o.initialConnectTimeout; + this.maxConnectionsPerCluster = o.maxConnectionsPerCluster; + this.numNodesConnected = o.numNodesConnected; + this.seeds = _listCopy(o.seeds); + this.skipUnavailable = o.skipUnavailable; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** - * Required - API name: {@code num_nodes_connected} + * Required - API name: {@code connected} */ - public final Builder numNodesConnected(long value) { - this.numNodesConnected = value; + @Nonnull + public final Builder connected(boolean value) { + this.connected = value; return this; } /** * Required - API name: {@code initial_connect_timeout} */ + @Nonnull public final Builder initialConnectTimeout(Time value) { this.initialConnectTimeout = value; return this; @@ -224,23 +251,37 @@ public final Builder initialConnectTimeout(Time value) { /** * Required - API name: {@code initial_connect_timeout} */ + @Nonnull public final Builder initialConnectTimeout(Function> fn) { - return this.initialConnectTimeout(fn.apply(new Time.Builder()).build()); + return initialConnectTimeout(fn.apply(new Time.Builder()).build()); } /** - * Required - API name: {@code skip_unavailable} + * Required - API name: {@code max_connections_per_cluster} */ - public final Builder skipUnavailable(boolean value) { - this.skipUnavailable = value; + @Nonnull + public final Builder maxConnectionsPerCluster(int value) { + this.maxConnectionsPerCluster = value; + return this; + } + + /** + * Required - API name: {@code num_nodes_connected} + */ + @Nonnull + public final Builder numNodesConnected(long value) { + this.numNodesConnected = value; return this; } /** * Required - API name: {@code seeds} + * *

* Adds all elements of list to seeds. + *

*/ + @Nonnull public final Builder seeds(List list) { this.seeds = _listAddAll(this.seeds, list); return this; @@ -248,20 +289,33 @@ public final Builder seeds(List list) { /** * Required - API name: {@code seeds} + * *

* Adds one or more values to seeds. + *

*/ + @Nonnull public final Builder seeds(String value, String... values) { this.seeds = _listAdd(this.seeds, value, values); return this; } + /** + * Required - API name: {@code skip_unavailable} + */ + @Nonnull + public final Builder skipUnavailable(boolean value) { + this.skipUnavailable = value; + return this; + } + /** * Builds a {@link ClusterRemoteSniffInfo}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ClusterRemoteSniffInfo build() { _checkSingleUse(); @@ -280,15 +334,38 @@ public ClusterRemoteSniffInfo build() { ); protected static void setupClusterRemoteSniffInfoDeserializer(ObjectDeserializer op) { - op.add(Builder::connected, JsonpDeserializer.booleanDeserializer(), "connected"); + op.add(Builder::initialConnectTimeout, Time._DESERIALIZER, "initial_connect_timeout"); op.add(Builder::maxConnectionsPerCluster, JsonpDeserializer.integerDeserializer(), "max_connections_per_cluster"); op.add(Builder::numNodesConnected, JsonpDeserializer.longDeserializer(), "num_nodes_connected"); - op.add(Builder::initialConnectTimeout, Time._DESERIALIZER, "initial_connect_timeout"); - op.add(Builder::skipUnavailable, JsonpDeserializer.booleanDeserializer(), "skip_unavailable"); op.add(Builder::seeds, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "seeds"); + op.add(Builder::skipUnavailable, JsonpDeserializer.booleanDeserializer(), "skip_unavailable"); op.ignore("mode"); } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Boolean.hashCode(this.connected); + result = 31 * result + this.initialConnectTimeout.hashCode(); + result = 31 * result + Integer.hashCode(this.maxConnectionsPerCluster); + result = 31 * result + Long.hashCode(this.numNodesConnected); + result = 31 * result + this.seeds.hashCode(); + result = 31 * result + Boolean.hashCode(this.skipUnavailable); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterRemoteSniffInfo other = (ClusterRemoteSniffInfo) o; + return this.connected == other.connected + && this.initialConnectTimeout.equals(other.initialConnectTimeout) + && this.maxConnectionsPerCluster == other.maxConnectionsPerCluster + && this.numNodesConnected == other.numNodesConnected + && this.seeds.equals(other.seeds) + && this.skipUnavailable == other.skipUnavailable; + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/ClusterRerouteMetric.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/ClusterRerouteMetric.java new file mode 100644 index 0000000000..630b3dd521 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/ClusterRerouteMetric.java @@ -0,0 +1,79 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.cluster.reroute; + +import javax.annotation.Generated; +import org.opensearch.client.json.JsonEnum; +import org.opensearch.client.json.JsonpDeserializable; + +// typedef: cluster.reroute.Metric + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public enum ClusterRerouteMetric implements JsonEnum { + All("_all"), + + Blocks("blocks"), + + ClusterManagerNode("cluster_manager_node"), + + MasterNode("master_node"), + + Metadata("metadata"), + + Nodes("nodes"), + + RoutingNodes("routing_nodes"), + + RoutingTable("routing_table"), + + Version("version"); + + private final String jsonValue; + + ClusterRerouteMetric(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + ClusterRerouteMetric.values() + ); +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/Command.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/Command.java similarity index 54% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/Command.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/Command.java index ee3fcf8c29..181a07861f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/Command.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/Command.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.reroute; 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; @@ -41,18 +48,19 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.reroute.Command @JsonpDeserializable -public class Command implements PlainJsonSerializable { - @Nullable - private final CommandCancelAction cancel; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Command implements PlainJsonSerializable, ToCopyableBuilder { @Nullable - private final CommandMoveAction move; + private final CommandAllocatePrimaryAction allocateEmptyPrimary; @Nullable private final CommandAllocateReplicaAction allocateReplica; @@ -61,59 +69,45 @@ public class Command implements PlainJsonSerializable { private final CommandAllocatePrimaryAction allocateStalePrimary; @Nullable - private final CommandAllocatePrimaryAction allocateEmptyPrimary; + private final CommandCancelAction cancel; + + @Nullable + private final CommandMoveAction move; // --------------------------------------------------------------------------------------------- private Command(Builder builder) { - - this.cancel = builder.cancel; - this.move = builder.move; + this.allocateEmptyPrimary = builder.allocateEmptyPrimary; this.allocateReplica = builder.allocateReplica; this.allocateStalePrimary = builder.allocateStalePrimary; - this.allocateEmptyPrimary = builder.allocateEmptyPrimary; - + this.cancel = builder.cancel; + this.move = builder.move; } - public static Command of(Function> fn) { + public static Command of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Cancel allocation of a shard (or recovery). Accepts index and shard for index - * name and shard number, and node for the node to cancel the shard allocation - * on. This can be used to force resynchronization of existing replicas from the - * primary shard by cancelling them and allowing them to be reinitialized - * through the standard recovery process. By default only replica shard - * allocations can be cancelled. If it is necessary to cancel the allocation of - * a primary shard then the allow_primary flag must also be included in the - * request. - *

- * API name: {@code cancel} - */ - @Nullable - public final CommandCancelAction cancel() { - return this.cancel; - } - - /** - * Move a started shard from one node to another node. Accepts index and shard - * for index name and shard number, from_node for the node to move the shard - * from, and to_node for the node to move the shard to. + * Allocate an empty primary shard to a node. Accepts the index and shard for index name and shard number, and node to allocate the + * shard to. Using this command leads to a complete loss of all data that was indexed into this shard, if it was previously started. If + * a node which has a copy of the data rejoins the cluster later on, that data will be deleted. To ensure that these implications are + * well-understood, this command requires the flag accept_data_loss to be explicitly set to true. *

- * API name: {@code move} + * API name: {@code allocate_empty_primary} + *

*/ @Nullable - public final CommandMoveAction move() { - return this.move; + public final CommandAllocatePrimaryAction allocateEmptyPrimary() { + return this.allocateEmptyPrimary; } /** - * Allocate an unassigned replica shard to a node. Accepts index and shard for - * index name and shard number, and node to allocate the shard to. Takes - * allocation deciders into account. + * Allocate an unassigned replica shard to a node. Accepts index and shard for index name and shard number, and node to allocate the + * shard to. Takes allocation deciders into account. *

* API name: {@code allocate_replica} + *

*/ @Nullable public final CommandAllocateReplicaAction allocateReplica() { @@ -121,16 +115,14 @@ public final CommandAllocateReplicaAction allocateReplica() { } /** - * Allocate a primary shard to a node that holds a stale copy. Accepts the index - * and shard for index name and shard number, and node to allocate the shard to. - * Using this command may lead to data loss for the provided shard id. If a node - * which has the good copy of the data rejoins the cluster later on, that data - * will be deleted or overwritten with the data of the stale copy that was - * forcefully allocated with this command. To ensure that these implications are - * well-understood, this command requires the flag accept_data_loss to be - * explicitly set to true. + * Allocate a primary shard to a node that holds a stale copy. Accepts the index and shard for index name and shard number, and node to + * allocate the shard to. Using this command may lead to data loss for the provided shard id. If a node which has the good copy of the + * data rejoins the cluster later on, that data will be deleted or overwritten with the data of the stale copy that was forcefully + * allocated with this command. To ensure that these implications are well-understood, this command requires the flag accept_data_loss + * to be explicitly set to true. *

* API name: {@code allocate_stale_primary} + *

*/ @Nullable public final CommandAllocatePrimaryAction allocateStalePrimary() { @@ -138,24 +130,36 @@ public final CommandAllocatePrimaryAction allocateStalePrimary() { } /** - * Allocate an empty primary shard to a node. Accepts the index and shard for - * index name and shard number, and node to allocate the shard to. Using this - * command leads to a complete loss of all data that was indexed into this - * shard, if it was previously started. If a node which has a copy of the data - * rejoins the cluster later on, that data will be deleted. To ensure that these - * implications are well-understood, this command requires the flag - * accept_data_loss to be explicitly set to true. + * Cancel allocation of a shard (or recovery). Accepts index and shard for index name and shard number, and node for the node to cancel + * the shard allocation on. This can be used to force resynchronization of existing replicas from the primary shard by cancelling them + * and allowing them to be reinitialized through the standard recovery process. By default only replica shard allocations can be + * cancelled. If it is necessary to cancel the allocation of a primary shard then the allow_primary flag must also be included in the + * request. *

- * API name: {@code allocate_empty_primary} + * API name: {@code cancel} + *

*/ @Nullable - public final CommandAllocatePrimaryAction allocateEmptyPrimary() { - return this.allocateEmptyPrimary; + public final CommandCancelAction cancel() { + return this.cancel; + } + + /** + * Move a started shard from one node to another node. Accepts index and shard for index name and shard number, from_node for the node + * to move the shard from, and to_node for the node to move the shard to. + *

+ * API name: {@code move} + *

+ */ + @Nullable + public final CommandMoveAction move() { + return this.move; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -163,212 +167,238 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.cancel != null) { - generator.writeKey("cancel"); - this.cancel.serialize(generator, mapper); - + if (this.allocateEmptyPrimary != null) { + generator.writeKey("allocate_empty_primary"); + this.allocateEmptyPrimary.serialize(generator, mapper); } - if (this.move != null) { - generator.writeKey("move"); - this.move.serialize(generator, mapper); - } if (this.allocateReplica != null) { generator.writeKey("allocate_replica"); this.allocateReplica.serialize(generator, mapper); - } + if (this.allocateStalePrimary != null) { generator.writeKey("allocate_stale_primary"); this.allocateStalePrimary.serialize(generator, mapper); - } - if (this.allocateEmptyPrimary != null) { - generator.writeKey("allocate_empty_primary"); - this.allocateEmptyPrimary.serialize(generator, mapper); + if (this.cancel != null) { + generator.writeKey("cancel"); + this.cancel.serialize(generator, mapper); } + if (this.move != null) { + generator.writeKey("move"); + this.move.serialize(generator, mapper); + } } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link Command}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable - private CommandCancelAction cancel; - - @Nullable - private CommandMoveAction move; - + private CommandAllocatePrimaryAction allocateEmptyPrimary; @Nullable private CommandAllocateReplicaAction allocateReplica; - @Nullable private CommandAllocatePrimaryAction allocateStalePrimary; - @Nullable - private CommandAllocatePrimaryAction allocateEmptyPrimary; + private CommandCancelAction cancel; + @Nullable + private CommandMoveAction move; - /** - * Cancel allocation of a shard (or recovery). Accepts index and shard for index - * name and shard number, and node for the node to cancel the shard allocation - * on. This can be used to force resynchronization of existing replicas from the - * primary shard by cancelling them and allowing them to be reinitialized - * through the standard recovery process. By default only replica shard - * allocations can be cancelled. If it is necessary to cancel the allocation of - * a primary shard then the allow_primary flag must also be included in the - * request. - *

- * API name: {@code cancel} - */ - public final Builder cancel(@Nullable CommandCancelAction value) { - this.cancel = value; - return this; + public Builder() {} + + private Builder(Command o) { + this.allocateEmptyPrimary = o.allocateEmptyPrimary; + this.allocateReplica = o.allocateReplica; + this.allocateStalePrimary = o.allocateStalePrimary; + this.cancel = o.cancel; + this.move = o.move; } - /** - * Cancel allocation of a shard (or recovery). Accepts index and shard for index - * name and shard number, and node for the node to cancel the shard allocation - * on. This can be used to force resynchronization of existing replicas from the - * primary shard by cancelling them and allowing them to be reinitialized - * through the standard recovery process. By default only replica shard - * allocations can be cancelled. If it is necessary to cancel the allocation of - * a primary shard then the allow_primary flag must also be included in the - * request. - *

- * API name: {@code cancel} - */ - public final Builder cancel(Function> fn) { - return this.cancel(fn.apply(new CommandCancelAction.Builder()).build()); + private Builder(Builder o) { + this.allocateEmptyPrimary = o.allocateEmptyPrimary; + this.allocateReplica = o.allocateReplica; + this.allocateStalePrimary = o.allocateStalePrimary; + this.cancel = o.cancel; + this.move = o.move; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** - * Move a started shard from one node to another node. Accepts index and shard - * for index name and shard number, from_node for the node to move the shard - * from, and to_node for the node to move the shard to. + * Allocate an empty primary shard to a node. Accepts the index and shard for index name and shard number, and node to allocate the + * shard to. Using this command leads to a complete loss of all data that was indexed into this shard, if it was previously started. + * If a node which has a copy of the data rejoins the cluster later on, that data will be deleted. To ensure that these implications + * are well-understood, this command requires the flag accept_data_loss to be explicitly set to true. *

- * API name: {@code move} + * API name: {@code allocate_empty_primary} + *

*/ - public final Builder move(@Nullable CommandMoveAction value) { - this.move = value; + @Nonnull + public final Builder allocateEmptyPrimary(@Nullable CommandAllocatePrimaryAction value) { + this.allocateEmptyPrimary = value; return this; } /** - * Move a started shard from one node to another node. Accepts index and shard - * for index name and shard number, from_node for the node to move the shard - * from, and to_node for the node to move the shard to. + * Allocate an empty primary shard to a node. Accepts the index and shard for index name and shard number, and node to allocate the + * shard to. Using this command leads to a complete loss of all data that was indexed into this shard, if it was previously started. + * If a node which has a copy of the data rejoins the cluster later on, that data will be deleted. To ensure that these implications + * are well-understood, this command requires the flag accept_data_loss to be explicitly set to true. *

- * API name: {@code move} + * API name: {@code allocate_empty_primary} + *

*/ - public final Builder move(Function> fn) { - return this.move(fn.apply(new CommandMoveAction.Builder()).build()); + @Nonnull + public final Builder allocateEmptyPrimary( + Function> fn + ) { + return allocateEmptyPrimary(fn.apply(new CommandAllocatePrimaryAction.Builder()).build()); } /** - * Allocate an unassigned replica shard to a node. Accepts index and shard for - * index name and shard number, and node to allocate the shard to. Takes - * allocation deciders into account. + * Allocate an unassigned replica shard to a node. Accepts index and shard for index name and shard number, and node to allocate the + * shard to. Takes allocation deciders into account. *

* API name: {@code allocate_replica} + *

*/ + @Nonnull public final Builder allocateReplica(@Nullable CommandAllocateReplicaAction value) { this.allocateReplica = value; return this; } /** - * Allocate an unassigned replica shard to a node. Accepts index and shard for - * index name and shard number, and node to allocate the shard to. Takes - * allocation deciders into account. + * Allocate an unassigned replica shard to a node. Accepts index and shard for index name and shard number, and node to allocate the + * shard to. Takes allocation deciders into account. *

* API name: {@code allocate_replica} + *

*/ + @Nonnull public final Builder allocateReplica( Function> fn ) { - return this.allocateReplica(fn.apply(new CommandAllocateReplicaAction.Builder()).build()); + return allocateReplica(fn.apply(new CommandAllocateReplicaAction.Builder()).build()); } /** - * Allocate a primary shard to a node that holds a stale copy. Accepts the index - * and shard for index name and shard number, and node to allocate the shard to. - * Using this command may lead to data loss for the provided shard id. If a node - * which has the good copy of the data rejoins the cluster later on, that data - * will be deleted or overwritten with the data of the stale copy that was - * forcefully allocated with this command. To ensure that these implications are - * well-understood, this command requires the flag accept_data_loss to be - * explicitly set to true. + * Allocate a primary shard to a node that holds a stale copy. Accepts the index and shard for index name and shard number, and node + * to allocate the shard to. Using this command may lead to data loss for the provided shard id. If a node which has the good copy + * of the data rejoins the cluster later on, that data will be deleted or overwritten with the data of the stale copy that was + * forcefully allocated with this command. To ensure that these implications are well-understood, this command requires the flag + * accept_data_loss to be explicitly set to true. *

* API name: {@code allocate_stale_primary} + *

*/ + @Nonnull public final Builder allocateStalePrimary(@Nullable CommandAllocatePrimaryAction value) { this.allocateStalePrimary = value; return this; } /** - * Allocate a primary shard to a node that holds a stale copy. Accepts the index - * and shard for index name and shard number, and node to allocate the shard to. - * Using this command may lead to data loss for the provided shard id. If a node - * which has the good copy of the data rejoins the cluster later on, that data - * will be deleted or overwritten with the data of the stale copy that was - * forcefully allocated with this command. To ensure that these implications are - * well-understood, this command requires the flag accept_data_loss to be - * explicitly set to true. + * Allocate a primary shard to a node that holds a stale copy. Accepts the index and shard for index name and shard number, and node + * to allocate the shard to. Using this command may lead to data loss for the provided shard id. If a node which has the good copy + * of the data rejoins the cluster later on, that data will be deleted or overwritten with the data of the stale copy that was + * forcefully allocated with this command. To ensure that these implications are well-understood, this command requires the flag + * accept_data_loss to be explicitly set to true. *

* API name: {@code allocate_stale_primary} + *

*/ + @Nonnull public final Builder allocateStalePrimary( Function> fn ) { - return this.allocateStalePrimary(fn.apply(new CommandAllocatePrimaryAction.Builder()).build()); + return allocateStalePrimary(fn.apply(new CommandAllocatePrimaryAction.Builder()).build()); } /** - * Allocate an empty primary shard to a node. Accepts the index and shard for - * index name and shard number, and node to allocate the shard to. Using this - * command leads to a complete loss of all data that was indexed into this - * shard, if it was previously started. If a node which has a copy of the data - * rejoins the cluster later on, that data will be deleted. To ensure that these - * implications are well-understood, this command requires the flag - * accept_data_loss to be explicitly set to true. + * Cancel allocation of a shard (or recovery). Accepts index and shard for index name and shard number, and node for the node to + * cancel the shard allocation on. This can be used to force resynchronization of existing replicas from the primary shard by + * cancelling them and allowing them to be reinitialized through the standard recovery process. By default only replica shard + * allocations can be cancelled. If it is necessary to cancel the allocation of a primary shard then the allow_primary flag must + * also be included in the request. *

- * API name: {@code allocate_empty_primary} + * API name: {@code cancel} + *

*/ - public final Builder allocateEmptyPrimary(@Nullable CommandAllocatePrimaryAction value) { - this.allocateEmptyPrimary = value; + @Nonnull + public final Builder cancel(@Nullable CommandCancelAction value) { + this.cancel = value; return this; } /** - * Allocate an empty primary shard to a node. Accepts the index and shard for - * index name and shard number, and node to allocate the shard to. Using this - * command leads to a complete loss of all data that was indexed into this - * shard, if it was previously started. If a node which has a copy of the data - * rejoins the cluster later on, that data will be deleted. To ensure that these - * implications are well-understood, this command requires the flag - * accept_data_loss to be explicitly set to true. + * Cancel allocation of a shard (or recovery). Accepts index and shard for index name and shard number, and node for the node to + * cancel the shard allocation on. This can be used to force resynchronization of existing replicas from the primary shard by + * cancelling them and allowing them to be reinitialized through the standard recovery process. By default only replica shard + * allocations can be cancelled. If it is necessary to cancel the allocation of a primary shard then the allow_primary flag must + * also be included in the request. *

- * API name: {@code allocate_empty_primary} + * API name: {@code cancel} + *

*/ - public final Builder allocateEmptyPrimary( - Function> fn - ) { - return this.allocateEmptyPrimary(fn.apply(new CommandAllocatePrimaryAction.Builder()).build()); + @Nonnull + public final Builder cancel(Function> fn) { + return cancel(fn.apply(new CommandCancelAction.Builder()).build()); + } + + /** + * Move a started shard from one node to another node. Accepts index and shard for index name and shard number, from_node for the + * node to move the shard from, and to_node for the node to move the shard to. + *

+ * API name: {@code move} + *

+ */ + @Nonnull + public final Builder move(@Nullable CommandMoveAction value) { + this.move = value; + return this; + } + + /** + * Move a started shard from one node to another node. Accepts index and shard for index name and shard number, from_node for the + * node to move the shard from, and to_node for the node to move the shard to. + *

+ * API name: {@code move} + *

+ */ + @Nonnull + public final Builder move(Function> fn) { + return move(fn.apply(new CommandMoveAction.Builder()).build()); } /** * Builds a {@link Command}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public Command build() { _checkSingleUse(); @@ -387,13 +417,33 @@ public Command build() { ); protected static void setupCommandDeserializer(ObjectDeserializer op) { - - op.add(Builder::cancel, CommandCancelAction._DESERIALIZER, "cancel"); - op.add(Builder::move, CommandMoveAction._DESERIALIZER, "move"); + op.add(Builder::allocateEmptyPrimary, CommandAllocatePrimaryAction._DESERIALIZER, "allocate_empty_primary"); op.add(Builder::allocateReplica, CommandAllocateReplicaAction._DESERIALIZER, "allocate_replica"); op.add(Builder::allocateStalePrimary, CommandAllocatePrimaryAction._DESERIALIZER, "allocate_stale_primary"); - op.add(Builder::allocateEmptyPrimary, CommandAllocatePrimaryAction._DESERIALIZER, "allocate_empty_primary"); + op.add(Builder::cancel, CommandCancelAction._DESERIALIZER, "cancel"); + op.add(Builder::move, CommandMoveAction._DESERIALIZER, "move"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allocateEmptyPrimary); + result = 31 * result + Objects.hashCode(this.allocateReplica); + result = 31 * result + Objects.hashCode(this.allocateStalePrimary); + result = 31 * result + Objects.hashCode(this.cancel); + result = 31 * result + Objects.hashCode(this.move); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + Command other = (Command) o; + return Objects.equals(this.allocateEmptyPrimary, other.allocateEmptyPrimary) + && Objects.equals(this.allocateReplica, other.allocateReplica) + && Objects.equals(this.allocateStalePrimary, other.allocateStalePrimary) + && Objects.equals(this.cancel, other.cancel) + && Objects.equals(this.move, other.move); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/CommandAllocatePrimaryAction.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/CommandAllocatePrimaryAction.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/CommandAllocatePrimaryAction.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/CommandAllocatePrimaryAction.java index 5c5e1df2f4..7856a58766 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/CommandAllocatePrimaryAction.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/CommandAllocatePrimaryAction.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.reroute; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,72 +47,84 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.reroute.CommandAllocatePrimaryAction @JsonpDeserializable -public class CommandAllocatePrimaryAction implements PlainJsonSerializable { - private final String index; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CommandAllocatePrimaryAction + implements + PlainJsonSerializable, + ToCopyableBuilder { - private final int shard; + private final boolean acceptDataLoss; + + @Nonnull + private final String index; + @Nonnull private final String node; - private final boolean acceptDataLoss; + private final int shard; // --------------------------------------------------------------------------------------------- private CommandAllocatePrimaryAction(Builder builder) { - + this.acceptDataLoss = ApiTypeHelper.requireNonNull(builder.acceptDataLoss, this, "acceptDataLoss"); this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - this.shard = ApiTypeHelper.requireNonNull(builder.shard, this, "shard"); this.node = ApiTypeHelper.requireNonNull(builder.node, this, "node"); - this.acceptDataLoss = ApiTypeHelper.requireNonNull(builder.acceptDataLoss, this, "acceptDataLoss"); - + this.shard = ApiTypeHelper.requireNonNull(builder.shard, this, "shard"); } - public static CommandAllocatePrimaryAction of(Function> fn) { + public static CommandAllocatePrimaryAction of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code index} + * Required - If a node which has a copy of the data rejoins the cluster later on, that data will be deleted. To ensure that these + * implications are well-understood, this command requires the flag accept_data_loss to be explicitly set to + * true. + *

+ * API name: {@code accept_data_loss} + *

*/ - public final String index() { - return this.index; + public final boolean acceptDataLoss() { + return this.acceptDataLoss; } /** - * Required - API name: {@code shard} + * Required - API name: {@code index} */ - public final int shard() { - return this.shard; + @Nonnull + public final String index() { + return this.index; } /** * Required - API name: {@code node} */ + @Nonnull public final String node() { return this.node; } /** - * Required - If a node which has a copy of the data rejoins the cluster later - * on, that data will be deleted. To ensure that these implications are - * well-understood, this command requires the flag accept_data_loss to be - * explicitly set to true - *

- * API name: {@code accept_data_loss} + * Required - API name: {@code shard} */ - public final boolean acceptDataLoss() { - return this.acceptDataLoss; + public final int shard() { + return this.shard; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -114,79 +132,111 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("accept_data_loss"); + generator.write(this.acceptDataLoss); generator.writeKey("index"); generator.write(this.index); - generator.writeKey("shard"); - generator.write(this.shard); - generator.writeKey("node"); generator.write(this.node); - generator.writeKey("accept_data_loss"); - generator.write(this.acceptDataLoss); - + generator.writeKey("shard"); + generator.write(this.shard); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link CommandAllocatePrimaryAction}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private Boolean acceptDataLoss; private String index; - + private String node; private Integer shard; - private String node; + public Builder() {} - private Boolean acceptDataLoss; + private Builder(CommandAllocatePrimaryAction o) { + this.acceptDataLoss = o.acceptDataLoss; + this.index = o.index; + this.node = o.node; + this.shard = o.shard; + } + + private Builder(Builder o) { + this.acceptDataLoss = o.acceptDataLoss; + this.index = o.index; + this.node = o.node; + this.shard = o.shard; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * Required - API name: {@code index} + * Required - If a node which has a copy of the data rejoins the cluster later on, that data will be deleted. To ensure that these + * implications are well-understood, this command requires the flag accept_data_loss to be explicitly set to + * true. + *

+ * API name: {@code accept_data_loss} + *

*/ - public final Builder index(String value) { - this.index = value; + @Nonnull + public final Builder acceptDataLoss(boolean value) { + this.acceptDataLoss = value; return this; } /** - * Required - API name: {@code shard} + * Required - API name: {@code index} */ - public final Builder shard(int value) { - this.shard = value; + @Nonnull + public final Builder index(String value) { + this.index = value; return this; } /** * Required - API name: {@code node} */ + @Nonnull public final Builder node(String value) { this.node = value; return this; } /** - * Required - If a node which has a copy of the data rejoins the cluster later - * on, that data will be deleted. To ensure that these implications are - * well-understood, this command requires the flag accept_data_loss to be - * explicitly set to true - *

- * API name: {@code accept_data_loss} + * Required - API name: {@code shard} */ - public final Builder acceptDataLoss(boolean value) { - this.acceptDataLoss = value; + @Nonnull + public final Builder shard(int value) { + this.shard = value; return this; } /** * Builds a {@link CommandAllocatePrimaryAction}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public CommandAllocatePrimaryAction build() { _checkSingleUse(); @@ -205,12 +255,30 @@ public CommandAllocatePrimaryAction build() { ); protected static void setupCommandAllocatePrimaryActionDeserializer(ObjectDeserializer op) { - + op.add(Builder::acceptDataLoss, JsonpDeserializer.booleanDeserializer(), "accept_data_loss"); op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); - op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard"); op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node"); - op.add(Builder::acceptDataLoss, JsonpDeserializer.booleanDeserializer(), "accept_data_loss"); + op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Boolean.hashCode(this.acceptDataLoss); + result = 31 * result + this.index.hashCode(); + result = 31 * result + this.node.hashCode(); + result = 31 * result + Integer.hashCode(this.shard); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CommandAllocatePrimaryAction other = (CommandAllocatePrimaryAction) o; + return this.acceptDataLoss == other.acceptDataLoss + && this.index.equals(other.index) + && this.node.equals(other.node) + && this.shard == other.shard; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/CommandAllocateReplicaAction.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/CommandAllocateReplicaAction.java similarity index 69% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/CommandAllocateReplicaAction.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/CommandAllocateReplicaAction.java index 58c12dce13..d8b2dfee56 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/CommandAllocateReplicaAction.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/CommandAllocateReplicaAction.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.reroute; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,57 +47,69 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.reroute.CommandAllocateReplicaAction @JsonpDeserializable -public class CommandAllocateReplicaAction implements PlainJsonSerializable { - private final String index; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CommandAllocateReplicaAction + implements + PlainJsonSerializable, + ToCopyableBuilder { - private final int shard; + @Nonnull + private final String index; + @Nonnull private final String node; + private final int shard; + // --------------------------------------------------------------------------------------------- private CommandAllocateReplicaAction(Builder builder) { - this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - this.shard = ApiTypeHelper.requireNonNull(builder.shard, this, "shard"); this.node = ApiTypeHelper.requireNonNull(builder.node, this, "node"); - + this.shard = ApiTypeHelper.requireNonNull(builder.shard, this, "shard"); } - public static CommandAllocateReplicaAction of(Function> fn) { + public static CommandAllocateReplicaAction of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code index} */ + @Nonnull public final String index() { return this.index; } /** - * Required - API name: {@code shard} + * Required - API name: {@code node} */ - public final int shard() { - return this.shard; + @Nonnull + public final String node() { + return this.node; } /** - * Required - API name: {@code node} + * Required - API name: {@code shard} */ - public final String node() { - return this.node; + public final int shard() { + return this.shard; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -99,61 +117,91 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("index"); generator.write(this.index); - generator.writeKey("shard"); - generator.write(this.shard); - generator.writeKey("node"); generator.write(this.node); + generator.writeKey("shard"); + generator.write(this.shard); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link CommandAllocateReplicaAction}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private String index; - + private String node; private Integer shard; - private String node; + public Builder() {} + + private Builder(CommandAllocateReplicaAction o) { + this.index = o.index; + this.node = o.node; + this.shard = o.shard; + } + + private Builder(Builder o) { + this.index = o.index; + this.node = o.node; + this.shard = o.shard; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** * Required - API name: {@code index} */ + @Nonnull public final Builder index(String value) { this.index = value; return this; } /** - * Required - API name: {@code shard} + * Required - API name: {@code node} */ - public final Builder shard(int value) { - this.shard = value; + @Nonnull + public final Builder node(String value) { + this.node = value; return this; } /** - * Required - API name: {@code node} + * Required - API name: {@code shard} */ - public final Builder node(String value) { - this.node = value; + @Nonnull + public final Builder shard(int value) { + this.shard = value; return this; } /** * Builds a {@link CommandAllocateReplicaAction}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public CommandAllocateReplicaAction build() { _checkSingleUse(); @@ -172,11 +220,25 @@ public CommandAllocateReplicaAction build() { ); protected static void setupCommandAllocateReplicaActionDeserializer(ObjectDeserializer op) { - op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); - op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard"); op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node"); + op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.index.hashCode(); + result = 31 * result + this.node.hashCode(); + result = 31 * result + Integer.hashCode(this.shard); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CommandAllocateReplicaAction other = (CommandAllocateReplicaAction) o; + return this.index.equals(other.index) && this.node.equals(other.node) && this.shard == other.shard; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/CommandCancelAction.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/CommandCancelAction.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/CommandCancelAction.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/CommandCancelAction.java index c3bbba356f..fc28c67af5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/CommandCancelAction.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/CommandCancelAction.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.reroute; 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; @@ -42,69 +49,76 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.reroute.CommandCancelAction @JsonpDeserializable -public class CommandCancelAction implements PlainJsonSerializable { - private final String index; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CommandCancelAction implements PlainJsonSerializable, ToCopyableBuilder { - private final int shard; + @Nullable + private final Boolean allowPrimary; + + @Nonnull + private final String index; + @Nonnull private final String node; - @Nullable - private final Boolean allowPrimary; + private final int shard; // --------------------------------------------------------------------------------------------- private CommandCancelAction(Builder builder) { - + this.allowPrimary = builder.allowPrimary; this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - this.shard = ApiTypeHelper.requireNonNull(builder.shard, this, "shard"); this.node = ApiTypeHelper.requireNonNull(builder.node, this, "node"); - this.allowPrimary = builder.allowPrimary; - + this.shard = ApiTypeHelper.requireNonNull(builder.shard, this, "shard"); } - public static CommandCancelAction of(Function> fn) { + public static CommandCancelAction of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code index} + * API name: {@code allow_primary} */ - public final String index() { - return this.index; + @Nullable + public final Boolean allowPrimary() { + return this.allowPrimary; } /** - * Required - API name: {@code shard} + * Required - API name: {@code index} */ - public final int shard() { - return this.shard; + @Nonnull + public final String index() { + return this.index; } /** * Required - API name: {@code node} */ + @Nonnull public final String node() { return this.node; } /** - * API name: {@code allow_primary} + * Required - API name: {@code shard} */ - @Nullable - public final Boolean allowPrimary() { - return this.allowPrimary; + public final int shard() { + return this.shard; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -112,78 +126,109 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.allowPrimary != null) { + generator.writeKey("allow_primary"); + generator.write(this.allowPrimary); + } generator.writeKey("index"); generator.write(this.index); - generator.writeKey("shard"); - generator.write(this.shard); - generator.writeKey("node"); generator.write(this.node); - if (this.allowPrimary != null) { - generator.writeKey("allow_primary"); - generator.write(this.allowPrimary); + generator.writeKey("shard"); + generator.write(this.shard); + } - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link CommandCancelAction}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Boolean allowPrimary; private String index; - + private String node; private Integer shard; - private String node; + public Builder() {} - @Nullable - private Boolean allowPrimary; + private Builder(CommandCancelAction o) { + this.allowPrimary = o.allowPrimary; + this.index = o.index; + this.node = o.node; + this.shard = o.shard; + } + + private Builder(Builder o) { + this.allowPrimary = o.allowPrimary; + this.index = o.index; + this.node = o.node; + this.shard = o.shard; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * Required - API name: {@code index} + * API name: {@code allow_primary} */ - public final Builder index(String value) { - this.index = value; + @Nonnull + public final Builder allowPrimary(@Nullable Boolean value) { + this.allowPrimary = value; return this; } /** - * Required - API name: {@code shard} + * Required - API name: {@code index} */ - public final Builder shard(int value) { - this.shard = value; + @Nonnull + public final Builder index(String value) { + this.index = value; return this; } /** * Required - API name: {@code node} */ + @Nonnull public final Builder node(String value) { this.node = value; return this; } /** - * API name: {@code allow_primary} + * Required - API name: {@code shard} */ - public final Builder allowPrimary(@Nullable Boolean value) { - this.allowPrimary = value; + @Nonnull + public final Builder shard(int value) { + this.shard = value; return this; } /** * Builds a {@link CommandCancelAction}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public CommandCancelAction build() { _checkSingleUse(); @@ -202,12 +247,30 @@ public CommandCancelAction build() { ); protected static void setupCommandCancelActionDeserializer(ObjectDeserializer op) { - + op.add(Builder::allowPrimary, JsonpDeserializer.booleanDeserializer(), "allow_primary"); op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); - op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard"); op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node"); - op.add(Builder::allowPrimary, JsonpDeserializer.booleanDeserializer(), "allow_primary"); + op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allowPrimary); + result = 31 * result + this.index.hashCode(); + result = 31 * result + this.node.hashCode(); + result = 31 * result + Integer.hashCode(this.shard); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CommandCancelAction other = (CommandCancelAction) o; + return Objects.equals(this.allowPrimary, other.allowPrimary) + && this.index.equals(other.index) + && this.node.equals(other.node) + && this.shard == other.shard; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/CommandMoveAction.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/CommandMoveAction.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/CommandMoveAction.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/CommandMoveAction.java index 1d6c6222b3..76ea126c17 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/CommandMoveAction.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/CommandMoveAction.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.reroute; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,39 +47,56 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.reroute.CommandMoveAction @JsonpDeserializable -public class CommandMoveAction implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CommandMoveAction implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final String fromNode; + + @Nonnull private final String index; private final int shard; - private final String fromNode; - + @Nonnull private final String toNode; // --------------------------------------------------------------------------------------------- private CommandMoveAction(Builder builder) { - + this.fromNode = ApiTypeHelper.requireNonNull(builder.fromNode, this, "fromNode"); this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); this.shard = ApiTypeHelper.requireNonNull(builder.shard, this, "shard"); - this.fromNode = ApiTypeHelper.requireNonNull(builder.fromNode, this, "fromNode"); this.toNode = ApiTypeHelper.requireNonNull(builder.toNode, this, "toNode"); - } - public static CommandMoveAction of(Function> fn) { + public static CommandMoveAction of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * Required - The node to move the shard from + *

+ * API name: {@code from_node} + *

+ */ + @Nonnull + public final String fromNode() { + return this.fromNode; + } + /** * Required - API name: {@code index} */ + @Nonnull public final String index() { return this.index; } @@ -85,20 +108,13 @@ public final int shard() { return this.shard; } - /** - * Required - The node to move the shard from - *

- * API name: {@code from_node} - */ - public final String fromNode() { - return this.fromNode; - } - /** * Required - The node to move the shard to *

* API name: {@code to_node} + *

*/ + @Nonnull public final String toNode() { return this.toNode; } @@ -106,6 +122,7 @@ public final String toNode() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -113,6 +130,8 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("from_node"); + generator.write(this.fromNode); generator.writeKey("index"); generator.write(this.index); @@ -120,32 +139,70 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("shard"); generator.write(this.shard); - generator.writeKey("from_node"); - generator.write(this.fromNode); - generator.writeKey("to_node"); generator.write(this.toNode); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link CommandMoveAction}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private String fromNode; private String index; - private Integer shard; + private String toNode; - private String fromNode; + public Builder() {} - private String toNode; + private Builder(CommandMoveAction o) { + this.fromNode = o.fromNode; + this.index = o.index; + this.shard = o.shard; + this.toNode = o.toNode; + } + + private Builder(Builder o) { + this.fromNode = o.fromNode; + this.index = o.index; + this.shard = o.shard; + this.toNode = o.toNode; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - The node to move the shard from + *

+ * API name: {@code from_node} + *

+ */ + @Nonnull + public final Builder fromNode(String value) { + this.fromNode = value; + return this; + } /** * Required - API name: {@code index} */ + @Nonnull public final Builder index(String value) { this.index = value; return this; @@ -154,26 +211,19 @@ public final Builder index(String value) { /** * Required - API name: {@code shard} */ + @Nonnull public final Builder shard(int value) { this.shard = value; return this; } - /** - * Required - The node to move the shard from - *

- * API name: {@code from_node} - */ - public final Builder fromNode(String value) { - this.fromNode = value; - return this; - } - /** * Required - The node to move the shard to *

* API name: {@code to_node} + *

*/ + @Nonnull public final Builder toNode(String value) { this.toNode = value; return this; @@ -182,9 +232,10 @@ public final Builder toNode(String value) { /** * Builds a {@link CommandMoveAction}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public CommandMoveAction build() { _checkSingleUse(); @@ -203,12 +254,30 @@ public CommandMoveAction build() { ); protected static void setupCommandMoveActionDeserializer(ObjectDeserializer op) { - + op.add(Builder::fromNode, JsonpDeserializer.stringDeserializer(), "from_node"); op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard"); - op.add(Builder::fromNode, JsonpDeserializer.stringDeserializer(), "from_node"); op.add(Builder::toNode, JsonpDeserializer.stringDeserializer(), "to_node"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.fromNode.hashCode(); + result = 31 * result + this.index.hashCode(); + result = 31 * result + Integer.hashCode(this.shard); + result = 31 * result + this.toNode.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CommandMoveAction other = (CommandMoveAction) o; + return this.fromNode.equals(other.fromNode) + && this.index.equals(other.index) + && this.shard == other.shard + && this.toNode.equals(other.toNode); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/RerouteDecision.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/RerouteDecision.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/RerouteDecision.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/RerouteDecision.java index d9488b90ac..67190891f8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/RerouteDecision.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/RerouteDecision.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.reroute; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,36 +47,42 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.reroute.RerouteDecision @JsonpDeserializable -public class RerouteDecision implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RerouteDecision implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final String decider; + @Nonnull private final String decision; + @Nonnull private final String explanation; // --------------------------------------------------------------------------------------------- private RerouteDecision(Builder builder) { - this.decider = ApiTypeHelper.requireNonNull(builder.decider, this, "decider"); this.decision = ApiTypeHelper.requireNonNull(builder.decision, this, "decision"); this.explanation = ApiTypeHelper.requireNonNull(builder.explanation, this, "explanation"); - } - public static RerouteDecision of(Function> fn) { + public static RerouteDecision of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code decider} */ + @Nonnull public final String decider() { return this.decider; } @@ -78,6 +90,7 @@ public final String decider() { /** * Required - API name: {@code decision} */ + @Nonnull public final String decision() { return this.decision; } @@ -85,6 +98,7 @@ public final String decision() { /** * Required - API name: {@code explanation} */ + @Nonnull public final String explanation() { return this.explanation; } @@ -92,6 +106,7 @@ public final String explanation() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -99,7 +114,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("decider"); generator.write(this.decider); @@ -108,25 +122,53 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("explanation"); generator.write(this.explanation); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RerouteDecision}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private String decider; - private String decision; - private String explanation; + public Builder() {} + + private Builder(RerouteDecision o) { + this.decider = o.decider; + this.decision = o.decision; + this.explanation = o.explanation; + } + + private Builder(Builder o) { + this.decider = o.decider; + this.decision = o.decision; + this.explanation = o.explanation; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code decider} */ + @Nonnull public final Builder decider(String value) { this.decider = value; return this; @@ -135,6 +177,7 @@ public final Builder decider(String value) { /** * Required - API name: {@code decision} */ + @Nonnull public final Builder decision(String value) { this.decision = value; return this; @@ -143,6 +186,7 @@ public final Builder decision(String value) { /** * Required - API name: {@code explanation} */ + @Nonnull public final Builder explanation(String value) { this.explanation = value; return this; @@ -151,9 +195,10 @@ public final Builder explanation(String value) { /** * Builds a {@link RerouteDecision}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RerouteDecision build() { _checkSingleUse(); @@ -172,11 +217,25 @@ public RerouteDecision build() { ); protected static void setupRerouteDecisionDeserializer(ObjectDeserializer op) { - op.add(Builder::decider, JsonpDeserializer.stringDeserializer(), "decider"); op.add(Builder::decision, JsonpDeserializer.stringDeserializer(), "decision"); op.add(Builder::explanation, JsonpDeserializer.stringDeserializer(), "explanation"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.decider.hashCode(); + result = 31 * result + this.decision.hashCode(); + result = 31 * result + this.explanation.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RerouteDecision other = (RerouteDecision) o; + return this.decider.equals(other.decider) && this.decision.equals(other.decision) && this.explanation.equals(other.explanation); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/RerouteExplanation.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/RerouteExplanation.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/RerouteExplanation.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/RerouteExplanation.java index 9b98cbf783..fd91b2a766 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/RerouteExplanation.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/RerouteExplanation.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.reroute; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,36 +48,42 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.reroute.RerouteExplanation @JsonpDeserializable -public class RerouteExplanation implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RerouteExplanation implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final String command; + @Nonnull private final List decisions; + @Nonnull private final RerouteParameters parameters; // --------------------------------------------------------------------------------------------- private RerouteExplanation(Builder builder) { - this.command = ApiTypeHelper.requireNonNull(builder.command, this, "command"); this.decisions = ApiTypeHelper.unmodifiableRequired(builder.decisions, this, "decisions"); this.parameters = ApiTypeHelper.requireNonNull(builder.parameters, this, "parameters"); - } - public static RerouteExplanation of(Function> fn) { + public static RerouteExplanation of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code command} */ + @Nonnull public final String command() { return this.command; } @@ -79,6 +91,7 @@ public final String command() { /** * Required - API name: {@code decisions} */ + @Nonnull public final List decisions() { return this.decisions; } @@ -86,6 +99,7 @@ public final List decisions() { /** * Required - API name: {@code parameters} */ + @Nonnull public final RerouteParameters parameters() { return this.parameters; } @@ -93,6 +107,7 @@ public final RerouteParameters parameters() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -100,41 +115,65 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("command"); generator.write(this.command); - if (ApiTypeHelper.isDefined(this.decisions)) { - generator.writeKey("decisions"); - generator.writeStartArray(); - for (RerouteDecision item0 : this.decisions) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("decisions"); + generator.writeStartArray(); + for (RerouteDecision item0 : this.decisions) { + item0.serialize(generator, mapper); } + generator.writeEnd(); + generator.writeKey("parameters"); this.parameters.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RerouteExplanation}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private String command; - private List decisions; - private RerouteParameters parameters; + public Builder() {} + + private Builder(RerouteExplanation o) { + this.command = o.command; + this.decisions = _listCopy(o.decisions); + this.parameters = o.parameters; + } + + private Builder(Builder o) { + this.command = o.command; + this.decisions = _listCopy(o.decisions); + this.parameters = o.parameters; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code command} */ + @Nonnull public final Builder command(String value) { this.command = value; return this; @@ -142,9 +181,12 @@ public final Builder command(String value) { /** * Required - API name: {@code decisions} + * *

* Adds all elements of list to decisions. + *

*/ + @Nonnull public final Builder decisions(List list) { this.decisions = _listAddAll(this.decisions, list); return this; @@ -152,9 +194,12 @@ public final Builder decisions(List list) { /** * Required - API name: {@code decisions} + * *

* Adds one or more values to decisions. + *

*/ + @Nonnull public final Builder decisions(RerouteDecision value, RerouteDecision... values) { this.decisions = _listAdd(this.decisions, value, values); return this; @@ -162,9 +207,12 @@ public final Builder decisions(RerouteDecision value, RerouteDecision... values) /** * Required - API name: {@code decisions} + * *

* Adds a value to decisions using a builder lambda. + *

*/ + @Nonnull public final Builder decisions(Function> fn) { return decisions(fn.apply(new RerouteDecision.Builder()).build()); } @@ -172,6 +220,7 @@ public final Builder decisions(Function> fn) { - return this.parameters(fn.apply(new RerouteParameters.Builder()).build()); + return parameters(fn.apply(new RerouteParameters.Builder()).build()); } /** * Builds a {@link RerouteExplanation}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RerouteExplanation build() { _checkSingleUse(); @@ -208,11 +259,25 @@ public RerouteExplanation build() { ); protected static void setupRerouteExplanationDeserializer(ObjectDeserializer op) { - op.add(Builder::command, JsonpDeserializer.stringDeserializer(), "command"); op.add(Builder::decisions, JsonpDeserializer.arrayDeserializer(RerouteDecision._DESERIALIZER), "decisions"); op.add(Builder::parameters, RerouteParameters._DESERIALIZER, "parameters"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.command.hashCode(); + result = 31 * result + this.decisions.hashCode(); + result = 31 * result + this.parameters.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RerouteExplanation other = (RerouteExplanation) o; + return this.command.equals(other.command) && this.decisions.equals(other.decisions) && this.parameters.equals(other.parameters); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/RerouteParameters.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/RerouteParameters.java similarity index 71% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/RerouteParameters.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/RerouteParameters.java index 64a384a950..e74f978fc5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/reroute/RerouteParameters.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/reroute/RerouteParameters.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.reroute; 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; @@ -42,41 +49,45 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.reroute.RerouteParameters @JsonpDeserializable -public class RerouteParameters implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class RerouteParameters implements PlainJsonSerializable, ToCopyableBuilder { + private final boolean allowPrimary; + @Nullable + private final String fromNode; + + @Nonnull private final String index; + @Nonnull private final String node; private final int shard; - @Nullable - private final String fromNode; - @Nullable private final String toNode; // --------------------------------------------------------------------------------------------- private RerouteParameters(Builder builder) { - this.allowPrimary = ApiTypeHelper.requireNonNull(builder.allowPrimary, this, "allowPrimary"); + this.fromNode = builder.fromNode; this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); this.node = ApiTypeHelper.requireNonNull(builder.node, this, "node"); this.shard = ApiTypeHelper.requireNonNull(builder.shard, this, "shard"); - this.fromNode = builder.fromNode; this.toNode = builder.toNode; - } - public static RerouteParameters of(Function> fn) { + public static RerouteParameters of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -87,9 +98,18 @@ public final boolean allowPrimary() { return this.allowPrimary; } + /** + * API name: {@code from_node} + */ + @Nullable + public final String fromNode() { + return this.fromNode; + } + /** * Required - API name: {@code index} */ + @Nonnull public final String index() { return this.index; } @@ -97,6 +117,7 @@ public final String index() { /** * Required - API name: {@code node} */ + @Nonnull public final String node() { return this.node; } @@ -108,14 +129,6 @@ public final int shard() { return this.shard; } - /** - * API name: {@code from_node} - */ - @Nullable - public final String fromNode() { - return this.fromNode; - } - /** * API name: {@code to_node} */ @@ -127,6 +140,7 @@ public final String toNode() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -134,10 +148,14 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("allow_primary"); generator.write(this.allowPrimary); + if (this.fromNode != null) { + generator.writeKey("from_node"); + generator.write(this.fromNode); + } + generator.writeKey("index"); generator.write(this.index); @@ -147,51 +165,86 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("shard"); generator.write(this.shard); - if (this.fromNode != null) { - generator.writeKey("from_node"); - generator.write(this.fromNode); - - } if (this.toNode != null) { generator.writeKey("to_node"); generator.write(this.toNode); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link RerouteParameters}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Boolean allowPrimary; - + @Nullable + private String fromNode; private String index; - private String node; - private Integer shard; - - @Nullable - private String fromNode; - @Nullable private String toNode; + public Builder() {} + + private Builder(RerouteParameters o) { + this.allowPrimary = o.allowPrimary; + this.fromNode = o.fromNode; + this.index = o.index; + this.node = o.node; + this.shard = o.shard; + this.toNode = o.toNode; + } + + private Builder(Builder o) { + this.allowPrimary = o.allowPrimary; + this.fromNode = o.fromNode; + this.index = o.index; + this.node = o.node; + this.shard = o.shard; + this.toNode = o.toNode; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code allow_primary} */ + @Nonnull public final Builder allowPrimary(boolean value) { this.allowPrimary = value; return this; } + /** + * API name: {@code from_node} + */ + @Nonnull + public final Builder fromNode(@Nullable String value) { + this.fromNode = value; + return this; + } + /** * Required - API name: {@code index} */ + @Nonnull public final Builder index(String value) { this.index = value; return this; @@ -200,6 +253,7 @@ public final Builder index(String value) { /** * Required - API name: {@code node} */ + @Nonnull public final Builder node(String value) { this.node = value; return this; @@ -208,22 +262,16 @@ public final Builder node(String value) { /** * Required - API name: {@code shard} */ + @Nonnull public final Builder shard(int value) { this.shard = value; return this; } - /** - * API name: {@code from_node} - */ - public final Builder fromNode(@Nullable String value) { - this.fromNode = value; - return this; - } - /** * API name: {@code to_node} */ + @Nonnull public final Builder toNode(@Nullable String value) { this.toNode = value; return this; @@ -232,9 +280,10 @@ public final Builder toNode(@Nullable String value) { /** * Builds a {@link RerouteParameters}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public RerouteParameters build() { _checkSingleUse(); @@ -253,14 +302,36 @@ public RerouteParameters build() { ); protected static void setupRerouteParametersDeserializer(ObjectDeserializer op) { - op.add(Builder::allowPrimary, JsonpDeserializer.booleanDeserializer(), "allow_primary"); + op.add(Builder::fromNode, JsonpDeserializer.stringDeserializer(), "from_node"); op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node"); op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard"); - op.add(Builder::fromNode, JsonpDeserializer.stringDeserializer(), "from_node"); op.add(Builder::toNode, JsonpDeserializer.stringDeserializer(), "to_node"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Boolean.hashCode(this.allowPrimary); + result = 31 * result + Objects.hashCode(this.fromNode); + result = 31 * result + this.index.hashCode(); + result = 31 * result + this.node.hashCode(); + result = 31 * result + Integer.hashCode(this.shard); + result = 31 * result + Objects.hashCode(this.toNode); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + RerouteParameters other = (RerouteParameters) o; + return this.allowPrimary == other.allowPrimary + && Objects.equals(this.fromNode, other.fromNode) + && this.index.equals(other.index) + && this.node.equals(other.node) + && this.shard == other.shard + && Objects.equals(this.toNode, other.toNode); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/state/ClusterStateMetric.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/state/ClusterStateMetric.java new file mode 100644 index 0000000000..1ae7d5e361 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/state/ClusterStateMetric.java @@ -0,0 +1,77 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.cluster.state; + +import javax.annotation.Generated; +import org.opensearch.client.json.JsonEnum; +import org.opensearch.client.json.JsonpDeserializable; + +// typedef: cluster.state.Metric + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public enum ClusterStateMetric implements JsonEnum { + All("_all"), + + Blocks("blocks"), + + ClusterManagerNode("cluster_manager_node"), + + MasterNode("master_node"), + + Metadata("metadata"), + + Nodes("nodes"), + + RoutingNodes("routing_nodes"), + + RoutingTable("routing_table"), + + Version("version"); + + private final String jsonValue; + + ClusterStateMetric(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(ClusterStateMetric.values()); +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/CharFilterTypes.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/CharFilterTypes.java similarity index 54% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/CharFilterTypes.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/CharFilterTypes.java index 43cea2023a..8072303a88 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/CharFilterTypes.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/CharFilterTypes.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.stats; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,107 +48,150 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.stats.CharFilterTypes @JsonpDeserializable -public class CharFilterTypes implements PlainJsonSerializable { - private final List charFilterTypes; - - private final List tokenizerTypes; - - private final List filterTypes; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class CharFilterTypes implements PlainJsonSerializable, ToCopyableBuilder { + @Nonnull private final List analyzerTypes; + @Nonnull + private final List builtInAnalyzers; + + @Nonnull private final List builtInCharFilters; + @Nonnull + private final List builtInFilters; + + @Nonnull private final List builtInTokenizers; - private final List builtInFilters; + @Nonnull + private final List charFilterTypes; - private final List builtInAnalyzers; + @Nonnull + private final List filterTypes; + + @Nonnull + private final List tokenizerTypes; // --------------------------------------------------------------------------------------------- private CharFilterTypes(Builder builder) { - - this.charFilterTypes = ApiTypeHelper.unmodifiableRequired(builder.charFilterTypes, this, "charFilterTypes"); - this.tokenizerTypes = ApiTypeHelper.unmodifiableRequired(builder.tokenizerTypes, this, "tokenizerTypes"); - this.filterTypes = ApiTypeHelper.unmodifiableRequired(builder.filterTypes, this, "filterTypes"); this.analyzerTypes = ApiTypeHelper.unmodifiableRequired(builder.analyzerTypes, this, "analyzerTypes"); + this.builtInAnalyzers = ApiTypeHelper.unmodifiableRequired(builder.builtInAnalyzers, this, "builtInAnalyzers"); this.builtInCharFilters = ApiTypeHelper.unmodifiableRequired(builder.builtInCharFilters, this, "builtInCharFilters"); - this.builtInTokenizers = ApiTypeHelper.unmodifiableRequired(builder.builtInTokenizers, this, "builtInTokenizers"); this.builtInFilters = ApiTypeHelper.unmodifiableRequired(builder.builtInFilters, this, "builtInFilters"); - this.builtInAnalyzers = ApiTypeHelper.unmodifiableRequired(builder.builtInAnalyzers, this, "builtInAnalyzers"); - + this.builtInTokenizers = ApiTypeHelper.unmodifiableRequired(builder.builtInTokenizers, this, "builtInTokenizers"); + this.charFilterTypes = ApiTypeHelper.unmodifiableRequired(builder.charFilterTypes, this, "charFilterTypes"); + this.filterTypes = ApiTypeHelper.unmodifiableRequired(builder.filterTypes, this, "filterTypes"); + this.tokenizerTypes = ApiTypeHelper.unmodifiableRequired(builder.tokenizerTypes, this, "tokenizerTypes"); } - public static CharFilterTypes of(Function> fn) { + public static CharFilterTypes of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code char_filter_types} + * Required - Contains statistics about analyzer types used in selected nodes. + *

+ * API name: {@code analyzer_types} + *

*/ - public final List charFilterTypes() { - return this.charFilterTypes; + @Nonnull + public final List analyzerTypes() { + return this.analyzerTypes; } /** - * Required - API name: {@code tokenizer_types} + * Required - Contains statistics about built-in analyzers used in selected nodes. + *

+ * API name: {@code built_in_analyzers} + *

*/ - public final List tokenizerTypes() { - return this.tokenizerTypes; + @Nonnull + public final List builtInAnalyzers() { + return this.builtInAnalyzers; } /** - * Required - API name: {@code filter_types} + * Required - Contains statistics about built-in character filters used in selected nodes. + *

+ * API name: {@code built_in_char_filters} + *

*/ - public final List filterTypes() { - return this.filterTypes; + @Nonnull + public final List builtInCharFilters() { + return this.builtInCharFilters; } /** - * Required - API name: {@code analyzer_types} + * Required - Contains statistics about built-in token filters used in selected nodes. + *

+ * API name: {@code built_in_filters} + *

*/ - public final List analyzerTypes() { - return this.analyzerTypes; + @Nonnull + public final List builtInFilters() { + return this.builtInFilters; } /** - * Required - API name: {@code built_in_char_filters} + * Required - Contains statistics about built-in tokenizers used in selected nodes. + *

+ * API name: {@code built_in_tokenizers} + *

*/ - public final List builtInCharFilters() { - return this.builtInCharFilters; + @Nonnull + public final List builtInTokenizers() { + return this.builtInTokenizers; } /** - * Required - API name: {@code built_in_tokenizers} + * Required - Contains statistics about character filter types used in selected nodes. + *

+ * API name: {@code char_filter_types} + *

*/ - public final List builtInTokenizers() { - return this.builtInTokenizers; + @Nonnull + public final List charFilterTypes() { + return this.charFilterTypes; } /** - * Required - API name: {@code built_in_filters} + * Required - Contains statistics about token filter types used in selected nodes. + *

+ * API name: {@code filter_types} + *

*/ - public final List builtInFilters() { - return this.builtInFilters; + @Nonnull + public final List filterTypes() { + return this.filterTypes; } /** - * Required - API name: {@code built_in_analyzers} + * Required - Contains statistics about tokenizer types used in selected nodes. + *

+ * API name: {@code tokenizer_types} + *

*/ - public final List builtInAnalyzers() { - return this.builtInAnalyzers; + @Nonnull + public final List tokenizerTypes() { + return this.tokenizerTypes; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -150,351 +199,502 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.charFilterTypes)) { - generator.writeKey("char_filter_types"); - generator.writeStartArray(); - for (FieldTypes item0 : this.charFilterTypes) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("analyzer_types"); + generator.writeStartArray(); + for (FieldTypes item0 : this.analyzerTypes) { + item0.serialize(generator, mapper); } - if (ApiTypeHelper.isDefined(this.tokenizerTypes)) { - generator.writeKey("tokenizer_types"); - generator.writeStartArray(); - for (FieldTypes item0 : this.tokenizerTypes) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); + generator.writeEnd(); + generator.writeKey("built_in_analyzers"); + generator.writeStartArray(); + for (FieldTypes item0 : this.builtInAnalyzers) { + item0.serialize(generator, mapper); } - if (ApiTypeHelper.isDefined(this.filterTypes)) { - generator.writeKey("filter_types"); - generator.writeStartArray(); - for (FieldTypes item0 : this.filterTypes) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); + generator.writeEnd(); + generator.writeKey("built_in_char_filters"); + generator.writeStartArray(); + for (FieldTypes item0 : this.builtInCharFilters) { + item0.serialize(generator, mapper); } - if (ApiTypeHelper.isDefined(this.analyzerTypes)) { - generator.writeKey("analyzer_types"); - generator.writeStartArray(); - for (FieldTypes item0 : this.analyzerTypes) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); + generator.writeEnd(); + generator.writeKey("built_in_filters"); + generator.writeStartArray(); + for (FieldTypes item0 : this.builtInFilters) { + item0.serialize(generator, mapper); } - if (ApiTypeHelper.isDefined(this.builtInCharFilters)) { - generator.writeKey("built_in_char_filters"); - generator.writeStartArray(); - for (FieldTypes item0 : this.builtInCharFilters) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); + generator.writeEnd(); + generator.writeKey("built_in_tokenizers"); + generator.writeStartArray(); + for (FieldTypes item0 : this.builtInTokenizers) { + item0.serialize(generator, mapper); } - if (ApiTypeHelper.isDefined(this.builtInTokenizers)) { - generator.writeKey("built_in_tokenizers"); - generator.writeStartArray(); - for (FieldTypes item0 : this.builtInTokenizers) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); + generator.writeEnd(); + generator.writeKey("char_filter_types"); + generator.writeStartArray(); + for (FieldTypes item0 : this.charFilterTypes) { + item0.serialize(generator, mapper); } - if (ApiTypeHelper.isDefined(this.builtInFilters)) { - generator.writeKey("built_in_filters"); - generator.writeStartArray(); - for (FieldTypes item0 : this.builtInFilters) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); + generator.writeEnd(); + generator.writeKey("filter_types"); + generator.writeStartArray(); + for (FieldTypes item0 : this.filterTypes) { + item0.serialize(generator, mapper); } - if (ApiTypeHelper.isDefined(this.builtInAnalyzers)) { - generator.writeKey("built_in_analyzers"); - generator.writeStartArray(); - for (FieldTypes item0 : this.builtInAnalyzers) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); + generator.writeEnd(); + generator.writeKey("tokenizer_types"); + generator.writeStartArray(); + for (FieldTypes item0 : this.tokenizerTypes) { + item0.serialize(generator, mapper); } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link CharFilterTypes}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private List analyzerTypes; + private List builtInAnalyzers; + private List builtInCharFilters; + private List builtInFilters; + private List builtInTokenizers; private List charFilterTypes; - - private List tokenizerTypes; - private List filterTypes; + private List tokenizerTypes; - private List analyzerTypes; + public Builder() {} - private List builtInCharFilters; - - private List builtInTokenizers; + private Builder(CharFilterTypes o) { + this.analyzerTypes = _listCopy(o.analyzerTypes); + this.builtInAnalyzers = _listCopy(o.builtInAnalyzers); + this.builtInCharFilters = _listCopy(o.builtInCharFilters); + this.builtInFilters = _listCopy(o.builtInFilters); + this.builtInTokenizers = _listCopy(o.builtInTokenizers); + this.charFilterTypes = _listCopy(o.charFilterTypes); + this.filterTypes = _listCopy(o.filterTypes); + this.tokenizerTypes = _listCopy(o.tokenizerTypes); + } - private List builtInFilters; + private Builder(Builder o) { + this.analyzerTypes = _listCopy(o.analyzerTypes); + this.builtInAnalyzers = _listCopy(o.builtInAnalyzers); + this.builtInCharFilters = _listCopy(o.builtInCharFilters); + this.builtInFilters = _listCopy(o.builtInFilters); + this.builtInTokenizers = _listCopy(o.builtInTokenizers); + this.charFilterTypes = _listCopy(o.charFilterTypes); + this.filterTypes = _listCopy(o.filterTypes); + this.tokenizerTypes = _listCopy(o.tokenizerTypes); + } - private List builtInAnalyzers; + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * Required - API name: {@code char_filter_types} + * Required - Contains statistics about analyzer types used in selected nodes. *

- * Adds all elements of list to charFilterTypes. + * API name: {@code analyzer_types} + *

+ * + *

+ * Adds all elements of list to analyzerTypes. + *

*/ - public final Builder charFilterTypes(List list) { - this.charFilterTypes = _listAddAll(this.charFilterTypes, list); + @Nonnull + public final Builder analyzerTypes(List list) { + this.analyzerTypes = _listAddAll(this.analyzerTypes, list); return this; } /** - * Required - API name: {@code char_filter_types} + * Required - Contains statistics about analyzer types used in selected nodes. *

- * Adds one or more values to charFilterTypes. + * API name: {@code analyzer_types} + *

+ * + *

+ * Adds one or more values to analyzerTypes. + *

*/ - public final Builder charFilterTypes(FieldTypes value, FieldTypes... values) { - this.charFilterTypes = _listAdd(this.charFilterTypes, value, values); + @Nonnull + public final Builder analyzerTypes(FieldTypes value, FieldTypes... values) { + this.analyzerTypes = _listAdd(this.analyzerTypes, value, values); return this; } /** - * Required - API name: {@code char_filter_types} + * Required - Contains statistics about analyzer types used in selected nodes. *

- * Adds a value to charFilterTypes using a builder lambda. + * API name: {@code analyzer_types} + *

+ * + *

+ * Adds a value to analyzerTypes using a builder lambda. + *

*/ - public final Builder charFilterTypes(Function> fn) { - return charFilterTypes(fn.apply(new FieldTypes.Builder()).build()); + @Nonnull + public final Builder analyzerTypes(Function> fn) { + return analyzerTypes(fn.apply(new FieldTypes.Builder()).build()); } /** - * Required - API name: {@code tokenizer_types} + * Required - Contains statistics about built-in analyzers used in selected nodes. *

- * Adds all elements of list to tokenizerTypes. + * API name: {@code built_in_analyzers} + *

+ * + *

+ * Adds all elements of list to builtInAnalyzers. + *

*/ - public final Builder tokenizerTypes(List list) { - this.tokenizerTypes = _listAddAll(this.tokenizerTypes, list); + @Nonnull + public final Builder builtInAnalyzers(List list) { + this.builtInAnalyzers = _listAddAll(this.builtInAnalyzers, list); return this; } /** - * Required - API name: {@code tokenizer_types} + * Required - Contains statistics about built-in analyzers used in selected nodes. *

- * Adds one or more values to tokenizerTypes. + * API name: {@code built_in_analyzers} + *

+ * + *

+ * Adds one or more values to builtInAnalyzers. + *

*/ - public final Builder tokenizerTypes(FieldTypes value, FieldTypes... values) { - this.tokenizerTypes = _listAdd(this.tokenizerTypes, value, values); + @Nonnull + public final Builder builtInAnalyzers(FieldTypes value, FieldTypes... values) { + this.builtInAnalyzers = _listAdd(this.builtInAnalyzers, value, values); return this; } /** - * Required - API name: {@code tokenizer_types} + * Required - Contains statistics about built-in analyzers used in selected nodes. *

- * Adds a value to tokenizerTypes using a builder lambda. + * API name: {@code built_in_analyzers} + *

+ * + *

+ * Adds a value to builtInAnalyzers using a builder lambda. + *

*/ - public final Builder tokenizerTypes(Function> fn) { - return tokenizerTypes(fn.apply(new FieldTypes.Builder()).build()); + @Nonnull + public final Builder builtInAnalyzers(Function> fn) { + return builtInAnalyzers(fn.apply(new FieldTypes.Builder()).build()); } /** - * Required - API name: {@code filter_types} + * Required - Contains statistics about built-in character filters used in selected nodes. *

- * Adds all elements of list to filterTypes. + * API name: {@code built_in_char_filters} + *

+ * + *

+ * Adds all elements of list to builtInCharFilters. + *

*/ - public final Builder filterTypes(List list) { - this.filterTypes = _listAddAll(this.filterTypes, list); + @Nonnull + public final Builder builtInCharFilters(List list) { + this.builtInCharFilters = _listAddAll(this.builtInCharFilters, list); return this; } /** - * Required - API name: {@code filter_types} + * Required - Contains statistics about built-in character filters used in selected nodes. *

- * Adds one or more values to filterTypes. + * API name: {@code built_in_char_filters} + *

+ * + *

+ * Adds one or more values to builtInCharFilters. + *

*/ - public final Builder filterTypes(FieldTypes value, FieldTypes... values) { - this.filterTypes = _listAdd(this.filterTypes, value, values); + @Nonnull + public final Builder builtInCharFilters(FieldTypes value, FieldTypes... values) { + this.builtInCharFilters = _listAdd(this.builtInCharFilters, value, values); return this; } /** - * Required - API name: {@code filter_types} + * Required - Contains statistics about built-in character filters used in selected nodes. *

- * Adds a value to filterTypes using a builder lambda. + * API name: {@code built_in_char_filters} + *

+ * + *

+ * Adds a value to builtInCharFilters using a builder lambda. + *

*/ - public final Builder filterTypes(Function> fn) { - return filterTypes(fn.apply(new FieldTypes.Builder()).build()); + @Nonnull + public final Builder builtInCharFilters(Function> fn) { + return builtInCharFilters(fn.apply(new FieldTypes.Builder()).build()); } /** - * Required - API name: {@code analyzer_types} + * Required - Contains statistics about built-in token filters used in selected nodes. *

- * Adds all elements of list to analyzerTypes. + * API name: {@code built_in_filters} + *

+ * + *

+ * Adds all elements of list to builtInFilters. + *

*/ - public final Builder analyzerTypes(List list) { - this.analyzerTypes = _listAddAll(this.analyzerTypes, list); + @Nonnull + public final Builder builtInFilters(List list) { + this.builtInFilters = _listAddAll(this.builtInFilters, list); return this; } /** - * Required - API name: {@code analyzer_types} + * Required - Contains statistics about built-in token filters used in selected nodes. *

- * Adds one or more values to analyzerTypes. + * API name: {@code built_in_filters} + *

+ * + *

+ * Adds one or more values to builtInFilters. + *

*/ - public final Builder analyzerTypes(FieldTypes value, FieldTypes... values) { - this.analyzerTypes = _listAdd(this.analyzerTypes, value, values); + @Nonnull + public final Builder builtInFilters(FieldTypes value, FieldTypes... values) { + this.builtInFilters = _listAdd(this.builtInFilters, value, values); return this; } /** - * Required - API name: {@code analyzer_types} + * Required - Contains statistics about built-in token filters used in selected nodes. *

- * Adds a value to analyzerTypes using a builder lambda. + * API name: {@code built_in_filters} + *

+ * + *

+ * Adds a value to builtInFilters using a builder lambda. + *

*/ - public final Builder analyzerTypes(Function> fn) { - return analyzerTypes(fn.apply(new FieldTypes.Builder()).build()); + @Nonnull + public final Builder builtInFilters(Function> fn) { + return builtInFilters(fn.apply(new FieldTypes.Builder()).build()); } /** - * Required - API name: {@code built_in_char_filters} + * Required - Contains statistics about built-in tokenizers used in selected nodes. *

- * Adds all elements of list to builtInCharFilters. + * API name: {@code built_in_tokenizers} + *

+ * + *

+ * Adds all elements of list to builtInTokenizers. + *

*/ - public final Builder builtInCharFilters(List list) { - this.builtInCharFilters = _listAddAll(this.builtInCharFilters, list); + @Nonnull + public final Builder builtInTokenizers(List list) { + this.builtInTokenizers = _listAddAll(this.builtInTokenizers, list); return this; } /** - * Required - API name: {@code built_in_char_filters} + * Required - Contains statistics about built-in tokenizers used in selected nodes. *

- * Adds one or more values to builtInCharFilters. + * API name: {@code built_in_tokenizers} + *

+ * + *

+ * Adds one or more values to builtInTokenizers. + *

*/ - public final Builder builtInCharFilters(FieldTypes value, FieldTypes... values) { - this.builtInCharFilters = _listAdd(this.builtInCharFilters, value, values); + @Nonnull + public final Builder builtInTokenizers(FieldTypes value, FieldTypes... values) { + this.builtInTokenizers = _listAdd(this.builtInTokenizers, value, values); return this; } /** - * Required - API name: {@code built_in_char_filters} + * Required - Contains statistics about built-in tokenizers used in selected nodes. *

- * Adds a value to builtInCharFilters using a builder lambda. + * API name: {@code built_in_tokenizers} + *

+ * + *

+ * Adds a value to builtInTokenizers using a builder lambda. + *

*/ - public final Builder builtInCharFilters(Function> fn) { - return builtInCharFilters(fn.apply(new FieldTypes.Builder()).build()); + @Nonnull + public final Builder builtInTokenizers(Function> fn) { + return builtInTokenizers(fn.apply(new FieldTypes.Builder()).build()); } /** - * Required - API name: {@code built_in_tokenizers} + * Required - Contains statistics about character filter types used in selected nodes. *

- * Adds all elements of list to builtInTokenizers. + * API name: {@code char_filter_types} + *

+ * + *

+ * Adds all elements of list to charFilterTypes. + *

*/ - public final Builder builtInTokenizers(List list) { - this.builtInTokenizers = _listAddAll(this.builtInTokenizers, list); + @Nonnull + public final Builder charFilterTypes(List list) { + this.charFilterTypes = _listAddAll(this.charFilterTypes, list); return this; } /** - * Required - API name: {@code built_in_tokenizers} + * Required - Contains statistics about character filter types used in selected nodes. *

- * Adds one or more values to builtInTokenizers. + * API name: {@code char_filter_types} + *

+ * + *

+ * Adds one or more values to charFilterTypes. + *

*/ - public final Builder builtInTokenizers(FieldTypes value, FieldTypes... values) { - this.builtInTokenizers = _listAdd(this.builtInTokenizers, value, values); + @Nonnull + public final Builder charFilterTypes(FieldTypes value, FieldTypes... values) { + this.charFilterTypes = _listAdd(this.charFilterTypes, value, values); return this; } /** - * Required - API name: {@code built_in_tokenizers} + * Required - Contains statistics about character filter types used in selected nodes. *

- * Adds a value to builtInTokenizers using a builder lambda. + * API name: {@code char_filter_types} + *

+ * + *

+ * Adds a value to charFilterTypes using a builder lambda. + *

*/ - public final Builder builtInTokenizers(Function> fn) { - return builtInTokenizers(fn.apply(new FieldTypes.Builder()).build()); + @Nonnull + public final Builder charFilterTypes(Function> fn) { + return charFilterTypes(fn.apply(new FieldTypes.Builder()).build()); } /** - * Required - API name: {@code built_in_filters} + * Required - Contains statistics about token filter types used in selected nodes. *

- * Adds all elements of list to builtInFilters. + * API name: {@code filter_types} + *

+ * + *

+ * Adds all elements of list to filterTypes. + *

*/ - public final Builder builtInFilters(List list) { - this.builtInFilters = _listAddAll(this.builtInFilters, list); + @Nonnull + public final Builder filterTypes(List list) { + this.filterTypes = _listAddAll(this.filterTypes, list); return this; } /** - * Required - API name: {@code built_in_filters} + * Required - Contains statistics about token filter types used in selected nodes. *

- * Adds one or more values to builtInFilters. + * API name: {@code filter_types} + *

+ * + *

+ * Adds one or more values to filterTypes. + *

*/ - public final Builder builtInFilters(FieldTypes value, FieldTypes... values) { - this.builtInFilters = _listAdd(this.builtInFilters, value, values); + @Nonnull + public final Builder filterTypes(FieldTypes value, FieldTypes... values) { + this.filterTypes = _listAdd(this.filterTypes, value, values); return this; } /** - * Required - API name: {@code built_in_filters} + * Required - Contains statistics about token filter types used in selected nodes. *

- * Adds a value to builtInFilters using a builder lambda. + * API name: {@code filter_types} + *

+ * + *

+ * Adds a value to filterTypes using a builder lambda. + *

*/ - public final Builder builtInFilters(Function> fn) { - return builtInFilters(fn.apply(new FieldTypes.Builder()).build()); + @Nonnull + public final Builder filterTypes(Function> fn) { + return filterTypes(fn.apply(new FieldTypes.Builder()).build()); } /** - * Required - API name: {@code built_in_analyzers} + * Required - Contains statistics about tokenizer types used in selected nodes. *

- * Adds all elements of list to builtInAnalyzers. + * API name: {@code tokenizer_types} + *

+ * + *

+ * Adds all elements of list to tokenizerTypes. + *

*/ - public final Builder builtInAnalyzers(List list) { - this.builtInAnalyzers = _listAddAll(this.builtInAnalyzers, list); + @Nonnull + public final Builder tokenizerTypes(List list) { + this.tokenizerTypes = _listAddAll(this.tokenizerTypes, list); return this; } /** - * Required - API name: {@code built_in_analyzers} + * Required - Contains statistics about tokenizer types used in selected nodes. *

- * Adds one or more values to builtInAnalyzers. + * API name: {@code tokenizer_types} + *

+ * + *

+ * Adds one or more values to tokenizerTypes. + *

*/ - public final Builder builtInAnalyzers(FieldTypes value, FieldTypes... values) { - this.builtInAnalyzers = _listAdd(this.builtInAnalyzers, value, values); + @Nonnull + public final Builder tokenizerTypes(FieldTypes value, FieldTypes... values) { + this.tokenizerTypes = _listAdd(this.tokenizerTypes, value, values); return this; } /** - * Required - API name: {@code built_in_analyzers} + * Required - Contains statistics about tokenizer types used in selected nodes. *

- * Adds a value to builtInAnalyzers using a builder lambda. + * API name: {@code tokenizer_types} + *

+ * + *

+ * Adds a value to tokenizerTypes using a builder lambda. + *

*/ - public final Builder builtInAnalyzers(Function> fn) { - return builtInAnalyzers(fn.apply(new FieldTypes.Builder()).build()); + @Nonnull + public final Builder tokenizerTypes(Function> fn) { + return tokenizerTypes(fn.apply(new FieldTypes.Builder()).build()); } /** * Builds a {@link CharFilterTypes}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public CharFilterTypes build() { _checkSingleUse(); @@ -513,16 +713,42 @@ public CharFilterTypes build() { ); protected static void setupCharFilterTypesDeserializer(ObjectDeserializer op) { - - op.add(Builder::charFilterTypes, JsonpDeserializer.arrayDeserializer(FieldTypes._DESERIALIZER), "char_filter_types"); - op.add(Builder::tokenizerTypes, JsonpDeserializer.arrayDeserializer(FieldTypes._DESERIALIZER), "tokenizer_types"); - op.add(Builder::filterTypes, JsonpDeserializer.arrayDeserializer(FieldTypes._DESERIALIZER), "filter_types"); op.add(Builder::analyzerTypes, JsonpDeserializer.arrayDeserializer(FieldTypes._DESERIALIZER), "analyzer_types"); + op.add(Builder::builtInAnalyzers, JsonpDeserializer.arrayDeserializer(FieldTypes._DESERIALIZER), "built_in_analyzers"); op.add(Builder::builtInCharFilters, JsonpDeserializer.arrayDeserializer(FieldTypes._DESERIALIZER), "built_in_char_filters"); - op.add(Builder::builtInTokenizers, JsonpDeserializer.arrayDeserializer(FieldTypes._DESERIALIZER), "built_in_tokenizers"); op.add(Builder::builtInFilters, JsonpDeserializer.arrayDeserializer(FieldTypes._DESERIALIZER), "built_in_filters"); - op.add(Builder::builtInAnalyzers, JsonpDeserializer.arrayDeserializer(FieldTypes._DESERIALIZER), "built_in_analyzers"); + op.add(Builder::builtInTokenizers, JsonpDeserializer.arrayDeserializer(FieldTypes._DESERIALIZER), "built_in_tokenizers"); + op.add(Builder::charFilterTypes, JsonpDeserializer.arrayDeserializer(FieldTypes._DESERIALIZER), "char_filter_types"); + op.add(Builder::filterTypes, JsonpDeserializer.arrayDeserializer(FieldTypes._DESERIALIZER), "filter_types"); + op.add(Builder::tokenizerTypes, JsonpDeserializer.arrayDeserializer(FieldTypes._DESERIALIZER), "tokenizer_types"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.analyzerTypes.hashCode(); + result = 31 * result + this.builtInAnalyzers.hashCode(); + result = 31 * result + this.builtInCharFilters.hashCode(); + result = 31 * result + this.builtInFilters.hashCode(); + result = 31 * result + this.builtInTokenizers.hashCode(); + result = 31 * result + this.charFilterTypes.hashCode(); + result = 31 * result + this.filterTypes.hashCode(); + result = 31 * result + this.tokenizerTypes.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + CharFilterTypes other = (CharFilterTypes) o; + return this.analyzerTypes.equals(other.analyzerTypes) + && this.builtInAnalyzers.equals(other.builtInAnalyzers) + && this.builtInCharFilters.equals(other.builtInCharFilters) + && this.builtInFilters.equals(other.builtInFilters) + && this.builtInTokenizers.equals(other.builtInTokenizers) + && this.charFilterTypes.equals(other.charFilterTypes) + && this.filterTypes.equals(other.filterTypes) + && this.tokenizerTypes.equals(other.tokenizerTypes); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterFileSystem.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterFileSystem.java new file mode 100644 index 0000000000..2871a8f179 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterFileSystem.java @@ -0,0 +1,460 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.cluster.stats; + +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.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: cluster.stats.ClusterFileSystem + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterFileSystem implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final String available; + + private final long availableInBytes; + + @Nullable + private final String cacheReserved; + + @Nullable + private final Long cacheReservedInBytes; + + @Nullable + private final String free; + + private final long freeInBytes; + + @Nullable + private final String total; + + private final long totalInBytes; + + // --------------------------------------------------------------------------------------------- + + private ClusterFileSystem(Builder builder) { + this.available = builder.available; + this.availableInBytes = ApiTypeHelper.requireNonNull(builder.availableInBytes, this, "availableInBytes"); + this.cacheReserved = builder.cacheReserved; + this.cacheReservedInBytes = builder.cacheReservedInBytes; + this.free = builder.free; + this.freeInBytes = ApiTypeHelper.requireNonNull(builder.freeInBytes, this, "freeInBytes"); + this.total = builder.total; + this.totalInBytes = ApiTypeHelper.requireNonNull(builder.totalInBytes, this, "totalInBytes"); + } + + public static ClusterFileSystem of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Total number of bytes available to JVM in file stores across all selected nodes. Depending on operating system or process-level + * restrictions, this number may be less than nodes.fs.free_in_byes. This is the actual amount of free disk space the + * selected OpenSearch nodes can use. + *

+ * API name: {@code available} + *

+ */ + @Nullable + public final String available() { + return this.available; + } + + /** + * Required - Total number of bytes available to JVM in file stores across all selected nodes. Depending on operating system or + * process-level restrictions, this number may be less than nodes.fs.free_in_byes. This is the actual amount of free disk + * space the selected OpenSearch nodes can use. + *

+ * API name: {@code available_in_bytes} + *

+ */ + public final long availableInBytes() { + return this.availableInBytes; + } + + /** + * Total size, of all cache reserved across all selected nodes. + *

+ * API name: {@code cache_reserved} + *

+ */ + @Nullable + public final String cacheReserved() { + return this.cacheReserved; + } + + /** + * Total size, in bytes, of all cache reserved across all selected nodes. + *

+ * API name: {@code cache_reserved_in_bytes} + *

+ */ + @Nullable + public final Long cacheReservedInBytes() { + return this.cacheReservedInBytes; + } + + /** + * Total number of unallocated bytes in file stores across all selected nodes. + *

+ * API name: {@code free} + *

+ */ + @Nullable + public final String free() { + return this.free; + } + + /** + * Required - Total number of unallocated bytes in file stores across all selected nodes. + *

+ * API name: {@code free_in_bytes} + *

+ */ + public final long freeInBytes() { + return this.freeInBytes; + } + + /** + * Total size, of all file stores across all selected nodes. + *

+ * API name: {@code total} + *

+ */ + @Nullable + public final String total() { + return this.total; + } + + /** + * Required - Total size, in bytes, of all file stores across all selected nodes. + *

+ * API name: {@code total_in_bytes} + *

+ */ + public final long totalInBytes() { + return this.totalInBytes; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.available != null) { + generator.writeKey("available"); + generator.write(this.available); + } + + generator.writeKey("available_in_bytes"); + generator.write(this.availableInBytes); + + if (this.cacheReserved != null) { + generator.writeKey("cache_reserved"); + generator.write(this.cacheReserved); + } + + if (this.cacheReservedInBytes != null) { + generator.writeKey("cache_reserved_in_bytes"); + generator.write(this.cacheReservedInBytes); + } + + if (this.free != null) { + generator.writeKey("free"); + generator.write(this.free); + } + + generator.writeKey("free_in_bytes"); + generator.write(this.freeInBytes); + + if (this.total != null) { + generator.writeKey("total"); + generator.write(this.total); + } + + generator.writeKey("total_in_bytes"); + generator.write(this.totalInBytes); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link ClusterFileSystem}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String available; + private Long availableInBytes; + @Nullable + private String cacheReserved; + @Nullable + private Long cacheReservedInBytes; + @Nullable + private String free; + private Long freeInBytes; + @Nullable + private String total; + private Long totalInBytes; + + public Builder() {} + + private Builder(ClusterFileSystem o) { + this.available = o.available; + this.availableInBytes = o.availableInBytes; + this.cacheReserved = o.cacheReserved; + this.cacheReservedInBytes = o.cacheReservedInBytes; + this.free = o.free; + this.freeInBytes = o.freeInBytes; + this.total = o.total; + this.totalInBytes = o.totalInBytes; + } + + private Builder(Builder o) { + this.available = o.available; + this.availableInBytes = o.availableInBytes; + this.cacheReserved = o.cacheReserved; + this.cacheReservedInBytes = o.cacheReservedInBytes; + this.free = o.free; + this.freeInBytes = o.freeInBytes; + this.total = o.total; + this.totalInBytes = o.totalInBytes; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Total number of bytes available to JVM in file stores across all selected nodes. Depending on operating system or process-level + * restrictions, this number may be less than nodes.fs.free_in_byes. This is the actual amount of free disk space the + * selected OpenSearch nodes can use. + *

+ * API name: {@code available} + *

+ */ + @Nonnull + public final Builder available(@Nullable String value) { + this.available = value; + return this; + } + + /** + * Required - Total number of bytes available to JVM in file stores across all selected nodes. Depending on operating system or + * process-level restrictions, this number may be less than nodes.fs.free_in_byes. This is the actual amount of free + * disk space the selected OpenSearch nodes can use. + *

+ * API name: {@code available_in_bytes} + *

+ */ + @Nonnull + public final Builder availableInBytes(long value) { + this.availableInBytes = value; + return this; + } + + /** + * Total size, of all cache reserved across all selected nodes. + *

+ * API name: {@code cache_reserved} + *

+ */ + @Nonnull + public final Builder cacheReserved(@Nullable String value) { + this.cacheReserved = value; + return this; + } + + /** + * Total size, in bytes, of all cache reserved across all selected nodes. + *

+ * API name: {@code cache_reserved_in_bytes} + *

+ */ + @Nonnull + public final Builder cacheReservedInBytes(@Nullable Long value) { + this.cacheReservedInBytes = value; + return this; + } + + /** + * Total number of unallocated bytes in file stores across all selected nodes. + *

+ * API name: {@code free} + *

+ */ + @Nonnull + public final Builder free(@Nullable String value) { + this.free = value; + return this; + } + + /** + * Required - Total number of unallocated bytes in file stores across all selected nodes. + *

+ * API name: {@code free_in_bytes} + *

+ */ + @Nonnull + public final Builder freeInBytes(long value) { + this.freeInBytes = value; + return this; + } + + /** + * Total size, of all file stores across all selected nodes. + *

+ * API name: {@code total} + *

+ */ + @Nonnull + public final Builder total(@Nullable String value) { + this.total = value; + return this; + } + + /** + * Required - Total size, in bytes, of all file stores across all selected nodes. + *

+ * API name: {@code total_in_bytes} + *

+ */ + @Nonnull + public final Builder totalInBytes(long value) { + this.totalInBytes = value; + return this; + } + + /** + * Builds a {@link ClusterFileSystem}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public ClusterFileSystem build() { + _checkSingleUse(); + + return new ClusterFileSystem(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ClusterFileSystem} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ClusterFileSystem::setupClusterFileSystemDeserializer + ); + + protected static void setupClusterFileSystemDeserializer(ObjectDeserializer op) { + op.add(Builder::available, JsonpDeserializer.stringDeserializer(), "available"); + op.add(Builder::availableInBytes, JsonpDeserializer.longDeserializer(), "available_in_bytes"); + op.add(Builder::cacheReserved, JsonpDeserializer.stringDeserializer(), "cache_reserved"); + op.add(Builder::cacheReservedInBytes, JsonpDeserializer.longDeserializer(), "cache_reserved_in_bytes"); + op.add(Builder::free, JsonpDeserializer.stringDeserializer(), "free"); + op.add(Builder::freeInBytes, JsonpDeserializer.longDeserializer(), "free_in_bytes"); + op.add(Builder::total, JsonpDeserializer.stringDeserializer(), "total"); + op.add(Builder::totalInBytes, JsonpDeserializer.longDeserializer(), "total_in_bytes"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.available); + result = 31 * result + Long.hashCode(this.availableInBytes); + result = 31 * result + Objects.hashCode(this.cacheReserved); + result = 31 * result + Objects.hashCode(this.cacheReservedInBytes); + result = 31 * result + Objects.hashCode(this.free); + result = 31 * result + Long.hashCode(this.freeInBytes); + result = 31 * result + Objects.hashCode(this.total); + result = 31 * result + Long.hashCode(this.totalInBytes); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterFileSystem other = (ClusterFileSystem) o; + return Objects.equals(this.available, other.available) + && this.availableInBytes == other.availableInBytes + && Objects.equals(this.cacheReserved, other.cacheReserved) + && Objects.equals(this.cacheReservedInBytes, other.cacheReservedInBytes) + && Objects.equals(this.free, other.free) + && this.freeInBytes == other.freeInBytes + && Objects.equals(this.total, other.total) + && this.totalInBytes == other.totalInBytes; + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterIndices.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterIndices.java similarity index 56% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterIndices.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterIndices.java index 3520b9f0e2..77d8cf1338 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterIndices.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterIndices.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.stats; import jakarta.json.stream.JsonGenerator; import java.util.List; +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; @@ -49,154 +56,160 @@ import org.opensearch.client.opensearch._types.SegmentsStats; import org.opensearch.client.opensearch._types.StoreStats; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.stats.ClusterIndices @JsonpDeserializable -public class ClusterIndices implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterIndices implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final CharFilterTypes analysis; + + @Nullable private final CompletionStats completion; - private final long count; + @Nullable + private final Long count; + @Nullable private final DocStats docs; + @Nullable private final FielddataStats fielddata; + @Nullable + private final FieldTypesMappings mappings; + + @Nullable private final QueryCacheStats queryCache; + @Nullable private final SegmentsStats segments; + @Nullable private final ClusterIndicesShards shards; + @Nullable private final StoreStats store; - private final FieldTypesMappings mappings; - - private final CharFilterTypes analysis; - + @Nonnull private final List versions; // --------------------------------------------------------------------------------------------- private ClusterIndices(Builder builder) { - - this.completion = ApiTypeHelper.requireNonNull(builder.completion, this, "completion"); - this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); - this.docs = ApiTypeHelper.requireNonNull(builder.docs, this, "docs"); - this.fielddata = ApiTypeHelper.requireNonNull(builder.fielddata, this, "fielddata"); - this.queryCache = ApiTypeHelper.requireNonNull(builder.queryCache, this, "queryCache"); - this.segments = ApiTypeHelper.requireNonNull(builder.segments, this, "segments"); - this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); - this.store = ApiTypeHelper.requireNonNull(builder.store, this, "store"); - this.mappings = ApiTypeHelper.requireNonNull(builder.mappings, this, "mappings"); - this.analysis = ApiTypeHelper.requireNonNull(builder.analysis, this, "analysis"); + this.analysis = builder.analysis; + this.completion = builder.completion; + this.count = builder.count; + this.docs = builder.docs; + this.fielddata = builder.fielddata; + this.mappings = builder.mappings; + this.queryCache = builder.queryCache; + this.segments = builder.segments; + this.shards = builder.shards; + this.store = builder.store; this.versions = ApiTypeHelper.unmodifiable(builder.versions); - } - public static ClusterIndices of(Function> fn) { + public static ClusterIndices of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - Contains statistics about memory used for completion in selected - * nodes. - *

+ * API name: {@code analysis} + */ + @Nullable + public final CharFilterTypes analysis() { + return this.analysis; + } + + /** * API name: {@code completion} */ + @Nullable public final CompletionStats completion() { return this.completion; } /** - * Required - Total number of indices with shards assigned to selected nodes. + * Total number of indexes with shards assigned to selected nodes. *

* API name: {@code count} + *

*/ - public final long count() { + @Nullable + public final Long count() { return this.count; } /** - * Required - Contains counts for documents in selected nodes. - *

* API name: {@code docs} */ + @Nullable public final DocStats docs() { return this.docs; } /** - * Required - Contains statistics about the field data cache of selected nodes. - *

* API name: {@code fielddata} */ + @Nullable public final FielddataStats fielddata() { return this.fielddata; } /** - * Required - Contains statistics about the query cache of selected nodes. - *

+ * API name: {@code mappings} + */ + @Nullable + public final FieldTypesMappings mappings() { + return this.mappings; + } + + /** * API name: {@code query_cache} */ + @Nullable public final QueryCacheStats queryCache() { return this.queryCache; } /** - * Required - Contains statistics about segments in selected nodes. - *

* API name: {@code segments} */ + @Nullable public final SegmentsStats segments() { return this.segments; } /** - * Required - Contains statistics about indices with shards assigned to selected - * nodes. - *

* API name: {@code shards} */ + @Nullable public final ClusterIndicesShards shards() { return this.shards; } /** - * Required - Contains statistics about the size of shards assigned to selected - * nodes. - *

* API name: {@code store} */ + @Nullable public final StoreStats store() { return this.store; } /** - * Required - Contains statistics about field mappings in selected nodes. + * Contains statistics about analyzers and analyzer components used in selected nodes. *

- * API name: {@code mappings} - */ - public final FieldTypesMappings mappings() { - return this.mappings; - } - - /** - * Required - Contains statistics about analyzers and analyzer components used - * in selected nodes. - *

- * API name: {@code analysis} - */ - public final CharFilterTypes analysis() { - return this.analysis; - } - - /** * API name: {@code versions} + *

*/ + @Nonnull public final List versions() { return this.versions; } @@ -204,6 +217,7 @@ public final List versions() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -211,294 +225,350 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.analysis != null) { + generator.writeKey("analysis"); + this.analysis.serialize(generator, mapper); + } - generator.writeKey("completion"); - this.completion.serialize(generator, mapper); - - generator.writeKey("count"); - generator.write(this.count); + if (this.completion != null) { + generator.writeKey("completion"); + this.completion.serialize(generator, mapper); + } - generator.writeKey("docs"); - this.docs.serialize(generator, mapper); + if (this.count != null) { + generator.writeKey("count"); + generator.write(this.count); + } - generator.writeKey("fielddata"); - this.fielddata.serialize(generator, mapper); + if (this.docs != null) { + generator.writeKey("docs"); + this.docs.serialize(generator, mapper); + } - generator.writeKey("query_cache"); - this.queryCache.serialize(generator, mapper); + if (this.fielddata != null) { + generator.writeKey("fielddata"); + this.fielddata.serialize(generator, mapper); + } - generator.writeKey("segments"); - this.segments.serialize(generator, mapper); + if (this.mappings != null) { + generator.writeKey("mappings"); + this.mappings.serialize(generator, mapper); + } - generator.writeKey("shards"); - this.shards.serialize(generator, mapper); + if (this.queryCache != null) { + generator.writeKey("query_cache"); + this.queryCache.serialize(generator, mapper); + } - generator.writeKey("store"); - this.store.serialize(generator, mapper); + if (this.segments != null) { + generator.writeKey("segments"); + this.segments.serialize(generator, mapper); + } - generator.writeKey("mappings"); - this.mappings.serialize(generator, mapper); + if (this.shards != null) { + generator.writeKey("shards"); + this.shards.serialize(generator, mapper); + } - generator.writeKey("analysis"); - this.analysis.serialize(generator, mapper); + if (this.store != null) { + generator.writeKey("store"); + this.store.serialize(generator, mapper); + } if (ApiTypeHelper.isDefined(this.versions)) { generator.writeKey("versions"); generator.writeStartArray(); for (IndicesVersions item0 : this.versions) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ClusterIndices}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private CharFilterTypes analysis; + @Nullable private CompletionStats completion; - + @Nullable private Long count; - + @Nullable private DocStats docs; - + @Nullable private FielddataStats fielddata; - + @Nullable + private FieldTypesMappings mappings; + @Nullable private QueryCacheStats queryCache; - + @Nullable private SegmentsStats segments; - + @Nullable private ClusterIndicesShards shards; - + @Nullable private StoreStats store; + @Nullable + private List versions; - private FieldTypesMappings mappings; + public Builder() {} + + private Builder(ClusterIndices o) { + this.analysis = o.analysis; + this.completion = o.completion; + this.count = o.count; + this.docs = o.docs; + this.fielddata = o.fielddata; + this.mappings = o.mappings; + this.queryCache = o.queryCache; + this.segments = o.segments; + this.shards = o.shards; + this.store = o.store; + this.versions = _listCopy(o.versions); + } - private CharFilterTypes analysis; + private Builder(Builder o) { + this.analysis = o.analysis; + this.completion = o.completion; + this.count = o.count; + this.docs = o.docs; + this.fielddata = o.fielddata; + this.mappings = o.mappings; + this.queryCache = o.queryCache; + this.segments = o.segments; + this.shards = o.shards; + this.store = o.store; + this.versions = _listCopy(o.versions); + } - @Nullable - private List versions; + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code analysis} + */ + @Nonnull + public final Builder analysis(@Nullable CharFilterTypes value) { + this.analysis = value; + return this; + } + + /** + * API name: {@code analysis} + */ + @Nonnull + public final Builder analysis(Function> fn) { + return analysis(fn.apply(new CharFilterTypes.Builder()).build()); + } /** - * Required - Contains statistics about memory used for completion in selected - * nodes. - *

* API name: {@code completion} */ - public final Builder completion(CompletionStats value) { + @Nonnull + public final Builder completion(@Nullable CompletionStats value) { this.completion = value; return this; } /** - * Required - Contains statistics about memory used for completion in selected - * nodes. - *

* API name: {@code completion} */ + @Nonnull public final Builder completion(Function> fn) { - return this.completion(fn.apply(new CompletionStats.Builder()).build()); + return completion(fn.apply(new CompletionStats.Builder()).build()); } /** - * Required - Total number of indices with shards assigned to selected nodes. + * Total number of indexes with shards assigned to selected nodes. *

* API name: {@code count} + *

*/ - public final Builder count(long value) { + @Nonnull + public final Builder count(@Nullable Long value) { this.count = value; return this; } /** - * Required - Contains counts for documents in selected nodes. - *

* API name: {@code docs} */ - public final Builder docs(DocStats value) { + @Nonnull + public final Builder docs(@Nullable DocStats value) { this.docs = value; return this; } /** - * Required - Contains counts for documents in selected nodes. - *

* API name: {@code docs} */ + @Nonnull public final Builder docs(Function> fn) { - return this.docs(fn.apply(new DocStats.Builder()).build()); + return docs(fn.apply(new DocStats.Builder()).build()); } /** - * Required - Contains statistics about the field data cache of selected nodes. - *

* API name: {@code fielddata} */ - public final Builder fielddata(FielddataStats value) { + @Nonnull + public final Builder fielddata(@Nullable FielddataStats value) { this.fielddata = value; return this; } /** - * Required - Contains statistics about the field data cache of selected nodes. - *

* API name: {@code fielddata} */ + @Nonnull public final Builder fielddata(Function> fn) { - return this.fielddata(fn.apply(new FielddataStats.Builder()).build()); + return fielddata(fn.apply(new FielddataStats.Builder()).build()); + } + + /** + * API name: {@code mappings} + */ + @Nonnull + public final Builder mappings(@Nullable FieldTypesMappings value) { + this.mappings = value; + return this; + } + + /** + * API name: {@code mappings} + */ + @Nonnull + public final Builder mappings(Function> fn) { + return mappings(fn.apply(new FieldTypesMappings.Builder()).build()); } /** - * Required - Contains statistics about the query cache of selected nodes. - *

* API name: {@code query_cache} */ - public final Builder queryCache(QueryCacheStats value) { + @Nonnull + public final Builder queryCache(@Nullable QueryCacheStats value) { this.queryCache = value; return this; } /** - * Required - Contains statistics about the query cache of selected nodes. - *

* API name: {@code query_cache} */ + @Nonnull public final Builder queryCache(Function> fn) { - return this.queryCache(fn.apply(new QueryCacheStats.Builder()).build()); + return queryCache(fn.apply(new QueryCacheStats.Builder()).build()); } /** - * Required - Contains statistics about segments in selected nodes. - *

* API name: {@code segments} */ - public final Builder segments(SegmentsStats value) { + @Nonnull + public final Builder segments(@Nullable SegmentsStats value) { this.segments = value; return this; } /** - * Required - Contains statistics about segments in selected nodes. - *

* API name: {@code segments} */ + @Nonnull public final Builder segments(Function> fn) { - return this.segments(fn.apply(new SegmentsStats.Builder()).build()); + return segments(fn.apply(new SegmentsStats.Builder()).build()); } /** - * Required - Contains statistics about indices with shards assigned to selected - * nodes. - *

* API name: {@code shards} */ - public final Builder shards(ClusterIndicesShards value) { + @Nonnull + public final Builder shards(@Nullable ClusterIndicesShards value) { this.shards = value; return this; } /** - * Required - Contains statistics about indices with shards assigned to selected - * nodes. - *

* API name: {@code shards} */ + @Nonnull public final Builder shards(Function> fn) { - return this.shards(fn.apply(new ClusterIndicesShards.Builder()).build()); + return shards(fn.apply(new ClusterIndicesShards.Builder()).build()); } /** - * Required - Contains statistics about the size of shards assigned to selected - * nodes. - *

* API name: {@code store} */ - public final Builder store(StoreStats value) { + @Nonnull + public final Builder store(@Nullable StoreStats value) { this.store = value; return this; } /** - * Required - Contains statistics about the size of shards assigned to selected - * nodes. - *

* API name: {@code store} */ + @Nonnull public final Builder store(Function> fn) { - return this.store(fn.apply(new StoreStats.Builder()).build()); - } - - /** - * Required - Contains statistics about field mappings in selected nodes. - *

- * API name: {@code mappings} - */ - public final Builder mappings(FieldTypesMappings value) { - this.mappings = value; - return this; - } - - /** - * Required - Contains statistics about field mappings in selected nodes. - *

- * API name: {@code mappings} - */ - public final Builder mappings(Function> fn) { - return this.mappings(fn.apply(new FieldTypesMappings.Builder()).build()); - } - - /** - * Required - Contains statistics about analyzers and analyzer components used - * in selected nodes. - *

- * API name: {@code analysis} - */ - public final Builder analysis(CharFilterTypes value) { - this.analysis = value; - return this; + return store(fn.apply(new StoreStats.Builder()).build()); } /** - * Required - Contains statistics about analyzers and analyzer components used - * in selected nodes. + * Contains statistics about analyzers and analyzer components used in selected nodes. *

- * API name: {@code analysis} - */ - public final Builder analysis(Function> fn) { - return this.analysis(fn.apply(new CharFilterTypes.Builder()).build()); - } - - /** * API name: {@code versions} + *

+ * *

* Adds all elements of list to versions. + *

*/ + @Nonnull public final Builder versions(List list) { this.versions = _listAddAll(this.versions, list); return this; } /** + * Contains statistics about analyzers and analyzer components used in selected nodes. + *

* API name: {@code versions} + *

+ * *

* Adds one or more values to versions. + *

*/ + @Nonnull public final Builder versions(IndicesVersions value, IndicesVersions... values) { this.versions = _listAdd(this.versions, value, values); return this; } /** + * Contains statistics about analyzers and analyzer components used in selected nodes. + *

* API name: {@code versions} + *

+ * *

* Adds a value to versions using a builder lambda. + *

*/ + @Nonnull public final Builder versions(Function> fn) { return versions(fn.apply(new IndicesVersions.Builder()).build()); } @@ -506,9 +576,10 @@ public final Builder versions(Function op) { - + op.add(Builder::analysis, CharFilterTypes._DESERIALIZER, "analysis"); op.add(Builder::completion, CompletionStats._DESERIALIZER, "completion"); op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); op.add(Builder::docs, DocStats._DESERIALIZER, "docs"); op.add(Builder::fielddata, FielddataStats._DESERIALIZER, "fielddata"); + op.add(Builder::mappings, FieldTypesMappings._DESERIALIZER, "mappings"); op.add(Builder::queryCache, QueryCacheStats._DESERIALIZER, "query_cache"); op.add(Builder::segments, SegmentsStats._DESERIALIZER, "segments"); op.add(Builder::shards, ClusterIndicesShards._DESERIALIZER, "shards"); op.add(Builder::store, StoreStats._DESERIALIZER, "store"); - op.add(Builder::mappings, FieldTypesMappings._DESERIALIZER, "mappings"); - op.add(Builder::analysis, CharFilterTypes._DESERIALIZER, "analysis"); op.add(Builder::versions, JsonpDeserializer.arrayDeserializer(IndicesVersions._DESERIALIZER), "versions"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.analysis); + result = 31 * result + Objects.hashCode(this.completion); + result = 31 * result + Objects.hashCode(this.count); + result = 31 * result + Objects.hashCode(this.docs); + result = 31 * result + Objects.hashCode(this.fielddata); + result = 31 * result + Objects.hashCode(this.mappings); + result = 31 * result + Objects.hashCode(this.queryCache); + result = 31 * result + Objects.hashCode(this.segments); + result = 31 * result + Objects.hashCode(this.shards); + result = 31 * result + Objects.hashCode(this.store); + result = 31 * result + Objects.hashCode(this.versions); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterIndices other = (ClusterIndices) o; + return Objects.equals(this.analysis, other.analysis) + && Objects.equals(this.completion, other.completion) + && Objects.equals(this.count, other.count) + && Objects.equals(this.docs, other.docs) + && Objects.equals(this.fielddata, other.fielddata) + && Objects.equals(this.mappings, other.mappings) + && Objects.equals(this.queryCache, other.queryCache) + && Objects.equals(this.segments, other.segments) + && Objects.equals(this.shards, other.shards) + && Objects.equals(this.store, other.store) + && Objects.equals(this.versions, other.versions); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterIndicesShards.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterIndicesShards.java similarity index 64% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterIndicesShards.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterIndicesShards.java index e4137d918b..b6105431be 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterIndicesShards.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterIndicesShards.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.stats; 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; @@ -41,47 +48,43 @@ import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.stats.ClusterIndicesShards -/** - * Contains statistics about shards assigned to selected nodes. -* - */ @JsonpDeserializable -public class ClusterIndicesShards implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterIndicesShards implements PlainJsonSerializable, ToCopyableBuilder { + @Nullable private final ClusterIndicesShardsIndex index; @Nullable - private final Double primaries; + private final Integer primaries; @Nullable - private final Double replication; + private final Integer replication; @Nullable - private final Double total; + private final Integer total; // --------------------------------------------------------------------------------------------- private ClusterIndicesShards(Builder builder) { - this.index = builder.index; this.primaries = builder.primaries; this.replication = builder.replication; this.total = builder.total; - } - public static ClusterIndicesShards of(Function> fn) { + public static ClusterIndicesShards of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Contains statistics about shards assigned to selected nodes. - *

* API name: {@code index} */ @Nullable @@ -93,9 +96,10 @@ public final ClusterIndicesShardsIndex index() { * Number of primary shards assigned to selected nodes. *

* API name: {@code primaries} + *

*/ @Nullable - public final Double primaries() { + public final Integer primaries() { return this.primaries; } @@ -103,9 +107,10 @@ public final Double primaries() { * Ratio of replica shards to primary shards across all selected nodes. *

* API name: {@code replication} + *

*/ @Nullable - public final Double replication() { + public final Integer replication() { return this.replication; } @@ -113,15 +118,17 @@ public final Double replication() { * Total number of shards assigned to selected nodes. *

* API name: {@code total} + *

*/ @Nullable - public final Double total() { + public final Integer total() { return this.total; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -129,74 +136,100 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.index != null) { generator.writeKey("index"); this.index.serialize(generator, mapper); - } + if (this.primaries != null) { generator.writeKey("primaries"); generator.write(this.primaries); - } + if (this.replication != null) { generator.writeKey("replication"); generator.write(this.replication); - } + if (this.total != null) { generator.writeKey("total"); generator.write(this.total); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ClusterIndicesShards}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private ClusterIndicesShardsIndex index; - @Nullable - private Double primaries; - + private Integer primaries; @Nullable - private Double replication; - + private Integer replication; @Nullable - private Double total; + private Integer total; + + public Builder() {} + + private Builder(ClusterIndicesShards o) { + this.index = o.index; + this.primaries = o.primaries; + this.replication = o.replication; + this.total = o.total; + } + + private Builder(Builder o) { + this.index = o.index; + this.primaries = o.primaries; + this.replication = o.replication; + this.total = o.total; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * Contains statistics about shards assigned to selected nodes. - *

* API name: {@code index} */ + @Nonnull public final Builder index(@Nullable ClusterIndicesShardsIndex value) { this.index = value; return this; } /** - * Contains statistics about shards assigned to selected nodes. - *

* API name: {@code index} */ + @Nonnull public final Builder index(Function> fn) { - return this.index(fn.apply(new ClusterIndicesShardsIndex.Builder()).build()); + return index(fn.apply(new ClusterIndicesShardsIndex.Builder()).build()); } /** * Number of primary shards assigned to selected nodes. *

* API name: {@code primaries} + *

*/ - public final Builder primaries(@Nullable Double value) { + @Nonnull + public final Builder primaries(@Nullable Integer value) { this.primaries = value; return this; } @@ -205,8 +238,10 @@ public final Builder primaries(@Nullable Double value) { * Ratio of replica shards to primary shards across all selected nodes. *

* API name: {@code replication} + *

*/ - public final Builder replication(@Nullable Double value) { + @Nonnull + public final Builder replication(@Nullable Integer value) { this.replication = value; return this; } @@ -215,8 +250,10 @@ public final Builder replication(@Nullable Double value) { * Total number of shards assigned to selected nodes. *

* API name: {@code total} + *

*/ - public final Builder total(@Nullable Double value) { + @Nonnull + public final Builder total(@Nullable Integer value) { this.total = value; return this; } @@ -224,9 +261,10 @@ public final Builder total(@Nullable Double value) { /** * Builds a {@link ClusterIndicesShards}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ClusterIndicesShards build() { _checkSingleUse(); @@ -245,12 +283,30 @@ public ClusterIndicesShards build() { ); protected static void setupClusterIndicesShardsDeserializer(ObjectDeserializer op) { - op.add(Builder::index, ClusterIndicesShardsIndex._DESERIALIZER, "index"); - op.add(Builder::primaries, JsonpDeserializer.doubleDeserializer(), "primaries"); - op.add(Builder::replication, JsonpDeserializer.doubleDeserializer(), "replication"); - op.add(Builder::total, JsonpDeserializer.doubleDeserializer(), "total"); + op.add(Builder::primaries, JsonpDeserializer.integerDeserializer(), "primaries"); + op.add(Builder::replication, JsonpDeserializer.integerDeserializer(), "replication"); + op.add(Builder::total, JsonpDeserializer.integerDeserializer(), "total"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + Objects.hashCode(this.primaries); + result = 31 * result + Objects.hashCode(this.replication); + result = 31 * result + Objects.hashCode(this.total); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterIndicesShards other = (ClusterIndicesShards) o; + return Objects.equals(this.index, other.index) + && Objects.equals(this.primaries, other.primaries) + && Objects.equals(this.replication, other.replication) + && Objects.equals(this.total, other.total); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterIndicesShardsIndex.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterIndicesShardsIndex.java similarity index 68% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterIndicesShardsIndex.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterIndicesShardsIndex.java index e0c709f48b..3d88fca2b4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterIndicesShardsIndex.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterIndicesShardsIndex.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.stats; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,59 +47,70 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.stats.ClusterIndicesShardsIndex @JsonpDeserializable -public class ClusterIndicesShardsIndex implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterIndicesShardsIndex + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull private final ClusterShardMetrics primaries; + @Nonnull private final ClusterShardMetrics replication; + @Nonnull private final ClusterShardMetrics shards; // --------------------------------------------------------------------------------------------- private ClusterIndicesShardsIndex(Builder builder) { - this.primaries = ApiTypeHelper.requireNonNull(builder.primaries, this, "primaries"); this.replication = ApiTypeHelper.requireNonNull(builder.replication, this, "replication"); this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards"); - } - public static ClusterIndicesShardsIndex of(Function> fn) { + public static ClusterIndicesShardsIndex of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - Contains statistics about the number of primary shards assigned to - * selected nodes. + * Required - Contains statistics about the number of primary shards assigned to selected nodes. *

* API name: {@code primaries} + *

*/ + @Nonnull public final ClusterShardMetrics primaries() { return this.primaries; } /** - * Required - Contains statistics about the number of replication shards - * assigned to selected nodes. + * Required - Contains statistics about the number of replication shards assigned to selected nodes. *

* API name: {@code replication} + *

*/ + @Nonnull public final ClusterShardMetrics replication() { return this.replication; } /** - * Required - Contains statistics about the number of shards assigned to - * selected nodes. + * Required - Contains statistics about the number of shards assigned to selected nodes. *

* API name: {@code shards} + *

*/ + @Nonnull public final ClusterShardMetrics shards() { return this.shards; } @@ -101,6 +118,7 @@ public final ClusterShardMetrics shards() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -108,7 +126,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("primaries"); this.primaries.serialize(generator, mapper); @@ -117,91 +134,125 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("shards"); this.shards.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ClusterIndicesShardsIndex}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private ClusterShardMetrics primaries; - private ClusterShardMetrics replication; - private ClusterShardMetrics shards; + public Builder() {} + + private Builder(ClusterIndicesShardsIndex o) { + this.primaries = o.primaries; + this.replication = o.replication; + this.shards = o.shards; + } + + private Builder(Builder o) { + this.primaries = o.primaries; + this.replication = o.replication; + this.shards = o.shards; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Required - Contains statistics about the number of primary shards assigned to - * selected nodes. + * Required - Contains statistics about the number of primary shards assigned to selected nodes. *

* API name: {@code primaries} + *

*/ + @Nonnull public final Builder primaries(ClusterShardMetrics value) { this.primaries = value; return this; } /** - * Required - Contains statistics about the number of primary shards assigned to - * selected nodes. + * Required - Contains statistics about the number of primary shards assigned to selected nodes. *

* API name: {@code primaries} + *

*/ + @Nonnull public final Builder primaries(Function> fn) { - return this.primaries(fn.apply(new ClusterShardMetrics.Builder()).build()); + return primaries(fn.apply(new ClusterShardMetrics.Builder()).build()); } /** - * Required - Contains statistics about the number of replication shards - * assigned to selected nodes. + * Required - Contains statistics about the number of replication shards assigned to selected nodes. *

* API name: {@code replication} + *

*/ + @Nonnull public final Builder replication(ClusterShardMetrics value) { this.replication = value; return this; } /** - * Required - Contains statistics about the number of replication shards - * assigned to selected nodes. + * Required - Contains statistics about the number of replication shards assigned to selected nodes. *

* API name: {@code replication} + *

*/ + @Nonnull public final Builder replication(Function> fn) { - return this.replication(fn.apply(new ClusterShardMetrics.Builder()).build()); + return replication(fn.apply(new ClusterShardMetrics.Builder()).build()); } /** - * Required - Contains statistics about the number of shards assigned to - * selected nodes. + * Required - Contains statistics about the number of shards assigned to selected nodes. *

* API name: {@code shards} + *

*/ + @Nonnull public final Builder shards(ClusterShardMetrics value) { this.shards = value; return this; } /** - * Required - Contains statistics about the number of shards assigned to - * selected nodes. + * Required - Contains statistics about the number of shards assigned to selected nodes. *

* API name: {@code shards} + *

*/ + @Nonnull public final Builder shards(Function> fn) { - return this.shards(fn.apply(new ClusterShardMetrics.Builder()).build()); + return shards(fn.apply(new ClusterShardMetrics.Builder()).build()); } /** * Builds a {@link ClusterIndicesShardsIndex}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ClusterIndicesShardsIndex build() { _checkSingleUse(); @@ -220,11 +271,25 @@ public ClusterIndicesShardsIndex build() { ); protected static void setupClusterIndicesShardsIndexDeserializer(ObjectDeserializer op) { - op.add(Builder::primaries, ClusterShardMetrics._DESERIALIZER, "primaries"); op.add(Builder::replication, ClusterShardMetrics._DESERIALIZER, "replication"); op.add(Builder::shards, ClusterShardMetrics._DESERIALIZER, "shards"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.primaries.hashCode(); + result = 31 * result + this.replication.hashCode(); + result = 31 * result + this.shards.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterIndicesShardsIndex other = (ClusterIndicesShardsIndex) o; + return this.primaries.equals(other.primaries) && this.replication.equals(other.replication) && this.shards.equals(other.shards); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterIngest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterIngest.java similarity index 67% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterIngest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterIngest.java index 5edf71cbd4..34e8ea63a8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterIngest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterIngest.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.stats; import jakarta.json.stream.JsonGenerator; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,27 +48,30 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.stats.ClusterIngest @JsonpDeserializable -public class ClusterIngest implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterIngest implements PlainJsonSerializable, ToCopyableBuilder { + private final int numberOfPipelines; + @Nonnull private final Map processorStats; // --------------------------------------------------------------------------------------------- private ClusterIngest(Builder builder) { - this.numberOfPipelines = ApiTypeHelper.requireNonNull(builder.numberOfPipelines, this, "numberOfPipelines"); this.processorStats = ApiTypeHelper.unmodifiableRequired(builder.processorStats, this, "processorStats"); - } - public static ClusterIngest of(Function> fn) { + public static ClusterIngest of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -76,6 +85,7 @@ public final int numberOfPipelines() { /** * Required - API name: {@code processor_stats} */ + @Nonnull public final Map processorStats() { return this.processorStats; } @@ -83,6 +93,7 @@ public final Map processorStats() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -90,38 +101,60 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("number_of_pipelines"); generator.write(this.numberOfPipelines); - if (ApiTypeHelper.isDefined(this.processorStats)) { - generator.writeKey("processor_stats"); - generator.writeStartObject(); - for (Map.Entry item0 : this.processorStats.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("processor_stats"); + generator.writeStartObject(); + for (Map.Entry item0 : this.processorStats.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ClusterIngest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Integer numberOfPipelines; - private Map processorStats; + public Builder() {} + + private Builder(ClusterIngest o) { + this.numberOfPipelines = o.numberOfPipelines; + this.processorStats = _mapCopy(o.processorStats); + } + + private Builder(Builder o) { + this.numberOfPipelines = o.numberOfPipelines; + this.processorStats = _mapCopy(o.processorStats); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code number_of_pipelines} */ + @Nonnull public final Builder numberOfPipelines(int value) { this.numberOfPipelines = value; return this; @@ -129,9 +162,12 @@ public final Builder numberOfPipelines(int value) { /** * Required - API name: {@code processor_stats} + * *

- * Adds all entries of map to processorStats. + * Adds all elements of map to processorStats. + *

*/ + @Nonnull public final Builder processorStats(Map map) { this.processorStats = _mapPutAll(this.processorStats, map); return this; @@ -139,9 +175,12 @@ public final Builder processorStats(Map map) { /** * Required - API name: {@code processor_stats} + * *

* Adds an entry to processorStats. + *

*/ + @Nonnull public final Builder processorStats(String key, ClusterProcessor value) { this.processorStats = _mapPut(this.processorStats, key, value); return this; @@ -149,9 +188,12 @@ public final Builder processorStats(String key, ClusterProcessor value) { /** * Required - API name: {@code processor_stats} + * *

- * Adds an entry to processorStats using a builder lambda. + * Adds a value to processorStats using a builder lambda. + *

*/ + @Nonnull public final Builder processorStats(String key, Function> fn) { return processorStats(key, fn.apply(new ClusterProcessor.Builder()).build()); } @@ -159,9 +201,10 @@ public final Builder processorStats(String key, Function op) { - op.add(Builder::numberOfPipelines, JsonpDeserializer.integerDeserializer(), "number_of_pipelines"); op.add(Builder::processorStats, JsonpDeserializer.stringMapDeserializer(ClusterProcessor._DESERIALIZER), "processor_stats"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Integer.hashCode(this.numberOfPipelines); + result = 31 * result + this.processorStats.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterIngest other = (ClusterIngest) o; + return this.numberOfPipelines == other.numberOfPipelines && this.processorStats.equals(other.processorStats); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvm.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvm.java similarity index 57% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvm.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvm.java index 78493245ee..20c6128354 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvm.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvm.java @@ -30,48 +30,73 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.stats; import jakarta.json.stream.JsonGenerator; import java.util.List; +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; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.stats.ClusterJvm @JsonpDeserializable -public class ClusterJvm implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterJvm implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final Time maxUptime; + private final long maxUptimeInMillis; + @Nonnull private final ClusterJvmMemory mem; private final long threads; + @Nonnull private final List versions; // --------------------------------------------------------------------------------------------- private ClusterJvm(Builder builder) { - + this.maxUptime = builder.maxUptime; this.maxUptimeInMillis = ApiTypeHelper.requireNonNull(builder.maxUptimeInMillis, this, "maxUptimeInMillis"); this.mem = ApiTypeHelper.requireNonNull(builder.mem, this, "mem"); this.threads = ApiTypeHelper.requireNonNull(builder.threads, this, "threads"); this.versions = ApiTypeHelper.unmodifiableRequired(builder.versions, this, "versions"); - } - public static ClusterJvm of(Function> fn) { + public static ClusterJvm of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * API name: {@code max_uptime} + */ + @Nullable + public final Time maxUptime() { + return this.maxUptime; + } + /** * Required - API name: {@code max_uptime_in_millis} */ @@ -82,20 +107,28 @@ public final long maxUptimeInMillis() { /** * Required - API name: {@code mem} */ + @Nonnull public final ClusterJvmMemory mem() { return this.mem; } /** - * Required - API name: {@code threads} + * Required - Number of active threads in use by JVM across all selected nodes. + *

+ * API name: {@code threads} + *

*/ public final long threads() { return this.threads; } /** - * Required - API name: {@code versions} + * Required - Contains statistics about the JVM versions used by selected nodes. + *

+ * API name: {@code versions} + *

*/ + @Nonnull public final List versions() { return this.versions; } @@ -103,6 +136,7 @@ public final List versions() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -110,6 +144,10 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.maxUptime != null) { + generator.writeKey("max_uptime"); + this.maxUptime.serialize(generator, mapper); + } generator.writeKey("max_uptime_in_millis"); generator.write(this.maxUptimeInMillis); @@ -120,37 +158,83 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("threads"); generator.write(this.threads); - if (ApiTypeHelper.isDefined(this.versions)) { - generator.writeKey("versions"); - generator.writeStartArray(); - for (ClusterJvmVersion item0 : this.versions) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("versions"); + generator.writeStartArray(); + for (ClusterJvmVersion item0 : this.versions) { + item0.serialize(generator, mapper); } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ClusterJvm}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Time maxUptime; private Long maxUptimeInMillis; - private ClusterJvmMemory mem; - private Long threads; - private List versions; + public Builder() {} + + private Builder(ClusterJvm o) { + this.maxUptime = o.maxUptime; + this.maxUptimeInMillis = o.maxUptimeInMillis; + this.mem = o.mem; + this.threads = o.threads; + this.versions = _listCopy(o.versions); + } + + private Builder(Builder o) { + this.maxUptime = o.maxUptime; + this.maxUptimeInMillis = o.maxUptimeInMillis; + this.mem = o.mem; + this.threads = o.threads; + this.versions = _listCopy(o.versions); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code max_uptime} + */ + @Nonnull + public final Builder maxUptime(@Nullable Time value) { + this.maxUptime = value; + return this; + } + + /** + * API name: {@code max_uptime} + */ + @Nonnull + public final Builder maxUptime(Function> fn) { + return maxUptime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code max_uptime_in_millis} */ + @Nonnull public final Builder maxUptimeInMillis(long value) { this.maxUptimeInMillis = value; return this; @@ -159,6 +243,7 @@ public final Builder maxUptimeInMillis(long value) { /** * Required - API name: {@code mem} */ + @Nonnull public final Builder mem(ClusterJvmMemory value) { this.mem = value; return this; @@ -167,43 +252,66 @@ public final Builder mem(ClusterJvmMemory value) { /** * Required - API name: {@code mem} */ + @Nonnull public final Builder mem(Function> fn) { - return this.mem(fn.apply(new ClusterJvmMemory.Builder()).build()); + return mem(fn.apply(new ClusterJvmMemory.Builder()).build()); } /** - * Required - API name: {@code threads} + * Required - Number of active threads in use by JVM across all selected nodes. + *

+ * API name: {@code threads} + *

*/ + @Nonnull public final Builder threads(long value) { this.threads = value; return this; } /** - * Required - API name: {@code versions} + * Required - Contains statistics about the JVM versions used by selected nodes. + *

+ * API name: {@code versions} + *

+ * *

* Adds all elements of list to versions. + *

*/ + @Nonnull public final Builder versions(List list) { this.versions = _listAddAll(this.versions, list); return this; } /** - * Required - API name: {@code versions} + * Required - Contains statistics about the JVM versions used by selected nodes. + *

+ * API name: {@code versions} + *

+ * *

* Adds one or more values to versions. + *

*/ + @Nonnull public final Builder versions(ClusterJvmVersion value, ClusterJvmVersion... values) { this.versions = _listAdd(this.versions, value, values); return this; } /** - * Required - API name: {@code versions} + * Required - Contains statistics about the JVM versions used by selected nodes. + *

+ * API name: {@code versions} + *

+ * *

* Adds a value to versions using a builder lambda. + *

*/ + @Nonnull public final Builder versions(Function> fn) { return versions(fn.apply(new ClusterJvmVersion.Builder()).build()); } @@ -211,9 +319,10 @@ public final Builder versions(Function op) { - + op.add(Builder::maxUptime, Time._DESERIALIZER, "max_uptime"); op.add(Builder::maxUptimeInMillis, JsonpDeserializer.longDeserializer(), "max_uptime_in_millis"); op.add(Builder::mem, ClusterJvmMemory._DESERIALIZER, "mem"); op.add(Builder::threads, JsonpDeserializer.longDeserializer(), "threads"); op.add(Builder::versions, JsonpDeserializer.arrayDeserializer(ClusterJvmVersion._DESERIALIZER), "versions"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.maxUptime); + result = 31 * result + Long.hashCode(this.maxUptimeInMillis); + result = 31 * result + this.mem.hashCode(); + result = 31 * result + Long.hashCode(this.threads); + result = 31 * result + this.versions.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterJvm other = (ClusterJvm) o; + return Objects.equals(this.maxUptime, other.maxUptime) + && this.maxUptimeInMillis == other.maxUptimeInMillis + && this.mem.equals(other.mem) + && this.threads == other.threads + && this.versions.equals(other.versions); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvmMemory.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvmMemory.java new file mode 100644 index 0000000000..5f5f2b214c --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvmMemory.java @@ -0,0 +1,301 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.cluster.stats; + +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.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: cluster.stats.ClusterJvmMemory + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterJvmMemory implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final String heapMax; + + private final long heapMaxInBytes; + + @Nullable + private final String heapUsed; + + private final long heapUsedInBytes; + + // --------------------------------------------------------------------------------------------- + + private ClusterJvmMemory(Builder builder) { + this.heapMax = builder.heapMax; + this.heapMaxInBytes = ApiTypeHelper.requireNonNull(builder.heapMaxInBytes, this, "heapMaxInBytes"); + this.heapUsed = builder.heapUsed; + this.heapUsedInBytes = ApiTypeHelper.requireNonNull(builder.heapUsedInBytes, this, "heapUsedInBytes"); + } + + public static ClusterJvmMemory of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Maximum amount of memory available for use by the heap across all selected nodes. + *

+ * API name: {@code heap_max} + *

+ */ + @Nullable + public final String heapMax() { + return this.heapMax; + } + + /** + * Required - Maximum amount of memory, in bytes, available for use by the heap across all selected nodes. + *

+ * API name: {@code heap_max_in_bytes} + *

+ */ + public final long heapMaxInBytes() { + return this.heapMaxInBytes; + } + + /** + * Memory currently in use by the heap across all selected nodes. + *

+ * API name: {@code heap_used} + *

+ */ + @Nullable + public final String heapUsed() { + return this.heapUsed; + } + + /** + * Required - Memory, in bytes, currently in use by the heap across all selected nodes. + *

+ * API name: {@code heap_used_in_bytes} + *

+ */ + public final long heapUsedInBytes() { + return this.heapUsedInBytes; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.heapMax != null) { + generator.writeKey("heap_max"); + generator.write(this.heapMax); + } + + generator.writeKey("heap_max_in_bytes"); + generator.write(this.heapMaxInBytes); + + if (this.heapUsed != null) { + generator.writeKey("heap_used"); + generator.write(this.heapUsed); + } + + generator.writeKey("heap_used_in_bytes"); + generator.write(this.heapUsedInBytes); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link ClusterJvmMemory}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String heapMax; + private Long heapMaxInBytes; + @Nullable + private String heapUsed; + private Long heapUsedInBytes; + + public Builder() {} + + private Builder(ClusterJvmMemory o) { + this.heapMax = o.heapMax; + this.heapMaxInBytes = o.heapMaxInBytes; + this.heapUsed = o.heapUsed; + this.heapUsedInBytes = o.heapUsedInBytes; + } + + private Builder(Builder o) { + this.heapMax = o.heapMax; + this.heapMaxInBytes = o.heapMaxInBytes; + this.heapUsed = o.heapUsed; + this.heapUsedInBytes = o.heapUsedInBytes; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Maximum amount of memory available for use by the heap across all selected nodes. + *

+ * API name: {@code heap_max} + *

+ */ + @Nonnull + public final Builder heapMax(@Nullable String value) { + this.heapMax = value; + return this; + } + + /** + * Required - Maximum amount of memory, in bytes, available for use by the heap across all selected nodes. + *

+ * API name: {@code heap_max_in_bytes} + *

+ */ + @Nonnull + public final Builder heapMaxInBytes(long value) { + this.heapMaxInBytes = value; + return this; + } + + /** + * Memory currently in use by the heap across all selected nodes. + *

+ * API name: {@code heap_used} + *

+ */ + @Nonnull + public final Builder heapUsed(@Nullable String value) { + this.heapUsed = value; + return this; + } + + /** + * Required - Memory, in bytes, currently in use by the heap across all selected nodes. + *

+ * API name: {@code heap_used_in_bytes} + *

+ */ + @Nonnull + public final Builder heapUsedInBytes(long value) { + this.heapUsedInBytes = value; + return this; + } + + /** + * Builds a {@link ClusterJvmMemory}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public ClusterJvmMemory build() { + _checkSingleUse(); + + return new ClusterJvmMemory(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ClusterJvmMemory} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ClusterJvmMemory::setupClusterJvmMemoryDeserializer + ); + + protected static void setupClusterJvmMemoryDeserializer(ObjectDeserializer op) { + op.add(Builder::heapMax, JsonpDeserializer.stringDeserializer(), "heap_max"); + op.add(Builder::heapMaxInBytes, JsonpDeserializer.longDeserializer(), "heap_max_in_bytes"); + op.add(Builder::heapUsed, JsonpDeserializer.stringDeserializer(), "heap_used"); + op.add(Builder::heapUsedInBytes, JsonpDeserializer.longDeserializer(), "heap_used_in_bytes"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.heapMax); + result = 31 * result + Long.hashCode(this.heapMaxInBytes); + result = 31 * result + Objects.hashCode(this.heapUsed); + result = 31 * result + Long.hashCode(this.heapUsedInBytes); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterJvmMemory other = (ClusterJvmMemory) o; + return Objects.equals(this.heapMax, other.heapMax) + && this.heapMaxInBytes == other.heapMaxInBytes + && Objects.equals(this.heapUsed, other.heapUsed) + && this.heapUsedInBytes == other.heapUsedInBytes; + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvmVersion.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvmVersion.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvmVersion.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvmVersion.java index cc366a9f80..85caafb241 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvmVersion.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvmVersion.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.stats; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,31 +47,38 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.stats.ClusterJvmVersion @JsonpDeserializable -public class ClusterJvmVersion implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterJvmVersion implements PlainJsonSerializable, ToCopyableBuilder { + private final boolean bundledJdk; private final int count; private final boolean usingBundledJdk; + @Nonnull private final String version; + @Nonnull private final String vmName; + @Nonnull private final String vmVendor; + @Nonnull private final String vmVersion; // --------------------------------------------------------------------------------------------- private ClusterJvmVersion(Builder builder) { - this.bundledJdk = ApiTypeHelper.requireNonNull(builder.bundledJdk, this, "bundledJdk"); this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); this.usingBundledJdk = ApiTypeHelper.requireNonNull(builder.usingBundledJdk, this, "usingBundledJdk"); @@ -73,29 +86,37 @@ private ClusterJvmVersion(Builder builder) { this.vmName = ApiTypeHelper.requireNonNull(builder.vmName, this, "vmName"); this.vmVendor = ApiTypeHelper.requireNonNull(builder.vmVendor, this, "vmVendor"); this.vmVersion = ApiTypeHelper.requireNonNull(builder.vmVersion, this, "vmVersion"); - } - public static ClusterJvmVersion of(Function> fn) { + public static ClusterJvmVersion of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code bundled_jdk} + * Required - Always true. All distributions come with a bundled Java Development Kit (JDK). + *

+ * API name: {@code bundled_jdk} + *

*/ public final boolean bundledJdk() { return this.bundledJdk; } /** - * Required - API name: {@code count} + * Required - Total number of selected nodes using JVM. + *

+ * API name: {@code count} + *

*/ public final int count() { return this.count; } /** - * Required - API name: {@code using_bundled_jdk} + * Required - If true, a bundled JDK is in use by JVM. + *

+ * API name: {@code using_bundled_jdk} + *

*/ public final boolean usingBundledJdk() { return this.usingBundledJdk; @@ -104,20 +125,29 @@ public final boolean usingBundledJdk() { /** * Required - API name: {@code version} */ + @Nonnull public final String version() { return this.version; } /** - * Required - API name: {@code vm_name} + * Required - Name of the JVM. + *

+ * API name: {@code vm_name} + *

*/ + @Nonnull public final String vmName() { return this.vmName; } /** - * Required - API name: {@code vm_vendor} + * Required - Vendor of the JVM. + *

+ * API name: {@code vm_vendor} + *

*/ + @Nonnull public final String vmVendor() { return this.vmVendor; } @@ -125,6 +155,7 @@ public final String vmVendor() { /** * Required - API name: {@code vm_version} */ + @Nonnull public final String vmVersion() { return this.vmVersion; } @@ -132,6 +163,7 @@ public final String vmVersion() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -139,7 +171,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("bundled_jdk"); generator.write(this.bundledJdk); @@ -160,49 +191,92 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("vm_version"); generator.write(this.vmVersion); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ClusterJvmVersion}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Boolean bundledJdk; - private Integer count; - private Boolean usingBundledJdk; - private String version; - private String vmName; - private String vmVendor; - private String vmVersion; + public Builder() {} + + private Builder(ClusterJvmVersion o) { + this.bundledJdk = o.bundledJdk; + this.count = o.count; + this.usingBundledJdk = o.usingBundledJdk; + this.version = o.version; + this.vmName = o.vmName; + this.vmVendor = o.vmVendor; + this.vmVersion = o.vmVersion; + } + + private Builder(Builder o) { + this.bundledJdk = o.bundledJdk; + this.count = o.count; + this.usingBundledJdk = o.usingBundledJdk; + this.version = o.version; + this.vmName = o.vmName; + this.vmVendor = o.vmVendor; + this.vmVersion = o.vmVersion; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Required - API name: {@code bundled_jdk} + * Required - Always true. All distributions come with a bundled Java Development Kit (JDK). + *

+ * API name: {@code bundled_jdk} + *

*/ + @Nonnull public final Builder bundledJdk(boolean value) { this.bundledJdk = value; return this; } /** - * Required - API name: {@code count} + * Required - Total number of selected nodes using JVM. + *

+ * API name: {@code count} + *

*/ + @Nonnull public final Builder count(int value) { this.count = value; return this; } /** - * Required - API name: {@code using_bundled_jdk} + * Required - If true, a bundled JDK is in use by JVM. + *

+ * API name: {@code using_bundled_jdk} + *

*/ + @Nonnull public final Builder usingBundledJdk(boolean value) { this.usingBundledJdk = value; return this; @@ -211,22 +285,31 @@ public final Builder usingBundledJdk(boolean value) { /** * Required - API name: {@code version} */ + @Nonnull public final Builder version(String value) { this.version = value; return this; } /** - * Required - API name: {@code vm_name} + * Required - Name of the JVM. + *

+ * API name: {@code vm_name} + *

*/ + @Nonnull public final Builder vmName(String value) { this.vmName = value; return this; } /** - * Required - API name: {@code vm_vendor} + * Required - Vendor of the JVM. + *

+ * API name: {@code vm_vendor} + *

*/ + @Nonnull public final Builder vmVendor(String value) { this.vmVendor = value; return this; @@ -235,6 +318,7 @@ public final Builder vmVendor(String value) { /** * Required - API name: {@code vm_version} */ + @Nonnull public final Builder vmVersion(String value) { this.vmVersion = value; return this; @@ -243,9 +327,10 @@ public final Builder vmVersion(String value) { /** * Builds a {@link ClusterJvmVersion}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ClusterJvmVersion build() { _checkSingleUse(); @@ -264,7 +349,6 @@ public ClusterJvmVersion build() { ); protected static void setupClusterJvmVersionDeserializer(ObjectDeserializer op) { - op.add(Builder::bundledJdk, JsonpDeserializer.booleanDeserializer(), "bundled_jdk"); op.add(Builder::count, JsonpDeserializer.integerDeserializer(), "count"); op.add(Builder::usingBundledJdk, JsonpDeserializer.booleanDeserializer(), "using_bundled_jdk"); @@ -272,7 +356,32 @@ protected static void setupClusterJvmVersionDeserializer(ObjectDeserializer { + + @Nonnull private final Map httpTypes; + @Nonnull private final Map transportTypes; // --------------------------------------------------------------------------------------------- private ClusterNetworkTypes(Builder builder) { - this.httpTypes = ApiTypeHelper.unmodifiableRequired(builder.httpTypes, this, "httpTypes"); this.transportTypes = ApiTypeHelper.unmodifiableRequired(builder.transportTypes, this, "transportTypes"); - } - public static ClusterNetworkTypes of(Function> fn) { + public static ClusterNetworkTypes of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code http_types} + * Required - Contains statistics about the HTTP network types used by selected nodes. + *

+ * API name: {@code http_types} + *

*/ + @Nonnull public final Map httpTypes() { return this.httpTypes; } /** - * Required - API name: {@code transport_types} + * Required - Contains statistics about the transport network types used by selected nodes. + *

+ * API name: {@code transport_types} + *

*/ + @Nonnull public final Map transportTypes() { return this.transportTypes; } @@ -83,6 +101,7 @@ public final Map transportTypes() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -90,78 +109,120 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.httpTypes)) { - generator.writeKey("http_types"); - generator.writeStartObject(); - for (Map.Entry item0 : this.httpTypes.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); - + generator.writeKey("http_types"); + generator.writeStartObject(); + for (Map.Entry item0 : this.httpTypes.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); } - if (ApiTypeHelper.isDefined(this.transportTypes)) { - generator.writeKey("transport_types"); - generator.writeStartObject(); - for (Map.Entry item0 : this.transportTypes.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); + generator.writeEnd(); + generator.writeKey("transport_types"); + generator.writeStartObject(); + for (Map.Entry item0 : this.transportTypes.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); } - + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ClusterNetworkTypes}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Map httpTypes; - private Map transportTypes; + public Builder() {} + + private Builder(ClusterNetworkTypes o) { + this.httpTypes = _mapCopy(o.httpTypes); + this.transportTypes = _mapCopy(o.transportTypes); + } + + private Builder(Builder o) { + this.httpTypes = _mapCopy(o.httpTypes); + this.transportTypes = _mapCopy(o.transportTypes); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Required - API name: {@code http_types} + * Required - Contains statistics about the HTTP network types used by selected nodes. + *

+ * API name: {@code http_types} + *

+ * *

- * Adds all entries of map to httpTypes. + * Adds all elements of map to httpTypes. + *

*/ + @Nonnull public final Builder httpTypes(Map map) { this.httpTypes = _mapPutAll(this.httpTypes, map); return this; } /** - * Required - API name: {@code http_types} + * Required - Contains statistics about the HTTP network types used by selected nodes. + *

+ * API name: {@code http_types} + *

+ * *

* Adds an entry to httpTypes. + *

*/ + @Nonnull public final Builder httpTypes(String key, Integer value) { this.httpTypes = _mapPut(this.httpTypes, key, value); return this; } /** - * Required - API name: {@code transport_types} + * Required - Contains statistics about the transport network types used by selected nodes. *

- * Adds all entries of map to transportTypes. + * API name: {@code transport_types} + *

+ * + *

+ * Adds all elements of map to transportTypes. + *

*/ + @Nonnull public final Builder transportTypes(Map map) { this.transportTypes = _mapPutAll(this.transportTypes, map); return this; } /** - * Required - API name: {@code transport_types} + * Required - Contains statistics about the transport network types used by selected nodes. + *

+ * API name: {@code transport_types} + *

+ * *

* Adds an entry to transportTypes. + *

*/ + @Nonnull public final Builder transportTypes(String key, Integer value) { this.transportTypes = _mapPut(this.transportTypes, key, value); return this; @@ -170,9 +231,10 @@ public final Builder transportTypes(String key, Integer value) { /** * Builds a {@link ClusterNetworkTypes}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ClusterNetworkTypes build() { _checkSingleUse(); @@ -191,14 +253,27 @@ public ClusterNetworkTypes build() { ); protected static void setupClusterNetworkTypesDeserializer(ObjectDeserializer op) { - op.add(Builder::httpTypes, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.integerDeserializer()), "http_types"); op.add( Builder::transportTypes, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.integerDeserializer()), "transport_types" ); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.httpTypes.hashCode(); + result = 31 * result + this.transportTypes.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterNetworkTypes other = (ClusterNetworkTypes) o; + return this.httpTypes.equals(other.httpTypes) && this.transportTypes.equals(other.transportTypes); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterNodeCount.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterNodeCount.java new file mode 100644 index 0000000000..df3d3cdb45 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterNodeCount.java @@ -0,0 +1,653 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.cluster.stats; + +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.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: cluster.stats.ClusterNodeCount + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterNodeCount implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable + private final Integer clusterManager; + + private final int coordinatingOnly; + + private final int data; + + @Nullable + private final Integer dataCold; + + @Nullable + private final Integer dataContent; + + @Nullable + private final Integer dataFrozen; + + @Nullable + private final Integer dataHot; + + @Nullable + private final Integer dataWarm; + + private final int ingest; + + private final int master; + + @Nullable + private final Integer ml; + + private final int remoteClusterClient; + + @Nullable + private final Integer search; + + private final int total; + + @Nullable + private final Integer transform; + + @Nullable + private final Integer votingOnly; + + // --------------------------------------------------------------------------------------------- + + private ClusterNodeCount(Builder builder) { + this.clusterManager = builder.clusterManager; + this.coordinatingOnly = ApiTypeHelper.requireNonNull(builder.coordinatingOnly, this, "coordinatingOnly"); + this.data = ApiTypeHelper.requireNonNull(builder.data, this, "data"); + this.dataCold = builder.dataCold; + this.dataContent = builder.dataContent; + this.dataFrozen = builder.dataFrozen; + this.dataHot = builder.dataHot; + this.dataWarm = builder.dataWarm; + this.ingest = ApiTypeHelper.requireNonNull(builder.ingest, this, "ingest"); + this.master = ApiTypeHelper.requireNonNull(builder.master, this, "master"); + this.ml = builder.ml; + this.remoteClusterClient = ApiTypeHelper.requireNonNull(builder.remoteClusterClient, this, "remoteClusterClient"); + this.search = builder.search; + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); + this.transform = builder.transform; + this.votingOnly = builder.votingOnly; + } + + public static ClusterNodeCount of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code cluster_manager} + */ + @Nullable + public final Integer clusterManager() { + return this.clusterManager; + } + + /** + * Required - API name: {@code coordinating_only} + */ + public final int coordinatingOnly() { + return this.coordinatingOnly; + } + + /** + * Required - API name: {@code data} + */ + public final int data() { + return this.data; + } + + /** + * API name: {@code data_cold} + */ + @Nullable + public final Integer dataCold() { + return this.dataCold; + } + + /** + * API name: {@code data_content} + */ + @Nullable + public final Integer dataContent() { + return this.dataContent; + } + + /** + * API name: {@code data_frozen} + */ + @Nullable + public final Integer dataFrozen() { + return this.dataFrozen; + } + + /** + * API name: {@code data_hot} + */ + @Nullable + public final Integer dataHot() { + return this.dataHot; + } + + /** + * API name: {@code data_warm} + */ + @Nullable + public final Integer dataWarm() { + return this.dataWarm; + } + + /** + * Required - API name: {@code ingest} + */ + public final int ingest() { + return this.ingest; + } + + /** + * Required - API name: {@code master} + */ + public final int master() { + return this.master; + } + + /** + * API name: {@code ml} + */ + @Nullable + public final Integer ml() { + return this.ml; + } + + /** + * Required - API name: {@code remote_cluster_client} + */ + public final int remoteClusterClient() { + return this.remoteClusterClient; + } + + /** + * API name: {@code search} + */ + @Nullable + public final Integer search() { + return this.search; + } + + /** + * Required - API name: {@code total} + */ + public final int total() { + return this.total; + } + + /** + * API name: {@code transform} + */ + @Nullable + public final Integer transform() { + return this.transform; + } + + /** + * API name: {@code voting_only} + */ + @Nullable + public final Integer votingOnly() { + return this.votingOnly; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.clusterManager != null) { + generator.writeKey("cluster_manager"); + generator.write(this.clusterManager); + } + + generator.writeKey("coordinating_only"); + generator.write(this.coordinatingOnly); + + generator.writeKey("data"); + generator.write(this.data); + + if (this.dataCold != null) { + generator.writeKey("data_cold"); + generator.write(this.dataCold); + } + + if (this.dataContent != null) { + generator.writeKey("data_content"); + generator.write(this.dataContent); + } + + if (this.dataFrozen != null) { + generator.writeKey("data_frozen"); + generator.write(this.dataFrozen); + } + + if (this.dataHot != null) { + generator.writeKey("data_hot"); + generator.write(this.dataHot); + } + + if (this.dataWarm != null) { + generator.writeKey("data_warm"); + generator.write(this.dataWarm); + } + + generator.writeKey("ingest"); + generator.write(this.ingest); + + generator.writeKey("master"); + generator.write(this.master); + + if (this.ml != null) { + generator.writeKey("ml"); + generator.write(this.ml); + } + + generator.writeKey("remote_cluster_client"); + generator.write(this.remoteClusterClient); + + if (this.search != null) { + generator.writeKey("search"); + generator.write(this.search); + } + + generator.writeKey("total"); + generator.write(this.total); + + if (this.transform != null) { + generator.writeKey("transform"); + generator.write(this.transform); + } + + if (this.votingOnly != null) { + generator.writeKey("voting_only"); + generator.write(this.votingOnly); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link ClusterNodeCount}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Integer clusterManager; + private Integer coordinatingOnly; + private Integer data; + @Nullable + private Integer dataCold; + @Nullable + private Integer dataContent; + @Nullable + private Integer dataFrozen; + @Nullable + private Integer dataHot; + @Nullable + private Integer dataWarm; + private Integer ingest; + private Integer master; + @Nullable + private Integer ml; + private Integer remoteClusterClient; + @Nullable + private Integer search; + private Integer total; + @Nullable + private Integer transform; + @Nullable + private Integer votingOnly; + + public Builder() {} + + private Builder(ClusterNodeCount o) { + this.clusterManager = o.clusterManager; + this.coordinatingOnly = o.coordinatingOnly; + this.data = o.data; + this.dataCold = o.dataCold; + this.dataContent = o.dataContent; + this.dataFrozen = o.dataFrozen; + this.dataHot = o.dataHot; + this.dataWarm = o.dataWarm; + this.ingest = o.ingest; + this.master = o.master; + this.ml = o.ml; + this.remoteClusterClient = o.remoteClusterClient; + this.search = o.search; + this.total = o.total; + this.transform = o.transform; + this.votingOnly = o.votingOnly; + } + + private Builder(Builder o) { + this.clusterManager = o.clusterManager; + this.coordinatingOnly = o.coordinatingOnly; + this.data = o.data; + this.dataCold = o.dataCold; + this.dataContent = o.dataContent; + this.dataFrozen = o.dataFrozen; + this.dataHot = o.dataHot; + this.dataWarm = o.dataWarm; + this.ingest = o.ingest; + this.master = o.master; + this.ml = o.ml; + this.remoteClusterClient = o.remoteClusterClient; + this.search = o.search; + this.total = o.total; + this.transform = o.transform; + this.votingOnly = o.votingOnly; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code cluster_manager} + */ + @Nonnull + public final Builder clusterManager(@Nullable Integer value) { + this.clusterManager = value; + return this; + } + + /** + * Required - API name: {@code coordinating_only} + */ + @Nonnull + public final Builder coordinatingOnly(int value) { + this.coordinatingOnly = value; + return this; + } + + /** + * Required - API name: {@code data} + */ + @Nonnull + public final Builder data(int value) { + this.data = value; + return this; + } + + /** + * API name: {@code data_cold} + */ + @Nonnull + public final Builder dataCold(@Nullable Integer value) { + this.dataCold = value; + return this; + } + + /** + * API name: {@code data_content} + */ + @Nonnull + public final Builder dataContent(@Nullable Integer value) { + this.dataContent = value; + return this; + } + + /** + * API name: {@code data_frozen} + */ + @Nonnull + public final Builder dataFrozen(@Nullable Integer value) { + this.dataFrozen = value; + return this; + } + + /** + * API name: {@code data_hot} + */ + @Nonnull + public final Builder dataHot(@Nullable Integer value) { + this.dataHot = value; + return this; + } + + /** + * API name: {@code data_warm} + */ + @Nonnull + public final Builder dataWarm(@Nullable Integer value) { + this.dataWarm = value; + return this; + } + + /** + * Required - API name: {@code ingest} + */ + @Nonnull + public final Builder ingest(int value) { + this.ingest = value; + return this; + } + + /** + * Required - API name: {@code master} + */ + @Nonnull + public final Builder master(int value) { + this.master = value; + return this; + } + + /** + * API name: {@code ml} + */ + @Nonnull + public final Builder ml(@Nullable Integer value) { + this.ml = value; + return this; + } + + /** + * Required - API name: {@code remote_cluster_client} + */ + @Nonnull + public final Builder remoteClusterClient(int value) { + this.remoteClusterClient = value; + return this; + } + + /** + * API name: {@code search} + */ + @Nonnull + public final Builder search(@Nullable Integer value) { + this.search = value; + return this; + } + + /** + * Required - API name: {@code total} + */ + @Nonnull + public final Builder total(int value) { + this.total = value; + return this; + } + + /** + * API name: {@code transform} + */ + @Nonnull + public final Builder transform(@Nullable Integer value) { + this.transform = value; + return this; + } + + /** + * API name: {@code voting_only} + */ + @Nonnull + public final Builder votingOnly(@Nullable Integer value) { + this.votingOnly = value; + return this; + } + + /** + * Builds a {@link ClusterNodeCount}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public ClusterNodeCount build() { + _checkSingleUse(); + + return new ClusterNodeCount(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ClusterNodeCount} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ClusterNodeCount::setupClusterNodeCountDeserializer + ); + + protected static void setupClusterNodeCountDeserializer(ObjectDeserializer op) { + op.add(Builder::clusterManager, JsonpDeserializer.integerDeserializer(), "cluster_manager"); + op.add(Builder::coordinatingOnly, JsonpDeserializer.integerDeserializer(), "coordinating_only"); + op.add(Builder::data, JsonpDeserializer.integerDeserializer(), "data"); + op.add(Builder::dataCold, JsonpDeserializer.integerDeserializer(), "data_cold"); + op.add(Builder::dataContent, JsonpDeserializer.integerDeserializer(), "data_content"); + op.add(Builder::dataFrozen, JsonpDeserializer.integerDeserializer(), "data_frozen"); + op.add(Builder::dataHot, JsonpDeserializer.integerDeserializer(), "data_hot"); + op.add(Builder::dataWarm, JsonpDeserializer.integerDeserializer(), "data_warm"); + op.add(Builder::ingest, JsonpDeserializer.integerDeserializer(), "ingest"); + op.add(Builder::master, JsonpDeserializer.integerDeserializer(), "master"); + op.add(Builder::ml, JsonpDeserializer.integerDeserializer(), "ml"); + op.add(Builder::remoteClusterClient, JsonpDeserializer.integerDeserializer(), "remote_cluster_client"); + op.add(Builder::search, JsonpDeserializer.integerDeserializer(), "search"); + op.add(Builder::total, JsonpDeserializer.integerDeserializer(), "total"); + op.add(Builder::transform, JsonpDeserializer.integerDeserializer(), "transform"); + op.add(Builder::votingOnly, JsonpDeserializer.integerDeserializer(), "voting_only"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManager); + result = 31 * result + Integer.hashCode(this.coordinatingOnly); + result = 31 * result + Integer.hashCode(this.data); + result = 31 * result + Objects.hashCode(this.dataCold); + result = 31 * result + Objects.hashCode(this.dataContent); + result = 31 * result + Objects.hashCode(this.dataFrozen); + result = 31 * result + Objects.hashCode(this.dataHot); + result = 31 * result + Objects.hashCode(this.dataWarm); + result = 31 * result + Integer.hashCode(this.ingest); + result = 31 * result + Integer.hashCode(this.master); + result = 31 * result + Objects.hashCode(this.ml); + result = 31 * result + Integer.hashCode(this.remoteClusterClient); + result = 31 * result + Objects.hashCode(this.search); + result = 31 * result + Integer.hashCode(this.total); + result = 31 * result + Objects.hashCode(this.transform); + result = 31 * result + Objects.hashCode(this.votingOnly); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterNodeCount other = (ClusterNodeCount) o; + return Objects.equals(this.clusterManager, other.clusterManager) + && this.coordinatingOnly == other.coordinatingOnly + && this.data == other.data + && Objects.equals(this.dataCold, other.dataCold) + && Objects.equals(this.dataContent, other.dataContent) + && Objects.equals(this.dataFrozen, other.dataFrozen) + && Objects.equals(this.dataHot, other.dataHot) + && Objects.equals(this.dataWarm, other.dataWarm) + && this.ingest == other.ingest + && this.master == other.master + && Objects.equals(this.ml, other.ml) + && this.remoteClusterClient == other.remoteClusterClient + && Objects.equals(this.search, other.search) + && this.total == other.total + && Objects.equals(this.transform, other.transform) + && Objects.equals(this.votingOnly, other.votingOnly); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterNodes.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterNodes.java similarity index 52% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterNodes.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterNodes.java index 95b3ebd674..68aa358f36 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterNodes.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterNodes.java @@ -30,12 +30,20 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.stats; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.Map; +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; @@ -44,156 +52,197 @@ import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.PluginStats; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.stats.ClusterNodes @JsonpDeserializable -public class ClusterNodes implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterNodes implements PlainJsonSerializable, ToCopyableBuilder { + + @Nullable private final ClusterNodeCount count; + @Nonnull private final Map discoveryTypes; + @Nullable private final ClusterFileSystem fs; + @Nullable + private final IndexingPressure indexingPressure; + + @Nullable private final ClusterIngest ingest; + @Nullable private final ClusterJvm jvm; + @Nullable private final ClusterNetworkTypes networkTypes; + @Nullable private final ClusterOperatingSystem os; + @Nonnull private final List packagingTypes; + @Nonnull private final List plugins; + @Nullable private final ClusterProcess process; + @Nonnull private final List versions; // --------------------------------------------------------------------------------------------- private ClusterNodes(Builder builder) { - - this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); - this.discoveryTypes = ApiTypeHelper.unmodifiableRequired(builder.discoveryTypes, this, "discoveryTypes"); - this.fs = ApiTypeHelper.requireNonNull(builder.fs, this, "fs"); - this.ingest = ApiTypeHelper.requireNonNull(builder.ingest, this, "ingest"); - this.jvm = ApiTypeHelper.requireNonNull(builder.jvm, this, "jvm"); - this.networkTypes = ApiTypeHelper.requireNonNull(builder.networkTypes, this, "networkTypes"); - this.os = ApiTypeHelper.requireNonNull(builder.os, this, "os"); - this.packagingTypes = ApiTypeHelper.unmodifiableRequired(builder.packagingTypes, this, "packagingTypes"); - this.plugins = ApiTypeHelper.unmodifiableRequired(builder.plugins, this, "plugins"); - this.process = ApiTypeHelper.requireNonNull(builder.process, this, "process"); - this.versions = ApiTypeHelper.unmodifiableRequired(builder.versions, this, "versions"); - + this.count = builder.count; + this.discoveryTypes = ApiTypeHelper.unmodifiable(builder.discoveryTypes); + this.fs = builder.fs; + this.indexingPressure = builder.indexingPressure; + this.ingest = builder.ingest; + this.jvm = builder.jvm; + this.networkTypes = builder.networkTypes; + this.os = builder.os; + this.packagingTypes = ApiTypeHelper.unmodifiable(builder.packagingTypes); + this.plugins = ApiTypeHelper.unmodifiable(builder.plugins); + this.process = builder.process; + this.versions = ApiTypeHelper.unmodifiable(builder.versions); } - public static ClusterNodes of(Function> fn) { + public static ClusterNodes of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - Contains counts for nodes selected by the request's node filters. + * Contains counts for nodes selected by the request's node filters. *

* API name: {@code count} + *

*/ + @Nullable public final ClusterNodeCount count() { return this.count; } /** - * Required - Contains statistics about the discovery types used by selected - * nodes. + * Contains statistics about the discovery types used by selected nodes. *

* API name: {@code discovery_types} + *

*/ + @Nonnull public final Map discoveryTypes() { return this.discoveryTypes; } /** - * Required - Contains statistics about file stores by selected nodes. + * Contains statistics about file stores by selected nodes. *

* API name: {@code fs} + *

*/ + @Nullable public final ClusterFileSystem fs() { return this.fs; } /** - * Required - API name: {@code ingest} + * API name: {@code indexing_pressure} + */ + @Nullable + public final IndexingPressure indexingPressure() { + return this.indexingPressure; + } + + /** + * API name: {@code ingest} */ + @Nullable public final ClusterIngest ingest() { return this.ingest; } /** - * Required - Contains statistics about the Java Virtual Machines (JVMs) used by - * selected nodes. + * Contains statistics about the Java Virtual Machines (JVMs) used by selected nodes. *

* API name: {@code jvm} + *

*/ + @Nullable public final ClusterJvm jvm() { return this.jvm; } /** - * Required - Contains statistics about the transport and HTTP networks used by - * selected nodes. + * Contains statistics about the transport and HTTP networks used by selected nodes. *

* API name: {@code network_types} + *

*/ + @Nullable public final ClusterNetworkTypes networkTypes() { return this.networkTypes; } /** - * Required - Contains statistics about the operating systems used by selected - * nodes. + * Contains statistics about the operating systems used by selected nodes. *

* API name: {@code os} + *

*/ + @Nullable public final ClusterOperatingSystem os() { return this.os; } /** - * Required - Contains statistics about OpenSearch distributions installed on - * selected nodes. + * Contains statistics about OpenSearch distributions installed on selected nodes. *

* API name: {@code packaging_types} + *

*/ + @Nonnull public final List packagingTypes() { return this.packagingTypes; } /** - * Required - Contains statistics about installed plugins and modules by - * selected nodes. + * Contains statistics about installed plugins and modules by selected nodes. If no plugins or modules are installed, this array is + * empty. *

* API name: {@code plugins} + *

*/ + @Nonnull public final List plugins() { return this.plugins; } /** - * Required - Contains statistics about processes used by selected nodes. + * Contains statistics about processes used by selected nodes. *

* API name: {@code process} + *

*/ + @Nullable public final ClusterProcess process() { return this.process; } /** - * Required - Array of OpenSearch versions used on selected nodes. + * Array of OpenSearch versions used on selected nodes. *

* API name: {@code versions} + *

*/ + @Nonnull public final List versions() { return this.versions; } @@ -201,6 +250,7 @@ public final List versions() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -208,9 +258,10 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("count"); - this.count.serialize(generator, mapper); + if (this.count != null) { + generator.writeKey("count"); + this.count.serialize(generator, mapper); + } if (ApiTypeHelper.isDefined(this.discoveryTypes)) { generator.writeKey("discovery_types"); @@ -218,347 +269,481 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { for (Map.Entry item0 : this.discoveryTypes.entrySet()) { generator.writeKey(item0.getKey()); generator.write(item0.getValue()); - } generator.writeEnd(); + } + if (this.fs != null) { + generator.writeKey("fs"); + this.fs.serialize(generator, mapper); } - generator.writeKey("fs"); - this.fs.serialize(generator, mapper); - generator.writeKey("ingest"); - this.ingest.serialize(generator, mapper); + if (this.indexingPressure != null) { + generator.writeKey("indexing_pressure"); + this.indexingPressure.serialize(generator, mapper); + } - generator.writeKey("jvm"); - this.jvm.serialize(generator, mapper); + if (this.ingest != null) { + generator.writeKey("ingest"); + this.ingest.serialize(generator, mapper); + } - generator.writeKey("network_types"); - this.networkTypes.serialize(generator, mapper); + if (this.jvm != null) { + generator.writeKey("jvm"); + this.jvm.serialize(generator, mapper); + } - generator.writeKey("os"); - this.os.serialize(generator, mapper); + if (this.networkTypes != null) { + generator.writeKey("network_types"); + this.networkTypes.serialize(generator, mapper); + } + + if (this.os != null) { + generator.writeKey("os"); + this.os.serialize(generator, mapper); + } if (ApiTypeHelper.isDefined(this.packagingTypes)) { generator.writeKey("packaging_types"); generator.writeStartArray(); for (NodePackagingType item0 : this.packagingTypes) { item0.serialize(generator, mapper); - } generator.writeEnd(); - } + if (ApiTypeHelper.isDefined(this.plugins)) { generator.writeKey("plugins"); generator.writeStartArray(); for (PluginStats item0 : this.plugins) { item0.serialize(generator, mapper); - } generator.writeEnd(); + } + if (this.process != null) { + generator.writeKey("process"); + this.process.serialize(generator, mapper); } - generator.writeKey("process"); - this.process.serialize(generator, mapper); if (ApiTypeHelper.isDefined(this.versions)) { generator.writeKey("versions"); generator.writeStartArray(); for (String item0 : this.versions) { generator.write(item0); - } generator.writeEnd(); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ClusterNodes}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable private ClusterNodeCount count; - + @Nullable private Map discoveryTypes; - + @Nullable private ClusterFileSystem fs; - + @Nullable + private IndexingPressure indexingPressure; + @Nullable private ClusterIngest ingest; - + @Nullable private ClusterJvm jvm; - + @Nullable private ClusterNetworkTypes networkTypes; - + @Nullable private ClusterOperatingSystem os; - + @Nullable private List packagingTypes; - + @Nullable private List plugins; - + @Nullable private ClusterProcess process; - + @Nullable private List versions; + public Builder() {} + + private Builder(ClusterNodes o) { + this.count = o.count; + this.discoveryTypes = _mapCopy(o.discoveryTypes); + this.fs = o.fs; + this.indexingPressure = o.indexingPressure; + this.ingest = o.ingest; + this.jvm = o.jvm; + this.networkTypes = o.networkTypes; + this.os = o.os; + this.packagingTypes = _listCopy(o.packagingTypes); + this.plugins = _listCopy(o.plugins); + this.process = o.process; + this.versions = _listCopy(o.versions); + } + + private Builder(Builder o) { + this.count = o.count; + this.discoveryTypes = _mapCopy(o.discoveryTypes); + this.fs = o.fs; + this.indexingPressure = o.indexingPressure; + this.ingest = o.ingest; + this.jvm = o.jvm; + this.networkTypes = o.networkTypes; + this.os = o.os; + this.packagingTypes = _listCopy(o.packagingTypes); + this.plugins = _listCopy(o.plugins); + this.process = o.process; + this.versions = _listCopy(o.versions); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Required - Contains counts for nodes selected by the request's node filters. + * Contains counts for nodes selected by the request's node filters. *

* API name: {@code count} + *

*/ - public final Builder count(ClusterNodeCount value) { + @Nonnull + public final Builder count(@Nullable ClusterNodeCount value) { this.count = value; return this; } /** - * Required - Contains counts for nodes selected by the request's node filters. + * Contains counts for nodes selected by the request's node filters. *

* API name: {@code count} + *

*/ + @Nonnull public final Builder count(Function> fn) { - return this.count(fn.apply(new ClusterNodeCount.Builder()).build()); + return count(fn.apply(new ClusterNodeCount.Builder()).build()); } /** - * Required - Contains statistics about the discovery types used by selected - * nodes. + * Contains statistics about the discovery types used by selected nodes. *

* API name: {@code discovery_types} + *

+ * *

- * Adds all entries of map to discoveryTypes. + * Adds all elements of map to discoveryTypes. + *

*/ + @Nonnull public final Builder discoveryTypes(Map map) { this.discoveryTypes = _mapPutAll(this.discoveryTypes, map); return this; } /** - * Required - Contains statistics about the discovery types used by selected - * nodes. + * Contains statistics about the discovery types used by selected nodes. *

* API name: {@code discovery_types} + *

+ * *

* Adds an entry to discoveryTypes. + *

*/ + @Nonnull public final Builder discoveryTypes(String key, Integer value) { this.discoveryTypes = _mapPut(this.discoveryTypes, key, value); return this; } /** - * Required - Contains statistics about file stores by selected nodes. + * Contains statistics about file stores by selected nodes. *

* API name: {@code fs} + *

*/ - public final Builder fs(ClusterFileSystem value) { + @Nonnull + public final Builder fs(@Nullable ClusterFileSystem value) { this.fs = value; return this; } /** - * Required - Contains statistics about file stores by selected nodes. + * Contains statistics about file stores by selected nodes. *

* API name: {@code fs} + *

*/ + @Nonnull public final Builder fs(Function> fn) { - return this.fs(fn.apply(new ClusterFileSystem.Builder()).build()); + return fs(fn.apply(new ClusterFileSystem.Builder()).build()); } /** - * Required - API name: {@code ingest} + * API name: {@code indexing_pressure} */ - public final Builder ingest(ClusterIngest value) { + @Nonnull + public final Builder indexingPressure(@Nullable IndexingPressure value) { + this.indexingPressure = value; + return this; + } + + /** + * API name: {@code indexing_pressure} + */ + @Nonnull + public final Builder indexingPressure(Function> fn) { + return indexingPressure(fn.apply(new IndexingPressure.Builder()).build()); + } + + /** + * API name: {@code ingest} + */ + @Nonnull + public final Builder ingest(@Nullable ClusterIngest value) { this.ingest = value; return this; } /** - * Required - API name: {@code ingest} + * API name: {@code ingest} */ + @Nonnull public final Builder ingest(Function> fn) { - return this.ingest(fn.apply(new ClusterIngest.Builder()).build()); + return ingest(fn.apply(new ClusterIngest.Builder()).build()); } /** - * Required - Contains statistics about the Java Virtual Machines (JVMs) used by - * selected nodes. + * Contains statistics about the Java Virtual Machines (JVMs) used by selected nodes. *

* API name: {@code jvm} + *

*/ - public final Builder jvm(ClusterJvm value) { + @Nonnull + public final Builder jvm(@Nullable ClusterJvm value) { this.jvm = value; return this; } /** - * Required - Contains statistics about the Java Virtual Machines (JVMs) used by - * selected nodes. + * Contains statistics about the Java Virtual Machines (JVMs) used by selected nodes. *

* API name: {@code jvm} + *

*/ + @Nonnull public final Builder jvm(Function> fn) { - return this.jvm(fn.apply(new ClusterJvm.Builder()).build()); + return jvm(fn.apply(new ClusterJvm.Builder()).build()); } /** - * Required - Contains statistics about the transport and HTTP networks used by - * selected nodes. + * Contains statistics about the transport and HTTP networks used by selected nodes. *

* API name: {@code network_types} + *

*/ - public final Builder networkTypes(ClusterNetworkTypes value) { + @Nonnull + public final Builder networkTypes(@Nullable ClusterNetworkTypes value) { this.networkTypes = value; return this; } /** - * Required - Contains statistics about the transport and HTTP networks used by - * selected nodes. + * Contains statistics about the transport and HTTP networks used by selected nodes. *

* API name: {@code network_types} + *

*/ + @Nonnull public final Builder networkTypes(Function> fn) { - return this.networkTypes(fn.apply(new ClusterNetworkTypes.Builder()).build()); + return networkTypes(fn.apply(new ClusterNetworkTypes.Builder()).build()); } /** - * Required - Contains statistics about the operating systems used by selected - * nodes. + * Contains statistics about the operating systems used by selected nodes. *

* API name: {@code os} + *

*/ - public final Builder os(ClusterOperatingSystem value) { + @Nonnull + public final Builder os(@Nullable ClusterOperatingSystem value) { this.os = value; return this; } /** - * Required - Contains statistics about the operating systems used by selected - * nodes. + * Contains statistics about the operating systems used by selected nodes. *

* API name: {@code os} + *

*/ + @Nonnull public final Builder os(Function> fn) { - return this.os(fn.apply(new ClusterOperatingSystem.Builder()).build()); + return os(fn.apply(new ClusterOperatingSystem.Builder()).build()); } /** - * Required - Contains statistics about OpenSearch distributions installed on - * selected nodes. + * Contains statistics about OpenSearch distributions installed on selected nodes. *

* API name: {@code packaging_types} + *

+ * *

* Adds all elements of list to packagingTypes. + *

*/ + @Nonnull public final Builder packagingTypes(List list) { this.packagingTypes = _listAddAll(this.packagingTypes, list); return this; } /** - * Required - Contains statistics about OpenSearch distributions installed on - * selected nodes. + * Contains statistics about OpenSearch distributions installed on selected nodes. *

* API name: {@code packaging_types} + *

+ * *

* Adds one or more values to packagingTypes. + *

*/ + @Nonnull public final Builder packagingTypes(NodePackagingType value, NodePackagingType... values) { this.packagingTypes = _listAdd(this.packagingTypes, value, values); return this; } /** - * Required - Contains statistics about OpenSearch distributions installed on - * selected nodes. + * Contains statistics about OpenSearch distributions installed on selected nodes. *

* API name: {@code packaging_types} + *

+ * *

* Adds a value to packagingTypes using a builder lambda. + *

*/ + @Nonnull public final Builder packagingTypes(Function> fn) { return packagingTypes(fn.apply(new NodePackagingType.Builder()).build()); } /** - * Required - Contains statistics about installed plugins and modules by - * selected nodes. + * Contains statistics about installed plugins and modules by selected nodes. If no plugins or modules are installed, this array is + * empty. *

* API name: {@code plugins} + *

+ * *

* Adds all elements of list to plugins. + *

*/ + @Nonnull public final Builder plugins(List list) { this.plugins = _listAddAll(this.plugins, list); return this; } /** - * Required - Contains statistics about installed plugins and modules by - * selected nodes. + * Contains statistics about installed plugins and modules by selected nodes. If no plugins or modules are installed, this array is + * empty. *

* API name: {@code plugins} + *

+ * *

* Adds one or more values to plugins. + *

*/ + @Nonnull public final Builder plugins(PluginStats value, PluginStats... values) { this.plugins = _listAdd(this.plugins, value, values); return this; } /** - * Required - Contains statistics about installed plugins and modules by - * selected nodes. + * Contains statistics about installed plugins and modules by selected nodes. If no plugins or modules are installed, this array is + * empty. *

* API name: {@code plugins} + *

+ * *

* Adds a value to plugins using a builder lambda. + *

*/ + @Nonnull public final Builder plugins(Function> fn) { return plugins(fn.apply(new PluginStats.Builder()).build()); } /** - * Required - Contains statistics about processes used by selected nodes. + * Contains statistics about processes used by selected nodes. *

* API name: {@code process} + *

*/ - public final Builder process(ClusterProcess value) { + @Nonnull + public final Builder process(@Nullable ClusterProcess value) { this.process = value; return this; } /** - * Required - Contains statistics about processes used by selected nodes. + * Contains statistics about processes used by selected nodes. *

* API name: {@code process} + *

*/ + @Nonnull public final Builder process(Function> fn) { - return this.process(fn.apply(new ClusterProcess.Builder()).build()); + return process(fn.apply(new ClusterProcess.Builder()).build()); } /** - * Required - Array of OpenSearch versions used on selected nodes. + * Array of OpenSearch versions used on selected nodes. *

* API name: {@code versions} + *

+ * *

* Adds all elements of list to versions. + *

*/ + @Nonnull public final Builder versions(List list) { this.versions = _listAddAll(this.versions, list); return this; } /** - * Required - Array of OpenSearch versions used on selected nodes. + * Array of OpenSearch versions used on selected nodes. *

* API name: {@code versions} + *

+ * *

* Adds one or more values to versions. + *

*/ + @Nonnull public final Builder versions(String value, String... values) { this.versions = _listAdd(this.versions, value, values); return this; @@ -567,9 +752,10 @@ public final Builder versions(String value, String... values) { /** * Builds a {@link ClusterNodes}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ClusterNodes build() { _checkSingleUse(); @@ -588,7 +774,6 @@ public ClusterNodes build() { ); protected static void setupClusterNodesDeserializer(ObjectDeserializer op) { - op.add(Builder::count, ClusterNodeCount._DESERIALIZER, "count"); op.add( Builder::discoveryTypes, @@ -596,6 +781,7 @@ protected static void setupClusterNodesDeserializer(ObjectDeserializer { + private final int allocatedProcessors; + @Nonnull + private final List architectures; + private final int availableProcessors; + @Nonnull private final OperatingSystemMemoryInfo mem; + @Nonnull private final List names; + @Nonnull private final List prettyNames; - private final List architectures; - // --------------------------------------------------------------------------------------------- private ClusterOperatingSystem(Builder builder) { - this.allocatedProcessors = ApiTypeHelper.requireNonNull(builder.allocatedProcessors, this, "allocatedProcessors"); + this.architectures = ApiTypeHelper.unmodifiable(builder.architectures); this.availableProcessors = ApiTypeHelper.requireNonNull(builder.availableProcessors, this, "availableProcessors"); this.mem = ApiTypeHelper.requireNonNull(builder.mem, this, "mem"); this.names = ApiTypeHelper.unmodifiableRequired(builder.names, this, "names"); this.prettyNames = ApiTypeHelper.unmodifiableRequired(builder.prettyNames, this, "prettyNames"); - this.architectures = ApiTypeHelper.unmodifiable(builder.architectures); - } - public static ClusterOperatingSystem of(Function> fn) { + public static ClusterOperatingSystem of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code allocated_processors} + * Required - Number of processors used to calculate thread pool size across all selected nodes. This number can be set with the + * processors setting of a node and defaults to the number of processors reported by the operating system. In both cases, this number + * will never be larger than 32. + *

+ * API name: {@code allocated_processors} + *

*/ public final int allocatedProcessors() { return this.allocatedProcessors; } /** - * Required - API name: {@code available_processors} + * Contains statistics about processor architectures (for example, x86_64 or aarch64) used by selected nodes. + *

+ * API name: {@code architectures} + *

+ */ + @Nonnull + public final List architectures() { + return this.architectures; + } + + /** + * Required - Number of processors available to JVM across all selected nodes. + *

+ * API name: {@code available_processors} + *

*/ public final int availableProcessors() { return this.availableProcessors; @@ -96,34 +131,37 @@ public final int availableProcessors() { /** * Required - API name: {@code mem} */ + @Nonnull public final OperatingSystemMemoryInfo mem() { return this.mem; } /** - * Required - API name: {@code names} + * Required - Contains statistics about operating systems used by selected nodes. + *

+ * API name: {@code names} + *

*/ + @Nonnull public final List names() { return this.names; } /** - * Required - API name: {@code pretty_names} + * Required - Contains statistics about operating systems used by selected nodes. + *

+ * API name: {@code pretty_names} + *

*/ + @Nonnull public final List prettyNames() { return this.prettyNames; } - /** - * API name: {@code architectures} - */ - public final List architectures() { - return this.architectures; - } - /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -131,80 +169,160 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("allocated_processors"); generator.write(this.allocatedProcessors); - generator.writeKey("available_processors"); - generator.write(this.availableProcessors); - - generator.writeKey("mem"); - this.mem.serialize(generator, mapper); - - if (ApiTypeHelper.isDefined(this.names)) { - generator.writeKey("names"); - generator.writeStartArray(); - for (ClusterOperatingSystemName item0 : this.names) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.prettyNames)) { - generator.writeKey("pretty_names"); - generator.writeStartArray(); - for (ClusterOperatingSystemPrettyName item0 : this.prettyNames) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } if (ApiTypeHelper.isDefined(this.architectures)) { generator.writeKey("architectures"); generator.writeStartArray(); for (ClusterOperatingSystemArchitecture item0 : this.architectures) { item0.serialize(generator, mapper); - } generator.writeEnd(); + } + + generator.writeKey("available_processors"); + generator.write(this.availableProcessors); + + generator.writeKey("mem"); + this.mem.serialize(generator, mapper); + generator.writeKey("names"); + generator.writeStartArray(); + for (ClusterOperatingSystemName item0 : this.names) { + item0.serialize(generator, mapper); } + generator.writeEnd(); + generator.writeKey("pretty_names"); + generator.writeStartArray(); + for (ClusterOperatingSystemPrettyName item0 : this.prettyNames) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ClusterOperatingSystem}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Integer allocatedProcessors; - + @Nullable + private List architectures; private Integer availableProcessors; - private OperatingSystemMemoryInfo mem; - private List names; - private List prettyNames; - @Nullable - private List architectures; + public Builder() {} + + private Builder(ClusterOperatingSystem o) { + this.allocatedProcessors = o.allocatedProcessors; + this.architectures = _listCopy(o.architectures); + this.availableProcessors = o.availableProcessors; + this.mem = o.mem; + this.names = _listCopy(o.names); + this.prettyNames = _listCopy(o.prettyNames); + } + + private Builder(Builder o) { + this.allocatedProcessors = o.allocatedProcessors; + this.architectures = _listCopy(o.architectures); + this.availableProcessors = o.availableProcessors; + this.mem = o.mem; + this.names = _listCopy(o.names); + this.prettyNames = _listCopy(o.prettyNames); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * Required - API name: {@code allocated_processors} + * Required - Number of processors used to calculate thread pool size across all selected nodes. This number can be set with the + * processors setting of a node and defaults to the number of processors reported by the operating system. In both cases, this + * number will never be larger than 32. + *

+ * API name: {@code allocated_processors} + *

*/ + @Nonnull public final Builder allocatedProcessors(int value) { this.allocatedProcessors = value; return this; } /** - * Required - API name: {@code available_processors} + * Contains statistics about processor architectures (for example, x86_64 or aarch64) used by selected nodes. + *

+ * API name: {@code architectures} + *

+ * + *

+ * Adds all elements of list to architectures. + *

+ */ + @Nonnull + public final Builder architectures(List list) { + this.architectures = _listAddAll(this.architectures, list); + return this; + } + + /** + * Contains statistics about processor architectures (for example, x86_64 or aarch64) used by selected nodes. + *

+ * API name: {@code architectures} + *

+ * + *

+ * Adds one or more values to architectures. + *

+ */ + @Nonnull + public final Builder architectures(ClusterOperatingSystemArchitecture value, ClusterOperatingSystemArchitecture... values) { + this.architectures = _listAdd(this.architectures, value, values); + return this; + } + + /** + * Contains statistics about processor architectures (for example, x86_64 or aarch64) used by selected nodes. + *

+ * API name: {@code architectures} + *

+ * + *

+ * Adds a value to architectures using a builder lambda. + *

+ */ + @Nonnull + public final Builder architectures( + Function> fn + ) { + return architectures(fn.apply(new ClusterOperatingSystemArchitecture.Builder()).build()); + } + + /** + * Required - Number of processors available to JVM across all selected nodes. + *

+ * API name: {@code available_processors} + *

*/ + @Nonnull public final Builder availableProcessors(int value) { this.availableProcessors = value; return this; @@ -213,6 +331,7 @@ public final Builder availableProcessors(int value) { /** * Required - API name: {@code mem} */ + @Nonnull public final Builder mem(OperatingSystemMemoryInfo value) { this.mem = value; return this; @@ -221,107 +340,114 @@ public final Builder mem(OperatingSystemMemoryInfo value) { /** * Required - API name: {@code mem} */ + @Nonnull public final Builder mem(Function> fn) { - return this.mem(fn.apply(new OperatingSystemMemoryInfo.Builder()).build()); + return mem(fn.apply(new OperatingSystemMemoryInfo.Builder()).build()); } /** - * Required - API name: {@code names} + * Required - Contains statistics about operating systems used by selected nodes. + *

+ * API name: {@code names} + *

+ * *

* Adds all elements of list to names. + *

*/ + @Nonnull public final Builder names(List list) { this.names = _listAddAll(this.names, list); return this; } /** - * Required - API name: {@code names} + * Required - Contains statistics about operating systems used by selected nodes. + *

+ * API name: {@code names} + *

+ * *

* Adds one or more values to names. + *

*/ + @Nonnull public final Builder names(ClusterOperatingSystemName value, ClusterOperatingSystemName... values) { this.names = _listAdd(this.names, value, values); return this; } /** - * Required - API name: {@code names} + * Required - Contains statistics about operating systems used by selected nodes. + *

+ * API name: {@code names} + *

+ * *

* Adds a value to names using a builder lambda. + *

*/ + @Nonnull public final Builder names(Function> fn) { return names(fn.apply(new ClusterOperatingSystemName.Builder()).build()); } /** - * Required - API name: {@code pretty_names} + * Required - Contains statistics about operating systems used by selected nodes. + *

+ * API name: {@code pretty_names} + *

+ * *

* Adds all elements of list to prettyNames. + *

*/ + @Nonnull public final Builder prettyNames(List list) { this.prettyNames = _listAddAll(this.prettyNames, list); return this; } /** - * Required - API name: {@code pretty_names} + * Required - Contains statistics about operating systems used by selected nodes. + *

+ * API name: {@code pretty_names} + *

+ * *

* Adds one or more values to prettyNames. + *

*/ + @Nonnull public final Builder prettyNames(ClusterOperatingSystemPrettyName value, ClusterOperatingSystemPrettyName... values) { this.prettyNames = _listAdd(this.prettyNames, value, values); return this; } /** - * Required - API name: {@code pretty_names} + * Required - Contains statistics about operating systems used by selected nodes. + *

+ * API name: {@code pretty_names} + *

+ * *

* Adds a value to prettyNames using a builder lambda. + *

*/ + @Nonnull public final Builder prettyNames( Function> fn ) { return prettyNames(fn.apply(new ClusterOperatingSystemPrettyName.Builder()).build()); } - /** - * API name: {@code architectures} - *

- * Adds all elements of list to architectures. - */ - public final Builder architectures(List list) { - this.architectures = _listAddAll(this.architectures, list); - return this; - } - - /** - * API name: {@code architectures} - *

- * Adds one or more values to architectures. - */ - public final Builder architectures(ClusterOperatingSystemArchitecture value, ClusterOperatingSystemArchitecture... values) { - this.architectures = _listAdd(this.architectures, value, values); - return this; - } - - /** - * API name: {@code architectures} - *

- * Adds a value to architectures using a builder lambda. - */ - public final Builder architectures( - Function> fn - ) { - return architectures(fn.apply(new ClusterOperatingSystemArchitecture.Builder()).build()); - } - /** * Builds a {@link ClusterOperatingSystem}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ClusterOperatingSystem build() { _checkSingleUse(); @@ -340,18 +466,40 @@ public ClusterOperatingSystem build() { ); protected static void setupClusterOperatingSystemDeserializer(ObjectDeserializer op) { - op.add(Builder::allocatedProcessors, JsonpDeserializer.integerDeserializer(), "allocated_processors"); - op.add(Builder::availableProcessors, JsonpDeserializer.integerDeserializer(), "available_processors"); - op.add(Builder::mem, OperatingSystemMemoryInfo._DESERIALIZER, "mem"); - op.add(Builder::names, JsonpDeserializer.arrayDeserializer(ClusterOperatingSystemName._DESERIALIZER), "names"); - op.add(Builder::prettyNames, JsonpDeserializer.arrayDeserializer(ClusterOperatingSystemPrettyName._DESERIALIZER), "pretty_names"); op.add( Builder::architectures, JsonpDeserializer.arrayDeserializer(ClusterOperatingSystemArchitecture._DESERIALIZER), "architectures" ); + op.add(Builder::availableProcessors, JsonpDeserializer.integerDeserializer(), "available_processors"); + op.add(Builder::mem, OperatingSystemMemoryInfo._DESERIALIZER, "mem"); + op.add(Builder::names, JsonpDeserializer.arrayDeserializer(ClusterOperatingSystemName._DESERIALIZER), "names"); + op.add(Builder::prettyNames, JsonpDeserializer.arrayDeserializer(ClusterOperatingSystemPrettyName._DESERIALIZER), "pretty_names"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Integer.hashCode(this.allocatedProcessors); + result = 31 * result + Objects.hashCode(this.architectures); + result = 31 * result + Integer.hashCode(this.availableProcessors); + result = 31 * result + this.mem.hashCode(); + result = 31 * result + this.names.hashCode(); + result = 31 * result + this.prettyNames.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterOperatingSystem other = (ClusterOperatingSystem) o; + return this.allocatedProcessors == other.allocatedProcessors + && Objects.equals(this.architectures, other.architectures) + && this.availableProcessors == other.availableProcessors + && this.mem.equals(other.mem) + && this.names.equals(other.names) + && this.prettyNames.equals(other.prettyNames); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystemArchitecture.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystemArchitecture.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystemArchitecture.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystemArchitecture.java index 47562445bc..18f0c1f440 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystemArchitecture.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystemArchitecture.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.stats; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,47 +47,63 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.stats.ClusterOperatingSystemArchitecture @JsonpDeserializable -public class ClusterOperatingSystemArchitecture implements PlainJsonSerializable { - private final int count; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterOperatingSystemArchitecture + implements + PlainJsonSerializable, + ToCopyableBuilder { + @Nonnull private final String arch; + private final int count; + // --------------------------------------------------------------------------------------------- private ClusterOperatingSystemArchitecture(Builder builder) { - - this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); this.arch = ApiTypeHelper.requireNonNull(builder.arch, this, "arch"); - + this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); } - public static ClusterOperatingSystemArchitecture of(Function> fn) { + public static ClusterOperatingSystemArchitecture of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code count} + * Required - Name of an architecture used by one or more selected nodes. + *

+ * API name: {@code arch} + *

*/ - public final int count() { - return this.count; + @Nonnull + public final String arch() { + return this.arch; } /** - * Required - API name: {@code arch} + * Required - Number of selected nodes using the architecture. + *

+ * API name: {@code count} + *

*/ - public final String arch() { - return this.arch; + public final int count() { + return this.count; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,48 +111,82 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("arch"); + generator.write(this.arch); generator.writeKey("count"); generator.write(this.count); + } - generator.writeKey("arch"); - generator.write(this.arch); + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link ClusterOperatingSystemArchitecture}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private String arch; private Integer count; - private String arch; + public Builder() {} + + private Builder(ClusterOperatingSystemArchitecture o) { + this.arch = o.arch; + this.count = o.count; + } + + private Builder(Builder o) { + this.arch = o.arch; + this.count = o.count; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * Required - API name: {@code count} + * Required - Name of an architecture used by one or more selected nodes. + *

+ * API name: {@code arch} + *

*/ - public final Builder count(int value) { - this.count = value; + @Nonnull + public final Builder arch(String value) { + this.arch = value; return this; } /** - * Required - API name: {@code arch} + * Required - Number of selected nodes using the architecture. + *

+ * API name: {@code count} + *

*/ - public final Builder arch(String value) { - this.arch = value; + @Nonnull + public final Builder count(int value) { + this.count = value; return this; } /** * Builds a {@link ClusterOperatingSystemArchitecture}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ClusterOperatingSystemArchitecture build() { _checkSingleUse(); @@ -151,10 +207,23 @@ public ClusterOperatingSystemArchitecture build() { protected static void setupClusterOperatingSystemArchitectureDeserializer( ObjectDeserializer op ) { - - op.add(Builder::count, JsonpDeserializer.integerDeserializer(), "count"); op.add(Builder::arch, JsonpDeserializer.stringDeserializer(), "arch"); + op.add(Builder::count, JsonpDeserializer.integerDeserializer(), "count"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.arch.hashCode(); + result = 31 * result + Integer.hashCode(this.count); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterOperatingSystemArchitecture other = (ClusterOperatingSystemArchitecture) o; + return this.arch.equals(other.arch) && this.count == other.count; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystemName.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystemName.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystemName.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystemName.java index 892a61ac32..7ee50aaf72 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystemName.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystemName.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.stats; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,32 +47,43 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.stats.ClusterOperatingSystemName @JsonpDeserializable -public class ClusterOperatingSystemName implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterOperatingSystemName + implements + PlainJsonSerializable, + ToCopyableBuilder { + private final int count; + @Nonnull private final String name; // --------------------------------------------------------------------------------------------- private ClusterOperatingSystemName(Builder builder) { - this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - } - public static ClusterOperatingSystemName of(Function> fn) { + public static ClusterOperatingSystemName of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code count} + * Required - Number of selected nodes using the operating system. + *

+ * API name: {@code count} + *

*/ public final int count() { return this.count; @@ -75,6 +92,7 @@ public final int count() { /** * Required - API name: {@code name} */ + @Nonnull public final String name() { return this.name; } @@ -82,6 +100,7 @@ public final String name() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,29 +108,58 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("count"); generator.write(this.count); generator.writeKey("name"); generator.write(this.name); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ClusterOperatingSystemName}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Integer count; - private String name; + public Builder() {} + + private Builder(ClusterOperatingSystemName o) { + this.count = o.count; + this.name = o.name; + } + + private Builder(Builder o) { + this.count = o.count; + this.name = o.name; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Required - API name: {@code count} + * Required - Number of selected nodes using the operating system. + *

+ * API name: {@code count} + *

*/ + @Nonnull public final Builder count(int value) { this.count = value; return this; @@ -120,6 +168,7 @@ public final Builder count(int value) { /** * Required - API name: {@code name} */ + @Nonnull public final Builder name(String value) { this.name = value; return this; @@ -128,9 +177,10 @@ public final Builder name(String value) { /** * Builds a {@link ClusterOperatingSystemName}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ClusterOperatingSystemName build() { _checkSingleUse(); @@ -149,10 +199,23 @@ public ClusterOperatingSystemName build() { ); protected static void setupClusterOperatingSystemNameDeserializer(ObjectDeserializer op) { - op.add(Builder::count, JsonpDeserializer.integerDeserializer(), "count"); op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Integer.hashCode(this.count); + result = 31 * result + this.name.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterOperatingSystemName other = (ClusterOperatingSystemName) o; + return this.count == other.count && this.name.equals(other.name); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystemPrettyName.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystemPrettyName.java similarity index 65% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystemPrettyName.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystemPrettyName.java index 98c56c31a6..654e1a0191 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystemPrettyName.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystemPrettyName.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.stats; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,32 +47,43 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.stats.ClusterOperatingSystemPrettyName @JsonpDeserializable -public class ClusterOperatingSystemPrettyName implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterOperatingSystemPrettyName + implements + PlainJsonSerializable, + ToCopyableBuilder { + private final int count; + @Nonnull private final String prettyName; // --------------------------------------------------------------------------------------------- private ClusterOperatingSystemPrettyName(Builder builder) { - this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); this.prettyName = ApiTypeHelper.requireNonNull(builder.prettyName, this, "prettyName"); - } - public static ClusterOperatingSystemPrettyName of(Function> fn) { + public static ClusterOperatingSystemPrettyName of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code count} + * Required - Number of selected nodes using the operating system. + *

+ * API name: {@code count} + *

*/ public final int count() { return this.count; @@ -75,6 +92,7 @@ public final int count() { /** * Required - API name: {@code pretty_name} */ + @Nonnull public final String prettyName() { return this.prettyName; } @@ -82,6 +100,7 @@ public final String prettyName() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,29 +108,58 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("count"); generator.write(this.count); generator.writeKey("pretty_name"); generator.write(this.prettyName); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ClusterOperatingSystemPrettyName}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Integer count; - private String prettyName; + public Builder() {} + + private Builder(ClusterOperatingSystemPrettyName o) { + this.count = o.count; + this.prettyName = o.prettyName; + } + + private Builder(Builder o) { + this.count = o.count; + this.prettyName = o.prettyName; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Required - API name: {@code count} + * Required - Number of selected nodes using the operating system. + *

+ * API name: {@code count} + *

*/ + @Nonnull public final Builder count(int value) { this.count = value; return this; @@ -120,6 +168,7 @@ public final Builder count(int value) { /** * Required - API name: {@code pretty_name} */ + @Nonnull public final Builder prettyName(String value) { this.prettyName = value; return this; @@ -128,9 +177,10 @@ public final Builder prettyName(String value) { /** * Builds a {@link ClusterOperatingSystemPrettyName}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ClusterOperatingSystemPrettyName build() { _checkSingleUse(); @@ -151,10 +201,23 @@ public ClusterOperatingSystemPrettyName build() { protected static void setupClusterOperatingSystemPrettyNameDeserializer( ObjectDeserializer op ) { - op.add(Builder::count, JsonpDeserializer.integerDeserializer(), "count"); op.add(Builder::prettyName, JsonpDeserializer.stringDeserializer(), "pretty_name"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Integer.hashCode(this.count); + result = 31 * result + this.prettyName.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterOperatingSystemPrettyName other = (ClusterOperatingSystemPrettyName) o; + return this.count == other.count && this.prettyName.equals(other.prettyName); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcess.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcess.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcess.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcess.java index 46799262c8..985166bc1c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcess.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcess.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.stats; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,33 +47,38 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.stats.ClusterProcess @JsonpDeserializable -public class ClusterProcess implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterProcess implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final ClusterProcessCpu cpu; + @Nonnull private final ClusterProcessOpenFileDescriptors openFileDescriptors; // --------------------------------------------------------------------------------------------- private ClusterProcess(Builder builder) { - this.cpu = ApiTypeHelper.requireNonNull(builder.cpu, this, "cpu"); this.openFileDescriptors = ApiTypeHelper.requireNonNull(builder.openFileDescriptors, this, "openFileDescriptors"); - } - public static ClusterProcess of(Function> fn) { + public static ClusterProcess of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code cpu} */ + @Nonnull public final ClusterProcessCpu cpu() { return this.cpu; } @@ -75,6 +86,7 @@ public final ClusterProcessCpu cpu() { /** * Required - API name: {@code open_file_descriptors} */ + @Nonnull public final ClusterProcessOpenFileDescriptors openFileDescriptors() { return this.openFileDescriptors; } @@ -82,6 +94,7 @@ public final ClusterProcessOpenFileDescriptors openFileDescriptors() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,29 +102,55 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("cpu"); this.cpu.serialize(generator, mapper); generator.writeKey("open_file_descriptors"); this.openFileDescriptors.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ClusterProcess}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private ClusterProcessCpu cpu; - private ClusterProcessOpenFileDescriptors openFileDescriptors; + public Builder() {} + + private Builder(ClusterProcess o) { + this.cpu = o.cpu; + this.openFileDescriptors = o.openFileDescriptors; + } + + private Builder(Builder o) { + this.cpu = o.cpu; + this.openFileDescriptors = o.openFileDescriptors; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code cpu} */ + @Nonnull public final Builder cpu(ClusterProcessCpu value) { this.cpu = value; return this; @@ -120,13 +159,15 @@ public final Builder cpu(ClusterProcessCpu value) { /** * Required - API name: {@code cpu} */ + @Nonnull public final Builder cpu(Function> fn) { - return this.cpu(fn.apply(new ClusterProcessCpu.Builder()).build()); + return cpu(fn.apply(new ClusterProcessCpu.Builder()).build()); } /** * Required - API name: {@code open_file_descriptors} */ + @Nonnull public final Builder openFileDescriptors(ClusterProcessOpenFileDescriptors value) { this.openFileDescriptors = value; return this; @@ -135,18 +176,20 @@ public final Builder openFileDescriptors(ClusterProcessOpenFileDescriptors value /** * Required - API name: {@code open_file_descriptors} */ + @Nonnull public final Builder openFileDescriptors( Function> fn ) { - return this.openFileDescriptors(fn.apply(new ClusterProcessOpenFileDescriptors.Builder()).build()); + return openFileDescriptors(fn.apply(new ClusterProcessOpenFileDescriptors.Builder()).build()); } /** * Builds a {@link ClusterProcess}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ClusterProcess build() { _checkSingleUse(); @@ -165,10 +208,23 @@ public ClusterProcess build() { ); protected static void setupClusterProcessDeserializer(ObjectDeserializer op) { - op.add(Builder::cpu, ClusterProcessCpu._DESERIALIZER, "cpu"); op.add(Builder::openFileDescriptors, ClusterProcessOpenFileDescriptors._DESERIALIZER, "open_file_descriptors"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.cpu.hashCode(); + result = 31 * result + this.openFileDescriptors.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterProcess other = (ClusterProcess) o; + return this.cpu.equals(other.cpu) && this.openFileDescriptors.equals(other.openFileDescriptors); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcessCpu.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcessCpu.java similarity index 60% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcessCpu.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcessCpu.java index 72d58b111f..88ac82b938 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcessCpu.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcessCpu.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.stats; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,37 +47,43 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.stats.ClusterProcessCpu @JsonpDeserializable -public class ClusterProcessCpu implements PlainJsonSerializable { - private final int percent; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterProcessCpu implements PlainJsonSerializable, ToCopyableBuilder { + + private final double percent; // --------------------------------------------------------------------------------------------- private ClusterProcessCpu(Builder builder) { - this.percent = ApiTypeHelper.requireNonNull(builder.percent, this, "percent"); - } - public static ClusterProcessCpu of(Function> fn) { + public static ClusterProcessCpu of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code percent} + * Required - Percentage of CPU used across all selected nodes. Returns -1 if not supported. + *

+ * API name: {@code percent} + *

*/ - public final int percent() { + public final double percent() { return this.percent; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -79,25 +91,53 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("percent"); generator.write(this.percent); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ClusterProcessCpu}. */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private Double percent; - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Integer percent; + public Builder() {} + + private Builder(ClusterProcessCpu o) { + this.percent = o.percent; + } + + private Builder(Builder o) { + this.percent = o.percent; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * Required - API name: {@code percent} + * Required - Percentage of CPU used across all selected nodes. Returns -1 if not supported. + *

+ * API name: {@code percent} + *

*/ - public final Builder percent(int value) { + @Nonnull + public final Builder percent(double value) { this.percent = value; return this; } @@ -105,9 +145,10 @@ public final Builder percent(int value) { /** * Builds a {@link ClusterProcessCpu}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ClusterProcessCpu build() { _checkSingleUse(); @@ -126,9 +167,21 @@ public ClusterProcessCpu build() { ); protected static void setupClusterProcessCpuDeserializer(ObjectDeserializer op) { + op.add(Builder::percent, JsonpDeserializer.doubleDeserializer(), "percent"); + } - op.add(Builder::percent, JsonpDeserializer.integerDeserializer(), "percent"); - + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Double.hashCode(this.percent); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterProcessCpu other = (ClusterProcessCpu) o; + return this.percent == other.percent; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcessOpenFileDescriptors.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcessOpenFileDescriptors.java similarity index 59% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcessOpenFileDescriptors.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcessOpenFileDescriptors.java index 48f2e84314..e8936c62fe 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcessOpenFileDescriptors.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcessOpenFileDescriptors.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.stats; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,13 +47,20 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.stats.ClusterProcessOpenFileDescriptors @JsonpDeserializable -public class ClusterProcessOpenFileDescriptors implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterProcessOpenFileDescriptors + implements + PlainJsonSerializable, + ToCopyableBuilder { + private final long avg; private final long max; @@ -57,33 +70,43 @@ public class ClusterProcessOpenFileDescriptors implements PlainJsonSerializable // --------------------------------------------------------------------------------------------- private ClusterProcessOpenFileDescriptors(Builder builder) { - this.avg = ApiTypeHelper.requireNonNull(builder.avg, this, "avg"); this.max = ApiTypeHelper.requireNonNull(builder.max, this, "max"); this.min = ApiTypeHelper.requireNonNull(builder.min, this, "min"); - } - public static ClusterProcessOpenFileDescriptors of(Function> fn) { + public static ClusterProcessOpenFileDescriptors of( + Function> fn + ) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code avg} + * Required - Average number of concurrently open file descriptors. Returns -1 if not supported. + *

+ * API name: {@code avg} + *

*/ public final long avg() { return this.avg; } /** - * Required - API name: {@code max} + * Required - Maximum number of concurrently open file descriptors allowed across all selected nodes. Returns -1 if not + * supported. + *

+ * API name: {@code max} + *

*/ public final long max() { return this.max; } /** - * Required - API name: {@code min} + * Required - Minimum number of concurrently open file descriptors across all selected nodes. Returns -1 if not supported. + *

+ * API name: {@code min} + *

*/ public final long min() { return this.min; @@ -92,6 +115,7 @@ public final long min() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -99,7 +123,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("avg"); generator.write(this.avg); @@ -108,41 +131,81 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("min"); generator.write(this.min); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ClusterProcessOpenFileDescriptors}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Long avg; - private Long max; - private Long min; + public Builder() {} + + private Builder(ClusterProcessOpenFileDescriptors o) { + this.avg = o.avg; + this.max = o.max; + this.min = o.min; + } + + private Builder(Builder o) { + this.avg = o.avg; + this.max = o.max; + this.min = o.min; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Required - API name: {@code avg} + * Required - Average number of concurrently open file descriptors. Returns -1 if not supported. + *

+ * API name: {@code avg} + *

*/ + @Nonnull public final Builder avg(long value) { this.avg = value; return this; } /** - * Required - API name: {@code max} + * Required - Maximum number of concurrently open file descriptors allowed across all selected nodes. Returns -1 if not + * supported. + *

+ * API name: {@code max} + *

*/ + @Nonnull public final Builder max(long value) { this.max = value; return this; } /** - * Required - API name: {@code min} + * Required - Minimum number of concurrently open file descriptors across all selected nodes. Returns -1 if not supported. + *

+ * API name: {@code min} + *

*/ + @Nonnull public final Builder min(long value) { this.min = value; return this; @@ -151,9 +214,10 @@ public final Builder min(long value) { /** * Builds a {@link ClusterProcessOpenFileDescriptors}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ClusterProcessOpenFileDescriptors build() { _checkSingleUse(); @@ -174,11 +238,25 @@ public ClusterProcessOpenFileDescriptors build() { protected static void setupClusterProcessOpenFileDescriptorsDeserializer( ObjectDeserializer op ) { - op.add(Builder::avg, JsonpDeserializer.longDeserializer(), "avg"); op.add(Builder::max, JsonpDeserializer.longDeserializer(), "max"); op.add(Builder::min, JsonpDeserializer.longDeserializer(), "min"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Long.hashCode(this.avg); + result = 31 * result + Long.hashCode(this.max); + result = 31 * result + Long.hashCode(this.min); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterProcessOpenFileDescriptors other = (ClusterProcessOpenFileDescriptors) o; + return this.avg == other.avg && this.max == other.max && this.min == other.min; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcessor.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcessor.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcessor.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcessor.java index b485c9d94b..142ed8df05 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcessor.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcessor.java @@ -30,44 +30,59 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.stats; 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; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.stats.ClusterProcessor @JsonpDeserializable -public class ClusterProcessor implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterProcessor implements PlainJsonSerializable, ToCopyableBuilder { + private final long count; private final long current; private final long failed; + @Nullable + private final Time time; + private final long timeInMillis; // --------------------------------------------------------------------------------------------- private ClusterProcessor(Builder builder) { - this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); this.current = ApiTypeHelper.requireNonNull(builder.current, this, "current"); this.failed = ApiTypeHelper.requireNonNull(builder.failed, this, "failed"); + this.time = builder.time; this.timeInMillis = ApiTypeHelper.requireNonNull(builder.timeInMillis, this, "timeInMillis"); - } - public static ClusterProcessor of(Function> fn) { + public static ClusterProcessor of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -92,6 +107,14 @@ public final long failed() { return this.failed; } + /** + * API name: {@code time} + */ + @Nullable + public final Time time() { + return this.time; + } + /** * Required - API name: {@code time_in_millis} */ @@ -102,6 +125,7 @@ public final long timeInMillis() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -109,7 +133,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("count"); generator.write(this.count); @@ -119,29 +142,67 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("failed"); generator.write(this.failed); + if (this.time != null) { + generator.writeKey("time"); + this.time.serialize(generator, mapper); + } + generator.writeKey("time_in_millis"); generator.write(this.timeInMillis); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ClusterProcessor}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Long count; - private Long current; - private Long failed; - + @Nullable + private Time time; private Long timeInMillis; + public Builder() {} + + private Builder(ClusterProcessor o) { + this.count = o.count; + this.current = o.current; + this.failed = o.failed; + this.time = o.time; + this.timeInMillis = o.timeInMillis; + } + + private Builder(Builder o) { + this.count = o.count; + this.current = o.current; + this.failed = o.failed; + this.time = o.time; + this.timeInMillis = o.timeInMillis; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code count} */ + @Nonnull public final Builder count(long value) { this.count = value; return this; @@ -150,6 +211,7 @@ public final Builder count(long value) { /** * Required - API name: {@code current} */ + @Nonnull public final Builder current(long value) { this.current = value; return this; @@ -158,14 +220,33 @@ public final Builder current(long value) { /** * Required - API name: {@code failed} */ + @Nonnull public final Builder failed(long value) { this.failed = value; return this; } + /** + * API name: {@code time} + */ + @Nonnull + public final Builder time(@Nullable Time value) { + this.time = value; + return this; + } + + /** + * API name: {@code time} + */ + @Nonnull + public final Builder time(Function> fn) { + return time(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code time_in_millis} */ + @Nonnull public final Builder timeInMillis(long value) { this.timeInMillis = value; return this; @@ -174,9 +255,10 @@ public final Builder timeInMillis(long value) { /** * Builds a {@link ClusterProcessor}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ClusterProcessor build() { _checkSingleUse(); @@ -195,12 +277,33 @@ public ClusterProcessor build() { ); protected static void setupClusterProcessorDeserializer(ObjectDeserializer op) { - op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); op.add(Builder::current, JsonpDeserializer.longDeserializer(), "current"); op.add(Builder::failed, JsonpDeserializer.longDeserializer(), "failed"); + op.add(Builder::time, Time._DESERIALIZER, "time"); op.add(Builder::timeInMillis, JsonpDeserializer.longDeserializer(), "time_in_millis"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Long.hashCode(this.count); + result = 31 * result + Long.hashCode(this.current); + result = 31 * result + Long.hashCode(this.failed); + result = 31 * result + Objects.hashCode(this.time); + result = 31 * result + Long.hashCode(this.timeInMillis); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterProcessor other = (ClusterProcessor) o; + return this.count == other.count + && this.current == other.current + && this.failed == other.failed + && Objects.equals(this.time, other.time) + && this.timeInMillis == other.timeInMillis; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterShardMetrics.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterShardMetrics.java similarity index 61% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterShardMetrics.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterShardMetrics.java index baf8a19a3d..1708088d78 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterShardMetrics.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterShardMetrics.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.stats; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,13 +47,17 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.stats.ClusterShardMetrics @JsonpDeserializable -public class ClusterShardMetrics implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ClusterShardMetrics implements PlainJsonSerializable, ToCopyableBuilder { + private final double avg; private final double max; @@ -57,33 +67,40 @@ public class ClusterShardMetrics implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private ClusterShardMetrics(Builder builder) { - this.avg = ApiTypeHelper.requireNonNull(builder.avg, this, "avg"); this.max = ApiTypeHelper.requireNonNull(builder.max, this, "max"); this.min = ApiTypeHelper.requireNonNull(builder.min, this, "min"); - } - public static ClusterShardMetrics of(Function> fn) { + public static ClusterShardMetrics of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code avg} + * Required - Mean number of shards in an index, counting only shards assigned to selected nodes. + *

+ * API name: {@code avg} + *

*/ public final double avg() { return this.avg; } /** - * Required - API name: {@code max} + * Required - Maximum number of shards in an index, counting only shards assigned to selected nodes. + *

+ * API name: {@code max} + *

*/ public final double max() { return this.max; } /** - * Required - API name: {@code min} + * Required - Minimum number of shards in an index, counting only shards assigned to selected nodes. + *

+ * API name: {@code min} + *

*/ public final double min() { return this.min; @@ -92,6 +109,7 @@ public final double min() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -99,7 +117,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("avg"); generator.write(this.avg); @@ -108,41 +125,80 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("min"); generator.write(this.min); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ClusterShardMetrics}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Double avg; - private Double max; - private Double min; + public Builder() {} + + private Builder(ClusterShardMetrics o) { + this.avg = o.avg; + this.max = o.max; + this.min = o.min; + } + + private Builder(Builder o) { + this.avg = o.avg; + this.max = o.max; + this.min = o.min; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Required - API name: {@code avg} + * Required - Mean number of shards in an index, counting only shards assigned to selected nodes. + *

+ * API name: {@code avg} + *

*/ + @Nonnull public final Builder avg(double value) { this.avg = value; return this; } /** - * Required - API name: {@code max} + * Required - Maximum number of shards in an index, counting only shards assigned to selected nodes. + *

+ * API name: {@code max} + *

*/ + @Nonnull public final Builder max(double value) { this.max = value; return this; } /** - * Required - API name: {@code min} + * Required - Minimum number of shards in an index, counting only shards assigned to selected nodes. + *

+ * API name: {@code min} + *

*/ + @Nonnull public final Builder min(double value) { this.min = value; return this; @@ -151,9 +207,10 @@ public final Builder min(double value) { /** * Builds a {@link ClusterShardMetrics}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ClusterShardMetrics build() { _checkSingleUse(); @@ -172,11 +229,25 @@ public ClusterShardMetrics build() { ); protected static void setupClusterShardMetricsDeserializer(ObjectDeserializer op) { - op.add(Builder::avg, JsonpDeserializer.doubleDeserializer(), "avg"); op.add(Builder::max, JsonpDeserializer.doubleDeserializer(), "max"); op.add(Builder::min, JsonpDeserializer.doubleDeserializer(), "min"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Double.hashCode(this.avg); + result = 31 * result + Double.hashCode(this.max); + result = 31 * result + Double.hashCode(this.min); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ClusterShardMetrics other = (ClusterShardMetrics) o; + return this.avg == other.avg && this.max == other.max && this.min == other.min; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/FieldTypes.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/FieldTypes.java similarity index 64% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/FieldTypes.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/FieldTypes.java index 374f7de853..1ba0a1db9d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/FieldTypes.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/FieldTypes.java @@ -30,11 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.stats; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; -import javax.annotation.Nullable; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,69 +47,68 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.stats.FieldTypes @JsonpDeserializable -public class FieldTypes implements PlainJsonSerializable { - private final String name; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class FieldTypes implements PlainJsonSerializable, ToCopyableBuilder { private final int count; private final int indexCount; - @Nullable - private final Integer scriptCount; + @Nonnull + private final String name; // --------------------------------------------------------------------------------------------- private FieldTypes(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); this.indexCount = ApiTypeHelper.requireNonNull(builder.indexCount, this, "indexCount"); - this.scriptCount = builder.scriptCount; - + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); } - public static FieldTypes of(Function> fn) { + public static FieldTypes of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Required - API name: {@code count} + * Required - The number of occurrences of the field type in selected nodes. + *

+ * API name: {@code count} + *

*/ public final int count() { return this.count; } /** - * Required - API name: {@code index_count} + * Required - The number of indexes containing the field type in selected nodes. + *

+ * API name: {@code index_count} + *

*/ public final int indexCount() { return this.indexCount; } /** - * API name: {@code script_count} + * Required - API name: {@code name} */ - @Nullable - public final Integer scriptCount() { - return this.scriptCount; + @Nonnull + public final String name() { + return this.name; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -112,78 +116,97 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("name"); - generator.write(this.name); - generator.writeKey("count"); generator.write(this.count); generator.writeKey("index_count"); generator.write(this.indexCount); - if (this.scriptCount != null) { - generator.writeKey("script_count"); - generator.write(this.scriptCount); + generator.writeKey("name"); + generator.write(this.name); + } - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link FieldTypes}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private Integer count; + private Integer indexCount; private String name; - private Integer count; + public Builder() {} - private Integer indexCount; + private Builder(FieldTypes o) { + this.count = o.count; + this.indexCount = o.indexCount; + this.name = o.name; + } - @Nullable - private Integer scriptCount; + private Builder(Builder o) { + this.count = o.count; + this.indexCount = o.indexCount; + this.name = o.name; + } - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** - * Required - API name: {@code count} + * Required - The number of occurrences of the field type in selected nodes. + *

+ * API name: {@code count} + *

*/ + @Nonnull public final Builder count(int value) { this.count = value; return this; } /** - * Required - API name: {@code index_count} + * Required - The number of indexes containing the field type in selected nodes. + *

+ * API name: {@code index_count} + *

*/ + @Nonnull public final Builder indexCount(int value) { this.indexCount = value; return this; } /** - * API name: {@code script_count} + * Required - API name: {@code name} */ - public final Builder scriptCount(@Nullable Integer value) { - this.scriptCount = value; + @Nonnull + public final Builder name(String value) { + this.name = value; return this; } /** * Builds a {@link FieldTypes}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public FieldTypes build() { _checkSingleUse(); @@ -202,12 +225,25 @@ public FieldTypes build() { ); protected static void setupFieldTypesDeserializer(ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); op.add(Builder::count, JsonpDeserializer.integerDeserializer(), "count"); op.add(Builder::indexCount, JsonpDeserializer.integerDeserializer(), "index_count"); - op.add(Builder::scriptCount, JsonpDeserializer.integerDeserializer(), "script_count"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Integer.hashCode(this.count); + result = 31 * result + Integer.hashCode(this.indexCount); + result = 31 * result + this.name.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + FieldTypes other = (FieldTypes) o; + return this.count == other.count && this.indexCount == other.indexCount && this.name.equals(other.name); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/FieldTypesMappings.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/FieldTypesMappings.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/FieldTypesMappings.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/FieldTypesMappings.java index 8a21c8eebf..e29ed6571d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/FieldTypesMappings.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/FieldTypesMappings.java @@ -30,12 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.stats; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.function.Function; -import javax.annotation.Nullable; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -43,47 +48,45 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.stats.FieldTypesMappings @JsonpDeserializable -public class FieldTypesMappings implements PlainJsonSerializable { - private final List fieldTypes; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class FieldTypesMappings implements PlainJsonSerializable, ToCopyableBuilder { - private final List runtimeFieldTypes; + @Nonnull + private final List fieldTypes; // --------------------------------------------------------------------------------------------- private FieldTypesMappings(Builder builder) { - this.fieldTypes = ApiTypeHelper.unmodifiableRequired(builder.fieldTypes, this, "fieldTypes"); - this.runtimeFieldTypes = ApiTypeHelper.unmodifiable(builder.runtimeFieldTypes); - } - public static FieldTypesMappings of(Function> fn) { + public static FieldTypesMappings of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code field_types} + * Required - Contains statistics about field data types used in selected nodes. + *

+ * API name: {@code field_types} + *

*/ + @Nonnull public final List fieldTypes() { return this.fieldTypes; } - /** - * API name: {@code runtime_field_types} - */ - public final List runtimeFieldTypes() { - return this.runtimeFieldTypes; - } - /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -91,106 +94,103 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.fieldTypes)) { - generator.writeKey("field_types"); - generator.writeStartArray(); - for (FieldTypes item0 : this.fieldTypes) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("field_types"); + generator.writeStartArray(); + for (FieldTypes item0 : this.fieldTypes) { + item0.serialize(generator, mapper); } - if (ApiTypeHelper.isDefined(this.runtimeFieldTypes)) { - generator.writeKey("runtime_field_types"); - generator.writeStartArray(); - for (RuntimeFieldTypes item0 : this.runtimeFieldTypes) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); + generator.writeEnd(); + } - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link FieldTypesMappings}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private List fieldTypes; - @Nullable - private List runtimeFieldTypes; + public Builder() {} + + private Builder(FieldTypesMappings o) { + this.fieldTypes = _listCopy(o.fieldTypes); + } + + private Builder(Builder o) { + this.fieldTypes = _listCopy(o.fieldTypes); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * Required - API name: {@code field_types} + * Required - Contains statistics about field data types used in selected nodes. + *

+ * API name: {@code field_types} + *

+ * *

* Adds all elements of list to fieldTypes. + *

*/ + @Nonnull public final Builder fieldTypes(List list) { this.fieldTypes = _listAddAll(this.fieldTypes, list); return this; } /** - * Required - API name: {@code field_types} + * Required - Contains statistics about field data types used in selected nodes. + *

+ * API name: {@code field_types} + *

+ * *

* Adds one or more values to fieldTypes. + *

*/ + @Nonnull public final Builder fieldTypes(FieldTypes value, FieldTypes... values) { this.fieldTypes = _listAdd(this.fieldTypes, value, values); return this; } /** - * Required - API name: {@code field_types} + * Required - Contains statistics about field data types used in selected nodes. + *

+ * API name: {@code field_types} + *

+ * *

* Adds a value to fieldTypes using a builder lambda. + *

*/ + @Nonnull public final Builder fieldTypes(Function> fn) { return fieldTypes(fn.apply(new FieldTypes.Builder()).build()); } - /** - * API name: {@code runtime_field_types} - *

- * Adds all elements of list to runtimeFieldTypes. - */ - public final Builder runtimeFieldTypes(List list) { - this.runtimeFieldTypes = _listAddAll(this.runtimeFieldTypes, list); - return this; - } - - /** - * API name: {@code runtime_field_types} - *

- * Adds one or more values to runtimeFieldTypes. - */ - public final Builder runtimeFieldTypes(RuntimeFieldTypes value, RuntimeFieldTypes... values) { - this.runtimeFieldTypes = _listAdd(this.runtimeFieldTypes, value, values); - return this; - } - - /** - * API name: {@code runtime_field_types} - *

- * Adds a value to runtimeFieldTypes using a builder lambda. - */ - public final Builder runtimeFieldTypes(Function> fn) { - return runtimeFieldTypes(fn.apply(new RuntimeFieldTypes.Builder()).build()); - } - /** * Builds a {@link FieldTypesMappings}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public FieldTypesMappings build() { _checkSingleUse(); @@ -209,10 +209,21 @@ public FieldTypesMappings build() { ); protected static void setupFieldTypesMappingsDeserializer(ObjectDeserializer op) { - op.add(Builder::fieldTypes, JsonpDeserializer.arrayDeserializer(FieldTypes._DESERIALIZER), "field_types"); - op.add(Builder::runtimeFieldTypes, JsonpDeserializer.arrayDeserializer(RuntimeFieldTypes._DESERIALIZER), "runtime_field_types"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.fieldTypes.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + FieldTypesMappings other = (FieldTypesMappings) o; + return this.fieldTypes.equals(other.fieldTypes); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PostVotingConfigExclusionsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/IndexMetric.java similarity index 50% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/PostVotingConfigExclusionsResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/IndexMetric.java index 0e20b8132e..734e4458ce 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PostVotingConfigExclusionsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/IndexMetric.java @@ -30,22 +30,50 @@ * GitHub history for details. */ -package org.opensearch.client.opensearch.cluster; +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- -import org.opensearch.client.json.JsonpDeserializer; +package org.opensearch.client.opensearch.cluster.stats; -// typedef: cluster.post_voting_config_exclusions.Response +import javax.annotation.Generated; +import org.opensearch.client.json.JsonEnum; +import org.opensearch.client.json.JsonpDeserializable; -public class PostVotingConfigExclusionsResponse { - public PostVotingConfigExclusionsResponse() {} +// typedef: cluster.stats.IndexMetric - /** - * Singleton instance for {@link PostVotingConfigExclusionsResponse}. - */ - public static final PostVotingConfigExclusionsResponse _INSTANCE = new PostVotingConfigExclusionsResponse(); +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public enum IndexMetric implements JsonEnum { + All("_all"), - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.fixedValue( - PostVotingConfigExclusionsResponse._INSTANCE - ); + Analysis("analysis"), + Completion("completion"), + + Docs("docs"), + + Fielddata("fielddata"), + + Mappings("mappings"), + + QueryCache("query_cache"), + + Segments("segments"), + + Shards("shards"), + + Store("store"); + + private final String jsonValue; + + IndexMetric(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(IndexMetric.values()); } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/IndexingPressure.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/IndexingPressure.java new file mode 100644 index 0000000000..b746d36312 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/IndexingPressure.java @@ -0,0 +1,191 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.cluster.stats; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +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.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: cluster.stats.IndexingPressure + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class IndexingPressure implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull + private final IndexingPressureMemory memory; + + // --------------------------------------------------------------------------------------------- + + private IndexingPressure(Builder builder) { + this.memory = ApiTypeHelper.requireNonNull(builder.memory, this, "memory"); + } + + public static IndexingPressure of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code memory} + */ + @Nonnull + public final IndexingPressureMemory memory() { + return this.memory; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("memory"); + this.memory.serialize(generator, mapper); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link IndexingPressure}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private IndexingPressureMemory memory; + + public Builder() {} + + private Builder(IndexingPressure o) { + this.memory = o.memory; + } + + private Builder(Builder o) { + this.memory = o.memory; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code memory} + */ + @Nonnull + public final Builder memory(IndexingPressureMemory value) { + this.memory = value; + return this; + } + + /** + * Required - API name: {@code memory} + */ + @Nonnull + public final Builder memory(Function> fn) { + return memory(fn.apply(new IndexingPressureMemory.Builder()).build()); + } + + /** + * Builds a {@link IndexingPressure}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public IndexingPressure build() { + _checkSingleUse(); + + return new IndexingPressure(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link IndexingPressure} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + IndexingPressure::setupIndexingPressureDeserializer + ); + + protected static void setupIndexingPressureDeserializer(ObjectDeserializer op) { + op.add(Builder::memory, IndexingPressureMemory._DESERIALIZER, "memory"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.memory.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + IndexingPressure other = (IndexingPressure) o; + return this.memory.equals(other.memory); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/IndexingPressureMemory.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/IndexingPressureMemory.java new file mode 100644 index 0000000000..dab705d091 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/IndexingPressureMemory.java @@ -0,0 +1,258 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.cluster.stats; + +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +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.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: cluster.stats.IndexingPressureMemory + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class IndexingPressureMemory + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final IndexingPressureMemorySummary current; + + private final long limitInBytes; + + @Nonnull + private final IndexingPressureMemorySummary total; + + // --------------------------------------------------------------------------------------------- + + private IndexingPressureMemory(Builder builder) { + this.current = ApiTypeHelper.requireNonNull(builder.current, this, "current"); + this.limitInBytes = ApiTypeHelper.requireNonNull(builder.limitInBytes, this, "limitInBytes"); + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); + } + + public static IndexingPressureMemory of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code current} + */ + @Nonnull + public final IndexingPressureMemorySummary current() { + return this.current; + } + + /** + * Required - API name: {@code limit_in_bytes} + */ + public final long limitInBytes() { + return this.limitInBytes; + } + + /** + * Required - API name: {@code total} + */ + @Nonnull + public final IndexingPressureMemorySummary total() { + return this.total; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("current"); + this.current.serialize(generator, mapper); + + generator.writeKey("limit_in_bytes"); + generator.write(this.limitInBytes); + + generator.writeKey("total"); + this.total.serialize(generator, mapper); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link IndexingPressureMemory}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private IndexingPressureMemorySummary current; + private Long limitInBytes; + private IndexingPressureMemorySummary total; + + public Builder() {} + + private Builder(IndexingPressureMemory o) { + this.current = o.current; + this.limitInBytes = o.limitInBytes; + this.total = o.total; + } + + private Builder(Builder o) { + this.current = o.current; + this.limitInBytes = o.limitInBytes; + this.total = o.total; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code current} + */ + @Nonnull + public final Builder current(IndexingPressureMemorySummary value) { + this.current = value; + return this; + } + + /** + * Required - API name: {@code current} + */ + @Nonnull + public final Builder current(Function> fn) { + return current(fn.apply(new IndexingPressureMemorySummary.Builder()).build()); + } + + /** + * Required - API name: {@code limit_in_bytes} + */ + @Nonnull + public final Builder limitInBytes(long value) { + this.limitInBytes = value; + return this; + } + + /** + * Required - API name: {@code total} + */ + @Nonnull + public final Builder total(IndexingPressureMemorySummary value) { + this.total = value; + return this; + } + + /** + * Required - API name: {@code total} + */ + @Nonnull + public final Builder total(Function> fn) { + return total(fn.apply(new IndexingPressureMemorySummary.Builder()).build()); + } + + /** + * Builds a {@link IndexingPressureMemory}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public IndexingPressureMemory build() { + _checkSingleUse(); + + return new IndexingPressureMemory(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link IndexingPressureMemory} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + IndexingPressureMemory::setupIndexingPressureMemoryDeserializer + ); + + protected static void setupIndexingPressureMemoryDeserializer(ObjectDeserializer op) { + op.add(Builder::current, IndexingPressureMemorySummary._DESERIALIZER, "current"); + op.add(Builder::limitInBytes, JsonpDeserializer.longDeserializer(), "limit_in_bytes"); + op.add(Builder::total, IndexingPressureMemorySummary._DESERIALIZER, "total"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.current.hashCode(); + result = 31 * result + Long.hashCode(this.limitInBytes); + result = 31 * result + this.total.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + IndexingPressureMemory other = (IndexingPressureMemory) o; + return this.current.equals(other.current) && this.limitInBytes == other.limitInBytes && this.total.equals(other.total); + } +} diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/IndexingPressureMemorySummary.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/IndexingPressureMemorySummary.java new file mode 100644 index 0000000000..032389edac --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/IndexingPressureMemorySummary.java @@ -0,0 +1,407 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.cluster.stats; + +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.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: cluster.stats.IndexingPressureMemorySummary + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class IndexingPressureMemorySummary + implements + PlainJsonSerializable, + ToCopyableBuilder { + + private final long allInBytes; + + private final long combinedCoordinatingAndPrimaryInBytes; + + private final long coordinatingInBytes; + + @Nullable + private final Number coordinatingRejections; + + private final long primaryInBytes; + + @Nullable + private final Number primaryRejections; + + private final long replicaInBytes; + + @Nullable + private final Number replicaRejections; + + // --------------------------------------------------------------------------------------------- + + private IndexingPressureMemorySummary(Builder builder) { + this.allInBytes = ApiTypeHelper.requireNonNull(builder.allInBytes, this, "allInBytes"); + this.combinedCoordinatingAndPrimaryInBytes = ApiTypeHelper.requireNonNull( + builder.combinedCoordinatingAndPrimaryInBytes, + this, + "combinedCoordinatingAndPrimaryInBytes" + ); + this.coordinatingInBytes = ApiTypeHelper.requireNonNull(builder.coordinatingInBytes, this, "coordinatingInBytes"); + this.coordinatingRejections = builder.coordinatingRejections; + this.primaryInBytes = ApiTypeHelper.requireNonNull(builder.primaryInBytes, this, "primaryInBytes"); + this.primaryRejections = builder.primaryRejections; + this.replicaInBytes = ApiTypeHelper.requireNonNull(builder.replicaInBytes, this, "replicaInBytes"); + this.replicaRejections = builder.replicaRejections; + } + + public static IndexingPressureMemorySummary of( + Function> fn + ) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code all_in_bytes} + */ + public final long allInBytes() { + return this.allInBytes; + } + + /** + * Required - API name: {@code combined_coordinating_and_primary_in_bytes} + */ + public final long combinedCoordinatingAndPrimaryInBytes() { + return this.combinedCoordinatingAndPrimaryInBytes; + } + + /** + * Required - API name: {@code coordinating_in_bytes} + */ + public final long coordinatingInBytes() { + return this.coordinatingInBytes; + } + + /** + * API name: {@code coordinating_rejections} + */ + @Nullable + public final Number coordinatingRejections() { + return this.coordinatingRejections; + } + + /** + * Required - API name: {@code primary_in_bytes} + */ + public final long primaryInBytes() { + return this.primaryInBytes; + } + + /** + * API name: {@code primary_rejections} + */ + @Nullable + public final Number primaryRejections() { + return this.primaryRejections; + } + + /** + * Required - API name: {@code replica_in_bytes} + */ + public final long replicaInBytes() { + return this.replicaInBytes; + } + + /** + * API name: {@code replica_rejections} + */ + @Nullable + public final Number replicaRejections() { + return this.replicaRejections; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("all_in_bytes"); + generator.write(this.allInBytes); + + generator.writeKey("combined_coordinating_and_primary_in_bytes"); + generator.write(this.combinedCoordinatingAndPrimaryInBytes); + + generator.writeKey("coordinating_in_bytes"); + generator.write(this.coordinatingInBytes); + + if (this.coordinatingRejections != null) { + generator.writeKey("coordinating_rejections"); + generator.write(this.coordinatingRejections.doubleValue()); + } + + generator.writeKey("primary_in_bytes"); + generator.write(this.primaryInBytes); + + if (this.primaryRejections != null) { + generator.writeKey("primary_rejections"); + generator.write(this.primaryRejections.doubleValue()); + } + + generator.writeKey("replica_in_bytes"); + generator.write(this.replicaInBytes); + + if (this.replicaRejections != null) { + generator.writeKey("replica_rejections"); + generator.write(this.replicaRejections.doubleValue()); + } + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link IndexingPressureMemorySummary}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private Long allInBytes; + private Long combinedCoordinatingAndPrimaryInBytes; + private Long coordinatingInBytes; + @Nullable + private Number coordinatingRejections; + private Long primaryInBytes; + @Nullable + private Number primaryRejections; + private Long replicaInBytes; + @Nullable + private Number replicaRejections; + + public Builder() {} + + private Builder(IndexingPressureMemorySummary o) { + this.allInBytes = o.allInBytes; + this.combinedCoordinatingAndPrimaryInBytes = o.combinedCoordinatingAndPrimaryInBytes; + this.coordinatingInBytes = o.coordinatingInBytes; + this.coordinatingRejections = o.coordinatingRejections; + this.primaryInBytes = o.primaryInBytes; + this.primaryRejections = o.primaryRejections; + this.replicaInBytes = o.replicaInBytes; + this.replicaRejections = o.replicaRejections; + } + + private Builder(Builder o) { + this.allInBytes = o.allInBytes; + this.combinedCoordinatingAndPrimaryInBytes = o.combinedCoordinatingAndPrimaryInBytes; + this.coordinatingInBytes = o.coordinatingInBytes; + this.coordinatingRejections = o.coordinatingRejections; + this.primaryInBytes = o.primaryInBytes; + this.primaryRejections = o.primaryRejections; + this.replicaInBytes = o.replicaInBytes; + this.replicaRejections = o.replicaRejections; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Required - API name: {@code all_in_bytes} + */ + @Nonnull + public final Builder allInBytes(long value) { + this.allInBytes = value; + return this; + } + + /** + * Required - API name: {@code combined_coordinating_and_primary_in_bytes} + */ + @Nonnull + public final Builder combinedCoordinatingAndPrimaryInBytes(long value) { + this.combinedCoordinatingAndPrimaryInBytes = value; + return this; + } + + /** + * Required - API name: {@code coordinating_in_bytes} + */ + @Nonnull + public final Builder coordinatingInBytes(long value) { + this.coordinatingInBytes = value; + return this; + } + + /** + * API name: {@code coordinating_rejections} + */ + @Nonnull + public final Builder coordinatingRejections(@Nullable Number value) { + this.coordinatingRejections = value; + return this; + } + + /** + * Required - API name: {@code primary_in_bytes} + */ + @Nonnull + public final Builder primaryInBytes(long value) { + this.primaryInBytes = value; + return this; + } + + /** + * API name: {@code primary_rejections} + */ + @Nonnull + public final Builder primaryRejections(@Nullable Number value) { + this.primaryRejections = value; + return this; + } + + /** + * Required - API name: {@code replica_in_bytes} + */ + @Nonnull + public final Builder replicaInBytes(long value) { + this.replicaInBytes = value; + return this; + } + + /** + * API name: {@code replica_rejections} + */ + @Nonnull + public final Builder replicaRejections(@Nullable Number value) { + this.replicaRejections = value; + return this; + } + + /** + * Builds a {@link IndexingPressureMemorySummary}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public IndexingPressureMemorySummary build() { + _checkSingleUse(); + + return new IndexingPressureMemorySummary(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link IndexingPressureMemorySummary} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + IndexingPressureMemorySummary::setupIndexingPressureMemorySummaryDeserializer + ); + + protected static void setupIndexingPressureMemorySummaryDeserializer(ObjectDeserializer op) { + op.add(Builder::allInBytes, JsonpDeserializer.longDeserializer(), "all_in_bytes"); + op.add( + Builder::combinedCoordinatingAndPrimaryInBytes, + JsonpDeserializer.longDeserializer(), + "combined_coordinating_and_primary_in_bytes" + ); + op.add(Builder::coordinatingInBytes, JsonpDeserializer.longDeserializer(), "coordinating_in_bytes"); + op.add(Builder::coordinatingRejections, JsonpDeserializer.numberDeserializer(), "coordinating_rejections"); + op.add(Builder::primaryInBytes, JsonpDeserializer.longDeserializer(), "primary_in_bytes"); + op.add(Builder::primaryRejections, JsonpDeserializer.numberDeserializer(), "primary_rejections"); + op.add(Builder::replicaInBytes, JsonpDeserializer.longDeserializer(), "replica_in_bytes"); + op.add(Builder::replicaRejections, JsonpDeserializer.numberDeserializer(), "replica_rejections"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Long.hashCode(this.allInBytes); + result = 31 * result + Long.hashCode(this.combinedCoordinatingAndPrimaryInBytes); + result = 31 * result + Long.hashCode(this.coordinatingInBytes); + result = 31 * result + Objects.hashCode(this.coordinatingRejections); + result = 31 * result + Long.hashCode(this.primaryInBytes); + result = 31 * result + Objects.hashCode(this.primaryRejections); + result = 31 * result + Long.hashCode(this.replicaInBytes); + result = 31 * result + Objects.hashCode(this.replicaRejections); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + IndexingPressureMemorySummary other = (IndexingPressureMemorySummary) o; + return this.allInBytes == other.allInBytes + && this.combinedCoordinatingAndPrimaryInBytes == other.combinedCoordinatingAndPrimaryInBytes + && this.coordinatingInBytes == other.coordinatingInBytes + && Objects.equals(this.coordinatingRejections, other.coordinatingRejections) + && this.primaryInBytes == other.primaryInBytes + && Objects.equals(this.primaryRejections, other.primaryRejections) + && this.replicaInBytes == other.replicaInBytes + && Objects.equals(this.replicaRejections, other.replicaRejections); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/IndicesVersions.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/IndicesVersions.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/IndicesVersions.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/IndicesVersions.java index 85ab99af22..5c8c5cad04 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/IndicesVersions.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/IndicesVersions.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.stats; import jakarta.json.stream.JsonGenerator; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,33 +47,36 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.stats.IndicesVersions @JsonpDeserializable -public class IndicesVersions implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class IndicesVersions implements PlainJsonSerializable, ToCopyableBuilder { + private final int indexCount; private final int primaryShardCount; private final long totalPrimaryBytes; + @Nonnull private final String version; // --------------------------------------------------------------------------------------------- private IndicesVersions(Builder builder) { - this.indexCount = ApiTypeHelper.requireNonNull(builder.indexCount, this, "indexCount"); this.primaryShardCount = ApiTypeHelper.requireNonNull(builder.primaryShardCount, this, "primaryShardCount"); this.totalPrimaryBytes = ApiTypeHelper.requireNonNull(builder.totalPrimaryBytes, this, "totalPrimaryBytes"); this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); - } - public static IndicesVersions of(Function> fn) { + public static IndicesVersions of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -95,6 +104,7 @@ public final long totalPrimaryBytes() { /** * Required - API name: {@code version} */ + @Nonnull public final String version() { return this.version; } @@ -102,6 +112,7 @@ public final String version() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -109,7 +120,6 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("index_count"); generator.write(this.indexCount); @@ -121,27 +131,56 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("version"); generator.write(this.version); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link IndicesVersions}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Integer indexCount; - private Integer primaryShardCount; - private Long totalPrimaryBytes; - private String version; + public Builder() {} + + private Builder(IndicesVersions o) { + this.indexCount = o.indexCount; + this.primaryShardCount = o.primaryShardCount; + this.totalPrimaryBytes = o.totalPrimaryBytes; + this.version = o.version; + } + + private Builder(Builder o) { + this.indexCount = o.indexCount; + this.primaryShardCount = o.primaryShardCount; + this.totalPrimaryBytes = o.totalPrimaryBytes; + this.version = o.version; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code index_count} */ + @Nonnull public final Builder indexCount(int value) { this.indexCount = value; return this; @@ -150,6 +189,7 @@ public final Builder indexCount(int value) { /** * Required - API name: {@code primary_shard_count} */ + @Nonnull public final Builder primaryShardCount(int value) { this.primaryShardCount = value; return this; @@ -158,6 +198,7 @@ public final Builder primaryShardCount(int value) { /** * Required - API name: {@code total_primary_bytes} */ + @Nonnull public final Builder totalPrimaryBytes(long value) { this.totalPrimaryBytes = value; return this; @@ -166,6 +207,7 @@ public final Builder totalPrimaryBytes(long value) { /** * Required - API name: {@code version} */ + @Nonnull public final Builder version(String value) { this.version = value; return this; @@ -174,9 +216,10 @@ public final Builder version(String value) { /** * Builds a {@link IndicesVersions}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public IndicesVersions build() { _checkSingleUse(); @@ -195,12 +238,30 @@ public IndicesVersions build() { ); protected static void setupIndicesVersionsDeserializer(ObjectDeserializer op) { - op.add(Builder::indexCount, JsonpDeserializer.integerDeserializer(), "index_count"); op.add(Builder::primaryShardCount, JsonpDeserializer.integerDeserializer(), "primary_shard_count"); op.add(Builder::totalPrimaryBytes, JsonpDeserializer.longDeserializer(), "total_primary_bytes"); op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Integer.hashCode(this.indexCount); + result = 31 * result + Integer.hashCode(this.primaryShardCount); + result = 31 * result + Long.hashCode(this.totalPrimaryBytes); + result = 31 * result + this.version.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + IndicesVersions other = (IndicesVersions) o; + return this.indexCount == other.indexCount + && this.primaryShardCount == other.primaryShardCount + && this.totalPrimaryBytes == other.totalPrimaryBytes + && this.version.equals(other.version); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/ExistsComponentTemplateResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/Metric.java similarity index 50% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/ExistsComponentTemplateResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/Metric.java index e32828dbba..b7cb3aa8f1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/ExistsComponentTemplateResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/Metric.java @@ -30,22 +30,52 @@ * GitHub history for details. */ -package org.opensearch.client.opensearch.cluster; +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- -import org.opensearch.client.json.JsonpDeserializer; +package org.opensearch.client.opensearch.cluster.stats; -// typedef: cluster.exists_component_template.Response +import javax.annotation.Generated; +import org.opensearch.client.json.JsonEnum; +import org.opensearch.client.json.JsonpDeserializable; -public class ExistsComponentTemplateResponse { - public ExistsComponentTemplateResponse() {} +// typedef: cluster.stats.Metric - /** - * Singleton instance for {@link ExistsComponentTemplateResponse}. - */ - public static final ExistsComponentTemplateResponse _INSTANCE = new ExistsComponentTemplateResponse(); +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public enum Metric implements JsonEnum { + All("_all"), - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.fixedValue( - ExistsComponentTemplateResponse._INSTANCE - ); + DiscoveryType("discovery_type"), + Fs("fs"), + + Indices("indices"), + + Ingest("ingest"), + + Jvm("jvm"), + + NetworkTypes("network_types"), + + Os("os"), + + PackagingTypes("packaging_types"), + + Plugins("plugins"), + + Process("process"); + + private final String jsonValue; + + Metric(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Metric.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/NodePackagingType.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/NodePackagingType.java similarity index 53% rename from java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/NodePackagingType.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/NodePackagingType.java index e17ebb71b3..0e847f4529 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/NodePackagingType.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/NodePackagingType.java @@ -30,10 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.cluster.stats; 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; @@ -41,40 +49,65 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: cluster.stats.NodePackagingType @JsonpDeserializable -public class NodePackagingType implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class NodePackagingType implements PlainJsonSerializable, ToCopyableBuilder { + private final int count; + @Nullable + private final String flavor; + + @Nonnull private final String type; // --------------------------------------------------------------------------------------------- private NodePackagingType(Builder builder) { - this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); + this.flavor = builder.flavor; this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - } - public static NodePackagingType of(Function> fn) { + public static NodePackagingType of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code count} + * Required - Number of selected nodes using the distribution flavor and file type. + *

+ * API name: {@code count} + *

*/ public final int count() { return this.count; } /** - * Required - API name: {@code type} + * Type of OpenSearch distribution. This is always default. + *

+ * API name: {@code flavor} + *

+ */ + @Nullable + public final String flavor() { + return this.flavor; + } + + /** + * Required - File type (such as tar or zip) used for the distribution package. + *

+ * API name: {@code type} + *

*/ + @Nonnull public final String type() { return this.type; } @@ -82,6 +115,7 @@ public final String type() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -89,37 +123,91 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("count"); generator.write(this.count); + if (this.flavor != null) { + generator.writeKey("flavor"); + generator.write(this.flavor); + } + generator.writeKey("type"); generator.write(this.type); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link NodePackagingType}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Integer count; - + @Nullable + private String flavor; private String type; + public Builder() {} + + private Builder(NodePackagingType o) { + this.count = o.count; + this.flavor = o.flavor; + this.type = o.type; + } + + private Builder(Builder o) { + this.count = o.count; + this.flavor = o.flavor; + this.type = o.type; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Required - API name: {@code count} + * Required - Number of selected nodes using the distribution flavor and file type. + *

+ * API name: {@code count} + *

*/ + @Nonnull public final Builder count(int value) { this.count = value; return this; } /** - * Required - API name: {@code type} + * Type of OpenSearch distribution. This is always default. + *

+ * API name: {@code flavor} + *

*/ + @Nonnull + public final Builder flavor(@Nullable String value) { + this.flavor = value; + return this; + } + + /** + * Required - File type (such as tar or zip) used for the distribution package. + *

+ * API name: {@code type} + *

+ */ + @Nonnull public final Builder type(String value) { this.type = value; return this; @@ -128,9 +216,10 @@ public final Builder type(String value) { /** * Builds a {@link NodePackagingType}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public NodePackagingType build() { _checkSingleUse(); @@ -149,10 +238,25 @@ public NodePackagingType build() { ); protected static void setupNodePackagingTypeDeserializer(ObjectDeserializer op) { - op.add(Builder::count, JsonpDeserializer.integerDeserializer(), "count"); + op.add(Builder::flavor, JsonpDeserializer.stringDeserializer(), "flavor"); op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Integer.hashCode(this.count); + result = 31 * result + Objects.hashCode(this.flavor); + result = 31 * result + this.type.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + NodePackagingType other = (NodePackagingType) o; + return this.count == other.count && Objects.equals(this.flavor, other.flavor) && this.type.equals(other.type); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/OperatingSystemMemoryInfo.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/OperatingSystemMemoryInfo.java new file mode 100644 index 0000000000..bdbeb8f3c3 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/OperatingSystemMemoryInfo.java @@ -0,0 +1,488 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.cluster.stats; + +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.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: cluster.stats.OperatingSystemMemoryInfo + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class OperatingSystemMemoryInfo + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final Long adjustedTotalInBytes; + + @Nullable + private final String free; + + private final long freeInBytes; + + private final double freePercent; + + @Nullable + private final String total; + + private final long totalInBytes; + + @Nullable + private final String used; + + private final long usedInBytes; + + private final double usedPercent; + + // --------------------------------------------------------------------------------------------- + + private OperatingSystemMemoryInfo(Builder builder) { + this.adjustedTotalInBytes = builder.adjustedTotalInBytes; + this.free = builder.free; + this.freeInBytes = ApiTypeHelper.requireNonNull(builder.freeInBytes, this, "freeInBytes"); + this.freePercent = ApiTypeHelper.requireNonNull(builder.freePercent, this, "freePercent"); + this.total = builder.total; + this.totalInBytes = ApiTypeHelper.requireNonNull(builder.totalInBytes, this, "totalInBytes"); + this.used = builder.used; + this.usedInBytes = ApiTypeHelper.requireNonNull(builder.usedInBytes, this, "usedInBytes"); + this.usedPercent = ApiTypeHelper.requireNonNull(builder.usedPercent, this, "usedPercent"); + } + + public static OperatingSystemMemoryInfo of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Total amount, in bytes, of memory across all selected nodes, but using the value specified using the + * es.total_memory_bytes system property instead of measured total memory for those nodes where that system property was + * set. + *

+ * API name: {@code adjusted_total_in_bytes} + *

+ */ + @Nullable + public final Long adjustedTotalInBytes() { + return this.adjustedTotalInBytes; + } + + /** + * Amount, in bytes, of free physical memory across all selected nodes. + *

+ * API name: {@code free} + *

+ */ + @Nullable + public final String free() { + return this.free; + } + + /** + * Required - Amount, in bytes, of free physical memory across all selected nodes. + *

+ * API name: {@code free_in_bytes} + *

+ */ + public final long freeInBytes() { + return this.freeInBytes; + } + + /** + * Required - Percentage of free physical memory across all selected nodes. + *

+ * API name: {@code free_percent} + *

+ */ + public final double freePercent() { + return this.freePercent; + } + + /** + * Total amount of physical memory across all selected nodes. + *

+ * API name: {@code total} + *

+ */ + @Nullable + public final String total() { + return this.total; + } + + /** + * Required - Total amount, in bytes, of physical memory across all selected nodes. + *

+ * API name: {@code total_in_bytes} + *

+ */ + public final long totalInBytes() { + return this.totalInBytes; + } + + /** + * Amount of physical memory in use across all selected nodes. + *

+ * API name: {@code used} + *

+ */ + @Nullable + public final String used() { + return this.used; + } + + /** + * Required - Amount, in bytes, of physical memory in use across all selected nodes. + *

+ * API name: {@code used_in_bytes} + *

+ */ + public final long usedInBytes() { + return this.usedInBytes; + } + + /** + * Required - Percentage of physical memory in use across all selected nodes. + *

+ * API name: {@code used_percent} + *

+ */ + public final double usedPercent() { + return this.usedPercent; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.adjustedTotalInBytes != null) { + generator.writeKey("adjusted_total_in_bytes"); + generator.write(this.adjustedTotalInBytes); + } + + if (this.free != null) { + generator.writeKey("free"); + generator.write(this.free); + } + + generator.writeKey("free_in_bytes"); + generator.write(this.freeInBytes); + + generator.writeKey("free_percent"); + generator.write(this.freePercent); + + if (this.total != null) { + generator.writeKey("total"); + generator.write(this.total); + } + + generator.writeKey("total_in_bytes"); + generator.write(this.totalInBytes); + + if (this.used != null) { + generator.writeKey("used"); + generator.write(this.used); + } + + generator.writeKey("used_in_bytes"); + generator.write(this.usedInBytes); + + generator.writeKey("used_percent"); + generator.write(this.usedPercent); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link OperatingSystemMemoryInfo}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Long adjustedTotalInBytes; + @Nullable + private String free; + private Long freeInBytes; + private Double freePercent; + @Nullable + private String total; + private Long totalInBytes; + @Nullable + private String used; + private Long usedInBytes; + private Double usedPercent; + + public Builder() {} + + private Builder(OperatingSystemMemoryInfo o) { + this.adjustedTotalInBytes = o.adjustedTotalInBytes; + this.free = o.free; + this.freeInBytes = o.freeInBytes; + this.freePercent = o.freePercent; + this.total = o.total; + this.totalInBytes = o.totalInBytes; + this.used = o.used; + this.usedInBytes = o.usedInBytes; + this.usedPercent = o.usedPercent; + } + + private Builder(Builder o) { + this.adjustedTotalInBytes = o.adjustedTotalInBytes; + this.free = o.free; + this.freeInBytes = o.freeInBytes; + this.freePercent = o.freePercent; + this.total = o.total; + this.totalInBytes = o.totalInBytes; + this.used = o.used; + this.usedInBytes = o.usedInBytes; + this.usedPercent = o.usedPercent; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Total amount, in bytes, of memory across all selected nodes, but using the value specified using the + * es.total_memory_bytes system property instead of measured total memory for those nodes where that system property + * was set. + *

+ * API name: {@code adjusted_total_in_bytes} + *

+ */ + @Nonnull + public final Builder adjustedTotalInBytes(@Nullable Long value) { + this.adjustedTotalInBytes = value; + return this; + } + + /** + * Amount, in bytes, of free physical memory across all selected nodes. + *

+ * API name: {@code free} + *

+ */ + @Nonnull + public final Builder free(@Nullable String value) { + this.free = value; + return this; + } + + /** + * Required - Amount, in bytes, of free physical memory across all selected nodes. + *

+ * API name: {@code free_in_bytes} + *

+ */ + @Nonnull + public final Builder freeInBytes(long value) { + this.freeInBytes = value; + return this; + } + + /** + * Required - Percentage of free physical memory across all selected nodes. + *

+ * API name: {@code free_percent} + *

+ */ + @Nonnull + public final Builder freePercent(double value) { + this.freePercent = value; + return this; + } + + /** + * Total amount of physical memory across all selected nodes. + *

+ * API name: {@code total} + *

+ */ + @Nonnull + public final Builder total(@Nullable String value) { + this.total = value; + return this; + } + + /** + * Required - Total amount, in bytes, of physical memory across all selected nodes. + *

+ * API name: {@code total_in_bytes} + *

+ */ + @Nonnull + public final Builder totalInBytes(long value) { + this.totalInBytes = value; + return this; + } + + /** + * Amount of physical memory in use across all selected nodes. + *

+ * API name: {@code used} + *

+ */ + @Nonnull + public final Builder used(@Nullable String value) { + this.used = value; + return this; + } + + /** + * Required - Amount, in bytes, of physical memory in use across all selected nodes. + *

+ * API name: {@code used_in_bytes} + *

+ */ + @Nonnull + public final Builder usedInBytes(long value) { + this.usedInBytes = value; + return this; + } + + /** + * Required - Percentage of physical memory in use across all selected nodes. + *

+ * API name: {@code used_percent} + *

+ */ + @Nonnull + public final Builder usedPercent(double value) { + this.usedPercent = value; + return this; + } + + /** + * Builds a {@link OperatingSystemMemoryInfo}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public OperatingSystemMemoryInfo build() { + _checkSingleUse(); + + return new OperatingSystemMemoryInfo(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link OperatingSystemMemoryInfo} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + OperatingSystemMemoryInfo::setupOperatingSystemMemoryInfoDeserializer + ); + + protected static void setupOperatingSystemMemoryInfoDeserializer(ObjectDeserializer op) { + op.add(Builder::adjustedTotalInBytes, JsonpDeserializer.longDeserializer(), "adjusted_total_in_bytes"); + op.add(Builder::free, JsonpDeserializer.stringDeserializer(), "free"); + op.add(Builder::freeInBytes, JsonpDeserializer.longDeserializer(), "free_in_bytes"); + op.add(Builder::freePercent, JsonpDeserializer.doubleDeserializer(), "free_percent"); + op.add(Builder::total, JsonpDeserializer.stringDeserializer(), "total"); + op.add(Builder::totalInBytes, JsonpDeserializer.longDeserializer(), "total_in_bytes"); + op.add(Builder::used, JsonpDeserializer.stringDeserializer(), "used"); + op.add(Builder::usedInBytes, JsonpDeserializer.longDeserializer(), "used_in_bytes"); + op.add(Builder::usedPercent, JsonpDeserializer.doubleDeserializer(), "used_percent"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.adjustedTotalInBytes); + result = 31 * result + Objects.hashCode(this.free); + result = 31 * result + Long.hashCode(this.freeInBytes); + result = 31 * result + Double.hashCode(this.freePercent); + result = 31 * result + Objects.hashCode(this.total); + result = 31 * result + Long.hashCode(this.totalInBytes); + result = 31 * result + Objects.hashCode(this.used); + result = 31 * result + Long.hashCode(this.usedInBytes); + result = 31 * result + Double.hashCode(this.usedPercent); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + OperatingSystemMemoryInfo other = (OperatingSystemMemoryInfo) o; + return Objects.equals(this.adjustedTotalInBytes, other.adjustedTotalInBytes) + && Objects.equals(this.free, other.free) + && this.freeInBytes == other.freeInBytes + && this.freePercent == other.freePercent + && Objects.equals(this.total, other.total) + && this.totalInBytes == other.totalInBytes + && Objects.equals(this.used, other.used) + && this.usedInBytes == other.usedInBytes + && this.usedPercent == other.usedPercent; + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/NodesResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/nodes/NodesResponseBase.java similarity index 61% rename from java-client/src/main/java/org/opensearch/client/opensearch/nodes/NodesResponseBase.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/nodes/NodesResponseBase.java index b162f314c9..3d4dbf79dd 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/nodes/NodesResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/nodes/NodesResponseBase.java @@ -30,37 +30,46 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.nodes; 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.JsonpMapper; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.NodeStatistics; -import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -// typedef: nodes._types.NodesResponseBase +// typedef: nodes.NodesResponseBase +@Generated("org.opensearch.client.codegen.CodeGenerator") public abstract class NodesResponseBase implements PlainJsonSerializable { + + @Nullable private final NodeStatistics nodeStats; // --------------------------------------------------------------------------------------------- protected NodesResponseBase(AbstractBuilder builder) { - - this.nodeStats = ApiTypeHelper.requireNonNull(builder.nodeStats, this, "nodeStats"); - + this.nodeStats = builder.nodeStats; } /** - * Required - Contains statistics about the number of nodes selected by the - * request's node filters. + * Contains statistics about the number of nodes selected by the request's node filters. *

* API name: {@code _nodes} + *

*/ + @Nullable public final NodeStatistics nodeStats() { return this.nodeStats; } @@ -68,6 +77,7 @@ public final NodeStatistics nodeStats() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -75,45 +85,73 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("_nodes"); - this.nodeStats.serialize(generator, mapper); - + if (this.nodeStats != null) { + generator.writeKey("_nodes"); + this.nodeStats.serialize(generator, mapper); + } } + // --------------------------------------------------------------------------------------------- + protected abstract static class AbstractBuilder> extends ObjectBuilderBase { + @Nullable private NodeStatistics nodeStats; + protected AbstractBuilder() {} + + protected AbstractBuilder(NodesResponseBase o) { + this.nodeStats = o.nodeStats; + } + + protected AbstractBuilder(AbstractBuilder o) { + this.nodeStats = o.nodeStats; + } + + @Nonnull + protected abstract BuilderT self(); + /** - * Required - Contains statistics about the number of nodes selected by the - * request's node filters. + * Contains statistics about the number of nodes selected by the request's node filters. *

* API name: {@code _nodes} + *

*/ - public final BuilderT nodeStats(NodeStatistics value) { + @Nonnull + public final BuilderT nodeStats(@Nullable NodeStatistics value) { this.nodeStats = value; return self(); } /** - * Required - Contains statistics about the number of nodes selected by the - * request's node filters. + * Contains statistics about the number of nodes selected by the request's node filters. *

* API name: {@code _nodes} + *

*/ + @Nonnull public final BuilderT nodeStats(Function> fn) { - return this.nodeStats(fn.apply(new NodeStatistics.Builder()).build()); + return nodeStats(fn.apply(new NodeStatistics.Builder()).build()); } - - protected abstract BuilderT self(); - } // --------------------------------------------------------------------------------------------- - protected static > void setupNodesResponseBaseDeserializer(ObjectDeserializer op) { + protected static > void setupNodesResponseBaseDeserializer(ObjectDeserializer op) { op.add(AbstractBuilder::nodeStats, NodeStatistics._DESERIALIZER, "_nodes"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.nodeStats); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + NodesResponseBase other = (NodesResponseBase) o; + return Objects.equals(this.nodeStats, other.nodeStats); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/ClusterStatsRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/ClusterStatsRequest.java deleted file mode 100644 index b98a6451e5..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/ClusterStatsRequest.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.cluster; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; -import javax.annotation.Nullable; -import org.opensearch.client.opensearch._types.ErrorResponse; -import org.opensearch.client.opensearch._types.RequestBase; -import org.opensearch.client.opensearch._types.Time; -import org.opensearch.client.transport.Endpoint; -import org.opensearch.client.transport.endpoints.SimpleEndpoint; -import org.opensearch.client.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: cluster.stats.Request - -/** - * Returns high-level overview of cluster statistics. - * - */ - -public class ClusterStatsRequest extends RequestBase { - @Nullable - private final Boolean flatSettings; - - private final List nodeId; - - @Nullable - private final Time timeout; - - // --------------------------------------------------------------------------------------------- - - private ClusterStatsRequest(Builder builder) { - - this.flatSettings = builder.flatSettings; - this.nodeId = ApiTypeHelper.unmodifiable(builder.nodeId); - this.timeout = builder.timeout; - - } - - public static ClusterStatsRequest of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Return settings in flat format (default: false) - *

- * API name: {@code flat_settings} - */ - @Nullable - public final Boolean flatSettings() { - return this.flatSettings; - } - - /** - * Comma-separated list of node filters used to limit returned information. - * Defaults to all nodes in the cluster. - *

- * API name: {@code node_id} - */ - public final List nodeId() { - return this.nodeId; - } - - /** - * Period to wait for each node to respond. If a node does not respond before - * its timeout expires, the response does not include its stats. However, timed - * out nodes are included in the response's _nodes.failed property. Defaults to - * no timeout. - *

- * API name: {@code timeout} - */ - @Nullable - public final Time timeout() { - return this.timeout; - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ClusterStatsRequest}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private Boolean flatSettings; - - @Nullable - private List nodeId; - - @Nullable - private Time timeout; - - /** - * Return settings in flat format (default: false) - *

- * API name: {@code flat_settings} - */ - public final Builder flatSettings(@Nullable Boolean value) { - this.flatSettings = value; - return this; - } - - /** - * Comma-separated list of node filters used to limit returned information. - * Defaults to all nodes in the cluster. - *

- * API name: {@code node_id} - *

- * Adds all elements of list to nodeId. - */ - public final Builder nodeId(List list) { - this.nodeId = _listAddAll(this.nodeId, list); - return this; - } - - /** - * Comma-separated list of node filters used to limit returned information. - * Defaults to all nodes in the cluster. - *

- * API name: {@code node_id} - *

- * Adds one or more values to nodeId. - */ - public final Builder nodeId(String value, String... values) { - this.nodeId = _listAdd(this.nodeId, value, values); - return this; - } - - /** - * Period to wait for each node to respond. If a node does not respond before - * its timeout expires, the response does not include its stats. However, timed - * out nodes are included in the response's _nodes.failed property. Defaults to - * no timeout. - *

- * API name: {@code timeout} - */ - public final Builder timeout(@Nullable Time value) { - this.timeout = value; - return this; - } - - /** - * Period to wait for each node to respond. If a node does not respond before - * its timeout expires, the response does not include its stats. However, timed - * out nodes are included in the response's _nodes.failed property. Defaults to - * no timeout. - *

- * API name: {@code timeout} - */ - public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Builds a {@link ClusterStatsRequest}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ClusterStatsRequest build() { - _checkSingleUse(); - - return new ClusterStatsRequest(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Endpoint "{@code cluster.stats}". - */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - - // Request method - request -> { - return "GET"; - - }, - - // Request path - request -> { - final int _nodeId = 1 << 0; - - int propsSet = 0; - - if (ApiTypeHelper.isDefined(request.nodeId())) propsSet |= _nodeId; - - if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_cluster"); - buf.append("/stats"); - return buf.toString(); - } - if (propsSet == (_nodeId)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_cluster"); - buf.append("/stats"); - buf.append("/nodes"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.nodeId.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - - }, - - // Request parameters - request -> { - Map params = new HashMap<>(); - if (request.flatSettings != null) { - params.put("flat_settings", String.valueOf(request.flatSettings)); - } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); - } - return params; - - }, - SimpleEndpoint.emptyMap(), - false, - ClusterStatsResponse._DESERIALIZER - ); -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterFileSystem.java b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterFileSystem.java deleted file mode 100644 index 0f6a8d38a9..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterFileSystem.java +++ /dev/null @@ -1,182 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.cluster.stats; - -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -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.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: cluster.stats.ClusterFileSystem - -@JsonpDeserializable -public class ClusterFileSystem implements PlainJsonSerializable { - private final long availableInBytes; - - private final long freeInBytes; - - private final long totalInBytes; - - // --------------------------------------------------------------------------------------------- - - private ClusterFileSystem(Builder builder) { - - this.availableInBytes = ApiTypeHelper.requireNonNull(builder.availableInBytes, this, "availableInBytes"); - this.freeInBytes = ApiTypeHelper.requireNonNull(builder.freeInBytes, this, "freeInBytes"); - this.totalInBytes = ApiTypeHelper.requireNonNull(builder.totalInBytes, this, "totalInBytes"); - - } - - public static ClusterFileSystem of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code available_in_bytes} - */ - public final long availableInBytes() { - return this.availableInBytes; - } - - /** - * Required - API name: {@code free_in_bytes} - */ - public final long freeInBytes() { - return this.freeInBytes; - } - - /** - * Required - API name: {@code total_in_bytes} - */ - public final long totalInBytes() { - return this.totalInBytes; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("available_in_bytes"); - generator.write(this.availableInBytes); - - generator.writeKey("free_in_bytes"); - generator.write(this.freeInBytes); - - generator.writeKey("total_in_bytes"); - generator.write(this.totalInBytes); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ClusterFileSystem}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long availableInBytes; - - private Long freeInBytes; - - private Long totalInBytes; - - /** - * Required - API name: {@code available_in_bytes} - */ - public final Builder availableInBytes(long value) { - this.availableInBytes = value; - return this; - } - - /** - * Required - API name: {@code free_in_bytes} - */ - public final Builder freeInBytes(long value) { - this.freeInBytes = value; - return this; - } - - /** - * Required - API name: {@code total_in_bytes} - */ - public final Builder totalInBytes(long value) { - this.totalInBytes = value; - return this; - } - - /** - * Builds a {@link ClusterFileSystem}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ClusterFileSystem build() { - _checkSingleUse(); - - return new ClusterFileSystem(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ClusterFileSystem} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - ClusterFileSystem::setupClusterFileSystemDeserializer - ); - - protected static void setupClusterFileSystemDeserializer(ObjectDeserializer op) { - - op.add(Builder::availableInBytes, JsonpDeserializer.longDeserializer(), "available_in_bytes"); - op.add(Builder::freeInBytes, JsonpDeserializer.longDeserializer(), "free_in_bytes"); - op.add(Builder::totalInBytes, JsonpDeserializer.longDeserializer(), "total_in_bytes"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvmMemory.java b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvmMemory.java deleted file mode 100644 index 8a258a0e38..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvmMemory.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.cluster.stats; - -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -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.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: cluster.stats.ClusterJvmMemory - -@JsonpDeserializable -public class ClusterJvmMemory implements PlainJsonSerializable { - private final long heapMaxInBytes; - - private final long heapUsedInBytes; - - // --------------------------------------------------------------------------------------------- - - private ClusterJvmMemory(Builder builder) { - - this.heapMaxInBytes = ApiTypeHelper.requireNonNull(builder.heapMaxInBytes, this, "heapMaxInBytes"); - this.heapUsedInBytes = ApiTypeHelper.requireNonNull(builder.heapUsedInBytes, this, "heapUsedInBytes"); - - } - - public static ClusterJvmMemory of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code heap_max_in_bytes} - */ - public final long heapMaxInBytes() { - return this.heapMaxInBytes; - } - - /** - * Required - API name: {@code heap_used_in_bytes} - */ - public final long heapUsedInBytes() { - return this.heapUsedInBytes; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("heap_max_in_bytes"); - generator.write(this.heapMaxInBytes); - - generator.writeKey("heap_used_in_bytes"); - generator.write(this.heapUsedInBytes); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ClusterJvmMemory}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long heapMaxInBytes; - - private Long heapUsedInBytes; - - /** - * Required - API name: {@code heap_max_in_bytes} - */ - public final Builder heapMaxInBytes(long value) { - this.heapMaxInBytes = value; - return this; - } - - /** - * Required - API name: {@code heap_used_in_bytes} - */ - public final Builder heapUsedInBytes(long value) { - this.heapUsedInBytes = value; - return this; - } - - /** - * Builds a {@link ClusterJvmMemory}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ClusterJvmMemory build() { - _checkSingleUse(); - - return new ClusterJvmMemory(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ClusterJvmMemory} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - ClusterJvmMemory::setupClusterJvmMemoryDeserializer - ); - - protected static void setupClusterJvmMemoryDeserializer(ObjectDeserializer op) { - - op.add(Builder::heapMaxInBytes, JsonpDeserializer.longDeserializer(), "heap_max_in_bytes"); - op.add(Builder::heapUsedInBytes, JsonpDeserializer.longDeserializer(), "heap_used_in_bytes"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterNodeCount.java b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterNodeCount.java deleted file mode 100644 index 2d1e5818aa..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterNodeCount.java +++ /dev/null @@ -1,314 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.cluster.stats; - -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -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.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: cluster.stats.ClusterNodeCount - -@JsonpDeserializable -public class ClusterNodeCount implements PlainJsonSerializable { - private final int coordinatingOnly; - - private final int data; - - private final int ingest; - - @Deprecated - private final Integer master; - - private final Integer clusterManager; - - private final int total; - - private final int remoteClusterClient; - - @Nullable - private final Integer search; - - // --------------------------------------------------------------------------------------------- - - 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.master = builder.master; - this.clusterManager = builder.clusterManager; - this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); - this.remoteClusterClient = ApiTypeHelper.requireNonNull(builder.remoteClusterClient, this, "remoteClusterClient"); - this.search = builder.search; - } - - public static ClusterNodeCount of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code coordinating_only} - */ - public final int coordinatingOnly() { - return this.coordinatingOnly; - } - - /** - * Required - API name: {@code data} - */ - public final int data() { - return this.data; - } - - /** - * Required - API name: {@code ingest} - */ - public final int ingest() { - return this.ingest; - } - - /** - * API name: {@code master} - */ - @Deprecated - public final int master() { - return this.master; - } - - /** - * API name: {@code clusterManager} - */ - public final int clusterManager() { - return this.clusterManager; - } - - /** - * Required - API name: {@code total} - */ - public final int total() { - return this.total; - } - - /** - * Required - API name: {@code remote_cluster_client} - */ - public final int remoteClusterClient() { - return this.remoteClusterClient; - } - - /** - * API name: {@code search} - */ - @Nullable - public final Integer search() { - return this.search; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("coordinating_only"); - generator.write(this.coordinatingOnly); - - generator.writeKey("data"); - generator.write(this.data); - - generator.writeKey("ingest"); - generator.write(this.ingest); - - if (this.master != null) { - generator.writeKey("master"); - generator.write(this.master); - } - - if (this.clusterManager != null) { - generator.writeKey("cluster_manager"); - generator.write(this.clusterManager); - } - - generator.writeKey("total"); - generator.write(this.total); - - generator.writeKey("remote_cluster_client"); - generator.write(this.remoteClusterClient); - - if (this.search != null) { - generator.writeKey("search"); - generator.write(this.search); - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ClusterNodeCount}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Integer coordinatingOnly; - - private Integer data; - - private Integer ingest; - - private Integer master; - - private Integer clusterManager; - - private Integer total; - - private Integer remoteClusterClient; - - private Integer search; - - /** - * Required - API name: {@code coordinating_only} - */ - public final Builder coordinatingOnly(int value) { - this.coordinatingOnly = value; - return this; - } - - /** - * Required - API name: {@code data} - */ - public final Builder data(int value) { - this.data = value; - return this; - } - - /** - * Required - API name: {@code ingest} - */ - public final Builder ingest(int value) { - this.ingest = value; - return this; - } - - /** - * API name: {@code master} - */ - @Deprecated - public final Builder master(int value) { - this.master = value; - return this; - } - - /** - * 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 remote_cluster_client} - */ - public final Builder remoteClusterClient(int value) { - this.remoteClusterClient = value; - return this; - } - - /** - * API name: {@code search} - */ - @Nullable - public final Builder search(int value) { - this.search = value; - return this; - } - - /** - * Builds a {@link ClusterNodeCount}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ClusterNodeCount build() { - _checkSingleUse(); - - return new ClusterNodeCount(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ClusterNodeCount} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - ClusterNodeCount::setupClusterNodeCountDeserializer - ); - - protected static void setupClusterNodeCountDeserializer(ObjectDeserializer op) { - - 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::remoteClusterClient, JsonpDeserializer.integerDeserializer(), "remote_cluster_client"); - op.add(Builder::search, JsonpDeserializer.integerDeserializer(), "search"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/OperatingSystemMemoryInfo.java b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/OperatingSystemMemoryInfo.java deleted file mode 100644 index 231f6b7fc9..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/OperatingSystemMemoryInfo.java +++ /dev/null @@ -1,230 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.cluster.stats; - -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -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.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: cluster.stats.OperatingSystemMemoryInfo - -@JsonpDeserializable -public class OperatingSystemMemoryInfo implements PlainJsonSerializable { - private final long freeInBytes; - - private final int freePercent; - - private final long totalInBytes; - - private final long usedInBytes; - - private final int usedPercent; - - // --------------------------------------------------------------------------------------------- - - private OperatingSystemMemoryInfo(Builder builder) { - - this.freeInBytes = ApiTypeHelper.requireNonNull(builder.freeInBytes, this, "freeInBytes"); - this.freePercent = ApiTypeHelper.requireNonNull(builder.freePercent, this, "freePercent"); - this.totalInBytes = ApiTypeHelper.requireNonNull(builder.totalInBytes, this, "totalInBytes"); - this.usedInBytes = ApiTypeHelper.requireNonNull(builder.usedInBytes, this, "usedInBytes"); - this.usedPercent = ApiTypeHelper.requireNonNull(builder.usedPercent, this, "usedPercent"); - - } - - public static OperatingSystemMemoryInfo of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code free_in_bytes} - */ - public final long freeInBytes() { - return this.freeInBytes; - } - - /** - * Required - API name: {@code free_percent} - */ - public final int freePercent() { - return this.freePercent; - } - - /** - * Required - API name: {@code total_in_bytes} - */ - public final long totalInBytes() { - return this.totalInBytes; - } - - /** - * Required - API name: {@code used_in_bytes} - */ - public final long usedInBytes() { - return this.usedInBytes; - } - - /** - * Required - API name: {@code used_percent} - */ - public final int usedPercent() { - return this.usedPercent; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("free_in_bytes"); - generator.write(this.freeInBytes); - - generator.writeKey("free_percent"); - generator.write(this.freePercent); - - generator.writeKey("total_in_bytes"); - generator.write(this.totalInBytes); - - generator.writeKey("used_in_bytes"); - generator.write(this.usedInBytes); - - generator.writeKey("used_percent"); - generator.write(this.usedPercent); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link OperatingSystemMemoryInfo}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long freeInBytes; - - private Integer freePercent; - - private Long totalInBytes; - - private Long usedInBytes; - - private Integer usedPercent; - - /** - * Required - API name: {@code free_in_bytes} - */ - public final Builder freeInBytes(long value) { - this.freeInBytes = value; - return this; - } - - /** - * Required - API name: {@code free_percent} - */ - public final Builder freePercent(int value) { - this.freePercent = value; - return this; - } - - /** - * Required - API name: {@code total_in_bytes} - */ - public final Builder totalInBytes(long value) { - this.totalInBytes = value; - return this; - } - - /** - * Required - API name: {@code used_in_bytes} - */ - public final Builder usedInBytes(long value) { - this.usedInBytes = value; - return this; - } - - /** - * Required - API name: {@code used_percent} - */ - public final Builder usedPercent(int value) { - this.usedPercent = value; - return this; - } - - /** - * Builds a {@link OperatingSystemMemoryInfo}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public OperatingSystemMemoryInfo build() { - _checkSingleUse(); - - return new OperatingSystemMemoryInfo(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link OperatingSystemMemoryInfo} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - OperatingSystemMemoryInfo::setupOperatingSystemMemoryInfoDeserializer - ); - - protected static void setupOperatingSystemMemoryInfoDeserializer(ObjectDeserializer op) { - - op.add(Builder::freeInBytes, JsonpDeserializer.longDeserializer(), "free_in_bytes"); - op.add(Builder::freePercent, JsonpDeserializer.integerDeserializer(), "free_percent"); - op.add(Builder::totalInBytes, JsonpDeserializer.longDeserializer(), "total_in_bytes"); - op.add(Builder::usedInBytes, JsonpDeserializer.longDeserializer(), "used_in_bytes"); - op.add(Builder::usedPercent, JsonpDeserializer.integerDeserializer(), "used_percent"); - - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/RuntimeFieldTypes.java b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/RuntimeFieldTypes.java deleted file mode 100644 index 624d69fb9c..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/RuntimeFieldTypes.java +++ /dev/null @@ -1,466 +0,0 @@ -/* - * SPDX-License-Identifier: Apache-2.0 - * - * The OpenSearch Contributors require contributions made to - * this file be licensed under the Apache-2.0 license or a - * compatible open source license. - */ - -/* - * Licensed to Elasticsearch B.V. under one or more contributor - * license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright - * ownership. Elasticsearch B.V. licenses this file to you under - * the Apache License, Version 2.0 (the "License"); you may - * not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Modifications Copyright OpenSearch Contributors. See - * GitHub history for details. - */ - -package org.opensearch.client.opensearch.cluster.stats; - -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.function.Function; -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.util.ApiTypeHelper; -import org.opensearch.client.util.ObjectBuilder; -import org.opensearch.client.util.ObjectBuilderBase; - -// typedef: cluster.stats.RuntimeFieldTypes - -@JsonpDeserializable -public class RuntimeFieldTypes implements PlainJsonSerializable { - private final String name; - - private final int count; - - private final int indexCount; - - private final int scriptlessCount; - - private final int shadowedCount; - - private final List lang; - - private final int linesMax; - - private final int linesTotal; - - private final int charsMax; - - private final int charsTotal; - - private final int sourceMax; - - private final int sourceTotal; - - private final int docMax; - - private final int docTotal; - - // --------------------------------------------------------------------------------------------- - - private RuntimeFieldTypes(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); - this.indexCount = ApiTypeHelper.requireNonNull(builder.indexCount, this, "indexCount"); - this.scriptlessCount = ApiTypeHelper.requireNonNull(builder.scriptlessCount, this, "scriptlessCount"); - this.shadowedCount = ApiTypeHelper.requireNonNull(builder.shadowedCount, this, "shadowedCount"); - this.lang = ApiTypeHelper.unmodifiableRequired(builder.lang, this, "lang"); - this.linesMax = ApiTypeHelper.requireNonNull(builder.linesMax, this, "linesMax"); - this.linesTotal = ApiTypeHelper.requireNonNull(builder.linesTotal, this, "linesTotal"); - this.charsMax = ApiTypeHelper.requireNonNull(builder.charsMax, this, "charsMax"); - this.charsTotal = ApiTypeHelper.requireNonNull(builder.charsTotal, this, "charsTotal"); - this.sourceMax = ApiTypeHelper.requireNonNull(builder.sourceMax, this, "sourceMax"); - this.sourceTotal = ApiTypeHelper.requireNonNull(builder.sourceTotal, this, "sourceTotal"); - this.docMax = ApiTypeHelper.requireNonNull(builder.docMax, this, "docMax"); - this.docTotal = ApiTypeHelper.requireNonNull(builder.docTotal, this, "docTotal"); - - } - - public static RuntimeFieldTypes of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Required - API name: {@code count} - */ - public final int count() { - return this.count; - } - - /** - * Required - API name: {@code index_count} - */ - public final int indexCount() { - return this.indexCount; - } - - /** - * Required - API name: {@code scriptless_count} - */ - public final int scriptlessCount() { - return this.scriptlessCount; - } - - /** - * Required - API name: {@code shadowed_count} - */ - public final int shadowedCount() { - return this.shadowedCount; - } - - /** - * Required - API name: {@code lang} - */ - public final List lang() { - return this.lang; - } - - /** - * Required - API name: {@code lines_max} - */ - public final int linesMax() { - return this.linesMax; - } - - /** - * Required - API name: {@code lines_total} - */ - public final int linesTotal() { - return this.linesTotal; - } - - /** - * Required - API name: {@code chars_max} - */ - public final int charsMax() { - return this.charsMax; - } - - /** - * Required - API name: {@code chars_total} - */ - public final int charsTotal() { - return this.charsTotal; - } - - /** - * Required - API name: {@code source_max} - */ - public final int sourceMax() { - return this.sourceMax; - } - - /** - * Required - API name: {@code source_total} - */ - public final int sourceTotal() { - return this.sourceTotal; - } - - /** - * Required - API name: {@code doc_max} - */ - public final int docMax() { - return this.docMax; - } - - /** - * Required - API name: {@code doc_total} - */ - public final int docTotal() { - return this.docTotal; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("name"); - generator.write(this.name); - - generator.writeKey("count"); - generator.write(this.count); - - generator.writeKey("index_count"); - generator.write(this.indexCount); - - generator.writeKey("scriptless_count"); - generator.write(this.scriptlessCount); - - generator.writeKey("shadowed_count"); - generator.write(this.shadowedCount); - - if (ApiTypeHelper.isDefined(this.lang)) { - generator.writeKey("lang"); - generator.writeStartArray(); - for (String item0 : this.lang) { - generator.write(item0); - - } - generator.writeEnd(); - - } - generator.writeKey("lines_max"); - generator.write(this.linesMax); - - generator.writeKey("lines_total"); - generator.write(this.linesTotal); - - generator.writeKey("chars_max"); - generator.write(this.charsMax); - - generator.writeKey("chars_total"); - generator.write(this.charsTotal); - - generator.writeKey("source_max"); - generator.write(this.sourceMax); - - generator.writeKey("source_total"); - generator.write(this.sourceTotal); - - generator.writeKey("doc_max"); - generator.write(this.docMax); - - generator.writeKey("doc_total"); - generator.write(this.docTotal); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link RuntimeFieldTypes}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String name; - - private Integer count; - - private Integer indexCount; - - private Integer scriptlessCount; - - private Integer shadowedCount; - - private List lang; - - private Integer linesMax; - - private Integer linesTotal; - - private Integer charsMax; - - private Integer charsTotal; - - private Integer sourceMax; - - private Integer sourceTotal; - - private Integer docMax; - - private Integer docTotal; - - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * Required - API name: {@code count} - */ - public final Builder count(int value) { - this.count = value; - return this; - } - - /** - * Required - API name: {@code index_count} - */ - public final Builder indexCount(int value) { - this.indexCount = value; - return this; - } - - /** - * Required - API name: {@code scriptless_count} - */ - public final Builder scriptlessCount(int value) { - this.scriptlessCount = value; - return this; - } - - /** - * Required - API name: {@code shadowed_count} - */ - public final Builder shadowedCount(int value) { - this.shadowedCount = value; - return this; - } - - /** - * Required - API name: {@code lang} - *

- * Adds all elements of list to lang. - */ - public final Builder lang(List list) { - this.lang = _listAddAll(this.lang, list); - return this; - } - - /** - * Required - API name: {@code lang} - *

- * Adds one or more values to lang. - */ - public final Builder lang(String value, String... values) { - this.lang = _listAdd(this.lang, value, values); - return this; - } - - /** - * Required - API name: {@code lines_max} - */ - public final Builder linesMax(int value) { - this.linesMax = value; - return this; - } - - /** - * Required - API name: {@code lines_total} - */ - public final Builder linesTotal(int value) { - this.linesTotal = value; - return this; - } - - /** - * Required - API name: {@code chars_max} - */ - public final Builder charsMax(int value) { - this.charsMax = value; - return this; - } - - /** - * Required - API name: {@code chars_total} - */ - public final Builder charsTotal(int value) { - this.charsTotal = value; - return this; - } - - /** - * Required - API name: {@code source_max} - */ - public final Builder sourceMax(int value) { - this.sourceMax = value; - return this; - } - - /** - * Required - API name: {@code source_total} - */ - public final Builder sourceTotal(int value) { - this.sourceTotal = value; - return this; - } - - /** - * Required - API name: {@code doc_max} - */ - public final Builder docMax(int value) { - this.docMax = value; - return this; - } - - /** - * Required - API name: {@code doc_total} - */ - public final Builder docTotal(int value) { - this.docTotal = value; - return this; - } - - /** - * Builds a {@link RuntimeFieldTypes}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public RuntimeFieldTypes build() { - _checkSingleUse(); - - return new RuntimeFieldTypes(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link RuntimeFieldTypes} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( - Builder::new, - RuntimeFieldTypes::setupRuntimeFieldTypesDeserializer - ); - - protected static void setupRuntimeFieldTypesDeserializer(ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::count, JsonpDeserializer.integerDeserializer(), "count"); - op.add(Builder::indexCount, JsonpDeserializer.integerDeserializer(), "index_count"); - op.add(Builder::scriptlessCount, JsonpDeserializer.integerDeserializer(), "scriptless_count"); - op.add(Builder::shadowedCount, JsonpDeserializer.integerDeserializer(), "shadowed_count"); - op.add(Builder::lang, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "lang"); - op.add(Builder::linesMax, JsonpDeserializer.integerDeserializer(), "lines_max"); - op.add(Builder::linesTotal, JsonpDeserializer.integerDeserializer(), "lines_total"); - op.add(Builder::charsMax, JsonpDeserializer.integerDeserializer(), "chars_max"); - op.add(Builder::charsTotal, JsonpDeserializer.integerDeserializer(), "chars_total"); - op.add(Builder::sourceMax, JsonpDeserializer.integerDeserializer(), "source_max"); - op.add(Builder::sourceTotal, JsonpDeserializer.integerDeserializer(), "source_total"); - op.add(Builder::docMax, JsonpDeserializer.integerDeserializer(), "doc_max"); - op.add(Builder::docTotal, JsonpDeserializer.integerDeserializer(), "doc_total"); - - } - -} diff --git a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractClusterClientIT.java b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractClusterClientIT.java index f5f0c682de..c820e5d10b 100644 --- a/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractClusterClientIT.java +++ b/java-client/src/test/java11/org/opensearch/client/opensearch/integTest/AbstractClusterClientIT.java @@ -20,7 +20,6 @@ import org.opensearch.client.json.JsonData; import org.opensearch.client.opensearch.OpenSearchClient; import org.opensearch.client.opensearch._types.HealthStatus; -import org.opensearch.client.opensearch._types.Level; import org.opensearch.client.opensearch._types.OpenSearchException; import org.opensearch.client.opensearch.cluster.ClusterStatsRequest; import org.opensearch.client.opensearch.cluster.ClusterStatsResponse; @@ -30,6 +29,7 @@ import org.opensearch.client.opensearch.cluster.HealthResponse; import org.opensearch.client.opensearch.cluster.PutClusterSettingsRequest; import org.opensearch.client.opensearch.cluster.PutClusterSettingsResponse; +import org.opensearch.client.opensearch.cluster.health.ClusterHealthLevel; import org.opensearch.client.opensearch.cluster.health.IndexHealthStats; import org.opensearch.client.opensearch.cluster.health.ShardHealthStats; import org.opensearch.cluster.routing.allocation.decider.EnableAllocationDecider; @@ -201,7 +201,7 @@ public void testClusterHealthYellowIndicesLevel() throws IOException { } HealthRequest request = new HealthRequest.Builder().index(firstIndex, secondIndex) .timeout(t -> t.time("5s")) - .level(Level.Indices) + .level(ClusterHealthLevel.Indices) .build(); HealthResponse response = openSearchClient.cluster().health(request); assertYellowShards(response); @@ -228,7 +228,10 @@ public void testClusterHealthYellowSpecificIndex() throws IOException { OpenSearchClient openSearchClient = javaClient(); createIndex("index", Settings.EMPTY); createIndex("index2", Settings.EMPTY); - HealthRequest request = new HealthRequest.Builder().index("index").timeout(t -> t.time("5s")).level(Level.Shards).build(); + HealthRequest request = new HealthRequest.Builder().index("index") + .timeout(t -> t.time("5s")) + .level(ClusterHealthLevel.Shards) + .build(); HealthResponse response = openSearchClient.cluster().health(request); assertNotNull(response); @@ -290,7 +293,7 @@ public void testClusterHealthNotFoundIndex() throws IOException { createIndex("index", Settings.EMPTY); HealthRequest request = new HealthRequest.Builder().index("notexisted-index") .timeout(t -> t.time("5s")) - .level(Level.Indices) + .level(ClusterHealthLevel.Indices) .build(); try { HealthResponse response = openSearchClient.cluster().health(request); @@ -310,7 +313,9 @@ public void testClusterStats() throws IOException { ClusterStatsResponse response = openSearchClient.cluster().stats(request); assertNotNull(response); assertNotNull(response.clusterName()); - assertNotEquals(response.nodes().count().total(), 0); - assertNotEquals(response.indices().count(), 0); + assertNotEquals(0, response.nodes().count().total()); + Long indexCount = response.indices().count(); + assertNotNull(indexCount); + assertNotEquals(0, (long) indexCount); } } diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index 29bcb35349..fcd0eb4bd5 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -1949,6 +1949,7 @@ paths: url: https://opensearch.org/docs/latest parameters: - $ref: '#/components/parameters/cluster.get_component_template___query.cluster_manager_timeout' + - $ref: '#/components/parameters/cluster.get_component_template___query.flat_settings' - $ref: '#/components/parameters/cluster.get_component_template___query.local' - $ref: '#/components/parameters/cluster.get_component_template___query.master_timeout' - $ref: '#/components/parameters/_global___query.pretty' @@ -1990,6 +1991,7 @@ paths: parameters: - $ref: '#/components/parameters/cluster.get_component_template___path.name' - $ref: '#/components/parameters/cluster.get_component_template___query.cluster_manager_timeout' + - $ref: '#/components/parameters/cluster.get_component_template___query.flat_settings' - $ref: '#/components/parameters/cluster.get_component_template___query.local' - $ref: '#/components/parameters/cluster.get_component_template___query.master_timeout' - $ref: '#/components/parameters/_global___query.pretty' @@ -17174,6 +17176,14 @@ components: schema: $ref: '#/components/schemas/_common___Duration' x-version-added: '2.0' + cluster.get_component_template___query.flat_settings: + in: query + name: flat_settings + description: If `true`, returns settings in flat format. + schema: + type: boolean + default: false + style: form cluster.get_component_template___query.local: in: query name: local @@ -26428,7 +26438,8 @@ components: type: boolean shard: description: Specifies the ID of the shard that you would like an explanation for. - type: number + type: integer + format: int32 description: The index, shard, and primary flag to explain. Empty means 'explain the first unassigned shard' cluster.delete_weighted_routing: content: @@ -28581,7 +28592,8 @@ components: remaining_delay_in_millis: $ref: '#/components/schemas/_common___DurationValueUnitMillis' shard: - type: number + type: integer + format: int32 unassigned_info: $ref: '#/components/schemas/cluster.allocation_explain___UnassignedInformation' note: @@ -28734,34 +28746,56 @@ components: content: application/json: schema: - type: object - properties: - acknowledged: - type: boolean - explanations: - type: array - items: - $ref: '#/components/schemas/cluster.reroute___RerouteExplanation' - state: - description: |- - There aren't any guarantees on the output/structure of the raw cluster state. - Here you will find the internal representation of the cluster, which can - differ from the external representation. - type: object - required: - - acknowledged + allOf: + - $ref: '#/components/schemas/_common___AcknowledgedResponseBase' + - type: object + properties: + explanations: + type: array + items: + $ref: '#/components/schemas/cluster.reroute___RerouteExplanation' + state: + description: |- + There aren't any guarantees on the output/structure of the raw cluster state. + Here you will find the internal representation of the cluster, which can + differ from the external representation. description: '' cluster.state___200: content: application/json: - schema: - type: object + schema: {} description: '' cluster.stats___200: content: application/json: schema: - $ref: '#/components/schemas/cluster.stats___StatsResponseBase' + allOf: + - $ref: '#/components/schemas/nodes._common___NodesResponseBase' + - type: object + properties: + cluster_name: + description: Name of the cluster, based on the Cluster name setting setting. + $ref: '#/components/schemas/_common___Name' + cluster_uuid: + description: Unique identifier for the cluster. + $ref: '#/components/schemas/_common___Uuid' + indices: + description: Contains statistics about indices with shards assigned to selected nodes. + $ref: '#/components/schemas/cluster.stats___ClusterIndices' + nodes: + description: Contains statistics about nodes selected by the request's node filters. + $ref: '#/components/schemas/cluster.stats___ClusterNodes' + status: + description: Health status of the cluster, based on the state of its primary and replica shards. + $ref: '#/components/schemas/_common___HealthStatus' + timestamp: + description: Unix timestamp, in milliseconds, for the last time the cluster statistics were refreshed. + $ref: '#/components/schemas/_common___EpochTimeUnitMillis' + required: + - cluster_name + - cluster_uuid + - status + - timestamp description: '' count___200: content: @@ -47804,7 +47838,8 @@ components: transport_address: $ref: '#/components/schemas/_common___TransportAddress' weight_ranking: - type: number + type: integer + format: int32 required: - attributes - id @@ -47872,7 +47907,8 @@ components: transport_address: $ref: '#/components/schemas/_common___TransportAddress' weight_ranking: - type: number + type: integer + format: int32 required: - deciders - node_attributes @@ -47901,7 +47937,8 @@ components: path: type: string total: - type: number + type: integer + format: int64 shards: type: array items: @@ -47923,7 +47960,8 @@ components: details: type: string failed_allocation_attempts: - type: number + type: integer + format: int32 delayed: type: boolean allocation_status: @@ -47967,26 +48005,34 @@ components: x-version-added: '2.5' properties: active_shards: - type: number + type: integer + format: int32 initializing_shards: - type: number + type: integer + format: int32 relocating_shards: - type: number + type: integer + format: int32 unassigned_shards: - type: number + type: integer + format: int32 data_nodes: - type: number + type: integer + format: int32 weight: - type: number + type: integer + format: int32 cluster.health___HealthResponseBody: type: object properties: active_primary_shards: description: The number of active primary shards. - type: number + type: integer + format: int32 active_shards: description: The total number of active primary and replica shards. - type: number + type: integer + format: int32 active_shards_percent: $ref: '#/components/schemas/_common___PercentageString' active_shards_percent_as_number: @@ -48001,7 +48047,8 @@ components: $ref: '#/components/schemas/_common___Name' delayed_unassigned_shards: description: The number of shards whose allocation has been delayed by the timeout settings. - type: number + type: integer + format: int32 discovered_master: description: True if the cluster-manager node has been discovered. type: boolean @@ -48016,22 +48063,28 @@ components: $ref: '#/components/schemas/cluster.health___IndexHealthStats' initializing_shards: description: The number of shards that are under initialization. - type: number + type: integer + format: int32 number_of_data_nodes: description: The number of nodes that are dedicated data nodes. - type: number + type: integer + format: int32 number_of_in_flight_fetch: description: The number of unfinished fetches. - type: number + type: integer + format: int32 number_of_nodes: description: The number of nodes within the cluster. - type: number + type: integer + format: int32 number_of_pending_tasks: description: The number of cluster-level changes that have not yet been executed. - type: number + type: integer + format: int32 relocating_shards: description: The number of shards that are under relocation. - type: number + type: integer + format: int32 status: $ref: '#/components/schemas/_common___HealthStatus' task_max_waiting_in_queue: @@ -48043,7 +48096,8 @@ components: type: boolean unassigned_shards: description: The number of shards that are not allocated. - type: number + type: integer + format: int32 required: - active_primary_shards - active_shards @@ -48064,17 +48118,23 @@ components: type: object properties: active_primary_shards: - type: number + type: integer + format: int32 active_shards: - type: number + type: integer + format: int32 initializing_shards: - type: number + type: integer + format: int32 number_of_replicas: - type: number + type: integer + format: int32 number_of_shards: - type: number + type: integer + format: int32 relocating_shards: - type: number + type: integer + format: int32 shards: type: object additionalProperties: @@ -48082,7 +48142,8 @@ components: status: $ref: '#/components/schemas/_common___HealthStatus' unassigned_shards: - type: number + type: integer + format: int32 required: - active_primary_shards - active_shards @@ -48103,17 +48164,21 @@ components: type: object properties: active_shards: - type: number + type: integer + format: int32 initializing_shards: - type: number + type: integer + format: int32 primary_active: type: boolean relocating_shards: - type: number + type: integer + format: int32 status: $ref: '#/components/schemas/_common___HealthStatus' unassigned_shards: - type: number + type: integer + format: int32 required: - active_shards - initializing_shards @@ -48129,7 +48194,8 @@ components: type: boolean insert_order: description: The number that represents when the task has been inserted into the task queue. - type: number + type: integer + format: int32 priority: description: |- The priority of the pending task. @@ -48173,9 +48239,11 @@ components: server_name: type: string num_proxy_sockets_connected: - type: number + type: integer + format: int32 max_proxy_socket_connections: - type: number + type: integer + format: int32 required: - connected - initial_connect_timeout @@ -48195,9 +48263,11 @@ components: connected: type: boolean max_connections_per_cluster: - type: number + type: integer + format: int32 num_nodes_connected: - type: number + type: integer + format: int64 initial_connect_timeout: $ref: '#/components/schemas/_common___Duration' skip_unavailable: @@ -48218,14 +48288,48 @@ components: type: object properties: cancel: + description: |- + Cancel allocation of a shard (or recovery). Accepts index and shard for index + name and shard number, and node for the node to cancel the shard allocation + on. This can be used to force resynchronization of existing replicas from the + primary shard by cancelling them and allowing them to be reinitialized + through the standard recovery process. By default only replica shard + allocations can be cancelled. If it is necessary to cancel the allocation of + a primary shard then the allow_primary flag must also be included in the + request. $ref: '#/components/schemas/cluster.reroute___CommandCancelAction' move: + description: |- + Move a started shard from one node to another node. Accepts index and shard + for index name and shard number, from_node for the node to move the shard + from, and to_node for the node to move the shard to. $ref: '#/components/schemas/cluster.reroute___CommandMoveAction' allocate_replica: + description: |- + Allocate an unassigned replica shard to a node. Accepts index and shard for + index name and shard number, and node to allocate the shard to. Takes + allocation deciders into account. $ref: '#/components/schemas/cluster.reroute___CommandAllocateReplicaAction' allocate_stale_primary: + description: |- + Allocate a primary shard to a node that holds a stale copy. Accepts the index + and shard for index name and shard number, and node to allocate the shard to. + Using this command may lead to data loss for the provided shard id. If a node + which has the good copy of the data rejoins the cluster later on, that data + will be deleted or overwritten with the data of the stale copy that was + forcefully allocated with this command. To ensure that these implications are + well-understood, this command requires the flag accept_data_loss to be + explicitly set to true. $ref: '#/components/schemas/cluster.reroute___CommandAllocatePrimaryAction' allocate_empty_primary: + description: |- + Allocate an empty primary shard to a node. Accepts the index and shard for + index name and shard number, and node to allocate the shard to. Using this + command leads to a complete loss of all data that was indexed into this + shard, if it was previously started. If a node which has a copy of the data + rejoins the cluster later on, that data will be deleted. To ensure that these + implications are well-understood, this command requires the flag + accept_data_loss to be explicitly set to true. $ref: '#/components/schemas/cluster.reroute___CommandAllocatePrimaryAction' cluster.reroute___CommandAllocatePrimaryAction: type: object @@ -48233,7 +48337,8 @@ components: index: $ref: '#/components/schemas/_common___IndexName' shard: - type: number + type: integer + format: int32 node: type: string accept_data_loss: @@ -48250,7 +48355,8 @@ components: index: $ref: '#/components/schemas/_common___IndexName' shard: - type: number + type: integer + format: int32 node: type: string required: @@ -48263,7 +48369,8 @@ components: index: $ref: '#/components/schemas/_common___IndexName' shard: - type: number + type: integer + format: int32 node: type: string allow_primary: @@ -48278,7 +48385,8 @@ components: index: $ref: '#/components/schemas/_common___IndexName' shard: - type: number + type: integer + format: int32 from_node: description: The node to move the shard from type: string @@ -48340,7 +48448,8 @@ components: node: $ref: '#/components/schemas/_common___NodeName' shard: - type: number + type: integer + format: int32 from_node: $ref: '#/components/schemas/_common___NodeName' to_node: @@ -48462,7 +48571,8 @@ components: $ref: '#/components/schemas/_common___CompletionStats' count: description: Total number of indexes with shards assigned to selected nodes. - type: number + type: integer + format: int64 docs: $ref: '#/components/schemas/_common___DocStats' fielddata: @@ -48489,21 +48599,27 @@ components: $ref: '#/components/schemas/cluster.stats___ClusterIndicesShardsIndex' primaries: description: Number of primary shards assigned to selected nodes. - type: number + type: integer + format: int32 replication: description: Ratio of replica shards to primary shards across all selected nodes. - type: number + type: integer + format: int32 total: description: Total number of shards assigned to selected nodes. - type: number + type: integer + format: int32 cluster.stats___ClusterIndicesShardsIndex: type: object properties: primaries: + description: Contains statistics about the number of primary shards assigned to selected nodes. $ref: '#/components/schemas/cluster.stats___ClusterShardMetrics' replication: + description: Contains statistics about the number of replication shards assigned to selected nodes. $ref: '#/components/schemas/cluster.stats___ClusterShardMetrics' shards: + description: Contains statistics about the number of shards assigned to selected nodes. $ref: '#/components/schemas/cluster.stats___ClusterShardMetrics' required: - primaries @@ -48513,7 +48629,8 @@ components: type: object properties: number_of_pipelines: - type: number + type: integer + format: int32 processor_stats: type: object additionalProperties: @@ -48532,7 +48649,8 @@ components: $ref: '#/components/schemas/cluster.stats___ClusterJvmMemory' threads: description: Number of active threads in use by JVM across all selected nodes. - type: number + type: integer + format: int64 versions: description: Contains statistics about the JVM versions used by selected nodes. type: array @@ -48569,7 +48687,8 @@ components: type: boolean count: description: Total number of selected nodes using JVM. - type: number + type: integer + format: int32 using_bundled_jdk: description: If `true`, a bundled JDK is in use by JVM. type: boolean @@ -48598,12 +48717,14 @@ components: description: Contains statistics about the HTTP network types used by selected nodes. type: object additionalProperties: - type: number + type: integer + format: int32 transport_types: description: Contains statistics about the transport network types used by selected nodes. type: object additionalProperties: - type: number + type: integer + format: int32 required: - http_types - transport_types @@ -48611,39 +48732,55 @@ components: type: object properties: coordinating_only: - type: number + type: integer + format: int32 data: - type: number + type: integer + format: int32 data_cold: - type: number + type: integer + format: int32 data_content: - type: number + type: integer + format: int32 data_frozen: - type: number + type: integer + format: int32 data_hot: - type: number + type: integer + format: int32 data_warm: - type: number + type: integer + format: int32 ingest: - type: number + type: integer + format: int32 master: - type: number + type: integer + format: int32 cluster_manager: - type: number + type: integer + format: int32 x-version-added: '2.0' ml: - type: number + type: integer + format: int32 remote_cluster_client: - type: number + type: integer + format: int32 search: - type: number + type: integer + format: int32 x-version-added: '2.4' total: - type: number + type: integer + format: int32 transform: - type: number + type: integer + format: int32 voting_only: - type: number + type: integer + format: int32 required: - coordinating_only - data @@ -48655,23 +48792,29 @@ components: type: object properties: count: + description: Contains counts for nodes selected by the request's node filters. $ref: '#/components/schemas/cluster.stats___ClusterNodeCount' discovery_types: description: Contains statistics about the discovery types used by selected nodes. type: object additionalProperties: - type: number + type: integer + format: int32 fs: + description: Contains statistics about file stores by selected nodes. $ref: '#/components/schemas/cluster.stats___ClusterFileSystem' indexing_pressure: $ref: '#/components/schemas/cluster.stats___IndexingPressure' ingest: $ref: '#/components/schemas/cluster.stats___ClusterIngest' jvm: + description: Contains statistics about the Java Virtual Machines (JVMs) used by selected nodes. $ref: '#/components/schemas/cluster.stats___ClusterJvm' network_types: + description: Contains statistics about the transport and HTTP networks used by selected nodes. $ref: '#/components/schemas/cluster.stats___ClusterNetworkTypes' os: + description: Contains statistics about the operating systems used by selected nodes. $ref: '#/components/schemas/cluster.stats___ClusterOperatingSystem' packaging_types: description: Contains statistics about OpenSearch distributions installed on selected nodes. @@ -48686,6 +48829,7 @@ components: items: $ref: '#/components/schemas/_common___PluginStats' process: + description: Contains statistics about processes used by selected nodes. $ref: '#/components/schemas/cluster.stats___ClusterProcess' versions: description: Array of OpenSearch versions used on selected nodes. @@ -48700,7 +48844,8 @@ components: Number of processors used to calculate thread pool size across all selected nodes. This number can be set with the processors setting of a node and defaults to the number of processors reported by the operating system. In both cases, this number will never be larger than 32. - type: number + type: integer + format: int32 architectures: description: Contains statistics about processor architectures (for example, x86_64 or aarch64) used by selected nodes. type: array @@ -48708,7 +48853,8 @@ components: $ref: '#/components/schemas/cluster.stats___ClusterOperatingSystemArchitecture' available_processors: description: Number of processors available to JVM across all selected nodes. - type: number + type: integer + format: int32 mem: $ref: '#/components/schemas/cluster.stats___OperatingSystemMemoryInfo' names: @@ -48735,7 +48881,8 @@ components: type: string count: description: Number of selected nodes using the architecture. - type: number + type: integer + format: int32 required: - arch - count @@ -48744,7 +48891,8 @@ components: properties: count: description: Number of selected nodes using the operating system. - type: number + type: integer + format: int32 name: $ref: '#/components/schemas/_common___Name' required: @@ -48755,7 +48903,8 @@ components: properties: count: description: Number of selected nodes using the operating system. - type: number + type: integer + format: int32 pretty_name: $ref: '#/components/schemas/_common___Name' required: @@ -48788,17 +48937,20 @@ components: description: |- Average number of concurrently open file descriptors. Returns `-1` if not supported. - type: number + type: integer + format: int64 max: description: |- Maximum number of concurrently open file descriptors allowed across all selected nodes. Returns `-1` if not supported. - type: number + type: integer + format: int64 min: description: |- Minimum number of concurrently open file descriptors across all selected nodes. Returns -1 if not supported. - type: number + type: integer + format: int64 required: - avg - max @@ -48807,11 +48959,14 @@ components: type: object properties: count: - type: number + type: integer + format: int64 current: - type: number + type: integer + format: int64 failed: - type: number + type: integer + format: int64 time: $ref: '#/components/schemas/_common___Duration' time_in_millis: @@ -48827,12 +48982,15 @@ components: avg: description: Mean number of shards in an index, counting only shards assigned to selected nodes. type: number + format: double max: description: Maximum number of shards in an index, counting only shards assigned to selected nodes. type: number + format: double min: description: Minimum number of shards in an index, counting only shards assigned to selected nodes. type: number + format: double required: - avg - max @@ -48844,22 +49002,12 @@ components: $ref: '#/components/schemas/_common___Name' count: description: The number of occurrences of the field type in selected nodes. - type: number + type: integer + format: int32 index_count: description: The number of indexes containing the field type in selected nodes. - type: number - indexed_vector_count: - description: For `dense_vector` field types, number of indexed vector types in selected nodes. - type: number - indexed_vector_dim_max: - description: For `dense_vector` field types, the maximum dimension of all indexed vector types in selected nodes. - type: number - indexed_vector_dim_min: - description: For `dense_vector` field types, the minimum dimension of all indexed vector types in selected nodes. - type: number - script_count: - description: The number of fields that declare a script. - type: number + type: integer + format: int32 required: - count - index_count @@ -48872,17 +49020,6 @@ components: type: array items: $ref: '#/components/schemas/cluster.stats___FieldTypes' - total_field_count: - description: Total number of fields in all non-system indexes. - type: number - total_deduplicated_field_count: - description: Total number of fields in all non-system indexes, accounting for mapping deduplication. - type: number - total_deduplicated_mapping_size: - $ref: '#/components/schemas/_common___HumanReadableByteCount' - total_deduplicated_mapping_size_in_bytes: - description: Total size of all mappings, in bytes, after deduplication and compression. - $ref: '#/components/schemas/_common___ByteCount' required: - field_types cluster.stats___IndexingPressure: @@ -48947,9 +49084,11 @@ components: type: object properties: index_count: - type: number + type: integer + format: int32 primary_shard_count: - type: number + type: integer + format: int32 total_primary_bytes: $ref: '#/components/schemas/_common___ByteCount' version: @@ -48978,7 +49117,8 @@ components: properties: count: description: Number of selected nodes using the distribution flavor and file type. - type: number + type: integer + format: int32 flavor: description: Type of OpenSearch distribution. This is always `default`. type: string @@ -49024,29 +49164,6 @@ components: - total_in_bytes - used_in_bytes - used_percent - cluster.stats___StatsResponseBase: - allOf: - - $ref: '#/components/schemas/nodes._common___NodesResponseBase' - - type: object - properties: - cluster_name: - $ref: '#/components/schemas/_common___Name' - cluster_uuid: - $ref: '#/components/schemas/_common___Uuid' - indices: - $ref: '#/components/schemas/cluster.stats___ClusterIndices' - nodes: - $ref: '#/components/schemas/cluster.stats___ClusterNodes' - status: - $ref: '#/components/schemas/_common___HealthStatus' - timestamp: - description: Unix timestamp, in milliseconds, for the last time the cluster statistics were refreshed. - type: number - required: - - cluster_name - - cluster_uuid - - status - - timestamp cluster.weighted_routing___Weights: allOf: - $ref: '#/components/schemas/cluster.weighted_routing___WeightsBase' @@ -54672,6 +54789,7 @@ components: type: object properties: _nodes: + description: Contains statistics about the number of nodes selected by the request's node filters. $ref: '#/components/schemas/_common___NodeStatistics' nodes._common___OperatingSystem: type: object diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java index c210d89f17..5043acbb98 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java @@ -14,7 +14,9 @@ import static org.opensearch.client.codegen.utils.matcher.Matcher.is; import static org.opensearch.client.codegen.utils.matcher.Matcher.isNot; import static org.opensearch.client.codegen.utils.matcher.Matcher.isNull; +import static org.opensearch.client.codegen.utils.matcher.Matcher.isOneOf; import static org.opensearch.client.codegen.utils.matcher.Matcher.or; +import static org.opensearch.client.codegen.utils.matcher.StringMatcher.contains; import java.io.File; import java.io.IOException; @@ -45,6 +47,17 @@ public class CodeGenerator { private static final Logger LOGGER = LogManager.getLogger(); private static final Matcher OPERATION_MATCHER = or( and(namespace(isNull()), name(is("info"))), + and( + namespace(is("cluster")), + name( + or( + isOneOf("allocation_explain", "health", "pending_tasks", "remote_info", "reroute", "state", "stats"), + contains("component_template"), + contains("settings"), + contains("voting_config_exclusions") + ) + ) + ), namespace(is("dangling_indices")), and(namespace(is("indices")), name(isNot("get_field_mapping"))), and( diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/DelegatedShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/DelegatedShape.java new file mode 100644 index 0000000000..850b7ca7d4 --- /dev/null +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/DelegatedShape.java @@ -0,0 +1,58 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +package org.opensearch.client.codegen.model; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import javax.annotation.Nonnull; +import org.opensearch.client.codegen.model.overrides.ShouldGenerate; + +public class DelegatedShape extends Shape { + @Nonnull + private final Type delegatedType; + + public DelegatedShape( + Namespace parent, + String className, + String typedefName, + String description, + ShouldGenerate shouldGenerate, + Type delegatedType + ) { + super(parent, className, typedefName, description, shouldGenerate); + this.delegatedType = Objects.requireNonNull(delegatedType, "delegatedType cannot be null"); + } + + @Nonnull + public Type getDelegatedType() { + return delegatedType; + } + + public Collection getFields() { + return List.of( + Field.builder().withName("valueBody").withType(delegatedType).withDescription("Response value.").withRequired(true).build() + ); + } + + @Override + public Collection getImplementsTypes() { + var types = new ArrayList<>(super.getImplementsTypes()); + types.add(Types.Client.Json.PlainJsonSerializable); + types.add(Types.Client.Util.ToCopyableBuilder(getType().getBuilderType(), getType())); + return types; + } + + public Collection getConcreteBuilderSetters() { + var builderT = Type.builder().withName("Builder").build(); + return getFields().stream().map(f -> new ObjectShapeBase.BuilderSetter(builderT, f)).collect(Collectors.toList()); + } +} diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java index ec6112fe38..71eb534cc7 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java @@ -238,6 +238,12 @@ private static String classBaseName(@Nonnull OperationGroup operationGroup) { Objects.requireNonNull(operationGroup, "operationGroup must not be null"); switch (operationGroup.toString()) { + case "cluster.get_settings": + return "GetClusterSettings"; + case "cluster.put_settings": + return "PutClusterSettings"; + case "cluster.stats": + return "ClusterStats"; case "indices.clone": return "CloneIndex"; case "indices.close": diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java index 219e8e5692..40b4440246 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java @@ -23,7 +23,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; import javax.annotation.Nonnull; -import org.apache.commons.lang3.NotImplementedException; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.opensearch.client.codegen.model.overrides.Overrides; @@ -388,7 +387,8 @@ private Shape visit(Namespace parent, String className, String typedefName, Open visitInto(schema, objShape); } } else { - throw new NotImplementedException("Unsupported schema: " + schema); + shape = new DelegatedShape(parent, className, typedefName, description, shouldGenerate, mapType(schema)); + visitedSchemas.putIfAbsent(schema, shape); } parent.addShape(shape); diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java index ee1dd130ec..12e4908867 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java @@ -110,6 +110,10 @@ private static JsonPointer schema(String namespace, String name) { so -> so.withAliasProvider(k -> k.endsWith("cludes") ? Set.of(k.substring(0, k.length() - 1)) : null) ) + .with(schema("cluster.health", "Level"), so -> so.withClassName("ClusterHealthLevel")) + .with(schema("cluster.reroute", "Metric"), so -> so.withClassName("ClusterRerouteMetric")) + .with(schema("cluster.state", "Metric"), so -> so.withClassName("ClusterStateMetric")) + .with(schema("indices._common", "IndexSettings"), so -> so.withAliasProvider(k -> { switch (k) { case "index": @@ -125,6 +129,11 @@ private static JsonPointer schema(String namespace, String name) { })) .with(schema("indices.stats", "Metric"), so -> so.withClassName("IndicesStatsMetric")) + + .with( + schema("nodes._common", "NodesResponseBase"), + so -> so.withProperties(p -> p.with("_nodes", po -> po.withName("nodeStats"))) + ) ) .build(); diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/DelegatedShape.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/DelegatedShape.mustache new file mode 100644 index 0000000000..31d5b6b18d --- /dev/null +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/DelegatedShape.mustache @@ -0,0 +1,39 @@ +{{>Partials/ClassDeclaration}} { + {{>ObjectShape/Fields}} + + // --------------------------------------------------------------------------------------------- + + {{>ObjectShape/Constructor}} + + {{>ObjectShape/Getters}} + + /** + * Serialize this value to JSON. + */ + @Override + public void serialize({{TYPES.Jakarta.Json.Stream.JsonGenerator}} generator, {{TYPES.Client.Json.JsonpMapper}} mapper) { + {{#delegatedType.directSerializer}}this.valueBody{{/delegatedType.directSerializer}} + } + + // --------------------------------------------------------------------------------------------- + + {{>ObjectShape/ToBuilder}} + + {{>ObjectShape/Builder}} + + // --------------------------------------------------------------------------------------------- + + public static final {{TYPES.Client.Json.JsonpDeserializer}}<{{className}}> _DESERIALIZER = create{{className}}Deserializer(); + + protected static {{TYPES.Client.Json.JsonpDeserializer}}<{{className}}> create{{className}}Deserializer() { + {{TYPES.Client.Json.JsonpDeserializer}}<{{delegatedType}}> valueDeserializer = {{delegatedType}}._DESERIALIZER; + return {{TYPES.Client.Json.JsonpDeserializer}}.of( + valueDeserializer.acceptedEvents(), + (parser, mapper) -> new Builder().valueBody(valueDeserializer.deserialize(parser, mapper)).build() + ); + } + + {{>ObjectShape/HashCode}} + + {{>ObjectShape/Equals}} +} diff --git a/samples/src/main/java/org/opensearch/client/samples/IndexTemplates.java b/samples/src/main/java/org/opensearch/client/samples/IndexTemplates.java index c540d45063..fd11165ba5 100644 --- a/samples/src/main/java/org/opensearch/client/samples/IndexTemplates.java +++ b/samples/src/main/java/org/opensearch/client/samples/IndexTemplates.java @@ -11,7 +11,6 @@ import java.util.List; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -import org.opensearch.client.opensearch._types.Time; import org.opensearch.client.opensearch.cluster.PutComponentTemplateRequest; import org.opensearch.client.opensearch.indices.CreateIndexRequest; import org.opensearch.client.opensearch.indices.DeleteIndexRequest; @@ -46,19 +45,21 @@ public static void main(String[] args) { final var indexSettingsComponentTemplate = "index-settings"; PutComponentTemplateRequest putComponentTemplateRequest = PutComponentTemplateRequest.of( c -> c.name(indexSettingsComponentTemplate) - .settings( - s -> s.numberOfShards(2) - .numberOfReplicas(1) - .indexing( - i -> i.slowlog( - sl -> sl.level("info") - .reformat(true) - .threshold(th -> th.index(ith -> ith.warn(Time.of(t -> t.time("2s"))))) + .template( + t -> t.settings( + s -> s.numberOfShards(2) + .numberOfReplicas(1) + .indexing( + i -> i.slowlog( + sl -> sl.level("info") + .reformat(true) + .threshold(th -> th.index(ith -> ith.warn(tt -> tt.time("2s")))) + ) ) - ) - .search( - se -> se.slowlog(sl -> sl.level("info").threshold(th -> th.query(q -> q.warn(Time.of(t -> t.time("2s")))))) - ) + .search( + se -> se.slowlog(sl -> sl.level("info").threshold(th -> th.query(q -> q.warn(tt -> tt.time("2s"))))) + ) + ) ) ); LOGGER.info("Creating component template {}", indexSettingsComponentTemplate); @@ -66,7 +67,7 @@ public static void main(String[] args) { final var indexMappingsComponentTemplate = "index-mappings"; putComponentTemplateRequest = PutComponentTemplateRequest.of( - c -> c.name(indexMappingsComponentTemplate).mappings(m -> m.properties("age", p -> p.integer(i -> i))) + c -> c.name(indexMappingsComponentTemplate).template(t -> t.mappings(m -> m.properties("age", p -> p.integer(i -> i)))) ); LOGGER.info("Creating component template {}", indexMappingsComponentTemplate); client.cluster().putComponentTemplate(putComponentTemplateRequest);