|
| 1 | +/* |
| 2 | + * Licensed to Elasticsearch B.V. under one or more contributor |
| 3 | + * license agreements. See the NOTICE file distributed with |
| 4 | + * this work for additional information regarding copyright |
| 5 | + * ownership. Elasticsearch B.V. licenses this file to you under |
| 6 | + * the Apache License, Version 2.0 (the "License"); you may |
| 7 | + * not use this file except in compliance with the License. |
| 8 | + * You may obtain a copy of the License at |
| 9 | + * |
| 10 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + * |
| 12 | + * Unless required by applicable law or agreed to in writing, |
| 13 | + * software distributed under the License is distributed on an |
| 14 | + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | + * KIND, either express or implied. See the License for the |
| 16 | + * specific language governing permissions and limitations |
| 17 | + * under the License. |
| 18 | + */ |
| 19 | + |
| 20 | +package co.elastic.clients.elasticsearch.indices; |
| 21 | + |
| 22 | +import co.elastic.clients.json.JsonpDeserializable; |
| 23 | +import co.elastic.clients.json.JsonpDeserializer; |
| 24 | +import co.elastic.clients.json.JsonpMapper; |
| 25 | +import co.elastic.clients.json.JsonpSerializable; |
| 26 | +import co.elastic.clients.json.JsonpUtils; |
| 27 | +import co.elastic.clients.json.ObjectBuilderDeserializer; |
| 28 | +import co.elastic.clients.json.ObjectDeserializer; |
| 29 | +import co.elastic.clients.util.ObjectBuilder; |
| 30 | +import co.elastic.clients.util.WithJsonObjectBuilderBase; |
| 31 | +import jakarta.json.stream.JsonGenerator; |
| 32 | +import java.util.Objects; |
| 33 | +import java.util.function.Function; |
| 34 | +import javax.annotation.Nullable; |
| 35 | + |
| 36 | +//---------------------------------------------------------------- |
| 37 | +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. |
| 38 | +//---------------------------------------------------------------- |
| 39 | +// |
| 40 | +// This code is generated from the Elasticsearch API specification |
| 41 | +// at https://github.com/elastic/elasticsearch-specification |
| 42 | +// |
| 43 | +// Manual updates to this file will be lost when the code is |
| 44 | +// re-generated. |
| 45 | +// |
| 46 | +// If you find a property that is missing or wrongly typed, please |
| 47 | +// open an issue or a PR on the API specification repository. |
| 48 | +// |
| 49 | +//---------------------------------------------------------------- |
| 50 | + |
| 51 | +// typedef: indices._types.IndexSettingsUnassigned |
| 52 | + |
| 53 | +/** |
| 54 | + * |
| 55 | + * @see <a href= |
| 56 | + * "../doc-files/api-spec.html#indices._types.IndexSettingsUnassigned">API |
| 57 | + * specification</a> |
| 58 | + */ |
| 59 | +@JsonpDeserializable |
| 60 | +public class IndexSettingsUnassigned implements JsonpSerializable { |
| 61 | + @Nullable |
| 62 | + private final IndexSettingsUnassignedNodeLeft nodeLeft; |
| 63 | + |
| 64 | + // --------------------------------------------------------------------------------------------- |
| 65 | + |
| 66 | + private IndexSettingsUnassigned(Builder builder) { |
| 67 | + |
| 68 | + this.nodeLeft = builder.nodeLeft; |
| 69 | + |
| 70 | + } |
| 71 | + |
| 72 | + public static IndexSettingsUnassigned of(Function<Builder, ObjectBuilder<IndexSettingsUnassigned>> fn) { |
| 73 | + return fn.apply(new Builder()).build(); |
| 74 | + } |
| 75 | + |
| 76 | + /** |
| 77 | + * API name: {@code node_left} |
| 78 | + */ |
| 79 | + @Nullable |
| 80 | + public final IndexSettingsUnassignedNodeLeft nodeLeft() { |
| 81 | + return this.nodeLeft; |
| 82 | + } |
| 83 | + |
| 84 | + /** |
| 85 | + * Serialize this object to JSON. |
| 86 | + */ |
| 87 | + public void serialize(JsonGenerator generator, JsonpMapper mapper) { |
| 88 | + generator.writeStartObject(); |
| 89 | + serializeInternal(generator, mapper); |
| 90 | + generator.writeEnd(); |
| 91 | + } |
| 92 | + |
| 93 | + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { |
| 94 | + |
| 95 | + if (this.nodeLeft != null) { |
| 96 | + generator.writeKey("node_left"); |
| 97 | + this.nodeLeft.serialize(generator, mapper); |
| 98 | + |
| 99 | + } |
| 100 | + |
| 101 | + } |
| 102 | + |
| 103 | + @Override |
| 104 | + public String toString() { |
| 105 | + return JsonpUtils.toString(this); |
| 106 | + } |
| 107 | + |
| 108 | + // --------------------------------------------------------------------------------------------- |
| 109 | + |
| 110 | + /** |
| 111 | + * Builder for {@link IndexSettingsUnassigned}. |
| 112 | + */ |
| 113 | + |
| 114 | + public static class Builder extends WithJsonObjectBuilderBase<Builder> |
| 115 | + implements |
| 116 | + ObjectBuilder<IndexSettingsUnassigned> { |
| 117 | + @Nullable |
| 118 | + private IndexSettingsUnassignedNodeLeft nodeLeft; |
| 119 | + |
| 120 | + public Builder() { |
| 121 | + } |
| 122 | + private Builder(IndexSettingsUnassigned instance) { |
| 123 | + this.nodeLeft = instance.nodeLeft; |
| 124 | + |
| 125 | + } |
| 126 | + /** |
| 127 | + * API name: {@code node_left} |
| 128 | + */ |
| 129 | + public final Builder nodeLeft(@Nullable IndexSettingsUnassignedNodeLeft value) { |
| 130 | + this.nodeLeft = value; |
| 131 | + return this; |
| 132 | + } |
| 133 | + |
| 134 | + /** |
| 135 | + * API name: {@code node_left} |
| 136 | + */ |
| 137 | + public final Builder nodeLeft( |
| 138 | + Function<IndexSettingsUnassignedNodeLeft.Builder, ObjectBuilder<IndexSettingsUnassignedNodeLeft>> fn) { |
| 139 | + return this.nodeLeft(fn.apply(new IndexSettingsUnassignedNodeLeft.Builder()).build()); |
| 140 | + } |
| 141 | + |
| 142 | + @Override |
| 143 | + protected Builder self() { |
| 144 | + return this; |
| 145 | + } |
| 146 | + |
| 147 | + /** |
| 148 | + * Builds a {@link IndexSettingsUnassigned}. |
| 149 | + * |
| 150 | + * @throws NullPointerException |
| 151 | + * if some of the required fields are null. |
| 152 | + */ |
| 153 | + public IndexSettingsUnassigned build() { |
| 154 | + _checkSingleUse(); |
| 155 | + |
| 156 | + return new IndexSettingsUnassigned(this); |
| 157 | + } |
| 158 | + } |
| 159 | + |
| 160 | + /** |
| 161 | + * @return New {@link Builder} initialized with field values of this instance |
| 162 | + */ |
| 163 | + public Builder rebuild() { |
| 164 | + return new Builder(this); |
| 165 | + } |
| 166 | + // --------------------------------------------------------------------------------------------- |
| 167 | + |
| 168 | + /** |
| 169 | + * Json deserializer for {@link IndexSettingsUnassigned} |
| 170 | + */ |
| 171 | + public static final JsonpDeserializer<IndexSettingsUnassigned> _DESERIALIZER = ObjectBuilderDeserializer |
| 172 | + .lazy(Builder::new, IndexSettingsUnassigned::setupIndexSettingsUnassignedDeserializer); |
| 173 | + |
| 174 | + protected static void setupIndexSettingsUnassignedDeserializer( |
| 175 | + ObjectDeserializer<IndexSettingsUnassigned.Builder> op) { |
| 176 | + |
| 177 | + op.add(Builder::nodeLeft, IndexSettingsUnassignedNodeLeft._DESERIALIZER, "node_left"); |
| 178 | + |
| 179 | + } |
| 180 | + |
| 181 | +} |
0 commit comments