co.elastic.clients.elasticsearch.migration.DeprecationsResponse Maven / Gradle / Ivy
Show all versions of elasticsearch-java Show documentation
/*
* 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.migration;
import co.elastic.clients.elasticsearch.migration.deprecations.Deprecation;
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.List;
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: migration.deprecations.Response
/**
*
* @see API
* specification
*/
@JsonpDeserializable
public class DeprecationsResponse implements JsonpSerializable {
private final List clusterSettings;
private final Map> indexSettings;
private final Map> dataStreams;
private final List nodeSettings;
private final List mlSettings;
// ---------------------------------------------------------------------------------------------
private DeprecationsResponse(Builder builder) {
this.clusterSettings = ApiTypeHelper.unmodifiableRequired(builder.clusterSettings, this, "clusterSettings");
this.indexSettings = ApiTypeHelper.unmodifiableRequired(builder.indexSettings, this, "indexSettings");
this.dataStreams = ApiTypeHelper.unmodifiableRequired(builder.dataStreams, this, "dataStreams");
this.nodeSettings = ApiTypeHelper.unmodifiableRequired(builder.nodeSettings, this, "nodeSettings");
this.mlSettings = ApiTypeHelper.unmodifiableRequired(builder.mlSettings, this, "mlSettings");
}
public static DeprecationsResponse of(Function> fn) {
return fn.apply(new Builder()).build();
}
/**
* Required - API name: {@code cluster_settings}
*/
public final List clusterSettings() {
return this.clusterSettings;
}
/**
* Required - API name: {@code index_settings}
*/
public final Map> indexSettings() {
return this.indexSettings;
}
/**
* Required - API name: {@code data_streams}
*/
public final Map> dataStreams() {
return this.dataStreams;
}
/**
* Required - API name: {@code node_settings}
*/
public final List nodeSettings() {
return this.nodeSettings;
}
/**
* Required - API name: {@code ml_settings}
*/
public final List mlSettings() {
return this.mlSettings;
}
/**
* 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 (ApiTypeHelper.isDefined(this.clusterSettings)) {
generator.writeKey("cluster_settings");
generator.writeStartArray();
for (Deprecation item0 : this.clusterSettings) {
item0.serialize(generator, mapper);
}
generator.writeEnd();
}
if (ApiTypeHelper.isDefined(this.indexSettings)) {
generator.writeKey("index_settings");
generator.writeStartObject();
for (Map.Entry> item0 : this.indexSettings.entrySet()) {
generator.writeKey(item0.getKey());
generator.writeStartArray();
if (item0.getValue() != null) {
for (Deprecation item1 : item0.getValue()) {
item1.serialize(generator, mapper);
}
}
generator.writeEnd();
}
generator.writeEnd();
}
if (ApiTypeHelper.isDefined(this.dataStreams)) {
generator.writeKey("data_streams");
generator.writeStartObject();
for (Map.Entry> item0 : this.dataStreams.entrySet()) {
generator.writeKey(item0.getKey());
generator.writeStartArray();
if (item0.getValue() != null) {
for (Deprecation item1 : item0.getValue()) {
item1.serialize(generator, mapper);
}
}
generator.writeEnd();
}
generator.writeEnd();
}
if (ApiTypeHelper.isDefined(this.nodeSettings)) {
generator.writeKey("node_settings");
generator.writeStartArray();
for (Deprecation item0 : this.nodeSettings) {
item0.serialize(generator, mapper);
}
generator.writeEnd();
}
if (ApiTypeHelper.isDefined(this.mlSettings)) {
generator.writeKey("ml_settings");
generator.writeStartArray();
for (Deprecation item0 : this.mlSettings) {
item0.serialize(generator, mapper);
}
generator.writeEnd();
}
}
@Override
public String toString() {
return JsonpUtils.toString(this);
}
// ---------------------------------------------------------------------------------------------
/**
* Builder for {@link DeprecationsResponse}.
*/
public static class Builder extends WithJsonObjectBuilderBase
implements
ObjectBuilder {
private List clusterSettings;
private Map> indexSettings;
private Map> dataStreams;
private List nodeSettings;
private List mlSettings;
/**
* Required - API name: {@code cluster_settings}
*
* Adds all elements of list
to clusterSettings
.
*/
public final Builder clusterSettings(List list) {
this.clusterSettings = _listAddAll(this.clusterSettings, list);
return this;
}
/**
* Required - API name: {@code cluster_settings}
*
* Adds one or more values to clusterSettings
.
*/
public final Builder clusterSettings(Deprecation value, Deprecation... values) {
this.clusterSettings = _listAdd(this.clusterSettings, value, values);
return this;
}
/**
* Required - API name: {@code cluster_settings}
*
* Adds a value to clusterSettings
using a builder lambda.
*/
public final Builder clusterSettings(Function> fn) {
return clusterSettings(fn.apply(new Deprecation.Builder()).build());
}
/**
* Required - API name: {@code index_settings}
*
* Adds all entries of map
to indexSettings
.
*/
public final Builder indexSettings(Map> map) {
this.indexSettings = _mapPutAll(this.indexSettings, map);
return this;
}
/**
* Required - API name: {@code index_settings}
*
* Adds an entry to indexSettings
.
*/
public final Builder indexSettings(String key, List value) {
this.indexSettings = _mapPut(this.indexSettings, key, value);
return this;
}
/**
* Required - API name: {@code data_streams}
*
* Adds all entries of map
to dataStreams
.
*/
public final Builder dataStreams(Map> map) {
this.dataStreams = _mapPutAll(this.dataStreams, map);
return this;
}
/**
* Required - API name: {@code data_streams}
*
* Adds an entry to dataStreams
.
*/
public final Builder dataStreams(String key, List value) {
this.dataStreams = _mapPut(this.dataStreams, key, value);
return this;
}
/**
* Required - API name: {@code node_settings}
*
* Adds all elements of list
to nodeSettings
.
*/
public final Builder nodeSettings(List list) {
this.nodeSettings = _listAddAll(this.nodeSettings, list);
return this;
}
/**
* Required - API name: {@code node_settings}
*
* Adds one or more values to nodeSettings
.
*/
public final Builder nodeSettings(Deprecation value, Deprecation... values) {
this.nodeSettings = _listAdd(this.nodeSettings, value, values);
return this;
}
/**
* Required - API name: {@code node_settings}
*
* Adds a value to nodeSettings
using a builder lambda.
*/
public final Builder nodeSettings(Function> fn) {
return nodeSettings(fn.apply(new Deprecation.Builder()).build());
}
/**
* Required - API name: {@code ml_settings}
*
* Adds all elements of list
to mlSettings
.
*/
public final Builder mlSettings(List list) {
this.mlSettings = _listAddAll(this.mlSettings, list);
return this;
}
/**
* Required - API name: {@code ml_settings}
*
* Adds one or more values to mlSettings
.
*/
public final Builder mlSettings(Deprecation value, Deprecation... values) {
this.mlSettings = _listAdd(this.mlSettings, value, values);
return this;
}
/**
* Required - API name: {@code ml_settings}
*
* Adds a value to mlSettings
using a builder lambda.
*/
public final Builder mlSettings(Function> fn) {
return mlSettings(fn.apply(new Deprecation.Builder()).build());
}
@Override
protected Builder self() {
return this;
}
/**
* Builds a {@link DeprecationsResponse}.
*
* @throws NullPointerException
* if some of the required fields are null.
*/
public DeprecationsResponse build() {
_checkSingleUse();
return new DeprecationsResponse(this);
}
}
// ---------------------------------------------------------------------------------------------
/**
* Json deserializer for {@link DeprecationsResponse}
*/
public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer
.lazy(Builder::new, DeprecationsResponse::setupDeprecationsResponseDeserializer);
protected static void setupDeprecationsResponseDeserializer(ObjectDeserializer op) {
op.add(Builder::clusterSettings, JsonpDeserializer.arrayDeserializer(Deprecation._DESERIALIZER),
"cluster_settings");
op.add(Builder::indexSettings,
JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.arrayDeserializer(Deprecation._DESERIALIZER)),
"index_settings");
op.add(Builder::dataStreams,
JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.arrayDeserializer(Deprecation._DESERIALIZER)),
"data_streams");
op.add(Builder::nodeSettings, JsonpDeserializer.arrayDeserializer(Deprecation._DESERIALIZER), "node_settings");
op.add(Builder::mlSettings, JsonpDeserializer.arrayDeserializer(Deprecation._DESERIALIZER), "ml_settings");
}
}