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

co.elastic.clients.elasticsearch.nodes.Discovery Maven / Gradle / Ivy

There is a newer version: 8.15.1
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.nodes;

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.String;
import java.util.Map;
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: nodes._types.Discovery

/**
 *
 * @see API
 *      specification
 */
@JsonpDeserializable
public class Discovery implements JsonpSerializable {
	@Nullable
	private final ClusterStateQueue clusterStateQueue;

	@Nullable
	private final PublishedClusterStates publishedClusterStates;

	private final Map clusterStateUpdate;

	@Nullable
	private final SerializedClusterState serializedClusterStates;

	@Nullable
	private final ClusterAppliedStats clusterApplierStats;

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

	private Discovery(Builder builder) {

		this.clusterStateQueue = builder.clusterStateQueue;
		this.publishedClusterStates = builder.publishedClusterStates;
		this.clusterStateUpdate = ApiTypeHelper.unmodifiable(builder.clusterStateUpdate);
		this.serializedClusterStates = builder.serializedClusterStates;
		this.clusterApplierStats = builder.clusterApplierStats;

	}

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

	/**
	 * Contains statistics for the cluster state queue of the node.
	 * 

* API name: {@code cluster_state_queue} */ @Nullable public final ClusterStateQueue clusterStateQueue() { return this.clusterStateQueue; } /** * Contains statistics for the published cluster states of the node. *

* API name: {@code published_cluster_states} */ @Nullable public final PublishedClusterStates publishedClusterStates() { return this.publishedClusterStates; } /** * Contains low-level statistics about how long various activities took during * cluster state updates while the node was the elected master. Omitted if the * node is not master-eligible. Every field whose name ends in * _time within this object is also represented as a raw number of * milliseconds in a field whose name ends in _time_millis. The * human-readable fields with a _time suffix are only returned if * requested with the ?human=true query parameter. *

* API name: {@code cluster_state_update} */ public final Map clusterStateUpdate() { return this.clusterStateUpdate; } /** * API name: {@code serialized_cluster_states} */ @Nullable public final SerializedClusterState serializedClusterStates() { return this.serializedClusterStates; } /** * API name: {@code cluster_applier_stats} */ @Nullable public final ClusterAppliedStats clusterApplierStats() { return this.clusterApplierStats; } /** * 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) { if (this.clusterStateQueue != null) { generator.writeKey("cluster_state_queue"); this.clusterStateQueue.serialize(generator, mapper); } if (this.publishedClusterStates != null) { generator.writeKey("published_cluster_states"); this.publishedClusterStates.serialize(generator, mapper); } if (ApiTypeHelper.isDefined(this.clusterStateUpdate)) { generator.writeKey("cluster_state_update"); generator.writeStartObject(); for (Map.Entry item0 : this.clusterStateUpdate.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); } generator.writeEnd(); } if (this.serializedClusterStates != null) { generator.writeKey("serialized_cluster_states"); this.serializedClusterStates.serialize(generator, mapper); } if (this.clusterApplierStats != null) { generator.writeKey("cluster_applier_stats"); this.clusterApplierStats.serialize(generator, mapper); } } @Override public String toString() { return JsonpUtils.toString(this); } // --------------------------------------------------------------------------------------------- /** * Builder for {@link Discovery}. */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { @Nullable private ClusterStateQueue clusterStateQueue; @Nullable private PublishedClusterStates publishedClusterStates; @Nullable private Map clusterStateUpdate; @Nullable private SerializedClusterState serializedClusterStates; @Nullable private ClusterAppliedStats clusterApplierStats; /** * Contains statistics for the cluster state queue of the node. *

* API name: {@code cluster_state_queue} */ public final Builder clusterStateQueue(@Nullable ClusterStateQueue value) { this.clusterStateQueue = value; return this; } /** * Contains statistics for the cluster state queue of the node. *

* API name: {@code cluster_state_queue} */ public final Builder clusterStateQueue( Function> fn) { return this.clusterStateQueue(fn.apply(new ClusterStateQueue.Builder()).build()); } /** * Contains statistics for the published cluster states of the node. *

* API name: {@code published_cluster_states} */ public final Builder publishedClusterStates(@Nullable PublishedClusterStates value) { this.publishedClusterStates = value; return this; } /** * Contains statistics for the published cluster states of the node. *

* API name: {@code published_cluster_states} */ public final Builder publishedClusterStates( Function> fn) { return this.publishedClusterStates(fn.apply(new PublishedClusterStates.Builder()).build()); } /** * Contains low-level statistics about how long various activities took during * cluster state updates while the node was the elected master. Omitted if the * node is not master-eligible. Every field whose name ends in * _time within this object is also represented as a raw number of * milliseconds in a field whose name ends in _time_millis. The * human-readable fields with a _time suffix are only returned if * requested with the ?human=true query parameter. *

* API name: {@code cluster_state_update} *

* Adds all entries of map to clusterStateUpdate. */ public final Builder clusterStateUpdate(Map map) { this.clusterStateUpdate = _mapPutAll(this.clusterStateUpdate, map); return this; } /** * Contains low-level statistics about how long various activities took during * cluster state updates while the node was the elected master. Omitted if the * node is not master-eligible. Every field whose name ends in * _time within this object is also represented as a raw number of * milliseconds in a field whose name ends in _time_millis. The * human-readable fields with a _time suffix are only returned if * requested with the ?human=true query parameter. *

* API name: {@code cluster_state_update} *

* Adds an entry to clusterStateUpdate. */ public final Builder clusterStateUpdate(String key, ClusterStateUpdate value) { this.clusterStateUpdate = _mapPut(this.clusterStateUpdate, key, value); return this; } /** * Contains low-level statistics about how long various activities took during * cluster state updates while the node was the elected master. Omitted if the * node is not master-eligible. Every field whose name ends in * _time within this object is also represented as a raw number of * milliseconds in a field whose name ends in _time_millis. The * human-readable fields with a _time suffix are only returned if * requested with the ?human=true query parameter. *

* API name: {@code cluster_state_update} *

* Adds an entry to clusterStateUpdate using a builder lambda. */ public final Builder clusterStateUpdate(String key, Function> fn) { return clusterStateUpdate(key, fn.apply(new ClusterStateUpdate.Builder()).build()); } /** * API name: {@code serialized_cluster_states} */ public final Builder serializedClusterStates(@Nullable SerializedClusterState value) { this.serializedClusterStates = value; return this; } /** * API name: {@code serialized_cluster_states} */ public final Builder serializedClusterStates( Function> fn) { return this.serializedClusterStates(fn.apply(new SerializedClusterState.Builder()).build()); } /** * API name: {@code cluster_applier_stats} */ public final Builder clusterApplierStats(@Nullable ClusterAppliedStats value) { this.clusterApplierStats = value; return this; } /** * API name: {@code cluster_applier_stats} */ public final Builder clusterApplierStats( Function> fn) { return this.clusterApplierStats(fn.apply(new ClusterAppliedStats.Builder()).build()); } @Override protected Builder self() { return this; } /** * Builds a {@link Discovery}. * * @throws NullPointerException * if some of the required fields are null. */ public Discovery build() { _checkSingleUse(); return new Discovery(this); } } // --------------------------------------------------------------------------------------------- /** * Json deserializer for {@link Discovery} */ public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, Discovery::setupDiscoveryDeserializer); protected static void setupDiscoveryDeserializer(ObjectDeserializer op) { op.add(Builder::clusterStateQueue, ClusterStateQueue._DESERIALIZER, "cluster_state_queue"); op.add(Builder::publishedClusterStates, PublishedClusterStates._DESERIALIZER, "published_cluster_states"); op.add(Builder::clusterStateUpdate, JsonpDeserializer.stringMapDeserializer(ClusterStateUpdate._DESERIALIZER), "cluster_state_update"); op.add(Builder::serializedClusterStates, SerializedClusterState._DESERIALIZER, "serialized_cluster_states"); op.add(Builder::clusterApplierStats, ClusterAppliedStats._DESERIALIZER, "cluster_applier_stats"); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy