All Downloads are FREE. Search and download functionalities are using the official Maven repository.

co.elastic.clients.elasticsearch.cluster.stats.ClusterOperatingSystem Maven / Gradle / Ivy

There is a newer version: 9.0.0-beta1
Show newest version
/*
 * 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.
 */

package co.elastic.clients.elasticsearch.cluster.stats;

import co.elastic.clients.json.JsonpDeserializable;
import co.elastic.clients.json.JsonpDeserializer;
import co.elastic.clients.json.JsonpMapper;
import co.elastic.clients.json.JsonpSerializable;
import co.elastic.clients.json.JsonpUtils;
import co.elastic.clients.json.ObjectBuilderDeserializer;
import co.elastic.clients.json.ObjectDeserializer;
import co.elastic.clients.util.ApiTypeHelper;
import co.elastic.clients.util.ObjectBuilder;
import co.elastic.clients.util.WithJsonObjectBuilderBase;
import jakarta.json.stream.JsonGenerator;
import java.lang.Integer;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
import javax.annotation.Nullable;

//----------------------------------------------------------------
//       THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------------------
//
// This code is generated from the Elasticsearch API specification
// at https://github.com/elastic/elasticsearch-specification
//
// Manual updates to this file will be lost when the code is
// re-generated.
//
// If you find a property that is missing or wrongly typed, please
// open an issue or a PR on the API specification repository.
//
//----------------------------------------------------------------

// typedef: cluster.stats.ClusterOperatingSystem

/**
 *
 * @see API
 *      specification
 */
@JsonpDeserializable
public class ClusterOperatingSystem implements JsonpSerializable {
	private final int allocatedProcessors;

	private final List architectures;

	private final int availableProcessors;

	private final OperatingSystemMemoryInfo mem;

	private final List names;

	private final List prettyNames;

	// ---------------------------------------------------------------------------------------------

	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");

	}

	public static ClusterOperatingSystem of(Function> fn) {
		return fn.apply(new Builder()).build();
	}

	/**
	 * 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; } /** * Contains statistics about processor architectures (for example, x86_64 or * aarch64) used by selected nodes. *

* API name: {@code architectures} */ 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; } /** * Required - Contains statistics about memory used by selected nodes. *

* API name: {@code mem} */ public final OperatingSystemMemoryInfo mem() { return this.mem; } /** * Required - Contains statistics about operating systems used by selected * nodes. *

* API name: {@code names} */ public final List names() { return this.names; } /** * Required - Contains statistics about operating systems used by selected * nodes. *

* API name: {@code pretty_names} */ public final List prettyNames() { return this.prettyNames; } /** * 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("allocated_processors"); generator.write(this.allocatedProcessors); 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); 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(); } } @Override public String toString() { return JsonpUtils.toString(this); } // --------------------------------------------------------------------------------------------- /** * Builder for {@link ClusterOperatingSystem}. */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { private Integer allocatedProcessors; @Nullable private List architectures; private Integer availableProcessors; private OperatingSystemMemoryInfo mem; private List names; private List prettyNames; /** * 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 Builder allocatedProcessors(int value) { this.allocatedProcessors = value; return this; } /** * 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. */ 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. */ 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. */ 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} */ public final Builder availableProcessors(int value) { this.availableProcessors = value; return this; } /** * Required - Contains statistics about memory used by selected nodes. *

* API name: {@code mem} */ public final Builder mem(OperatingSystemMemoryInfo value) { this.mem = value; return this; } /** * Required - Contains statistics about memory used by selected nodes. *

* API name: {@code mem} */ public final Builder mem( Function> fn) { return this.mem(fn.apply(new OperatingSystemMemoryInfo.Builder()).build()); } /** * Required - Contains statistics about operating systems used by selected * nodes. *

* API name: {@code names} *

* Adds all elements of list to names. */ public final Builder names(List list) { this.names = _listAddAll(this.names, list); return this; } /** * Required - Contains statistics about operating systems used by selected * nodes. *

* API name: {@code names} *

* Adds one or more values to names. */ public final Builder names(ClusterOperatingSystemName value, ClusterOperatingSystemName... values) { this.names = _listAdd(this.names, value, values); return this; } /** * Required - Contains statistics about operating systems used by selected * nodes. *

* API name: {@code names} *

* Adds a value to names using a builder lambda. */ public final Builder names( Function> fn) { return names(fn.apply(new ClusterOperatingSystemName.Builder()).build()); } /** * Required - Contains statistics about operating systems used by selected * nodes. *

* API name: {@code pretty_names} *

* Adds all elements of list to prettyNames. */ public final Builder prettyNames(List list) { this.prettyNames = _listAddAll(this.prettyNames, list); return this; } /** * Required - Contains statistics about operating systems used by selected * nodes. *

* API name: {@code pretty_names} *

* Adds one or more values to prettyNames. */ public final Builder prettyNames(ClusterOperatingSystemPrettyName value, ClusterOperatingSystemPrettyName... values) { this.prettyNames = _listAdd(this.prettyNames, value, values); return this; } /** * Required - Contains statistics about operating systems used by selected * nodes. *

* API name: {@code pretty_names} *

* Adds a value to prettyNames using a builder lambda. */ public final Builder prettyNames( Function> fn) { return prettyNames(fn.apply(new ClusterOperatingSystemPrettyName.Builder()).build()); } @Override protected Builder self() { return this; } /** * Builds a {@link ClusterOperatingSystem}. * * @throws NullPointerException * if some of the required fields are null. */ public ClusterOperatingSystem build() { _checkSingleUse(); return new ClusterOperatingSystem(this); } } // --------------------------------------------------------------------------------------------- /** * Json deserializer for {@link ClusterOperatingSystem} */ public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer .lazy(Builder::new, ClusterOperatingSystem::setupClusterOperatingSystemDeserializer); protected static void setupClusterOperatingSystemDeserializer( ObjectDeserializer op) { op.add(Builder::allocatedProcessors, JsonpDeserializer.integerDeserializer(), "allocated_processors"); 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"); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy