From a6bb6570992ad960146afcbc25e5e8ec20f0ba1f Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Mon, 23 Dec 2024 17:25:22 +1300 Subject: [PATCH] Generate cluster.stats Signed-off-by: Thomas Farr --- UPGRADING.md | 17 +- .../client/opensearch/_types/PluginStats.java | 252 +++++-- .../cluster/ClusterStatsRequest.java | 444 ++++++++++++ .../cluster/ClusterStatsResponse.java | 204 ++++-- ...java => OpenSearchClusterAsyncClient.java} | 41 +- ...Base.java => OpenSearchClusterClient.java} | 41 +- .../cluster/stats/CharFilterTypes.java | 670 ++++++++++++------ .../cluster/stats/ClusterFileSystem.java | 460 ++++++++++++ .../cluster/stats/ClusterIndices.java | 477 ++++++++----- .../cluster/stats/ClusterIndicesShards.java | 144 ++-- .../stats/ClusterIndicesShardsIndex.java | 133 +++- .../cluster/stats/ClusterIngest.java | 104 ++- .../opensearch/cluster/stats/ClusterJvm.java | 188 ++++- .../cluster/stats/ClusterJvmMemory.java | 301 ++++++++ .../cluster/stats/ClusterJvmVersion.java | 163 ++++- .../cluster/stats/ClusterNetworkTypes.java | 153 +++- .../cluster/stats/ClusterNodeCount.java | 653 +++++++++++++++++ .../cluster/stats/ClusterNodes.java | 465 ++++++++---- .../cluster/stats/ClusterOperatingSystem.java | 350 ++++++--- .../ClusterOperatingSystemArchitecture.java | 125 +++- .../stats/ClusterOperatingSystemName.java | 91 ++- .../ClusterOperatingSystemPrettyName.java | 91 ++- .../cluster/stats/ClusterProcess.java | 84 ++- .../cluster/stats/ClusterProcessCpu.java | 87 ++- .../ClusterProcessOpenFileDescriptors.java | 116 ++- .../cluster/stats/ClusterProcessor.java | 131 +++- .../cluster/stats/ClusterShardMetrics.java | 109 ++- .../opensearch/cluster/stats/FieldTypes.java | 144 ++-- .../cluster/stats/FieldTypesMappings.java | 163 +++-- .../opensearch/cluster/stats/IndexMetric.java | 79 +++ .../cluster/stats/IndexingPressure.java | 191 +++++ .../cluster/stats/IndexingPressureMemory.java | 258 +++++++ .../stats/IndexingPressureMemorySummary.java | 407 +++++++++++ .../cluster/stats/IndicesVersions.java | 89 ++- .../opensearch/cluster/stats/Metric.java | 81 +++ .../cluster/stats/NodePackagingType.java | 136 +++- .../stats/OperatingSystemMemoryInfo.java | 488 +++++++++++++ .../opensearch/nodes/NodesResponseBase.java | 80 ++- .../cluster/ClusterStatsRequest.java | 259 ------- .../cluster/OpenSearchClusterAsyncClient.java | 110 --- .../cluster/OpenSearchClusterClient.java | 109 --- .../cluster/stats/ClusterFileSystem.java | 182 ----- .../cluster/stats/ClusterJvmMemory.java | 158 ----- .../cluster/stats/ClusterNodeCount.java | 314 -------- .../stats/OperatingSystemMemoryInfo.java | 230 ------ .../cluster/stats/RuntimeFieldTypes.java | 466 ------------ java-codegen/opensearch-openapi.yaml | 213 +++--- .../client/codegen/CodeGenerator.java | 2 +- .../client/codegen/model/Namespace.java | 2 +- .../client/codegen/model/RequestShape.java | 2 + .../codegen/model/overrides/Overrides.java | 5 + 51 files changed, 7088 insertions(+), 3174 deletions(-) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/PluginStats.java (60%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/cluster/ClusterStatsRequest.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/ClusterStatsResponse.java (60%) rename java-client/src/generated/java/org/opensearch/client/opensearch/cluster/{OpenSearchClusterAsyncClientBase.java => OpenSearchClusterAsyncClient.java} (91%) rename java-client/src/generated/java/org/opensearch/client/opensearch/cluster/{OpenSearchClusterClientBase.java => OpenSearchClusterClient.java} (91%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/CharFilterTypes.java (54%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterFileSystem.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/ClusterIndices.java (56%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/ClusterIndicesShards.java (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/ClusterIndicesShardsIndex.java (68%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/ClusterIngest.java (67%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvm.java (57%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvmMemory.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvmVersion.java (63%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/ClusterNetworkTypes.java (57%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/ClusterNodeCount.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/ClusterNodes.java (52%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystem.java (60%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystemArchitecture.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystemName.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/ClusterOperatingSystemPrettyName.java (65%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcess.java (70%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcessCpu.java (60%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcessOpenFileDescriptors.java (59%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/ClusterProcessor.java (62%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/ClusterShardMetrics.java (61%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/FieldTypes.java (64%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/FieldTypesMappings.java (63%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/IndexMetric.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/IndexingPressure.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/IndexingPressureMemory.java create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/IndexingPressureMemorySummary.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/IndicesVersions.java (70%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/Metric.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/cluster/stats/NodePackagingType.java (53%) create mode 100644 java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/OperatingSystemMemoryInfo.java rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/nodes/NodesResponseBase.java (61%) delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/cluster/ClusterStatsRequest.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterAsyncClient.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterClient.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterFileSystem.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterJvmMemory.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/ClusterNodeCount.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/OperatingSystemMemoryInfo.java delete mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/cluster/stats/RuntimeFieldTypes.java diff --git a/UPGRADING.md b/UPGRADING.md index 00ab53d55c..8de42c6750 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -302,4 +302,19 @@ After: - The `metric` property is now of type `List` instead of `List`. ### StateRequest -- The `metric` property is now of type `List` instead of `List`. \ No newline at end of file +- 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/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/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/generated/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterAsyncClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterAsyncClient.java similarity index 91% rename from java-client/src/generated/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterAsyncClientBase.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterAsyncClient.java index 5782c72854..cfd560c291 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterAsyncClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterAsyncClient.java @@ -52,13 +52,20 @@ * Client for the cluster namespace. */ @Generated("org.opensearch.client.codegen.CodeGenerator") -public abstract class OpenSearchClusterAsyncClientBase> extends ApiClient< - OpenSearchTransport, - Self> { - public OpenSearchClusterAsyncClientBase(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { +public class OpenSearchClusterAsyncClient extends ApiClient { + public OpenSearchClusterAsyncClient(OpenSearchTransport transport) { + super(transport, null); + } + + public OpenSearchClusterAsyncClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { super(transport, transportOptions); } + @Override + public OpenSearchClusterAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new OpenSearchClusterAsyncClient(this.transport, transportOptions); + } + // ----- Endpoint: cluster.allocation_explain /** @@ -406,4 +413,30 @@ public final CompletableFuture state(Function 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 { + 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} + */ + public final CompletableFuture stats(Function> fn) + throws IOException, OpenSearchException { + return stats(fn.apply(new ClusterStatsRequest.Builder()).build()); + } + + /** + * Returns high-level overview of cluster statistics. + */ + public final CompletableFuture stats() throws IOException, OpenSearchException { + return stats(new ClusterStatsRequest.Builder().build()); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterClient.java similarity index 91% rename from java-client/src/generated/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterClientBase.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterClient.java index bfc030a10a..a8e946665b 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterClient.java @@ -51,13 +51,20 @@ * Client for the cluster namespace. */ @Generated("org.opensearch.client.codegen.CodeGenerator") -public abstract class OpenSearchClusterClientBase> extends ApiClient< - OpenSearchTransport, - Self> { - public OpenSearchClusterClientBase(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { +public class OpenSearchClusterClient extends ApiClient { + public OpenSearchClusterClient(OpenSearchTransport transport) { + super(transport, null); + } + + public OpenSearchClusterClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { super(transport, transportOptions); } + @Override + public OpenSearchClusterClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new OpenSearchClusterClient(this.transport, transportOptions); + } + // ----- Endpoint: cluster.allocation_explain /** @@ -397,4 +404,30 @@ public final StateResponse state(Function> fn) + throws IOException, OpenSearchException { + return stats(fn.apply(new ClusterStatsRequest.Builder()).build()); + } + + /** + * Returns high-level overview of cluster statistics. + */ + public final ClusterStatsResponse stats() throws IOException, OpenSearchException { + return stats(new ClusterStatsRequest.Builder().build()); + } } 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/generated/java/org/opensearch/client/opensearch/cluster/stats/IndexMetric.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/IndexMetric.java new file mode 100644 index 0000000000..734e4458ce --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/IndexMetric.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.stats; + +import javax.annotation.Generated; +import org.opensearch.client.json.JsonEnum; +import org.opensearch.client.json.JsonpDeserializable; + +// typedef: cluster.stats.IndexMetric + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public enum IndexMetric implements JsonEnum { + All("_all"), + + 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/generated/java/org/opensearch/client/opensearch/cluster/stats/Metric.java b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/Metric.java new file mode 100644 index 0000000000..b7cb3aa8f1 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/cluster/stats/Metric.java @@ -0,0 +1,81 @@ +/* + * 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 javax.annotation.Generated; +import org.opensearch.client.json.JsonEnum; +import org.opensearch.client.json.JsonpDeserializable; + +// typedef: cluster.stats.Metric + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public enum Metric implements JsonEnum { + All("_all"), + + 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/OpenSearchClusterAsyncClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterAsyncClient.java deleted file mode 100644 index d4c350a27a..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterAsyncClient.java +++ /dev/null @@ -1,110 +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.io.IOException; -import java.util.concurrent.CompletableFuture; -import java.util.function.Function; -import javax.annotation.Nullable; -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.util.ObjectBuilder; - -/** - * Client for the cluster namespace. - */ -public class OpenSearchClusterAsyncClient extends OpenSearchClusterAsyncClientBase { - - public OpenSearchClusterAsyncClient(OpenSearchTransport transport) { - super(transport, null); - } - - public OpenSearchClusterAsyncClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { - super(transport, transportOptions); - } - - @Override - public OpenSearchClusterAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) { - return new OpenSearchClusterAsyncClient(this.transport, transportOptions); - } - - // ----- 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); - } - - /** - * Returns high-level overview of cluster statistics. - * - * @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()); - } - - /** - * Returns high-level overview of cluster statistics. - * - * - */ - - public CompletableFuture stats() throws IOException, OpenSearchException { - return this.transport.performRequestAsync( - new ClusterStatsRequest.Builder().build(), - ClusterStatsRequest._ENDPOINT, - this.transportOptions - ); - } - -} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterClient.java deleted file mode 100644 index 29217fb2c9..0000000000 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/OpenSearchClusterClient.java +++ /dev/null @@ -1,109 +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.io.IOException; -import java.util.function.Function; -import javax.annotation.Nullable; -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.util.ObjectBuilder; - -/** - * Client for the cluster namespace. - */ -public class OpenSearchClusterClient extends OpenSearchClusterClientBase { - - public OpenSearchClusterClient(OpenSearchTransport transport) { - super(transport, null); - } - - public OpenSearchClusterClient(OpenSearchTransport transport, @Nullable TransportOptions transportOptions) { - super(transport, transportOptions); - } - - @Override - public OpenSearchClusterClient withTransportOptions(@Nullable TransportOptions transportOptions) { - return new OpenSearchClusterClient(this.transport, transportOptions); - } - - // ----- Endpoint: cluster.stats - - /** - * Returns high-level overview of cluster statistics. - * - * - */ - - public ClusterStatsResponse stats(ClusterStatsRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - ClusterStatsRequest, - ClusterStatsResponse, - ErrorResponse>) ClusterStatsRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Returns high-level overview of cluster statistics. - * - * @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()); - } - - /** - * Returns high-level overview of cluster statistics. - * - * - */ - - public ClusterStatsResponse stats() throws IOException, OpenSearchException { - return this.transport.performRequest( - new ClusterStatsRequest.Builder().build(), - ClusterStatsRequest._ENDPOINT, - this.transportOptions - ); - } - -} 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-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index 0a2b247204..fcd0eb4bd5 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -28769,7 +28769,33 @@ components: 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: @@ -48545,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: @@ -48572,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 @@ -48596,7 +48629,8 @@ components: type: object properties: number_of_pipelines: - type: number + type: integer + format: int32 processor_stats: type: object additionalProperties: @@ -48615,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 @@ -48652,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 @@ -48681,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 @@ -48694,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 @@ -48738,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. @@ -48769,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. @@ -48783,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 @@ -48791,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: @@ -48818,7 +48881,8 @@ components: type: string count: description: Number of selected nodes using the architecture. - type: number + type: integer + format: int32 required: - arch - count @@ -48827,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: @@ -48838,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: @@ -48871,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 @@ -48890,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: @@ -48910,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 @@ -48927,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 @@ -48955,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: @@ -49030,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: @@ -49061,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 @@ -49107,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' @@ -54755,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 70a3519e20..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 @@ -51,7 +51,7 @@ public class CodeGenerator { namespace(is("cluster")), name( or( - isOneOf("allocation_explain", "health", "pending_tasks", "remote_info", "reroute", "state"), + isOneOf("allocation_explain", "health", "pending_tasks", "remote_info", "reroute", "state", "stats"), contains("component_template"), contains("settings"), contains("voting_config_exclusions") diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java index d995c118b3..1e2d186b5a 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java @@ -24,7 +24,7 @@ import org.opensearch.client.codegen.utils.Strings; public class Namespace { - private static final Set PARTIAL_NAMESPACES = Set.of("", "cluster", "indices"); + private static final Set PARTIAL_NAMESPACES = Set.of("", "indices"); private final Namespace parent; private final String name; 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 6b31355311..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 @@ -242,6 +242,8 @@ private static String classBaseName(@Nonnull OperationGroup operationGroup) { 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/overrides/Overrides.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/overrides/Overrides.java index 23ffd69312..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 @@ -129,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();