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

co.elastic.clients.elasticsearch.snapshot.Status Maven / Gradle / Ivy

The 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.snapshot;

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.Boolean;
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: snapshot._types.Status

/**
 *
 * @see API
 *      specification
 */
@JsonpDeserializable
public class Status implements JsonpSerializable {
	private final boolean includeGlobalState;

	private final Map indices;

	private final String repository;

	private final ShardsStats shardsStats;

	private final String snapshot;

	private final String state;

	private final SnapshotStats stats;

	private final String uuid;

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

	private Status(Builder builder) {

		this.includeGlobalState = ApiTypeHelper.requireNonNull(builder.includeGlobalState, this, "includeGlobalState",
				false);
		this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices");
		this.repository = ApiTypeHelper.requireNonNull(builder.repository, this, "repository");
		this.shardsStats = ApiTypeHelper.requireNonNull(builder.shardsStats, this, "shardsStats");
		this.snapshot = ApiTypeHelper.requireNonNull(builder.snapshot, this, "snapshot");
		this.state = ApiTypeHelper.requireNonNull(builder.state, this, "state");
		this.stats = ApiTypeHelper.requireNonNull(builder.stats, this, "stats");
		this.uuid = ApiTypeHelper.requireNonNull(builder.uuid, this, "uuid");

	}

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

	/**
	 * Required - Indicates whether the current cluster state is included in the
	 * snapshot.
	 * 

* API name: {@code include_global_state} */ public final boolean includeGlobalState() { return this.includeGlobalState; } /** * Required - API name: {@code indices} */ public final Map indices() { return this.indices; } /** * Required - The name of the repository that includes the snapshot. *

* API name: {@code repository} */ public final String repository() { return this.repository; } /** * Required - Statistics for the shards in the snapshot. *

* API name: {@code shards_stats} */ public final ShardsStats shardsStats() { return this.shardsStats; } /** * Required - The name of the snapshot. *

* API name: {@code snapshot} */ public final String snapshot() { return this.snapshot; } /** * Required - The current snapshot state: *

    *
  • FAILED: The snapshot finished with an error and failed to * store any data.
  • *
  • STARTED: The snapshot is currently running.
  • *
  • SUCCESS: The snapshot completed.
  • *
*

* API name: {@code state} */ public final String state() { return this.state; } /** * Required - Details about the number (file_count) and size * (size_in_bytes) of files included in the snapshot. *

* API name: {@code stats} */ public final SnapshotStats stats() { return this.stats; } /** * Required - The universally unique identifier (UUID) for the snapshot. *

* API name: {@code uuid} */ public final String uuid() { return this.uuid; } /** * 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("include_global_state"); generator.write(this.includeGlobalState); if (ApiTypeHelper.isDefined(this.indices)) { generator.writeKey("indices"); generator.writeStartObject(); for (Map.Entry item0 : this.indices.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); } generator.writeEnd(); } generator.writeKey("repository"); generator.write(this.repository); generator.writeKey("shards_stats"); this.shardsStats.serialize(generator, mapper); generator.writeKey("snapshot"); generator.write(this.snapshot); generator.writeKey("state"); generator.write(this.state); generator.writeKey("stats"); this.stats.serialize(generator, mapper); generator.writeKey("uuid"); generator.write(this.uuid); } @Override public String toString() { return JsonpUtils.toString(this); } // --------------------------------------------------------------------------------------------- /** * Builder for {@link Status}. */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { private Boolean includeGlobalState; private Map indices; private String repository; private ShardsStats shardsStats; private String snapshot; private String state; private SnapshotStats stats; private String uuid; /** * Required - Indicates whether the current cluster state is included in the * snapshot. *

* API name: {@code include_global_state} */ public final Builder includeGlobalState(boolean value) { this.includeGlobalState = value; return this; } /** * Required - API name: {@code indices} *

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

* Adds an entry to indices. */ public final Builder indices(String key, SnapshotIndexStats value) { this.indices = _mapPut(this.indices, key, value); return this; } /** * Required - API name: {@code indices} *

* Adds an entry to indices using a builder lambda. */ public final Builder indices(String key, Function> fn) { return indices(key, fn.apply(new SnapshotIndexStats.Builder()).build()); } /** * Required - The name of the repository that includes the snapshot. *

* API name: {@code repository} */ public final Builder repository(String value) { this.repository = value; return this; } /** * Required - Statistics for the shards in the snapshot. *

* API name: {@code shards_stats} */ public final Builder shardsStats(ShardsStats value) { this.shardsStats = value; return this; } /** * Required - Statistics for the shards in the snapshot. *

* API name: {@code shards_stats} */ public final Builder shardsStats(Function> fn) { return this.shardsStats(fn.apply(new ShardsStats.Builder()).build()); } /** * Required - The name of the snapshot. *

* API name: {@code snapshot} */ public final Builder snapshot(String value) { this.snapshot = value; return this; } /** * Required - The current snapshot state: *

    *
  • FAILED: The snapshot finished with an error and failed to * store any data.
  • *
  • STARTED: The snapshot is currently running.
  • *
  • SUCCESS: The snapshot completed.
  • *
*

* API name: {@code state} */ public final Builder state(String value) { this.state = value; return this; } /** * Required - Details about the number (file_count) and size * (size_in_bytes) of files included in the snapshot. *

* API name: {@code stats} */ public final Builder stats(SnapshotStats value) { this.stats = value; return this; } /** * Required - Details about the number (file_count) and size * (size_in_bytes) of files included in the snapshot. *

* API name: {@code stats} */ public final Builder stats(Function> fn) { return this.stats(fn.apply(new SnapshotStats.Builder()).build()); } /** * Required - The universally unique identifier (UUID) for the snapshot. *

* API name: {@code uuid} */ public final Builder uuid(String value) { this.uuid = value; return this; } @Override protected Builder self() { return this; } /** * Builds a {@link Status}. * * @throws NullPointerException * if some of the required fields are null. */ public Status build() { _checkSingleUse(); return new Status(this); } } // --------------------------------------------------------------------------------------------- /** * Json deserializer for {@link Status} */ public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, Status::setupStatusDeserializer); protected static void setupStatusDeserializer(ObjectDeserializer op) { op.add(Builder::includeGlobalState, JsonpDeserializer.booleanDeserializer(), "include_global_state"); op.add(Builder::indices, JsonpDeserializer.stringMapDeserializer(SnapshotIndexStats._DESERIALIZER), "indices"); op.add(Builder::repository, JsonpDeserializer.stringDeserializer(), "repository"); op.add(Builder::shardsStats, ShardsStats._DESERIALIZER, "shards_stats"); op.add(Builder::snapshot, JsonpDeserializer.stringDeserializer(), "snapshot"); op.add(Builder::state, JsonpDeserializer.stringDeserializer(), "state"); op.add(Builder::stats, SnapshotStats._DESERIALIZER, "stats"); op.add(Builder::uuid, JsonpDeserializer.stringDeserializer(), "uuid"); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy