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

co.elastic.clients.elasticsearch.indices.DataStreamsStatsResponse 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.indices;

import co.elastic.clients.elasticsearch._types.ShardStatistics;
import co.elastic.clients.elasticsearch.indices.data_streams_stats.DataStreamsStatsItem;
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.lang.Long;
import java.lang.String;
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: indices.data_streams_stats.Response

/**
 *
 * @see API
 *      specification
 */
@JsonpDeserializable
public class DataStreamsStatsResponse implements JsonpSerializable {
	private final ShardStatistics shards;

	private final int backingIndices;

	private final int dataStreamCount;

	private final List dataStreams;

	@Nullable
	private final String totalStoreSizes;

	private final long totalStoreSizeBytes;

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

	private DataStreamsStatsResponse(Builder builder) {

		this.shards = ApiTypeHelper.requireNonNull(builder.shards, this, "shards");
		this.backingIndices = ApiTypeHelper.requireNonNull(builder.backingIndices, this, "backingIndices");
		this.dataStreamCount = ApiTypeHelper.requireNonNull(builder.dataStreamCount, this, "dataStreamCount");
		this.dataStreams = ApiTypeHelper.unmodifiableRequired(builder.dataStreams, this, "dataStreams");
		this.totalStoreSizes = builder.totalStoreSizes;
		this.totalStoreSizeBytes = ApiTypeHelper.requireNonNull(builder.totalStoreSizeBytes, this,
				"totalStoreSizeBytes");

	}

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

	/**
	 * Required - Contains information about shards that attempted to execute the
	 * request.
	 * 

* API name: {@code _shards} */ public final ShardStatistics shards() { return this.shards; } /** * Required - Total number of backing indices for the selected data streams. *

* API name: {@code backing_indices} */ public final int backingIndices() { return this.backingIndices; } /** * Required - Total number of selected data streams. *

* API name: {@code data_stream_count} */ public final int dataStreamCount() { return this.dataStreamCount; } /** * Required - Contains statistics for the selected data streams. *

* API name: {@code data_streams} */ public final List dataStreams() { return this.dataStreams; } /** * Total size of all shards for the selected data streams. This property is * included only if the human query parameter is true *

* API name: {@code total_store_sizes} */ @Nullable public final String totalStoreSizes() { return this.totalStoreSizes; } /** * Required - Total size, in bytes, of all shards for the selected data streams. *

* API name: {@code total_store_size_bytes} */ public final long totalStoreSizeBytes() { return this.totalStoreSizeBytes; } /** * 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("_shards"); this.shards.serialize(generator, mapper); generator.writeKey("backing_indices"); generator.write(this.backingIndices); generator.writeKey("data_stream_count"); generator.write(this.dataStreamCount); if (ApiTypeHelper.isDefined(this.dataStreams)) { generator.writeKey("data_streams"); generator.writeStartArray(); for (DataStreamsStatsItem item0 : this.dataStreams) { item0.serialize(generator, mapper); } generator.writeEnd(); } if (this.totalStoreSizes != null) { generator.writeKey("total_store_sizes"); generator.write(this.totalStoreSizes); } generator.writeKey("total_store_size_bytes"); generator.write(this.totalStoreSizeBytes); } @Override public String toString() { return JsonpUtils.toString(this); } // --------------------------------------------------------------------------------------------- /** * Builder for {@link DataStreamsStatsResponse}. */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { private ShardStatistics shards; private Integer backingIndices; private Integer dataStreamCount; private List dataStreams; @Nullable private String totalStoreSizes; private Long totalStoreSizeBytes; /** * Required - Contains information about shards that attempted to execute the * request. *

* API name: {@code _shards} */ public final Builder shards(ShardStatistics value) { this.shards = value; return this; } /** * Required - Contains information about shards that attempted to execute the * request. *

* API name: {@code _shards} */ public final Builder shards(Function> fn) { return this.shards(fn.apply(new ShardStatistics.Builder()).build()); } /** * Required - Total number of backing indices for the selected data streams. *

* API name: {@code backing_indices} */ public final Builder backingIndices(int value) { this.backingIndices = value; return this; } /** * Required - Total number of selected data streams. *

* API name: {@code data_stream_count} */ public final Builder dataStreamCount(int value) { this.dataStreamCount = value; return this; } /** * Required - Contains statistics for the selected data streams. *

* API name: {@code data_streams} *

* Adds all elements of list to dataStreams. */ public final Builder dataStreams(List list) { this.dataStreams = _listAddAll(this.dataStreams, list); return this; } /** * Required - Contains statistics for the selected data streams. *

* API name: {@code data_streams} *

* Adds one or more values to dataStreams. */ public final Builder dataStreams(DataStreamsStatsItem value, DataStreamsStatsItem... values) { this.dataStreams = _listAdd(this.dataStreams, value, values); return this; } /** * Required - Contains statistics for the selected data streams. *

* API name: {@code data_streams} *

* Adds a value to dataStreams using a builder lambda. */ public final Builder dataStreams( Function> fn) { return dataStreams(fn.apply(new DataStreamsStatsItem.Builder()).build()); } /** * Total size of all shards for the selected data streams. This property is * included only if the human query parameter is true *

* API name: {@code total_store_sizes} */ public final Builder totalStoreSizes(@Nullable String value) { this.totalStoreSizes = value; return this; } /** * Required - Total size, in bytes, of all shards for the selected data streams. *

* API name: {@code total_store_size_bytes} */ public final Builder totalStoreSizeBytes(long value) { this.totalStoreSizeBytes = value; return this; } @Override protected Builder self() { return this; } /** * Builds a {@link DataStreamsStatsResponse}. * * @throws NullPointerException * if some of the required fields are null. */ public DataStreamsStatsResponse build() { _checkSingleUse(); return new DataStreamsStatsResponse(this); } } // --------------------------------------------------------------------------------------------- /** * Json deserializer for {@link DataStreamsStatsResponse} */ public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer .lazy(Builder::new, DataStreamsStatsResponse::setupDataStreamsStatsResponseDeserializer); protected static void setupDataStreamsStatsResponseDeserializer( ObjectDeserializer op) { op.add(Builder::shards, ShardStatistics._DESERIALIZER, "_shards"); op.add(Builder::backingIndices, JsonpDeserializer.integerDeserializer(), "backing_indices"); op.add(Builder::dataStreamCount, JsonpDeserializer.integerDeserializer(), "data_stream_count"); op.add(Builder::dataStreams, JsonpDeserializer.arrayDeserializer(DataStreamsStatsItem._DESERIALIZER), "data_streams"); op.add(Builder::totalStoreSizes, JsonpDeserializer.stringDeserializer(), "total_store_sizes"); op.add(Builder::totalStoreSizeBytes, JsonpDeserializer.longDeserializer(), "total_store_size_bytes"); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy