diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ElasticsearchVersionMinInfo.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ElasticsearchVersionMinInfo.java new file mode 100644 index 000000000..8b4f7ece4 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ElasticsearchVersionMinInfo.java @@ -0,0 +1,234 @@ +/* + * 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._types; + +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.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: _types.ElasticsearchVersionMinInfo + +/** + * Reduced (minimal) info ElasticsearchVersion + * + * @see API + * specification + */ +@JsonpDeserializable +public class ElasticsearchVersionMinInfo implements JsonpSerializable { + private final String buildFlavor; + + private final String minimumIndexCompatibilityVersion; + + private final String minimumWireCompatibilityVersion; + + private final String number; + + // --------------------------------------------------------------------------------------------- + + private ElasticsearchVersionMinInfo(Builder builder) { + + this.buildFlavor = ApiTypeHelper.requireNonNull(builder.buildFlavor, this, "buildFlavor"); + this.minimumIndexCompatibilityVersion = ApiTypeHelper.requireNonNull(builder.minimumIndexCompatibilityVersion, + this, "minimumIndexCompatibilityVersion"); + this.minimumWireCompatibilityVersion = ApiTypeHelper.requireNonNull(builder.minimumWireCompatibilityVersion, + this, "minimumWireCompatibilityVersion"); + this.number = ApiTypeHelper.requireNonNull(builder.number, this, "number"); + + } + + public static ElasticsearchVersionMinInfo of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code build_flavor} + */ + public final String buildFlavor() { + return this.buildFlavor; + } + + /** + * Required - API name: {@code minimum_index_compatibility_version} + */ + public final String minimumIndexCompatibilityVersion() { + return this.minimumIndexCompatibilityVersion; + } + + /** + * Required - API name: {@code minimum_wire_compatibility_version} + */ + public final String minimumWireCompatibilityVersion() { + return this.minimumWireCompatibilityVersion; + } + + /** + * Required - API name: {@code number} + */ + public final String number() { + return this.number; + } + + /** + * 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("build_flavor"); + generator.write(this.buildFlavor); + + generator.writeKey("minimum_index_compatibility_version"); + generator.write(this.minimumIndexCompatibilityVersion); + + generator.writeKey("minimum_wire_compatibility_version"); + generator.write(this.minimumWireCompatibilityVersion); + + generator.writeKey("number"); + generator.write(this.number); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ElasticsearchVersionMinInfo}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private String buildFlavor; + + private String minimumIndexCompatibilityVersion; + + private String minimumWireCompatibilityVersion; + + private String number; + + /** + * Required - API name: {@code build_flavor} + */ + public final Builder buildFlavor(String value) { + this.buildFlavor = value; + return this; + } + + /** + * Required - API name: {@code minimum_index_compatibility_version} + */ + public final Builder minimumIndexCompatibilityVersion(String value) { + this.minimumIndexCompatibilityVersion = value; + return this; + } + + /** + * Required - API name: {@code minimum_wire_compatibility_version} + */ + public final Builder minimumWireCompatibilityVersion(String value) { + this.minimumWireCompatibilityVersion = value; + return this; + } + + /** + * Required - API name: {@code number} + */ + public final Builder number(String value) { + this.number = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ElasticsearchVersionMinInfo}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ElasticsearchVersionMinInfo build() { + _checkSingleUse(); + + return new ElasticsearchVersionMinInfo(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ElasticsearchVersionMinInfo} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, ElasticsearchVersionMinInfo::setupElasticsearchVersionMinInfoDeserializer); + + protected static void setupElasticsearchVersionMinInfoDeserializer( + ObjectDeserializer op) { + + op.add(Builder::buildFlavor, JsonpDeserializer.stringDeserializer(), "build_flavor"); + op.add(Builder::minimumIndexCompatibilityVersion, JsonpDeserializer.stringDeserializer(), + "minimum_index_compatibility_version"); + op.add(Builder::minimumWireCompatibilityVersion, JsonpDeserializer.stringDeserializer(), + "minimum_wire_compatibility_version"); + op.add(Builder::number, JsonpDeserializer.stringDeserializer(), "number"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/InlineGet.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/InlineGet.java index 429f25552..61156fda3 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/InlineGet.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/InlineGet.java @@ -82,6 +82,7 @@ public class InlineGet implements JsonpSerializable { @Nullable private final String routing; + @Nullable private final TDocument source; @Nullable @@ -98,7 +99,7 @@ private InlineGet(Builder builder) { this.seqNo = builder.seqNo; this.primaryTerm = builder.primaryTerm; this.routing = builder.routing; - this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source"); + this.source = builder.source; this.tDocumentSerializer = builder.tDocumentSerializer; } @@ -154,8 +155,9 @@ public final String routing() { } /** - * Required - API name: {@code _source} + * API name: {@code _source} */ + @Nullable public final TDocument source() { return this.source; } @@ -206,8 +208,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.routing); } - generator.writeKey("_source"); - JsonpUtils.serialize(this.source, generator, tDocumentSerializer, mapper); + if (this.source != null) { + generator.writeKey("_source"); + JsonpUtils.serialize(this.source, generator, tDocumentSerializer, mapper); + + } } @@ -262,6 +267,7 @@ public final Builder metadata(String key, JsonData value) { @Nullable private String routing; + @Nullable private TDocument source; @Nullable @@ -320,9 +326,9 @@ public final Builder routing(@Nullable String value) { } /** - * Required - API name: {@code _source} + * API name: {@code _source} */ - public final Builder source(TDocument value) { + public final Builder source(@Nullable TDocument value) { this.source = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/KnnQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/KnnQuery.java index cadd63349..604190f16 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/KnnQuery.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/KnnQuery.java @@ -20,6 +20,8 @@ package co.elastic.clients.elasticsearch._types; import co.elastic.clients.elasticsearch._types.query_dsl.Query; +import co.elastic.clients.elasticsearch._types.query_dsl.QueryVariant; +import co.elastic.clients.elasticsearch.core.search.InnerHits; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -62,7 +64,7 @@ * specification */ @JsonpDeserializable -public class KnnQuery implements JsonpSerializable { +public class KnnQuery implements QueryVariant, JsonpSerializable { private final String field; private final List queryVector; @@ -82,6 +84,9 @@ public class KnnQuery implements JsonpSerializable { @Nullable private final Float similarity; + @Nullable + private final InnerHits innerHits; + // --------------------------------------------------------------------------------------------- private KnnQuery(Builder builder) { @@ -94,6 +99,7 @@ private KnnQuery(Builder builder) { this.boost = builder.boost; this.filter = ApiTypeHelper.unmodifiable(builder.filter); this.similarity = builder.similarity; + this.innerHits = builder.innerHits; } @@ -101,6 +107,14 @@ public static KnnQuery of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * Query variant kind. + */ + @Override + public Query.Kind _queryKind() { + return Query.Kind.Knn; + } + /** * Required - The name of the vector field to search against *

@@ -177,6 +191,16 @@ public final Float similarity() { return this.similarity; } + /** + * If defined, each search hit will contain inner hits. + *

+ * API name: {@code inner_hits} + */ + @Nullable + public final InnerHits innerHits() { + return this.innerHits; + } + /** * Serialize this object to JSON. */ @@ -232,6 +256,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.similarity); } + if (this.innerHits != null) { + generator.writeKey("inner_hits"); + this.innerHits.serialize(generator, mapper); + + } } @@ -268,6 +297,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private Float similarity; + @Nullable + private InnerHits innerHits; + /** * Required - The name of the vector field to search against *

@@ -399,6 +431,25 @@ public final Builder similarity(@Nullable Float value) { return this; } + /** + * If defined, each search hit will contain inner hits. + *

+ * API name: {@code inner_hits} + */ + public final Builder innerHits(@Nullable InnerHits value) { + this.innerHits = value; + return this; + } + + /** + * If defined, each search hit will contain inner hits. + *

+ * API name: {@code inner_hits} + */ + public final Builder innerHits(Function> fn) { + return this.innerHits(fn.apply(new InnerHits.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -436,6 +487,7 @@ protected static void setupKnnQueryDeserializer(ObjectDeserializer implements ObjectBuilder { + @Nullable private Integer dims; @Nullable @@ -171,9 +175,9 @@ public static class Builder extends PropertyBase.AbstractBuilder private DenseVectorIndexOptions indexOptions; /** - * Required - API name: {@code dims} + * API name: {@code dims} */ - public final Builder dims(int value) { + public final Builder dims(@Nullable Integer value) { this.dims = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/GeoPointProperty.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/GeoPointProperty.java index 7610ffba0..956f2e502 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/GeoPointProperty.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/mapping/GeoPointProperty.java @@ -20,6 +20,7 @@ package co.elastic.clients.elasticsearch._types.mapping; import co.elastic.clients.elasticsearch._types.GeoLocation; +import co.elastic.clients.elasticsearch._types.Script; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -66,6 +67,15 @@ public class GeoPointProperty extends DocValuesPropertyBase implements PropertyV @Nullable private final GeoLocation nullValue; + @Nullable + private final Boolean index; + + @Nullable + private final OnScriptError onScriptError; + + @Nullable + private final Script script; + // --------------------------------------------------------------------------------------------- private GeoPointProperty(Builder builder) { @@ -74,6 +84,9 @@ private GeoPointProperty(Builder builder) { this.ignoreMalformed = builder.ignoreMalformed; this.ignoreZValue = builder.ignoreZValue; this.nullValue = builder.nullValue; + this.index = builder.index; + this.onScriptError = builder.onScriptError; + this.script = builder.script; } @@ -113,6 +126,30 @@ public final GeoLocation nullValue() { return this.nullValue; } + /** + * API name: {@code index} + */ + @Nullable + public final Boolean index() { + return this.index; + } + + /** + * API name: {@code on_script_error} + */ + @Nullable + public final OnScriptError onScriptError() { + return this.onScriptError; + } + + /** + * API name: {@code script} + */ + @Nullable + public final Script script() { + return this.script; + } + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write("type", "geo_point"); @@ -132,6 +169,20 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.nullValue.serialize(generator, mapper); } + if (this.index != null) { + generator.writeKey("index"); + generator.write(this.index); + + } + if (this.onScriptError != null) { + generator.writeKey("on_script_error"); + this.onScriptError.serialize(generator, mapper); + } + if (this.script != null) { + generator.writeKey("script"); + this.script.serialize(generator, mapper); + + } } @@ -153,6 +204,15 @@ public static class Builder extends DocValuesPropertyBase.AbstractBuilder> fn) { + return this.script(fn.apply(new Script.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -215,6 +306,9 @@ protected static void setupGeoPointPropertyDeserializer(ObjectDeserializer> fn) { @@ -73,10 +80,23 @@ public Property.Kind _propertyKind() { return Property.Kind.RankFeatures; } + /** + * API name: {@code positive_score_impact} + */ + @Nullable + public final Boolean positiveScoreImpact() { + return this.positiveScoreImpact; + } + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write("type", "rank_features"); super.serializeInternal(generator, mapper); + if (this.positiveScoreImpact != null) { + generator.writeKey("positive_score_impact"); + generator.write(this.positiveScoreImpact); + + } } @@ -89,6 +109,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends PropertyBase.AbstractBuilder implements ObjectBuilder { + @Nullable + private Boolean positiveScoreImpact; + + /** + * API name: {@code positive_score_impact} + */ + public final Builder positiveScoreImpact(@Nullable Boolean value) { + this.positiveScoreImpact = value; + return this; + } + @Override protected Builder self() { return this; @@ -117,6 +148,7 @@ public RankFeaturesProperty build() { protected static void setupRankFeaturesPropertyDeserializer(ObjectDeserializer op) { PropertyBase.setupPropertyBaseDeserializer(op); + op.add(Builder::positiveScoreImpact, JsonpDeserializer.booleanDeserializer(), "positive_score_impact"); op.ignore("type"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/Query.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/Query.java index b373897d9..fad0416e5 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/Query.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/Query.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch._types.query_dsl; +import co.elastic.clients.elasticsearch._types.KnnQuery; import co.elastic.clients.elasticsearch._types.aggregations.Aggregation; import co.elastic.clients.elasticsearch._types.aggregations.AggregationVariant; import co.elastic.clients.json.JsonData; @@ -115,6 +116,8 @@ public enum Kind implements JsonEnum { Intervals("intervals"), + Knn("knn"), + Match("match"), MatchAll("match_all"), @@ -560,6 +563,23 @@ public IntervalsQuery intervals() { return TaggedUnionUtils.get(this, Kind.Intervals); } + /** + * Is this variant instance of kind {@code knn}? + */ + public boolean isKnn() { + return _kind == Kind.Knn; + } + + /** + * Get the {@code knn} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code knn} kind. + */ + public KnnQuery knn() { + return TaggedUnionUtils.get(this, Kind.Knn); + } + /** * Is this variant instance of kind {@code match}? */ @@ -1473,6 +1493,16 @@ public ObjectBuilder intervals(Function knn(KnnQuery v) { + this._kind = Kind.Knn; + this._value = v; + return this; + } + + public ObjectBuilder knn(Function> fn) { + return this.knn(fn.apply(new KnnQuery.Builder()).build()); + } + public ObjectBuilder match(MatchQuery v) { this._kind = Kind.Match; this._value = v; @@ -1919,6 +1949,7 @@ protected static void setupQueryDeserializer(ObjectDeserializer op) { op.add(Builder::hasParent, HasParentQuery._DESERIALIZER, "has_parent"); op.add(Builder::ids, IdsQuery._DESERIALIZER, "ids"); op.add(Builder::intervals, IntervalsQuery._DESERIALIZER, "intervals"); + op.add(Builder::knn, KnnQuery._DESERIALIZER, "knn"); op.add(Builder::match, MatchQuery._DESERIALIZER, "match"); op.add(Builder::matchAll, MatchAllQuery._DESERIALIZER, "match_all"); op.add(Builder::matchBoolPrefix, MatchBoolPrefixQuery._DESERIALIZER, "match_bool_prefix"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/QueryBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/QueryBuilders.java index 473535e20..292600e20 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/QueryBuilders.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/QueryBuilders.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch._types.query_dsl; +import co.elastic.clients.elasticsearch._types.KnnQuery; import co.elastic.clients.util.ObjectBuilder; import java.util.function.Function; @@ -355,6 +356,22 @@ public static Query intervals(Function> fn) { + Query.Builder builder = new Query.Builder(); + builder.knn(fn.apply(new KnnQuery.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link MatchQuery match} {@code Query} variant. */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/InnerHits.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/InnerHits.java index 250b7abf0..503ea8d28 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/InnerHits.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/search/InnerHits.java @@ -102,7 +102,7 @@ public class InnerHits implements JsonpSerializable { @Nullable private final SourceConfig source; - private final List storedField; + private final List storedFields; @Nullable private final Boolean trackScores; @@ -127,7 +127,7 @@ private InnerHits(Builder builder) { this.fields = ApiTypeHelper.unmodifiable(builder.fields); this.sort = ApiTypeHelper.unmodifiable(builder.sort); this.source = builder.source; - this.storedField = ApiTypeHelper.unmodifiable(builder.storedField); + this.storedFields = ApiTypeHelper.unmodifiable(builder.storedFields); this.trackScores = builder.trackScores; this.version = builder.version; @@ -248,10 +248,10 @@ public final SourceConfig source() { } /** - * API name: {@code stored_field} + * API name: {@code stored_fields} */ - public final List storedField() { - return this.storedField; + public final List storedFields() { + return this.storedFields; } /** @@ -367,10 +367,10 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.source.serialize(generator, mapper); } - if (ApiTypeHelper.isDefined(this.storedField)) { - generator.writeKey("stored_field"); + if (ApiTypeHelper.isDefined(this.storedFields)) { + generator.writeKey("stored_fields"); generator.writeStartArray(); - for (String item0 : this.storedField) { + for (String item0 : this.storedFields) { generator.write(item0); } @@ -442,7 +442,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private SourceConfig source; @Nullable - private List storedField; + private List storedFields; @Nullable private Boolean trackScores; @@ -667,22 +667,22 @@ public final Builder source(Function - * Adds all elements of list to storedField. + * Adds all elements of list to storedFields. */ - public final Builder storedField(List list) { - this.storedField = _listAddAll(this.storedField, list); + public final Builder storedFields(List list) { + this.storedFields = _listAddAll(this.storedFields, list); return this; } /** - * API name: {@code stored_field} + * API name: {@code stored_fields} *

- * Adds one or more values to storedField. + * Adds one or more values to storedFields. */ - public final Builder storedField(String value, String... values) { - this.storedField = _listAdd(this.storedField, value, values); + public final Builder storedFields(String value, String... values) { + this.storedFields = _listAdd(this.storedFields, value, values); return this; } @@ -745,8 +745,8 @@ protected static void setupInnerHitsDeserializer(ObjectDeserializer 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/d792c326a393769cc783482cf209435750d45029/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/0a63a19b96834d9bcaad0738cb0c6850dd326d20/specification/" + (paths[hash] || ""); - Please see the Elasticsearch API specification. + Please see the Elasticsearch API specification. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/enrich/ExecutePolicyResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/enrich/ExecutePolicyResponse.java index 92a390c65..f489217df 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/enrich/ExecutePolicyResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/enrich/ExecutePolicyResponse.java @@ -27,7 +27,6 @@ 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; @@ -60,6 +59,7 @@ */ @JsonpDeserializable public class ExecutePolicyResponse implements JsonpSerializable { + @Nullable private final ExecuteEnrichPolicyStatus status; @Nullable @@ -69,7 +69,7 @@ public class ExecutePolicyResponse implements JsonpSerializable { private ExecutePolicyResponse(Builder builder) { - this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + this.status = builder.status; this.taskId = builder.taskId; } @@ -79,8 +79,9 @@ public static ExecutePolicyResponse of(Function implements ObjectBuilder { + @Nullable private ExecuteEnrichPolicyStatus status; @Nullable private String taskId; /** - * Required - API name: {@code status} + * API name: {@code status} */ - public final Builder status(ExecuteEnrichPolicyStatus value) { + public final Builder status(@Nullable ExecuteEnrichPolicyStatus value) { this.status = value; return this; } /** - * Required - API name: {@code status} + * API name: {@code status} */ public final Builder status( Function> fn) { diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamsStatsResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamsStatsResponse.java index 021fbc31b..efd8a3023 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamsStatsResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStreamsStatsResponse.java @@ -33,6 +33,7 @@ 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; @@ -75,7 +76,7 @@ public class DataStreamsStatsResponse implements JsonpSerializable { @Nullable private final String totalStoreSizes; - private final int totalStoreSizeBytes; + private final long totalStoreSizeBytes; // --------------------------------------------------------------------------------------------- @@ -148,7 +149,7 @@ public final String totalStoreSizes() { *

* API name: {@code total_store_size_bytes} */ - public final int totalStoreSizeBytes() { + public final long totalStoreSizeBytes() { return this.totalStoreSizeBytes; } @@ -217,7 +218,7 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private String totalStoreSizes; - private Integer totalStoreSizeBytes; + private Long totalStoreSizeBytes; /** * Required - Contains information about shards that attempted to execute the @@ -312,7 +313,7 @@ public final Builder totalStoreSizes(@Nullable String value) { *

* API name: {@code total_store_size_bytes} */ - public final Builder totalStoreSizeBytes(int value) { + public final Builder totalStoreSizeBytes(long value) { this.totalStoreSizeBytes = value; return this; } @@ -352,7 +353,7 @@ protected static void setupDataStreamsStatsResponseDeserializer( op.add(Builder::dataStreams, JsonpDeserializer.arrayDeserializer(DataStreamsStatsItem._DESERIALIZER), "data_streams"); op.add(Builder::totalStoreSizes, JsonpDeserializer.stringDeserializer(), "total_store_sizes"); - op.add(Builder::totalStoreSizeBytes, JsonpDeserializer.integerDeserializer(), "total_store_size_bytes"); + op.add(Builder::totalStoreSizeBytes, JsonpDeserializer.longDeserializer(), "total_store_size_bytes"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesAsyncClient.java index 37a14dd21..fe3570505 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesAsyncClient.java @@ -1775,6 +1775,41 @@ public final CompletableFuture reloadSearchAnalyz return reloadSearchAnalyzers(fn.apply(new ReloadSearchAnalyzersRequest.Builder()).build()); } + // ----- Endpoint: indices.resolve_cluster + + /** + * Resolves the specified index expressions to return information about each + * cluster, including the local cluster, if included. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture resolveCluster(ResolveClusterRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) ResolveClusterRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Resolves the specified index expressions to return information about each + * cluster, including the local cluster, if included. + * + * @param fn + * a function that initializes a builder to create the + * {@link ResolveClusterRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture resolveCluster( + Function> fn) { + return resolveCluster(fn.apply(new ResolveClusterRequest.Builder()).build()); + } + // ----- Endpoint: indices.resolve_index /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesClient.java index 74071de73..05e4eb9fb 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ElasticsearchIndicesClient.java @@ -1819,6 +1819,43 @@ public final ReloadSearchAnalyzersResponse reloadSearchAnalyzers( return reloadSearchAnalyzers(fn.apply(new ReloadSearchAnalyzersRequest.Builder()).build()); } + // ----- Endpoint: indices.resolve_cluster + + /** + * Resolves the specified index expressions to return information about each + * cluster, including the local cluster, if included. + * + * @see Documentation + * on elastic.co + */ + + public ResolveClusterResponse resolveCluster(ResolveClusterRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) ResolveClusterRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Resolves the specified index expressions to return information about each + * cluster, including the local cluster, if included. + * + * @param fn + * a function that initializes a builder to create the + * {@link ResolveClusterRequest} + * @see Documentation + * on elastic.co + */ + + public final ResolveClusterResponse resolveCluster( + Function> fn) + throws IOException, ElasticsearchException { + return resolveCluster(fn.apply(new ResolveClusterRequest.Builder()).build()); + } + // ----- Endpoint: indices.resolve_index /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ResolveClusterRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ResolveClusterRequest.java new file mode 100644 index 000000000..8656ec355 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ResolveClusterRequest.java @@ -0,0 +1,371 @@ +/* + * 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.ErrorResponse; +import co.elastic.clients.elasticsearch._types.ExpandWildcard; +import co.elastic.clients.elasticsearch._types.RequestBase; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.endpoints.SimpleEndpoint; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.String; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import java.util.stream.Collectors; +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.resolve_cluster.Request + +/** + * Resolves the specified index expressions to return information about each + * cluster, including the local cluster, if included. Multiple patterns and + * remote clusters are supported. + * + * @see API + * specification + */ + +public class ResolveClusterRequest extends RequestBase { + @Nullable + private final Boolean allowNoIndices; + + private final List expandWildcards; + + @Nullable + private final Boolean ignoreThrottled; + + @Nullable + private final Boolean ignoreUnavailable; + + private final List name; + + // --------------------------------------------------------------------------------------------- + + private ResolveClusterRequest(Builder builder) { + + this.allowNoIndices = builder.allowNoIndices; + this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); + this.ignoreThrottled = builder.ignoreThrottled; + this.ignoreUnavailable = builder.ignoreUnavailable; + this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); + + } + + public static ResolveClusterRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * If false, the request returns an error if any wildcard expression, index + * alias, or _all value targets only missing or closed indices. This behavior + * applies even if the request targets other open indices. For example, a + * request targeting foo*,bar* returns an error if an index starts with foo but + * no index starts with bar. + *

+ * API name: {@code allow_no_indices} + */ + @Nullable + public final Boolean allowNoIndices() { + return this.allowNoIndices; + } + + /** + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. Valid values are: all, + * open, closed, hidden, + * none. + *

+ * API name: {@code expand_wildcards} + */ + public final List expandWildcards() { + return this.expandWildcards; + } + + /** + * If true, concrete, expanded or aliased indices are ignored when frozen. + * Defaults to false. + *

+ * API name: {@code ignore_throttled} + */ + @Nullable + public final Boolean ignoreThrottled() { + return this.ignoreThrottled; + } + + /** + * If false, the request returns an error if it targets a missing or closed + * index. Defaults to false. + *

+ * API name: {@code ignore_unavailable} + */ + @Nullable + public final Boolean ignoreUnavailable() { + return this.ignoreUnavailable; + } + + /** + * Required - Comma-separated name(s) or index pattern(s) of the indices, + * aliases, and data streams to resolve. Resources on remote clusters can be + * specified using the <cluster>:<name> + * syntax. + *

+ * API name: {@code name} + */ + public final List name() { + return this.name; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ResolveClusterRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private Boolean allowNoIndices; + + @Nullable + private List expandWildcards; + + @Nullable + private Boolean ignoreThrottled; + + @Nullable + private Boolean ignoreUnavailable; + + private List name; + + /** + * If false, the request returns an error if any wildcard expression, index + * alias, or _all value targets only missing or closed indices. This behavior + * applies even if the request targets other open indices. For example, a + * request targeting foo*,bar* returns an error if an index starts with foo but + * no index starts with bar. + *

+ * API name: {@code allow_no_indices} + */ + public final Builder allowNoIndices(@Nullable Boolean value) { + this.allowNoIndices = value; + return this; + } + + /** + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. Valid values are: all, + * open, closed, hidden, + * none. + *

+ * API name: {@code expand_wildcards} + *

+ * Adds all elements of list to expandWildcards. + */ + public final Builder expandWildcards(List list) { + this.expandWildcards = _listAddAll(this.expandWildcards, list); + return this; + } + + /** + * Type of index that wildcard patterns can match. If the request can target + * data streams, this argument determines whether wildcard expressions match + * hidden data streams. Supports comma-separated values, such as + * open,hidden. Valid values are: all, + * open, closed, hidden, + * none. + *

+ * API name: {@code expand_wildcards} + *

+ * Adds one or more values to expandWildcards. + */ + public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { + this.expandWildcards = _listAdd(this.expandWildcards, value, values); + return this; + } + + /** + * If true, concrete, expanded or aliased indices are ignored when frozen. + * Defaults to false. + *

+ * API name: {@code ignore_throttled} + */ + public final Builder ignoreThrottled(@Nullable Boolean value) { + this.ignoreThrottled = value; + return this; + } + + /** + * If false, the request returns an error if it targets a missing or closed + * index. Defaults to false. + *

+ * API name: {@code ignore_unavailable} + */ + public final Builder ignoreUnavailable(@Nullable Boolean value) { + this.ignoreUnavailable = value; + return this; + } + + /** + * Required - Comma-separated name(s) or index pattern(s) of the indices, + * aliases, and data streams to resolve. Resources on remote clusters can be + * specified using the <cluster>:<name> + * syntax. + *

+ * API name: {@code name} + *

+ * Adds all elements of list to name. + */ + public final Builder name(List list) { + this.name = _listAddAll(this.name, list); + return this; + } + + /** + * Required - Comma-separated name(s) or index pattern(s) of the indices, + * aliases, and data streams to resolve. Resources on remote clusters can be + * specified using the <cluster>:<name> + * syntax. + *

+ * API name: {@code name} + *

+ * Adds one or more values to name. + */ + public final Builder name(String value, String... values) { + this.name = _listAdd(this.name, value, values); + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ResolveClusterRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ResolveClusterRequest build() { + _checkSingleUse(); + + return new ResolveClusterRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code indices.resolve_cluster}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/indices.resolve_cluster", + + // Request method + request -> { + return "GET"; + + }, + + // Request path + request -> { + final int _name = 1 << 0; + + int propsSet = 0; + + propsSet |= _name; + + if (propsSet == (_name)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_resolve"); + buf.append("/cluster"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Path parameters + request -> { + Map params = new HashMap<>(); + final int _name = 1 << 0; + + int propsSet = 0; + + propsSet |= _name; + + if (propsSet == (_name)) { + params.put("name", request.name.stream().map(v -> v).collect(Collectors.joining(","))); + } + return params; + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (ApiTypeHelper.isDefined(request.expandWildcards)) { + params.put("expand_wildcards", + request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); + } + if (request.ignoreUnavailable != null) { + params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); + } + if (request.allowNoIndices != null) { + params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); + } + if (request.ignoreThrottled != null) { + params.put("ignore_throttled", String.valueOf(request.ignoreThrottled)); + } + return params; + + }, SimpleEndpoint.emptyMap(), false, ResolveClusterResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ResolveClusterResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ResolveClusterResponse.java new file mode 100644 index 000000000..f2913258f --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ResolveClusterResponse.java @@ -0,0 +1,192 @@ +/* + * 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.indices.resolve_cluster.ResolveClusterInfo; +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 jakarta.json.stream.JsonParser; +import java.lang.String; +import java.util.HashMap; +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: indices.resolve_cluster.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class ResolveClusterResponse implements JsonpSerializable { + private final Map result; + + // --------------------------------------------------------------------------------------------- + + private ResolveClusterResponse(Builder builder) { + + this.result = ApiTypeHelper.unmodifiableRequired(builder.result, this, "result"); + + } + + public static ResolveClusterResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Response value. + */ + public final Map result() { + return this.result; + } + + /** + * Get an element of {@code result}. + */ + public final @Nullable ResolveClusterInfo get(String key) { + return this.result.get(key); + } + + /** + * Serialize this value to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + for (Map.Entry item0 : this.result.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ResolveClusterResponse}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private Map result = new HashMap<>(); + + /** + * Required - Response value. + *

+ * Adds all entries of map to result. + */ + public final Builder result(Map map) { + this.result = _mapPutAll(this.result, map); + return this; + } + + /** + * Required - Response value. + *

+ * Adds an entry to result. + */ + public final Builder result(String key, ResolveClusterInfo value) { + this.result = _mapPut(this.result, key, value); + return this; + } + + /** + * Required - Response value. + *

+ * Adds an entry to result using a builder lambda. + */ + public final Builder result(String key, + Function> fn) { + return result(key, fn.apply(new ResolveClusterInfo.Builder()).build()); + } + + @Override + public Builder withJson(JsonParser parser, JsonpMapper mapper) { + + @SuppressWarnings("unchecked") + Map value = (Map) JsonpDeserializer + .stringMapDeserializer(ResolveClusterInfo._DESERIALIZER).deserialize(parser, mapper); + return this.result(value); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ResolveClusterResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ResolveClusterResponse build() { + _checkSingleUse(); + + return new ResolveClusterResponse(this); + } + } + + public static final JsonpDeserializer _DESERIALIZER = createResolveClusterResponseDeserializer(); + protected static JsonpDeserializer createResolveClusterResponseDeserializer() { + + JsonpDeserializer> valueDeserializer = JsonpDeserializer + .stringMapDeserializer(ResolveClusterInfo._DESERIALIZER); + + return JsonpDeserializer.of(valueDeserializer.acceptedEvents(), (parser, mapper, event) -> new Builder() + .result(valueDeserializer.deserialize(parser, mapper, event)).build()); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/data_streams_stats/DataStreamsStatsItem.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/data_streams_stats/DataStreamsStatsItem.java index 329d26d36..1545c0030 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/data_streams_stats/DataStreamsStatsItem.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/data_streams_stats/DataStreamsStatsItem.java @@ -71,7 +71,7 @@ public class DataStreamsStatsItem implements JsonpSerializable { @Nullable private final String storeSize; - private final int storeSizeBytes; + private final long storeSizeBytes; // --------------------------------------------------------------------------------------------- @@ -139,7 +139,7 @@ public final String storeSize() { *

* API name: {@code store_size_bytes} */ - public final int storeSizeBytes() { + public final long storeSizeBytes() { return this.storeSizeBytes; } @@ -196,7 +196,7 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private String storeSize; - private Integer storeSizeBytes; + private Long storeSizeBytes; /** * Required - Current number of backing indices for the data stream. @@ -251,7 +251,7 @@ public final Builder storeSize(@Nullable String value) { *

* API name: {@code store_size_bytes} */ - public final Builder storeSizeBytes(int value) { + public final Builder storeSizeBytes(long value) { this.storeSizeBytes = value; return this; } @@ -288,7 +288,7 @@ protected static void setupDataStreamsStatsItemDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public class ResolveClusterInfo implements JsonpSerializable { + private final boolean connected; + + private final boolean skipUnavailable; + + @Nullable + private final Boolean matchingIndices; + + @Nullable + private final String error; + + @Nullable + private final ElasticsearchVersionMinInfo version; + + // --------------------------------------------------------------------------------------------- + + private ResolveClusterInfo(Builder builder) { + + this.connected = ApiTypeHelper.requireNonNull(builder.connected, this, "connected"); + this.skipUnavailable = ApiTypeHelper.requireNonNull(builder.skipUnavailable, this, "skipUnavailable"); + this.matchingIndices = builder.matchingIndices; + this.error = builder.error; + this.version = builder.version; + + } + + public static ResolveClusterInfo of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Whether the remote cluster is connected to the local (querying) + * cluster. + *

+ * API name: {@code connected} + */ + public final boolean connected() { + return this.connected; + } + + /** + * Required - The skip_unavailable setting for a remote cluster. + *

+ * API name: {@code skip_unavailable} + */ + public final boolean skipUnavailable() { + return this.skipUnavailable; + } + + /** + * Whether the index expression provided in the request matches any indices, + * aliases or data streams on the cluster. + *

+ * API name: {@code matching_indices} + */ + @Nullable + public final Boolean matchingIndices() { + return this.matchingIndices; + } + + /** + * Provides error messages that are likely to occur if you do a search with this + * index expression on the specified cluster (e.g., lack of security privileges + * to query an index). + *

+ * API name: {@code error} + */ + @Nullable + public final String error() { + return this.error; + } + + /** + * Provides version information about the cluster. + *

+ * API name: {@code version} + */ + @Nullable + public final ElasticsearchVersionMinInfo version() { + return this.version; + } + + /** + * 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("connected"); + generator.write(this.connected); + + generator.writeKey("skip_unavailable"); + generator.write(this.skipUnavailable); + + if (this.matchingIndices != null) { + generator.writeKey("matching_indices"); + generator.write(this.matchingIndices); + + } + if (this.error != null) { + generator.writeKey("error"); + generator.write(this.error); + + } + if (this.version != null) { + generator.writeKey("version"); + this.version.serialize(generator, mapper); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ResolveClusterInfo}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private Boolean connected; + + private Boolean skipUnavailable; + + @Nullable + private Boolean matchingIndices; + + @Nullable + private String error; + + @Nullable + private ElasticsearchVersionMinInfo version; + + /** + * Required - Whether the remote cluster is connected to the local (querying) + * cluster. + *

+ * API name: {@code connected} + */ + public final Builder connected(boolean value) { + this.connected = value; + return this; + } + + /** + * Required - The skip_unavailable setting for a remote cluster. + *

+ * API name: {@code skip_unavailable} + */ + public final Builder skipUnavailable(boolean value) { + this.skipUnavailable = value; + return this; + } + + /** + * Whether the index expression provided in the request matches any indices, + * aliases or data streams on the cluster. + *

+ * API name: {@code matching_indices} + */ + public final Builder matchingIndices(@Nullable Boolean value) { + this.matchingIndices = value; + return this; + } + + /** + * Provides error messages that are likely to occur if you do a search with this + * index expression on the specified cluster (e.g., lack of security privileges + * to query an index). + *

+ * API name: {@code error} + */ + public final Builder error(@Nullable String value) { + this.error = value; + return this; + } + + /** + * Provides version information about the cluster. + *

+ * API name: {@code version} + */ + public final Builder version(@Nullable ElasticsearchVersionMinInfo value) { + this.version = value; + return this; + } + + /** + * Provides version information about the cluster. + *

+ * API name: {@code version} + */ + public final Builder version( + Function> fn) { + return this.version(fn.apply(new ElasticsearchVersionMinInfo.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ResolveClusterInfo}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ResolveClusterInfo build() { + _checkSingleUse(); + + return new ResolveClusterInfo(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ResolveClusterInfo} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, ResolveClusterInfo::setupResolveClusterInfoDeserializer); + + protected static void setupResolveClusterInfoDeserializer(ObjectDeserializer op) { + + op.add(Builder::connected, JsonpDeserializer.booleanDeserializer(), "connected"); + op.add(Builder::skipUnavailable, JsonpDeserializer.booleanDeserializer(), "skip_unavailable"); + op.add(Builder::matchingIndices, JsonpDeserializer.booleanDeserializer(), "matching_indices"); + op.add(Builder::error, JsonpDeserializer.stringDeserializer(), "error"); + op.add(Builder::version, ElasticsearchVersionMinInfo._DESERIALIZER, "version"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteModelRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteModelRequest.java index a482dcc80..58a8f73c6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteModelRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteModelRequest.java @@ -63,16 +63,17 @@ */ public class DeleteModelRequest extends RequestBase { - private final String modelId; + private final String inferenceId; + @Nullable private final TaskType taskType; // --------------------------------------------------------------------------------------------- private DeleteModelRequest(Builder builder) { - this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); - this.taskType = ApiTypeHelper.requireNonNull(builder.taskType, this, "taskType"); + this.inferenceId = ApiTypeHelper.requireNonNull(builder.inferenceId, this, "inferenceId"); + this.taskType = builder.taskType; } @@ -81,19 +82,20 @@ public static DeleteModelRequest of(Function - * API name: {@code model_id} + * API name: {@code inference_id} */ - public final String modelId() { - return this.modelId; + public final String inferenceId() { + return this.inferenceId; } /** - * Required - The model task type + * The task type *

* API name: {@code task_type} */ + @Nullable public final TaskType taskType() { return this.taskType; } @@ -107,26 +109,27 @@ public final TaskType taskType() { public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { - private String modelId; + private String inferenceId; + @Nullable private TaskType taskType; /** - * Required - The unique identifier of the inference model. + * Required - The inference Id *

- * API name: {@code model_id} + * API name: {@code inference_id} */ - public final Builder modelId(String value) { - this.modelId = value; + public final Builder inferenceId(String value) { + this.inferenceId = value; return this; } /** - * Required - The model task type + * The task type *

* API name: {@code task_type} */ - public final Builder taskType(TaskType value) { + public final Builder taskType(@Nullable TaskType value) { this.taskType = value; return this; } @@ -165,21 +168,29 @@ public DeleteModelRequest build() { // Request path request -> { - final int _modelId = 1 << 0; + final int _inferenceId = 1 << 0; final int _taskType = 1 << 1; int propsSet = 0; - propsSet |= _modelId; - propsSet |= _taskType; + propsSet |= _inferenceId; + if (request.taskType() != null) + propsSet |= _taskType; - if (propsSet == (_taskType | _modelId)) { + if (propsSet == (_inferenceId)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_inference"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.inferenceId, buf); + return buf.toString(); + } + if (propsSet == (_taskType | _inferenceId)) { StringBuilder buf = new StringBuilder(); buf.append("/_inference"); buf.append("/"); SimpleEndpoint.pathEncode(request.taskType.jsonValue(), buf); buf.append("/"); - SimpleEndpoint.pathEncode(request.modelId, buf); + SimpleEndpoint.pathEncode(request.inferenceId, buf); return buf.toString(); } throw SimpleEndpoint.noPathTemplateFound("path"); @@ -189,17 +200,21 @@ public DeleteModelRequest build() { // Path parameters request -> { Map params = new HashMap<>(); - final int _modelId = 1 << 0; + final int _inferenceId = 1 << 0; final int _taskType = 1 << 1; int propsSet = 0; - propsSet |= _modelId; - propsSet |= _taskType; + propsSet |= _inferenceId; + if (request.taskType() != null) + propsSet |= _taskType; - if (propsSet == (_taskType | _modelId)) { + if (propsSet == (_inferenceId)) { + params.put("inferenceId", request.inferenceId); + } + if (propsSet == (_taskType | _inferenceId)) { params.put("taskType", request.taskType.jsonValue()); - params.put("modelId", request.modelId); + params.put("inferenceId", request.inferenceId); } return params; }, diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetModelRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetModelRequest.java index 54ef93edc..b7ce8d929 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetModelRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetModelRequest.java @@ -63,16 +63,17 @@ */ public class GetModelRequest extends RequestBase { - private final String modelId; + private final String inferenceId; + @Nullable private final TaskType taskType; // --------------------------------------------------------------------------------------------- private GetModelRequest(Builder builder) { - this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); - this.taskType = ApiTypeHelper.requireNonNull(builder.taskType, this, "taskType"); + this.inferenceId = ApiTypeHelper.requireNonNull(builder.inferenceId, this, "inferenceId"); + this.taskType = builder.taskType; } @@ -81,19 +82,20 @@ public static GetModelRequest of(Function - * API name: {@code model_id} + * API name: {@code inference_id} */ - public final String modelId() { - return this.modelId; + public final String inferenceId() { + return this.inferenceId; } /** - * Required - The model task type + * The task type *

* API name: {@code task_type} */ + @Nullable public final TaskType taskType() { return this.taskType; } @@ -105,26 +107,27 @@ public final TaskType taskType() { */ public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { - private String modelId; + private String inferenceId; + @Nullable private TaskType taskType; /** - * Required - The unique identifier of the inference model. + * Required - The inference Id *

- * API name: {@code model_id} + * API name: {@code inference_id} */ - public final Builder modelId(String value) { - this.modelId = value; + public final Builder inferenceId(String value) { + this.inferenceId = value; return this; } /** - * Required - The model task type + * The task type *

* API name: {@code task_type} */ - public final Builder taskType(TaskType value) { + public final Builder taskType(@Nullable TaskType value) { this.taskType = value; return this; } @@ -163,21 +166,29 @@ public GetModelRequest build() { // Request path request -> { - final int _modelId = 1 << 0; + final int _inferenceId = 1 << 0; final int _taskType = 1 << 1; int propsSet = 0; - propsSet |= _modelId; - propsSet |= _taskType; + propsSet |= _inferenceId; + if (request.taskType() != null) + propsSet |= _taskType; - if (propsSet == (_taskType | _modelId)) { + if (propsSet == (_inferenceId)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_inference"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.inferenceId, buf); + return buf.toString(); + } + if (propsSet == (_taskType | _inferenceId)) { StringBuilder buf = new StringBuilder(); buf.append("/_inference"); buf.append("/"); SimpleEndpoint.pathEncode(request.taskType.jsonValue(), buf); buf.append("/"); - SimpleEndpoint.pathEncode(request.modelId, buf); + SimpleEndpoint.pathEncode(request.inferenceId, buf); return buf.toString(); } throw SimpleEndpoint.noPathTemplateFound("path"); @@ -187,17 +198,21 @@ public GetModelRequest build() { // Path parameters request -> { Map params = new HashMap<>(); - final int _modelId = 1 << 0; + final int _inferenceId = 1 << 0; final int _taskType = 1 << 1; int propsSet = 0; - propsSet |= _modelId; - propsSet |= _taskType; + propsSet |= _inferenceId; + if (request.taskType() != null) + propsSet |= _taskType; - if (propsSet == (_taskType | _modelId)) { + if (propsSet == (_inferenceId)) { + params.put("inferenceId", request.inferenceId); + } + if (propsSet == (_taskType | _inferenceId)) { params.put("taskType", request.taskType.jsonValue()); - params.put("modelId", request.modelId); + params.put("inferenceId", request.inferenceId); } return params; }, diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceRequest.java index 681895e6b..aaa83cb1c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceRequest.java @@ -67,23 +67,24 @@ */ @JsonpDeserializable public class InferenceRequest extends RequestBase implements JsonpSerializable { - private final List input; + private final String inferenceId; - private final String modelId; + private final List input; @Nullable private final JsonData taskSettings; + @Nullable private final TaskType taskType; // --------------------------------------------------------------------------------------------- private InferenceRequest(Builder builder) { + this.inferenceId = ApiTypeHelper.requireNonNull(builder.inferenceId, this, "inferenceId"); this.input = ApiTypeHelper.unmodifiableRequired(builder.input, this, "input"); - this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); this.taskSettings = builder.taskSettings; - this.taskType = ApiTypeHelper.requireNonNull(builder.taskType, this, "taskType"); + this.taskType = builder.taskType; } @@ -92,21 +93,21 @@ public static InferenceRequest of(Function - * API name: {@code input} + * API name: {@code inference_id} */ - public final List input() { - return this.input; + public final String inferenceId() { + return this.inferenceId; } /** - * Required - The unique identifier of the inference model. + * Required - Text input to the model. Either a string or an array of strings. *

- * API name: {@code model_id} + * API name: {@code input} */ - public final String modelId() { - return this.modelId; + public final List input() { + return this.input; } /** @@ -120,10 +121,11 @@ public final JsonData taskSettings() { } /** - * Required - The model task type + * The task type *

* API name: {@code task_type} */ + @Nullable public final TaskType taskType() { return this.taskType; } @@ -166,15 +168,26 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { - private List input; + private String inferenceId; - private String modelId; + private List input; @Nullable private JsonData taskSettings; + @Nullable private TaskType taskType; + /** + * Required - The inference Id + *

+ * API name: {@code inference_id} + */ + public final Builder inferenceId(String value) { + this.inferenceId = value; + return this; + } + /** * Required - Text input to the model. Either a string or an array of strings. *

@@ -199,16 +212,6 @@ public final Builder input(String value, String... values) { return this; } - /** - * Required - The unique identifier of the inference model. - *

- * API name: {@code model_id} - */ - public final Builder modelId(String value) { - this.modelId = value; - return this; - } - /** * Optional task settings *

@@ -220,11 +223,11 @@ public final Builder taskSettings(@Nullable JsonData value) { } /** - * Required - The model task type + * The task type *

* API name: {@code task_type} */ - public final Builder taskType(TaskType value) { + public final Builder taskType(@Nullable TaskType value) { this.taskType = value; return this; } @@ -278,21 +281,29 @@ protected static void setupInferenceRequestDeserializer(ObjectDeserializer { - final int _modelId = 1 << 0; + final int _inferenceId = 1 << 0; final int _taskType = 1 << 1; int propsSet = 0; - propsSet |= _modelId; - propsSet |= _taskType; + propsSet |= _inferenceId; + if (request.taskType() != null) + propsSet |= _taskType; - if (propsSet == (_taskType | _modelId)) { + if (propsSet == (_inferenceId)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_inference"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.inferenceId, buf); + return buf.toString(); + } + if (propsSet == (_taskType | _inferenceId)) { StringBuilder buf = new StringBuilder(); buf.append("/_inference"); buf.append("/"); SimpleEndpoint.pathEncode(request.taskType.jsonValue(), buf); buf.append("/"); - SimpleEndpoint.pathEncode(request.modelId, buf); + SimpleEndpoint.pathEncode(request.inferenceId, buf); return buf.toString(); } throw SimpleEndpoint.noPathTemplateFound("path"); @@ -302,17 +313,21 @@ protected static void setupInferenceRequestDeserializer(ObjectDeserializer { Map params = new HashMap<>(); - final int _modelId = 1 << 0; + final int _inferenceId = 1 << 0; final int _taskType = 1 << 1; int propsSet = 0; - propsSet |= _modelId; - propsSet |= _taskType; + propsSet |= _inferenceId; + if (request.taskType() != null) + propsSet |= _taskType; - if (propsSet == (_taskType | _modelId)) { + if (propsSet == (_inferenceId)) { + params.put("inferenceId", request.inferenceId); + } + if (propsSet == (_taskType | _inferenceId)) { params.put("taskType", request.taskType.jsonValue()); - params.put("modelId", request.modelId); + params.put("inferenceId", request.inferenceId); } return params; }, diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutModelRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutModelRequest.java index a1fd000f8..30c31115d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutModelRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutModelRequest.java @@ -66,8 +66,9 @@ */ @JsonpDeserializable public class PutModelRequest extends RequestBase implements JsonpSerializable { - private final String modelId; + private final String inferenceId; + @Nullable private final TaskType taskType; private final ModelConfig modelConfig; @@ -76,8 +77,8 @@ public class PutModelRequest extends RequestBase implements JsonpSerializable { private PutModelRequest(Builder builder) { - this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); - this.taskType = ApiTypeHelper.requireNonNull(builder.taskType, this, "taskType"); + this.inferenceId = ApiTypeHelper.requireNonNull(builder.inferenceId, this, "inferenceId"); + this.taskType = builder.taskType; this.modelConfig = ApiTypeHelper.requireNonNull(builder.modelConfig, this, "modelConfig"); } @@ -87,19 +88,20 @@ public static PutModelRequest of(Function - * API name: {@code model_id} + * API name: {@code inference_id} */ - public final String modelId() { - return this.modelId; + public final String inferenceId() { + return this.inferenceId; } /** - * Required - The model task type + * The task type *

* API name: {@code task_type} */ + @Nullable public final TaskType taskType() { return this.taskType; } @@ -126,28 +128,29 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { */ public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { - private String modelId; + private String inferenceId; + @Nullable private TaskType taskType; private ModelConfig modelConfig; /** - * Required - The unique identifier of the inference model. + * Required - The inference Id *

- * API name: {@code model_id} + * API name: {@code inference_id} */ - public final Builder modelId(String value) { - this.modelId = value; + public final Builder inferenceId(String value) { + this.inferenceId = value; return this; } /** - * Required - The model task type + * The task type *

* API name: {@code task_type} */ - public final Builder taskType(TaskType value) { + public final Builder taskType(@Nullable TaskType value) { this.taskType = value; return this; } @@ -218,21 +221,29 @@ protected static JsonpDeserializer createPutModelRequestDeseria // Request path request -> { - final int _modelId = 1 << 0; + final int _inferenceId = 1 << 0; final int _taskType = 1 << 1; int propsSet = 0; - propsSet |= _modelId; - propsSet |= _taskType; + propsSet |= _inferenceId; + if (request.taskType() != null) + propsSet |= _taskType; - if (propsSet == (_taskType | _modelId)) { + if (propsSet == (_inferenceId)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_inference"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.inferenceId, buf); + return buf.toString(); + } + if (propsSet == (_taskType | _inferenceId)) { StringBuilder buf = new StringBuilder(); buf.append("/_inference"); buf.append("/"); SimpleEndpoint.pathEncode(request.taskType.jsonValue(), buf); buf.append("/"); - SimpleEndpoint.pathEncode(request.modelId, buf); + SimpleEndpoint.pathEncode(request.inferenceId, buf); return buf.toString(); } throw SimpleEndpoint.noPathTemplateFound("path"); @@ -242,17 +253,21 @@ protected static JsonpDeserializer createPutModelRequestDeseria // Path parameters request -> { Map params = new HashMap<>(); - final int _modelId = 1 << 0; + final int _inferenceId = 1 << 0; final int _taskType = 1 << 1; int propsSet = 0; - propsSet |= _modelId; - propsSet |= _taskType; + propsSet |= _inferenceId; + if (request.taskType() != null) + propsSet |= _taskType; - if (propsSet == (_taskType | _modelId)) { + if (propsSet == (_inferenceId)) { + params.put("inferenceId", request.inferenceId); + } + if (propsSet == (_taskType | _inferenceId)) { params.put("taskType", request.taskType.jsonValue()); - params.put("modelId", request.modelId); + params.put("inferenceId", request.inferenceId); } return params; }, diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/Pipeline.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/Pipeline.java index 1ec9cc9c2..4b79d2767 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/Pipeline.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/Pipeline.java @@ -83,7 +83,7 @@ private Pipeline(Builder builder) { this.onFailure = ApiTypeHelper.unmodifiable(builder.onFailure); this.processors = ApiTypeHelper.unmodifiable(builder.processors); this.version = builder.version; - this.meta = ApiTypeHelper.unmodifiableRequired(builder.meta, this, "meta"); + this.meta = ApiTypeHelper.unmodifiable(builder.meta); } @@ -131,8 +131,8 @@ public final Long version() { } /** - * Required - Arbitrary metadata about the ingest pipeline. This map is not - * automatically generated by Elasticsearch. + * Arbitrary metadata about the ingest pipeline. This map is not automatically + * generated by Elasticsearch. *

* API name: {@code _meta} */ @@ -219,6 +219,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private Long version; + @Nullable private Map meta; /** @@ -315,8 +316,8 @@ public final Builder version(@Nullable Long value) { } /** - * Required - Arbitrary metadata about the ingest pipeline. This map is not - * automatically generated by Elasticsearch. + * Arbitrary metadata about the ingest pipeline. This map is not automatically + * generated by Elasticsearch. *

* API name: {@code _meta} *

@@ -328,8 +329,8 @@ public final Builder meta(Map map) { } /** - * Required - Arbitrary metadata about the ingest pipeline. This map is not - * automatically generated by Elasticsearch. + * Arbitrary metadata about the ingest pipeline. This map is not automatically + * generated by Elasticsearch. *

* API name: {@code _meta} *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleRequest.java index c0dd257f5..04466ff0f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/PutRoleRequest.java @@ -86,8 +86,7 @@ public class PutRoleRequest extends RequestBase implements JsonpSerializable { private final List runAs; - @Nullable - private final TransientMetadataConfig transientMetadata; + private final Map transientMetadata; // --------------------------------------------------------------------------------------------- @@ -101,7 +100,7 @@ private PutRoleRequest(Builder builder) { this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); this.refresh = builder.refresh; this.runAs = ApiTypeHelper.unmodifiable(builder.runAs); - this.transientMetadata = builder.transientMetadata; + this.transientMetadata = ApiTypeHelper.unmodifiable(builder.transientMetadata); } @@ -199,8 +198,7 @@ public final List runAs() { *

* API name: {@code transient_metadata} */ - @Nullable - public final TransientMetadataConfig transientMetadata() { + public final Map transientMetadata() { return this.transientMetadata; } @@ -277,9 +275,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - if (this.transientMetadata != null) { + if (ApiTypeHelper.isDefined(this.transientMetadata)) { generator.writeKey("transient_metadata"); - this.transientMetadata.serialize(generator, mapper); + generator.writeStartObject(); + for (Map.Entry item0 : this.transientMetadata.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); } @@ -316,7 +320,7 @@ public static class Builder extends RequestBase.AbstractBuilder impleme private List runAs; @Nullable - private TransientMetadataConfig transientMetadata; + private Map transientMetadata; /** * A list of application privilege entries. @@ -525,9 +529,11 @@ public final Builder runAs(String value, String... values) { * listed in the response from the authenticate API. *

* API name: {@code transient_metadata} + *

+ * Adds all entries of map to transientMetadata. */ - public final Builder transientMetadata(@Nullable TransientMetadataConfig value) { - this.transientMetadata = value; + public final Builder transientMetadata(Map map) { + this.transientMetadata = _mapPutAll(this.transientMetadata, map); return this; } @@ -540,10 +546,12 @@ public final Builder transientMetadata(@Nullable TransientMetadataConfig value) * listed in the response from the authenticate API. *

* API name: {@code transient_metadata} + *

+ * Adds an entry to transientMetadata. */ - public final Builder transientMetadata( - Function> fn) { - return this.transientMetadata(fn.apply(new TransientMetadataConfig.Builder()).build()); + public final Builder transientMetadata(String key, JsonData value) { + this.transientMetadata = _mapPut(this.transientMetadata, key, value); + return this; } @Override @@ -582,7 +590,8 @@ protected static void setupPutRoleRequestDeserializer(ObjectDeserializer runAs; - @Nullable - private final TransientMetadataConfig transientMetadata; + private final Map transientMetadata; // --------------------------------------------------------------------------------------------- @@ -87,7 +86,7 @@ private RoleDescriptor(Builder builder) { this.applications = ApiTypeHelper.unmodifiable(builder.applications); this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); this.runAs = ApiTypeHelper.unmodifiable(builder.runAs); - this.transientMetadata = builder.transientMetadata; + this.transientMetadata = ApiTypeHelper.unmodifiable(builder.transientMetadata); } @@ -156,8 +155,7 @@ public final List runAs() { /** * API name: {@code transient_metadata} */ - @Nullable - public final TransientMetadataConfig transientMetadata() { + public final Map transientMetadata() { return this.transientMetadata; } @@ -233,9 +231,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - if (this.transientMetadata != null) { + if (ApiTypeHelper.isDefined(this.transientMetadata)) { generator.writeKey("transient_metadata"); - this.transientMetadata.serialize(generator, mapper); + generator.writeStartObject(); + for (Map.Entry item0 : this.transientMetadata.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); } @@ -272,7 +276,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement private List runAs; @Nullable - private TransientMetadataConfig transientMetadata; + private Map transientMetadata; /** * A list of cluster privileges. These privileges define the cluster level @@ -464,18 +468,22 @@ public final Builder runAs(String value, String... values) { /** * API name: {@code transient_metadata} + *

+ * Adds all entries of map to transientMetadata. */ - public final Builder transientMetadata(@Nullable TransientMetadataConfig value) { - this.transientMetadata = value; + public final Builder transientMetadata(Map map) { + this.transientMetadata = _mapPutAll(this.transientMetadata, map); return this; } /** * API name: {@code transient_metadata} + *

+ * Adds an entry to transientMetadata. */ - public final Builder transientMetadata( - Function> fn) { - return this.transientMetadata(fn.apply(new TransientMetadataConfig.Builder()).build()); + public final Builder transientMetadata(String key, JsonData value) { + this.transientMetadata = _mapPut(this.transientMetadata, key, value); + return this; } @Override @@ -515,7 +523,8 @@ protected static void setupRoleDescriptorDeserializer(ObjectDeserializer runAs; - @Nullable - private final TransientMetadataConfig transientMetadata; + private final Map transientMetadata; // --------------------------------------------------------------------------------------------- @@ -88,7 +87,7 @@ private RoleDescriptorRead(Builder builder) { this.applications = ApiTypeHelper.unmodifiable(builder.applications); this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); this.runAs = ApiTypeHelper.unmodifiable(builder.runAs); - this.transientMetadata = builder.transientMetadata; + this.transientMetadata = ApiTypeHelper.unmodifiable(builder.transientMetadata); } @@ -157,8 +156,7 @@ public final List runAs() { /** * API name: {@code transient_metadata} */ - @Nullable - public final TransientMetadataConfig transientMetadata() { + public final Map transientMetadata() { return this.transientMetadata; } @@ -234,9 +232,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - if (this.transientMetadata != null) { + if (ApiTypeHelper.isDefined(this.transientMetadata)) { generator.writeKey("transient_metadata"); - this.transientMetadata.serialize(generator, mapper); + generator.writeStartObject(); + for (Map.Entry item0 : this.transientMetadata.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); } @@ -273,7 +277,7 @@ public static class Builder extends WithJsonObjectBuilderBase private List runAs; @Nullable - private TransientMetadataConfig transientMetadata; + private Map transientMetadata; /** * Required - A list of cluster privileges. These privileges define the cluster @@ -465,18 +469,22 @@ public final Builder runAs(String value, String... values) { /** * API name: {@code transient_metadata} + *

+ * Adds all entries of map to transientMetadata. */ - public final Builder transientMetadata(@Nullable TransientMetadataConfig value) { - this.transientMetadata = value; + public final Builder transientMetadata(Map map) { + this.transientMetadata = _mapPutAll(this.transientMetadata, map); return this; } /** * API name: {@code transient_metadata} + *

+ * Adds an entry to transientMetadata. */ - public final Builder transientMetadata( - Function> fn) { - return this.transientMetadata(fn.apply(new TransientMetadataConfig.Builder()).build()); + public final Builder transientMetadata(String key, JsonData value) { + this.transientMetadata = _mapPut(this.transientMetadata, key, value); + return this; } @Override @@ -516,7 +524,8 @@ protected static void setupRoleDescriptorReadDeserializer(ObjectDeserializer runAs; - private final TransientMetadataConfig transientMetadata; + private final Map transientMetadata; private final List applications; @@ -90,7 +89,7 @@ private Role(Builder builder) { this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); this.metadata = ApiTypeHelper.unmodifiableRequired(builder.metadata, this, "metadata"); this.runAs = ApiTypeHelper.unmodifiableRequired(builder.runAs, this, "runAs"); - this.transientMetadata = ApiTypeHelper.requireNonNull(builder.transientMetadata, this, "transientMetadata"); + this.transientMetadata = ApiTypeHelper.unmodifiable(builder.transientMetadata); this.applications = ApiTypeHelper.unmodifiableRequired(builder.applications, this, "applications"); this.roleTemplates = ApiTypeHelper.unmodifiable(builder.roleTemplates); this.global = ApiTypeHelper.unmodifiable(builder.global); @@ -130,9 +129,9 @@ public final List runAs() { } /** - * Required - API name: {@code transient_metadata} + * API name: {@code transient_metadata} */ - public final TransientMetadataConfig transientMetadata() { + public final Map transientMetadata() { return this.transientMetadata; } @@ -209,9 +208,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - generator.writeKey("transient_metadata"); - this.transientMetadata.serialize(generator, mapper); + if (ApiTypeHelper.isDefined(this.transientMetadata)) { + generator.writeKey("transient_metadata"); + generator.writeStartObject(); + for (Map.Entry item0 : this.transientMetadata.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + } if (ApiTypeHelper.isDefined(this.applications)) { generator.writeKey("applications"); generator.writeStartArray(); @@ -289,7 +296,8 @@ public static class Builder extends WithJsonObjectBuilderBase implement private List runAs; - private TransientMetadataConfig transientMetadata; + @Nullable + private Map transientMetadata; private List applications; @@ -389,19 +397,23 @@ public final Builder runAs(String value, String... values) { } /** - * Required - API name: {@code transient_metadata} + * API name: {@code transient_metadata} + *

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

+ * Adds an entry to transientMetadata. */ - public final Builder transientMetadata( - Function> fn) { - return this.transientMetadata(fn.apply(new TransientMetadataConfig.Builder()).build()); + public final Builder transientMetadata(String key, JsonData value) { + this.transientMetadata = _mapPut(this.transientMetadata, key, value); + return this; } /** @@ -516,7 +528,8 @@ protected static void setupRoleDeserializer(ObjectDeserializer op) op.add(Builder::indices, JsonpDeserializer.arrayDeserializer(IndicesPrivileges._DESERIALIZER), "indices"); op.add(Builder::metadata, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "metadata"); op.add(Builder::runAs, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "run_as"); - op.add(Builder::transientMetadata, TransientMetadataConfig._DESERIALIZER, "transient_metadata"); + op.add(Builder::transientMetadata, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), + "transient_metadata"); op.add(Builder::applications, JsonpDeserializer.arrayDeserializer(ApplicationPrivileges._DESERIALIZER), "applications"); op.add(Builder::roleTemplates, JsonpDeserializer.arrayDeserializer(RoleTemplate._DESERIALIZER), diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/AzureRepository.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/AzureRepository.java new file mode 100644 index 000000000..68943221d --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/AzureRepository.java @@ -0,0 +1,157 @@ +/* + * 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.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +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.AzureRepository + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class AzureRepository extends RepositoryBase implements RepositoryVariant { + private final AzureRepositorySettings settings; + + // --------------------------------------------------------------------------------------------- + + private AzureRepository(Builder builder) { + super(builder); + + this.settings = ApiTypeHelper.requireNonNull(builder.settings, this, "settings"); + + } + + public static AzureRepository of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Repository variant kind. + */ + @Override + public Repository.Kind _repositoryKind() { + return Repository.Kind.Azure; + } + + /** + * Required - API name: {@code settings} + */ + public final AzureRepositorySettings settings() { + return this.settings; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.write("type", "azure"); + super.serializeInternal(generator, mapper); + generator.writeKey("settings"); + this.settings.serialize(generator, mapper); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link AzureRepository}. + */ + + public static class Builder extends RepositoryBase.AbstractBuilder + implements + ObjectBuilder { + private AzureRepositorySettings settings; + + /** + * Required - API name: {@code settings} + */ + public final Builder settings(AzureRepositorySettings value) { + this.settings = value; + return this; + } + + /** + * Required - API name: {@code settings} + */ + public final Builder settings( + Function> fn) { + return this.settings(fn.apply(new AzureRepositorySettings.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link AzureRepository}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public AzureRepository build() { + _checkSingleUse(); + + return new AzureRepository(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link AzureRepository} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + AzureRepository::setupAzureRepositoryDeserializer); + + protected static void setupAzureRepositoryDeserializer(ObjectDeserializer op) { + RepositoryBase.setupRepositoryBaseDeserializer(op); + op.add(Builder::settings, AzureRepositorySettings._DESERIALIZER, "settings"); + + op.ignore("type"); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/AzureRepositorySettings.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/AzureRepositorySettings.java new file mode 100644 index 000000000..81d342bd2 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/AzureRepositorySettings.java @@ -0,0 +1,264 @@ +/* + * 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.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.String; +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.AzureRepositorySettings + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class AzureRepositorySettings extends RepositorySettingsBase { + @Nullable + private final String client; + + @Nullable + private final String container; + + @Nullable + private final String basePath; + + @Nullable + private final Boolean readonly; + + @Nullable + private final String locationMode; + + // --------------------------------------------------------------------------------------------- + + private AzureRepositorySettings(Builder builder) { + super(builder); + + this.client = builder.client; + this.container = builder.container; + this.basePath = builder.basePath; + this.readonly = builder.readonly; + this.locationMode = builder.locationMode; + + } + + public static AzureRepositorySettings of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code client} + */ + @Nullable + public final String client() { + return this.client; + } + + /** + * API name: {@code container} + */ + @Nullable + public final String container() { + return this.container; + } + + /** + * API name: {@code base_path} + */ + @Nullable + public final String basePath() { + return this.basePath; + } + + /** + * API name: {@code readonly} + */ + @Nullable + public final Boolean readonly() { + return this.readonly; + } + + /** + * API name: {@code location_mode} + */ + @Nullable + public final String locationMode() { + return this.locationMode; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + if (this.client != null) { + generator.writeKey("client"); + generator.write(this.client); + + } + if (this.container != null) { + generator.writeKey("container"); + generator.write(this.container); + + } + if (this.basePath != null) { + generator.writeKey("base_path"); + generator.write(this.basePath); + + } + if (this.readonly != null) { + generator.writeKey("readonly"); + generator.write(this.readonly); + + } + if (this.locationMode != null) { + generator.writeKey("location_mode"); + generator.write(this.locationMode); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link AzureRepositorySettings}. + */ + + public static class Builder extends RepositorySettingsBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private String client; + + @Nullable + private String container; + + @Nullable + private String basePath; + + @Nullable + private Boolean readonly; + + @Nullable + private String locationMode; + + /** + * API name: {@code client} + */ + public final Builder client(@Nullable String value) { + this.client = value; + return this; + } + + /** + * API name: {@code container} + */ + public final Builder container(@Nullable String value) { + this.container = value; + return this; + } + + /** + * API name: {@code base_path} + */ + public final Builder basePath(@Nullable String value) { + this.basePath = value; + return this; + } + + /** + * API name: {@code readonly} + */ + public final Builder readonly(@Nullable Boolean value) { + this.readonly = value; + return this; + } + + /** + * API name: {@code location_mode} + */ + public final Builder locationMode(@Nullable String value) { + this.locationMode = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link AzureRepositorySettings}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public AzureRepositorySettings build() { + _checkSingleUse(); + + return new AzureRepositorySettings(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link AzureRepositorySettings} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, AzureRepositorySettings::setupAzureRepositorySettingsDeserializer); + + protected static void setupAzureRepositorySettingsDeserializer( + ObjectDeserializer op) { + RepositorySettingsBase.setupRepositorySettingsBaseDeserializer(op); + op.add(Builder::client, JsonpDeserializer.stringDeserializer(), "client"); + op.add(Builder::container, JsonpDeserializer.stringDeserializer(), "container"); + op.add(Builder::basePath, JsonpDeserializer.stringDeserializer(), "base_path"); + op.add(Builder::readonly, JsonpDeserializer.booleanDeserializer(), "readonly"); + op.add(Builder::locationMode, JsonpDeserializer.stringDeserializer(), "location_mode"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/CreateRepositoryRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/CreateRepositoryRequest.java index 10202f902..0bb69501c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/CreateRepositoryRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/CreateRepositoryRequest.java @@ -33,6 +33,7 @@ import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; +import jakarta.json.stream.JsonParser; import java.lang.Boolean; import java.lang.String; import java.util.HashMap; @@ -72,30 +73,23 @@ public class CreateRepositoryRequest extends RequestBase implements JsonpSeriali private final String name; - @Nullable - private final Repository repository; - - private final RepositorySettings settings; - @Nullable private final Time timeout; - private final String type; - @Nullable private final Boolean verify; + private final Repository repository; + // --------------------------------------------------------------------------------------------- private CreateRepositoryRequest(Builder builder) { this.masterTimeout = builder.masterTimeout; this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.repository = builder.repository; - this.settings = ApiTypeHelper.requireNonNull(builder.settings, this, "settings"); this.timeout = builder.timeout; - this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); this.verify = builder.verify; + this.repository = ApiTypeHelper.requireNonNull(builder.repository, this, "repository"); } @@ -122,21 +116,6 @@ public final String name() { return this.name; } - /** - * API name: {@code repository} - */ - @Nullable - public final Repository repository() { - return this.repository; - } - - /** - * Required - API name: {@code settings} - */ - public final RepositorySettings settings() { - return this.settings; - } - /** * Explicit operation timeout *

@@ -147,13 +126,6 @@ public final Time timeout() { return this.timeout; } - /** - * Required - API name: {@code type} - */ - public final String type() { - return this.type; - } - /** * Whether to verify the repository after creation *

@@ -165,26 +137,17 @@ public final Boolean verify() { } /** - * Serialize this object to JSON. + * Required - Request body. */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); + public final Repository repository() { + return this.repository; } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.repository != null) { - generator.writeKey("repository"); - this.repository.serialize(generator, mapper); - - } - generator.writeKey("settings"); - this.settings.serialize(generator, mapper); - - generator.writeKey("type"); - generator.write(this.type); + /** + * Serialize this value to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + this.repository.serialize(generator, mapper); } @@ -202,19 +165,14 @@ public static class Builder extends RequestBase.AbstractBuilder private String name; - @Nullable - private Repository repository; - - private RepositorySettings settings; - @Nullable private Time timeout; - private String type; - @Nullable private Boolean verify; + private Repository repository; + /** * Explicit operation timeout for connection to master node *

@@ -244,36 +202,6 @@ public final Builder name(String value) { return this; } - /** - * API name: {@code repository} - */ - public final Builder repository(@Nullable Repository value) { - this.repository = value; - return this; - } - - /** - * API name: {@code repository} - */ - public final Builder repository(Function> fn) { - return this.repository(fn.apply(new Repository.Builder()).build()); - } - - /** - * Required - API name: {@code settings} - */ - public final Builder settings(RepositorySettings value) { - this.settings = value; - return this; - } - - /** - * Required - API name: {@code settings} - */ - public final Builder settings(Function> fn) { - return this.settings(fn.apply(new RepositorySettings.Builder()).build()); - } - /** * Explicit operation timeout *

@@ -293,14 +221,6 @@ public final Builder timeout(Function> fn) { return this.timeout(fn.apply(new Time.Builder()).build()); } - /** - * Required - API name: {@code type} - */ - public final Builder type(String value) { - this.type = value; - return this; - } - /** * Whether to verify the repository after creation *

@@ -311,6 +231,29 @@ public final Builder verify(@Nullable Boolean value) { return this; } + /** + * Required - Request body. + */ + public final Builder repository(Repository value) { + this.repository = value; + return this; + } + + /** + * Required - Request body. + */ + public final Builder repository(Function> fn) { + return this.repository(fn.apply(new Repository.Builder()).build()); + } + + @Override + public Builder withJson(JsonParser parser, JsonpMapper mapper) { + + @SuppressWarnings("unchecked") + Repository value = (Repository) Repository._DESERIALIZER.deserialize(parser, mapper); + return this.repository(value); + } + @Override protected Builder self() { return this; @@ -329,21 +272,13 @@ public CreateRepositoryRequest build() { } } - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link CreateRepositoryRequest} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, CreateRepositoryRequest::setupCreateRepositoryRequestDeserializer); - - protected static void setupCreateRepositoryRequestDeserializer( - ObjectDeserializer op) { + public static final JsonpDeserializer _DESERIALIZER = createCreateRepositoryRequestDeserializer(); + protected static JsonpDeserializer createCreateRepositoryRequestDeserializer() { - op.add(Builder::repository, Repository._DESERIALIZER, "repository"); - op.add(Builder::settings, RepositorySettings._DESERIALIZER, "settings"); - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + JsonpDeserializer valueDeserializer = Repository._DESERIALIZER; + return JsonpDeserializer.of(valueDeserializer.acceptedEvents(), (parser, mapper, event) -> new Builder() + .repository(valueDeserializer.deserialize(parser, mapper, event)).build()); } // --------------------------------------------------------------------------------------------- diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/GcsRepository.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/GcsRepository.java new file mode 100644 index 000000000..786d6a220 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/GcsRepository.java @@ -0,0 +1,157 @@ +/* + * 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.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +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.GcsRepository + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class GcsRepository extends RepositoryBase implements RepositoryVariant { + private final GcsRepositorySettings settings; + + // --------------------------------------------------------------------------------------------- + + private GcsRepository(Builder builder) { + super(builder); + + this.settings = ApiTypeHelper.requireNonNull(builder.settings, this, "settings"); + + } + + public static GcsRepository of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Repository variant kind. + */ + @Override + public Repository.Kind _repositoryKind() { + return Repository.Kind.Gcs; + } + + /** + * Required - API name: {@code settings} + */ + public final GcsRepositorySettings settings() { + return this.settings; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.write("type", "gcs"); + super.serializeInternal(generator, mapper); + generator.writeKey("settings"); + this.settings.serialize(generator, mapper); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GcsRepository}. + */ + + public static class Builder extends RepositoryBase.AbstractBuilder + implements + ObjectBuilder { + private GcsRepositorySettings settings; + + /** + * Required - API name: {@code settings} + */ + public final Builder settings(GcsRepositorySettings value) { + this.settings = value; + return this; + } + + /** + * Required - API name: {@code settings} + */ + public final Builder settings( + Function> fn) { + return this.settings(fn.apply(new GcsRepositorySettings.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link GcsRepository}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GcsRepository build() { + _checkSingleUse(); + + return new GcsRepository(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GcsRepository} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + GcsRepository::setupGcsRepositoryDeserializer); + + protected static void setupGcsRepositoryDeserializer(ObjectDeserializer op) { + RepositoryBase.setupRepositoryBaseDeserializer(op); + op.add(Builder::settings, GcsRepositorySettings._DESERIALIZER, "settings"); + + op.ignore("type"); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/GcsRepositorySettings.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/GcsRepositorySettings.java new file mode 100644 index 000000000..3bf19af9d --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/GcsRepositorySettings.java @@ -0,0 +1,259 @@ +/* + * 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.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.String; +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.GcsRepositorySettings + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class GcsRepositorySettings extends RepositorySettingsBase { + private final String bucket; + + @Nullable + private final String client; + + @Nullable + private final String basePath; + + @Nullable + private final Boolean readonly; + + @Nullable + private final String applicationName; + + // --------------------------------------------------------------------------------------------- + + private GcsRepositorySettings(Builder builder) { + super(builder); + + this.bucket = ApiTypeHelper.requireNonNull(builder.bucket, this, "bucket"); + this.client = builder.client; + this.basePath = builder.basePath; + this.readonly = builder.readonly; + this.applicationName = builder.applicationName; + + } + + public static GcsRepositorySettings of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code bucket} + */ + public final String bucket() { + return this.bucket; + } + + /** + * API name: {@code client} + */ + @Nullable + public final String client() { + return this.client; + } + + /** + * API name: {@code base_path} + */ + @Nullable + public final String basePath() { + return this.basePath; + } + + /** + * API name: {@code readonly} + */ + @Nullable + public final Boolean readonly() { + return this.readonly; + } + + /** + * API name: {@code application_name} + */ + @Nullable + public final String applicationName() { + return this.applicationName; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + generator.writeKey("bucket"); + generator.write(this.bucket); + + if (this.client != null) { + generator.writeKey("client"); + generator.write(this.client); + + } + if (this.basePath != null) { + generator.writeKey("base_path"); + generator.write(this.basePath); + + } + if (this.readonly != null) { + generator.writeKey("readonly"); + generator.write(this.readonly); + + } + if (this.applicationName != null) { + generator.writeKey("application_name"); + generator.write(this.applicationName); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GcsRepositorySettings}. + */ + + public static class Builder extends RepositorySettingsBase.AbstractBuilder + implements + ObjectBuilder { + private String bucket; + + @Nullable + private String client; + + @Nullable + private String basePath; + + @Nullable + private Boolean readonly; + + @Nullable + private String applicationName; + + /** + * Required - API name: {@code bucket} + */ + public final Builder bucket(String value) { + this.bucket = value; + return this; + } + + /** + * API name: {@code client} + */ + public final Builder client(@Nullable String value) { + this.client = value; + return this; + } + + /** + * API name: {@code base_path} + */ + public final Builder basePath(@Nullable String value) { + this.basePath = value; + return this; + } + + /** + * API name: {@code readonly} + */ + public final Builder readonly(@Nullable Boolean value) { + this.readonly = value; + return this; + } + + /** + * API name: {@code application_name} + */ + public final Builder applicationName(@Nullable String value) { + this.applicationName = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link GcsRepositorySettings}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GcsRepositorySettings build() { + _checkSingleUse(); + + return new GcsRepositorySettings(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GcsRepositorySettings} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, GcsRepositorySettings::setupGcsRepositorySettingsDeserializer); + + protected static void setupGcsRepositorySettingsDeserializer(ObjectDeserializer op) { + RepositorySettingsBase.setupRepositorySettingsBaseDeserializer(op); + op.add(Builder::bucket, JsonpDeserializer.stringDeserializer(), "bucket"); + op.add(Builder::client, JsonpDeserializer.stringDeserializer(), "client"); + op.add(Builder::basePath, JsonpDeserializer.stringDeserializer(), "base_path"); + op.add(Builder::readonly, JsonpDeserializer.booleanDeserializer(), "readonly"); + op.add(Builder::applicationName, JsonpDeserializer.stringDeserializer(), "application_name"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/ReadOnlyUrlRepository.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/ReadOnlyUrlRepository.java new file mode 100644 index 000000000..000230998 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/ReadOnlyUrlRepository.java @@ -0,0 +1,158 @@ +/* + * 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.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +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.ReadOnlyUrlRepository + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class ReadOnlyUrlRepository extends RepositoryBase implements RepositoryVariant { + private final ReadOnlyUrlRepositorySettings settings; + + // --------------------------------------------------------------------------------------------- + + private ReadOnlyUrlRepository(Builder builder) { + super(builder); + + this.settings = ApiTypeHelper.requireNonNull(builder.settings, this, "settings"); + + } + + public static ReadOnlyUrlRepository of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Repository variant kind. + */ + @Override + public Repository.Kind _repositoryKind() { + return Repository.Kind.Url; + } + + /** + * Required - API name: {@code settings} + */ + public final ReadOnlyUrlRepositorySettings settings() { + return this.settings; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.write("type", "url"); + super.serializeInternal(generator, mapper); + generator.writeKey("settings"); + this.settings.serialize(generator, mapper); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ReadOnlyUrlRepository}. + */ + + public static class Builder extends RepositoryBase.AbstractBuilder + implements + ObjectBuilder { + private ReadOnlyUrlRepositorySettings settings; + + /** + * Required - API name: {@code settings} + */ + public final Builder settings(ReadOnlyUrlRepositorySettings value) { + this.settings = value; + return this; + } + + /** + * Required - API name: {@code settings} + */ + public final Builder settings( + Function> fn) { + return this.settings(fn.apply(new ReadOnlyUrlRepositorySettings.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ReadOnlyUrlRepository}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ReadOnlyUrlRepository build() { + _checkSingleUse(); + + return new ReadOnlyUrlRepository(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ReadOnlyUrlRepository} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, ReadOnlyUrlRepository::setupReadOnlyUrlRepositoryDeserializer); + + protected static void setupReadOnlyUrlRepositoryDeserializer(ObjectDeserializer op) { + RepositoryBase.setupRepositoryBaseDeserializer(op); + op.add(Builder::settings, ReadOnlyUrlRepositorySettings._DESERIALIZER, "settings"); + + op.ignore("type"); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/ReadOnlyUrlRepositorySettings.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/ReadOnlyUrlRepositorySettings.java new file mode 100644 index 000000000..1383a93af --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/ReadOnlyUrlRepositorySettings.java @@ -0,0 +1,238 @@ +/* + * 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.elasticsearch._types.Time; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +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 jakarta.json.stream.JsonGenerator; +import java.lang.Integer; +import java.lang.String; +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.ReadOnlyUrlRepositorySettings + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class ReadOnlyUrlRepositorySettings extends RepositorySettingsBase { + @Nullable + private final Integer httpMaxRetries; + + @Nullable + private final Time httpSocketTimeout; + + @Nullable + private final Integer maxNumberOfSnapshots; + + private final String url; + + // --------------------------------------------------------------------------------------------- + + private ReadOnlyUrlRepositorySettings(Builder builder) { + super(builder); + + this.httpMaxRetries = builder.httpMaxRetries; + this.httpSocketTimeout = builder.httpSocketTimeout; + this.maxNumberOfSnapshots = builder.maxNumberOfSnapshots; + this.url = ApiTypeHelper.requireNonNull(builder.url, this, "url"); + + } + + public static ReadOnlyUrlRepositorySettings of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code http_max_retries} + */ + @Nullable + public final Integer httpMaxRetries() { + return this.httpMaxRetries; + } + + /** + * API name: {@code http_socket_timeout} + */ + @Nullable + public final Time httpSocketTimeout() { + return this.httpSocketTimeout; + } + + /** + * API name: {@code max_number_of_snapshots} + */ + @Nullable + public final Integer maxNumberOfSnapshots() { + return this.maxNumberOfSnapshots; + } + + /** + * Required - API name: {@code url} + */ + public final String url() { + return this.url; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + if (this.httpMaxRetries != null) { + generator.writeKey("http_max_retries"); + generator.write(this.httpMaxRetries); + + } + if (this.httpSocketTimeout != null) { + generator.writeKey("http_socket_timeout"); + this.httpSocketTimeout.serialize(generator, mapper); + + } + if (this.maxNumberOfSnapshots != null) { + generator.writeKey("max_number_of_snapshots"); + generator.write(this.maxNumberOfSnapshots); + + } + generator.writeKey("url"); + generator.write(this.url); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ReadOnlyUrlRepositorySettings}. + */ + + public static class Builder extends RepositorySettingsBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private Integer httpMaxRetries; + + @Nullable + private Time httpSocketTimeout; + + @Nullable + private Integer maxNumberOfSnapshots; + + private String url; + + /** + * API name: {@code http_max_retries} + */ + public final Builder httpMaxRetries(@Nullable Integer value) { + this.httpMaxRetries = value; + return this; + } + + /** + * API name: {@code http_socket_timeout} + */ + public final Builder httpSocketTimeout(@Nullable Time value) { + this.httpSocketTimeout = value; + return this; + } + + /** + * API name: {@code http_socket_timeout} + */ + public final Builder httpSocketTimeout(Function> fn) { + return this.httpSocketTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * API name: {@code max_number_of_snapshots} + */ + public final Builder maxNumberOfSnapshots(@Nullable Integer value) { + this.maxNumberOfSnapshots = value; + return this; + } + + /** + * Required - API name: {@code url} + */ + public final Builder url(String value) { + this.url = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ReadOnlyUrlRepositorySettings}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ReadOnlyUrlRepositorySettings build() { + _checkSingleUse(); + + return new ReadOnlyUrlRepositorySettings(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ReadOnlyUrlRepositorySettings} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, ReadOnlyUrlRepositorySettings::setupReadOnlyUrlRepositorySettingsDeserializer); + + protected static void setupReadOnlyUrlRepositorySettingsDeserializer( + ObjectDeserializer op) { + RepositorySettingsBase.setupRepositorySettingsBaseDeserializer(op); + op.add(Builder::httpMaxRetries, JsonpDeserializer.integerDeserializer(), "http_max_retries"); + op.add(Builder::httpSocketTimeout, Time._DESERIALIZER, "http_socket_timeout"); + op.add(Builder::maxNumberOfSnapshots, JsonpDeserializer.integerDeserializer(), "max_number_of_snapshots"); + op.add(Builder::url, JsonpDeserializer.stringDeserializer(), "url"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/Repository.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/Repository.java index 30f5fcf32..466cc939f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/Repository.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/Repository.java @@ -19,6 +19,8 @@ package co.elastic.clients.elasticsearch.snapshot; +import co.elastic.clients.json.JsonData; +import co.elastic.clients.json.JsonEnum; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -28,9 +30,11 @@ import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.OpenTaggedUnion; +import co.elastic.clients.util.TaggedUnionUtils; import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; -import java.lang.String; +import java.lang.Object; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -58,21 +62,71 @@ * specification */ @JsonpDeserializable -public class Repository implements JsonpSerializable { - private final String type; +public class Repository implements OpenTaggedUnion, JsonpSerializable { - @Nullable - private final String uuid; + /** + * {@link Repository} variant kinds. + * + * @see API + * specification + */ + + public enum Kind implements JsonEnum { + Azure("azure"), + + Gcs("gcs"), + + Url("url"), + + S3("s3"), + + Fs("fs"), + + Source("source"), + + /** A custom {@code Repository} defined by a plugin */ + _Custom(null) + + ; + + private final String jsonValue; + + Kind(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + } + + private final Kind _kind; + private final Object _value; - private final RepositorySettings settings; + @Override + public final Kind _kind() { + return _kind; + } - // --------------------------------------------------------------------------------------------- + @Override + public final Object _get() { + return _value; + } + + public Repository(RepositoryVariant value) { + + this._kind = ApiTypeHelper.requireNonNull(value._repositoryKind(), this, ""); + this._value = ApiTypeHelper.requireNonNull(value, this, ""); + this._customKind = null; + + } private Repository(Builder builder) { - this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - this.uuid = builder.uuid; - this.settings = ApiTypeHelper.requireNonNull(builder.settings, this, "settings"); + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + this._customKind = builder._customKind; } @@ -81,133 +135,271 @@ public static Repository of(Function> fn) { } /** - * Required - API name: {@code type} + * Build a custom plugin-defined {@code Repository}, given its kind and some + * JSON data */ - public final String type() { - return this.type; + public Repository(String kind, JsonData value) { + this._kind = Kind._Custom; + this._value = value; + this._customKind = kind; } /** - * API name: {@code uuid} + * Is this variant instance of kind {@code azure}? */ - @Nullable - public final String uuid() { - return this.uuid; + public boolean isAzure() { + return _kind == Kind.Azure; } /** - * Required - API name: {@code settings} + * Get the {@code azure} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code azure} kind. */ - public final RepositorySettings settings() { - return this.settings; + public AzureRepository azure() { + return TaggedUnionUtils.get(this, Kind.Azure); } /** - * Serialize this object to JSON. + * Is this variant instance of kind {@code gcs}? */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); + public boolean isGcs() { + return _kind == Kind.Gcs; + } + + /** + * Get the {@code gcs} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code gcs} kind. + */ + public GcsRepository gcs() { + return TaggedUnionUtils.get(this, Kind.Gcs); } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + /** + * Is this variant instance of kind {@code url}? + */ + public boolean isUrl() { + return _kind == Kind.Url; + } - generator.writeKey("type"); - generator.write(this.type); + /** + * Get the {@code url} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code url} kind. + */ + public ReadOnlyUrlRepository url() { + return TaggedUnionUtils.get(this, Kind.Url); + } - if (this.uuid != null) { - generator.writeKey("uuid"); - generator.write(this.uuid); + /** + * Is this variant instance of kind {@code s3}? + */ + public boolean isS3() { + return _kind == Kind.S3; + } - } - generator.writeKey("settings"); - this.settings.serialize(generator, mapper); + /** + * Get the {@code s3} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code s3} kind. + */ + public S3Repository s3() { + return TaggedUnionUtils.get(this, Kind.S3); + } + /** + * Is this variant instance of kind {@code fs}? + */ + public boolean isFs() { + return _kind == Kind.Fs; } - @Override - public String toString() { - return JsonpUtils.toString(this); + /** + * Get the {@code fs} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code fs} kind. + */ + public SharedFileSystemRepository fs() { + return TaggedUnionUtils.get(this, Kind.Fs); + } + + /** + * Is this variant instance of kind {@code source}? + */ + public boolean isSource() { + return _kind == Kind.Source; + } + + /** + * Get the {@code source} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code source} kind. + */ + public SourceOnlyRepository source() { + return TaggedUnionUtils.get(this, Kind.Source); } - // --------------------------------------------------------------------------------------------- + @Nullable + private final String _customKind; + + /** + * Is this a custom {@code Repository} defined by a plugin? + */ + public boolean _isCustom() { + return _kind == Kind._Custom; + } /** - * Builder for {@link Repository}. + * Get the actual kind when {@code _kind()} equals {@link Kind#_Custom} + * (plugin-defined variant). */ + @Nullable + public final String _customKind() { + return _customKind; + } + + /** + * Get the custom plugin-defined variant value. + * + * @throws IllegalStateException + * if the current variant is not {@link Kind#_Custom}. + */ + public JsonData _custom() { + return TaggedUnionUtils.get(this, Kind._Custom); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + + mapper.serialize(_value, generator); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private String type; + private Kind _kind; + private Object _value; + private String _customKind; + + @Override + protected Builder self() { + return this; + } + public ObjectBuilder azure(AzureRepository v) { + this._kind = Kind.Azure; + this._value = v; + return this; + } - @Nullable - private String uuid; + public ObjectBuilder azure(Function> fn) { + return this.azure(fn.apply(new AzureRepository.Builder()).build()); + } - private RepositorySettings settings; + public ObjectBuilder gcs(GcsRepository v) { + this._kind = Kind.Gcs; + this._value = v; + return this; + } - /** - * Required - API name: {@code type} - */ - public final Builder type(String value) { - this.type = value; + public ObjectBuilder gcs(Function> fn) { + return this.gcs(fn.apply(new GcsRepository.Builder()).build()); + } + + public ObjectBuilder url(ReadOnlyUrlRepository v) { + this._kind = Kind.Url; + this._value = v; return this; } - /** - * API name: {@code uuid} - */ - public final Builder uuid(@Nullable String value) { - this.uuid = value; + public ObjectBuilder url( + Function> fn) { + return this.url(fn.apply(new ReadOnlyUrlRepository.Builder()).build()); + } + + public ObjectBuilder s3(S3Repository v) { + this._kind = Kind.S3; + this._value = v; return this; } - /** - * Required - API name: {@code settings} - */ - public final Builder settings(RepositorySettings value) { - this.settings = value; + public ObjectBuilder s3(Function> fn) { + return this.s3(fn.apply(new S3Repository.Builder()).build()); + } + + public ObjectBuilder fs(SharedFileSystemRepository v) { + this._kind = Kind.Fs; + this._value = v; return this; } - /** - * Required - API name: {@code settings} - */ - public final Builder settings(Function> fn) { - return this.settings(fn.apply(new RepositorySettings.Builder()).build()); + public ObjectBuilder fs( + Function> fn) { + return this.fs(fn.apply(new SharedFileSystemRepository.Builder()).build()); } - @Override - protected Builder self() { + public ObjectBuilder source(SourceOnlyRepository v) { + this._kind = Kind.Source; + this._value = v; return this; } + public ObjectBuilder source( + Function> fn) { + return this.source(fn.apply(new SourceOnlyRepository.Builder()).build()); + } + /** - * Builds a {@link Repository}. + * Define this {@code Repository} as a plugin-defined variant. * - * @throws NullPointerException - * if some of the required fields are null. + * @param name + * the plugin-defined identifier + * @param data + * the data for this custom {@code Repository}. It is converted + * internally to {@link JsonData}. */ + public ObjectBuilder _custom(String name, Object data) { + this._kind = Kind._Custom; + this._customKind = name; + this._value = JsonData.of(data); + return this; + } + public Repository build() { _checkSingleUse(); - return new Repository(this); } + } - // --------------------------------------------------------------------------------------------- + protected static void setupRepositoryDeserializer(ObjectDeserializer op) { - /** - * Json deserializer for {@link Repository} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Repository::setupRepositoryDeserializer); + op.add(Builder::azure, AzureRepository._DESERIALIZER, "azure"); + op.add(Builder::gcs, GcsRepository._DESERIALIZER, "gcs"); + op.add(Builder::url, ReadOnlyUrlRepository._DESERIALIZER, "url"); + op.add(Builder::s3, S3Repository._DESERIALIZER, "s3"); + op.add(Builder::fs, SharedFileSystemRepository._DESERIALIZER, "fs"); + op.add(Builder::source, SourceOnlyRepository._DESERIALIZER, "source"); - protected static void setupRepositoryDeserializer(ObjectDeserializer op) { + op.setUnknownFieldHandler((builder, name, parser, mapper) -> { + JsonpUtils.ensureCustomVariantsAllowed(parser, mapper); + builder._custom(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); + }); - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); - op.add(Builder::uuid, JsonpDeserializer.stringDeserializer(), "uuid"); - op.add(Builder::settings, RepositorySettings._DESERIALIZER, "settings"); + op.setTypeProperty("type", null); } + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + Repository::setupRepositoryDeserializer, Builder::build); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RepositoryBase.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RepositoryBase.java new file mode 100644 index 000000000..e1d203b85 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RepositoryBase.java @@ -0,0 +1,129 @@ +/* + * 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.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Objects; +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.RepositoryBase + +/** + * + * @see API + * specification + */ + +public abstract class RepositoryBase implements JsonpSerializable { + @Nullable + private final String uuid; + + // --------------------------------------------------------------------------------------------- + + protected RepositoryBase(AbstractBuilder builder) { + + this.uuid = builder.uuid; + + } + + /** + * API name: {@code uuid} + */ + @Nullable + 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) { + + if (this.uuid != null) { + generator.writeKey("uuid"); + generator.write(this.uuid); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + public abstract static class AbstractBuilder> + extends + WithJsonObjectBuilderBase { + @Nullable + private String uuid; + + /** + * API name: {@code uuid} + */ + public final BuilderT uuid(@Nullable String value) { + this.uuid = value; + return self(); + } + + protected abstract BuilderT self(); + + } + + // --------------------------------------------------------------------------------------------- + protected static > void setupRepositoryBaseDeserializer( + ObjectDeserializer op) { + + op.add(AbstractBuilder::uuid, JsonpDeserializer.stringDeserializer(), "uuid"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RepositoryBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RepositoryBuilders.java new file mode 100644 index 000000000..fc37c5046 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RepositoryBuilders.java @@ -0,0 +1,155 @@ +/* + * 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.util.ObjectBuilder; +import java.util.function.Function; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * Builders for {@link Repository} variants. + */ +public class RepositoryBuilders { + private RepositoryBuilders() { + } + + /** + * Creates a builder for the {@link AzureRepository azure} {@code Repository} + * variant. + */ + public static AzureRepository.Builder azure() { + return new AzureRepository.Builder(); + } + + /** + * Creates a Repository of the {@link AzureRepository azure} {@code Repository} + * variant. + */ + public static Repository azure(Function> fn) { + Repository.Builder builder = new Repository.Builder(); + builder.azure(fn.apply(new AzureRepository.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link GcsRepository gcs} {@code Repository} + * variant. + */ + public static GcsRepository.Builder gcs() { + return new GcsRepository.Builder(); + } + + /** + * Creates a Repository of the {@link GcsRepository gcs} {@code Repository} + * variant. + */ + public static Repository gcs(Function> fn) { + Repository.Builder builder = new Repository.Builder(); + builder.gcs(fn.apply(new GcsRepository.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link ReadOnlyUrlRepository url} + * {@code Repository} variant. + */ + public static ReadOnlyUrlRepository.Builder url() { + return new ReadOnlyUrlRepository.Builder(); + } + + /** + * Creates a Repository of the {@link ReadOnlyUrlRepository url} + * {@code Repository} variant. + */ + public static Repository url(Function> fn) { + Repository.Builder builder = new Repository.Builder(); + builder.url(fn.apply(new ReadOnlyUrlRepository.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link S3Repository s3} {@code Repository} variant. + */ + public static S3Repository.Builder s3() { + return new S3Repository.Builder(); + } + + /** + * Creates a Repository of the {@link S3Repository s3} {@code Repository} + * variant. + */ + public static Repository s3(Function> fn) { + Repository.Builder builder = new Repository.Builder(); + builder.s3(fn.apply(new S3Repository.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link SharedFileSystemRepository fs} + * {@code Repository} variant. + */ + public static SharedFileSystemRepository.Builder fs() { + return new SharedFileSystemRepository.Builder(); + } + + /** + * Creates a Repository of the {@link SharedFileSystemRepository fs} + * {@code Repository} variant. + */ + public static Repository fs( + Function> fn) { + Repository.Builder builder = new Repository.Builder(); + builder.fs(fn.apply(new SharedFileSystemRepository.Builder()).build()); + return builder.build(); + } + + /** + * Creates a builder for the {@link SourceOnlyRepository source} + * {@code Repository} variant. + */ + public static SourceOnlyRepository.Builder source() { + return new SourceOnlyRepository.Builder(); + } + + /** + * Creates a Repository of the {@link SourceOnlyRepository source} + * {@code Repository} variant. + */ + public static Repository source(Function> fn) { + Repository.Builder builder = new Repository.Builder(); + builder.source(fn.apply(new SourceOnlyRepository.Builder()).build()); + return builder.build(); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RepositorySettingsBase.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RepositorySettingsBase.java new file mode 100644 index 000000000..772913e94 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RepositorySettingsBase.java @@ -0,0 +1,220 @@ +/* + * 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.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.String; +import java.util.Objects; +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.RepositorySettingsBase + +/** + * + * @see API + * specification + */ + +public abstract class RepositorySettingsBase implements JsonpSerializable { + @Nullable + private final String chunkSize; + + @Nullable + private final Boolean compress; + + @Nullable + private final String maxRestoreBytesPerSec; + + @Nullable + private final String maxSnapshotBytesPerSec; + + // --------------------------------------------------------------------------------------------- + + protected RepositorySettingsBase(AbstractBuilder builder) { + + this.chunkSize = builder.chunkSize; + this.compress = builder.compress; + this.maxRestoreBytesPerSec = builder.maxRestoreBytesPerSec; + this.maxSnapshotBytesPerSec = builder.maxSnapshotBytesPerSec; + + } + + /** + * API name: {@code chunk_size} + */ + @Nullable + public final String chunkSize() { + return this.chunkSize; + } + + /** + * API name: {@code compress} + */ + @Nullable + public final Boolean compress() { + return this.compress; + } + + /** + * API name: {@code max_restore_bytes_per_sec} + */ + @Nullable + public final String maxRestoreBytesPerSec() { + return this.maxRestoreBytesPerSec; + } + + /** + * API name: {@code max_snapshot_bytes_per_sec} + */ + @Nullable + public final String maxSnapshotBytesPerSec() { + return this.maxSnapshotBytesPerSec; + } + + /** + * 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.chunkSize != null) { + generator.writeKey("chunk_size"); + generator.write(this.chunkSize); + + } + if (this.compress != null) { + generator.writeKey("compress"); + generator.write(this.compress); + + } + if (this.maxRestoreBytesPerSec != null) { + generator.writeKey("max_restore_bytes_per_sec"); + generator.write(this.maxRestoreBytesPerSec); + + } + if (this.maxSnapshotBytesPerSec != null) { + generator.writeKey("max_snapshot_bytes_per_sec"); + generator.write(this.maxSnapshotBytesPerSec); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + public abstract static class AbstractBuilder> + extends + WithJsonObjectBuilderBase { + @Nullable + private String chunkSize; + + @Nullable + private Boolean compress; + + @Nullable + private String maxRestoreBytesPerSec; + + @Nullable + private String maxSnapshotBytesPerSec; + + /** + * API name: {@code chunk_size} + */ + public final BuilderT chunkSize(@Nullable String value) { + this.chunkSize = value; + return self(); + } + + /** + * API name: {@code compress} + */ + public final BuilderT compress(@Nullable Boolean value) { + this.compress = value; + return self(); + } + + /** + * API name: {@code max_restore_bytes_per_sec} + */ + public final BuilderT maxRestoreBytesPerSec(@Nullable String value) { + this.maxRestoreBytesPerSec = value; + return self(); + } + + /** + * API name: {@code max_snapshot_bytes_per_sec} + */ + public final BuilderT maxSnapshotBytesPerSec(@Nullable String value) { + this.maxSnapshotBytesPerSec = value; + return self(); + } + + protected abstract BuilderT self(); + + } + + // --------------------------------------------------------------------------------------------- + protected static > void setupRepositorySettingsBaseDeserializer( + ObjectDeserializer op) { + + op.add(AbstractBuilder::chunkSize, JsonpDeserializer.stringDeserializer(), "chunk_size"); + op.add(AbstractBuilder::compress, JsonpDeserializer.booleanDeserializer(), "compress"); + op.add(AbstractBuilder::maxRestoreBytesPerSec, JsonpDeserializer.stringDeserializer(), + "max_restore_bytes_per_sec"); + op.add(AbstractBuilder::maxSnapshotBytesPerSec, JsonpDeserializer.stringDeserializer(), + "max_snapshot_bytes_per_sec"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RepositoryVariant.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RepositoryVariant.java new file mode 100644 index 000000000..1ac913457 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/RepositoryVariant.java @@ -0,0 +1,50 @@ +/* + * 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.JsonpSerializable; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * Base interface for {@link Repository} variants. + */ +public interface RepositoryVariant extends JsonpSerializable { + + Repository.Kind _repositoryKind(); + + default Repository _toRepository() { + return new Repository(this); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/S3Repository.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/S3Repository.java new file mode 100644 index 000000000..8e8e359a3 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/S3Repository.java @@ -0,0 +1,154 @@ +/* + * 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.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +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.S3Repository + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class S3Repository extends RepositoryBase implements RepositoryVariant { + private final S3RepositorySettings settings; + + // --------------------------------------------------------------------------------------------- + + private S3Repository(Builder builder) { + super(builder); + + this.settings = ApiTypeHelper.requireNonNull(builder.settings, this, "settings"); + + } + + public static S3Repository of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Repository variant kind. + */ + @Override + public Repository.Kind _repositoryKind() { + return Repository.Kind.S3; + } + + /** + * Required - API name: {@code settings} + */ + public final S3RepositorySettings settings() { + return this.settings; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.write("type", "s3"); + super.serializeInternal(generator, mapper); + generator.writeKey("settings"); + this.settings.serialize(generator, mapper); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link S3Repository}. + */ + + public static class Builder extends RepositoryBase.AbstractBuilder implements ObjectBuilder { + private S3RepositorySettings settings; + + /** + * Required - API name: {@code settings} + */ + public final Builder settings(S3RepositorySettings value) { + this.settings = value; + return this; + } + + /** + * Required - API name: {@code settings} + */ + public final Builder settings(Function> fn) { + return this.settings(fn.apply(new S3RepositorySettings.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link S3Repository}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public S3Repository build() { + _checkSingleUse(); + + return new S3Repository(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link S3Repository} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + S3Repository::setupS3RepositoryDeserializer); + + protected static void setupS3RepositoryDeserializer(ObjectDeserializer op) { + RepositoryBase.setupRepositoryBaseDeserializer(op); + op.add(Builder::settings, S3RepositorySettings._DESERIALIZER, "settings"); + + op.ignore("type"); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/S3RepositorySettings.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/S3RepositorySettings.java new file mode 100644 index 000000000..3b1b6928c --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/S3RepositorySettings.java @@ -0,0 +1,346 @@ +/* + * 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.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.String; +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.S3RepositorySettings + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class S3RepositorySettings extends RepositorySettingsBase { + private final String bucket; + + @Nullable + private final String client; + + @Nullable + private final String basePath; + + @Nullable + private final Boolean readonly; + + @Nullable + private final Boolean serverSideEncryption; + + @Nullable + private final String bufferSize; + + @Nullable + private final String cannedAcl; + + @Nullable + private final String storageClass; + + // --------------------------------------------------------------------------------------------- + + private S3RepositorySettings(Builder builder) { + super(builder); + + this.bucket = ApiTypeHelper.requireNonNull(builder.bucket, this, "bucket"); + this.client = builder.client; + this.basePath = builder.basePath; + this.readonly = builder.readonly; + this.serverSideEncryption = builder.serverSideEncryption; + this.bufferSize = builder.bufferSize; + this.cannedAcl = builder.cannedAcl; + this.storageClass = builder.storageClass; + + } + + public static S3RepositorySettings of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code bucket} + */ + public final String bucket() { + return this.bucket; + } + + /** + * API name: {@code client} + */ + @Nullable + public final String client() { + return this.client; + } + + /** + * API name: {@code base_path} + */ + @Nullable + public final String basePath() { + return this.basePath; + } + + /** + * API name: {@code readonly} + */ + @Nullable + public final Boolean readonly() { + return this.readonly; + } + + /** + * API name: {@code server_side_encryption} + */ + @Nullable + public final Boolean serverSideEncryption() { + return this.serverSideEncryption; + } + + /** + * API name: {@code buffer_size} + */ + @Nullable + public final String bufferSize() { + return this.bufferSize; + } + + /** + * API name: {@code canned_acl} + */ + @Nullable + public final String cannedAcl() { + return this.cannedAcl; + } + + /** + * API name: {@code storage_class} + */ + @Nullable + public final String storageClass() { + return this.storageClass; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + generator.writeKey("bucket"); + generator.write(this.bucket); + + if (this.client != null) { + generator.writeKey("client"); + generator.write(this.client); + + } + if (this.basePath != null) { + generator.writeKey("base_path"); + generator.write(this.basePath); + + } + if (this.readonly != null) { + generator.writeKey("readonly"); + generator.write(this.readonly); + + } + if (this.serverSideEncryption != null) { + generator.writeKey("server_side_encryption"); + generator.write(this.serverSideEncryption); + + } + if (this.bufferSize != null) { + generator.writeKey("buffer_size"); + generator.write(this.bufferSize); + + } + if (this.cannedAcl != null) { + generator.writeKey("canned_acl"); + generator.write(this.cannedAcl); + + } + if (this.storageClass != null) { + generator.writeKey("storage_class"); + generator.write(this.storageClass); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link S3RepositorySettings}. + */ + + public static class Builder extends RepositorySettingsBase.AbstractBuilder + implements + ObjectBuilder { + private String bucket; + + @Nullable + private String client; + + @Nullable + private String basePath; + + @Nullable + private Boolean readonly; + + @Nullable + private Boolean serverSideEncryption; + + @Nullable + private String bufferSize; + + @Nullable + private String cannedAcl; + + @Nullable + private String storageClass; + + /** + * Required - API name: {@code bucket} + */ + public final Builder bucket(String value) { + this.bucket = value; + return this; + } + + /** + * API name: {@code client} + */ + public final Builder client(@Nullable String value) { + this.client = value; + return this; + } + + /** + * API name: {@code base_path} + */ + public final Builder basePath(@Nullable String value) { + this.basePath = value; + return this; + } + + /** + * API name: {@code readonly} + */ + public final Builder readonly(@Nullable Boolean value) { + this.readonly = value; + return this; + } + + /** + * API name: {@code server_side_encryption} + */ + public final Builder serverSideEncryption(@Nullable Boolean value) { + this.serverSideEncryption = value; + return this; + } + + /** + * API name: {@code buffer_size} + */ + public final Builder bufferSize(@Nullable String value) { + this.bufferSize = value; + return this; + } + + /** + * API name: {@code canned_acl} + */ + public final Builder cannedAcl(@Nullable String value) { + this.cannedAcl = value; + return this; + } + + /** + * API name: {@code storage_class} + */ + public final Builder storageClass(@Nullable String value) { + this.storageClass = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link S3RepositorySettings}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public S3RepositorySettings build() { + _checkSingleUse(); + + return new S3RepositorySettings(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link S3RepositorySettings} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, S3RepositorySettings::setupS3RepositorySettingsDeserializer); + + protected static void setupS3RepositorySettingsDeserializer(ObjectDeserializer op) { + RepositorySettingsBase.setupRepositorySettingsBaseDeserializer(op); + op.add(Builder::bucket, JsonpDeserializer.stringDeserializer(), "bucket"); + op.add(Builder::client, JsonpDeserializer.stringDeserializer(), "client"); + op.add(Builder::basePath, JsonpDeserializer.stringDeserializer(), "base_path"); + op.add(Builder::readonly, JsonpDeserializer.booleanDeserializer(), "readonly"); + op.add(Builder::serverSideEncryption, JsonpDeserializer.booleanDeserializer(), "server_side_encryption"); + op.add(Builder::bufferSize, JsonpDeserializer.stringDeserializer(), "buffer_size"); + op.add(Builder::cannedAcl, JsonpDeserializer.stringDeserializer(), "canned_acl"); + op.add(Builder::storageClass, JsonpDeserializer.stringDeserializer(), "storage_class"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/SharedFileSystemRepository.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/SharedFileSystemRepository.java new file mode 100644 index 000000000..03ba8f085 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/SharedFileSystemRepository.java @@ -0,0 +1,159 @@ +/* + * 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.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +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.SharedFileSystemRepository + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class SharedFileSystemRepository extends RepositoryBase implements RepositoryVariant { + private final SharedFileSystemRepositorySettings settings; + + // --------------------------------------------------------------------------------------------- + + private SharedFileSystemRepository(Builder builder) { + super(builder); + + this.settings = ApiTypeHelper.requireNonNull(builder.settings, this, "settings"); + + } + + public static SharedFileSystemRepository of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Repository variant kind. + */ + @Override + public Repository.Kind _repositoryKind() { + return Repository.Kind.Fs; + } + + /** + * Required - API name: {@code settings} + */ + public final SharedFileSystemRepositorySettings settings() { + return this.settings; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.write("type", "fs"); + super.serializeInternal(generator, mapper); + generator.writeKey("settings"); + this.settings.serialize(generator, mapper); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SharedFileSystemRepository}. + */ + + public static class Builder extends RepositoryBase.AbstractBuilder + implements + ObjectBuilder { + private SharedFileSystemRepositorySettings settings; + + /** + * Required - API name: {@code settings} + */ + public final Builder settings(SharedFileSystemRepositorySettings value) { + this.settings = value; + return this; + } + + /** + * Required - API name: {@code settings} + */ + public final Builder settings( + Function> fn) { + return this.settings(fn.apply(new SharedFileSystemRepositorySettings.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link SharedFileSystemRepository}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SharedFileSystemRepository build() { + _checkSingleUse(); + + return new SharedFileSystemRepository(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SharedFileSystemRepository} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SharedFileSystemRepository::setupSharedFileSystemRepositoryDeserializer); + + protected static void setupSharedFileSystemRepositoryDeserializer( + ObjectDeserializer op) { + RepositoryBase.setupRepositoryBaseDeserializer(op); + op.add(Builder::settings, SharedFileSystemRepositorySettings._DESERIALIZER, "settings"); + + op.ignore("type"); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/SharedFileSystemRepositorySettings.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/SharedFileSystemRepositorySettings.java new file mode 100644 index 000000000..dfe78cebc --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/SharedFileSystemRepositorySettings.java @@ -0,0 +1,205 @@ +/* + * 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.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.Integer; +import java.lang.String; +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.SharedFileSystemRepositorySettings + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class SharedFileSystemRepositorySettings extends RepositorySettingsBase { + private final String location; + + @Nullable + private final Integer maxNumberOfSnapshots; + + @Nullable + private final Boolean readonly; + + // --------------------------------------------------------------------------------------------- + + private SharedFileSystemRepositorySettings(Builder builder) { + super(builder); + + this.location = ApiTypeHelper.requireNonNull(builder.location, this, "location"); + this.maxNumberOfSnapshots = builder.maxNumberOfSnapshots; + this.readonly = builder.readonly; + + } + + public static SharedFileSystemRepositorySettings of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code location} + */ + public final String location() { + return this.location; + } + + /** + * API name: {@code max_number_of_snapshots} + */ + @Nullable + public final Integer maxNumberOfSnapshots() { + return this.maxNumberOfSnapshots; + } + + /** + * API name: {@code readonly} + */ + @Nullable + public final Boolean readonly() { + return this.readonly; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + generator.writeKey("location"); + generator.write(this.location); + + if (this.maxNumberOfSnapshots != null) { + generator.writeKey("max_number_of_snapshots"); + generator.write(this.maxNumberOfSnapshots); + + } + if (this.readonly != null) { + generator.writeKey("readonly"); + generator.write(this.readonly); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SharedFileSystemRepositorySettings}. + */ + + public static class Builder extends RepositorySettingsBase.AbstractBuilder + implements + ObjectBuilder { + private String location; + + @Nullable + private Integer maxNumberOfSnapshots; + + @Nullable + private Boolean readonly; + + /** + * Required - API name: {@code location} + */ + public final Builder location(String value) { + this.location = value; + return this; + } + + /** + * API name: {@code max_number_of_snapshots} + */ + public final Builder maxNumberOfSnapshots(@Nullable Integer value) { + this.maxNumberOfSnapshots = value; + return this; + } + + /** + * API name: {@code readonly} + */ + public final Builder readonly(@Nullable Boolean value) { + this.readonly = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link SharedFileSystemRepositorySettings}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SharedFileSystemRepositorySettings build() { + _checkSingleUse(); + + return new SharedFileSystemRepositorySettings(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SharedFileSystemRepositorySettings} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, + SharedFileSystemRepositorySettings::setupSharedFileSystemRepositorySettingsDeserializer); + + protected static void setupSharedFileSystemRepositorySettingsDeserializer( + ObjectDeserializer op) { + RepositorySettingsBase.setupRepositorySettingsBaseDeserializer(op); + op.add(Builder::location, JsonpDeserializer.stringDeserializer(), "location"); + op.add(Builder::maxNumberOfSnapshots, JsonpDeserializer.integerDeserializer(), "max_number_of_snapshots"); + op.add(Builder::readonly, JsonpDeserializer.booleanDeserializer(), "readonly"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/SourceOnlyRepository.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/SourceOnlyRepository.java new file mode 100644 index 000000000..97a29ae24 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/SourceOnlyRepository.java @@ -0,0 +1,158 @@ +/* + * 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.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +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.SourceOnlyRepository + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class SourceOnlyRepository extends RepositoryBase implements RepositoryVariant { + private final SourceOnlyRepositorySettings settings; + + // --------------------------------------------------------------------------------------------- + + private SourceOnlyRepository(Builder builder) { + super(builder); + + this.settings = ApiTypeHelper.requireNonNull(builder.settings, this, "settings"); + + } + + public static SourceOnlyRepository of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Repository variant kind. + */ + @Override + public Repository.Kind _repositoryKind() { + return Repository.Kind.Source; + } + + /** + * Required - API name: {@code settings} + */ + public final SourceOnlyRepositorySettings settings() { + return this.settings; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.write("type", "source"); + super.serializeInternal(generator, mapper); + generator.writeKey("settings"); + this.settings.serialize(generator, mapper); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SourceOnlyRepository}. + */ + + public static class Builder extends RepositoryBase.AbstractBuilder + implements + ObjectBuilder { + private SourceOnlyRepositorySettings settings; + + /** + * Required - API name: {@code settings} + */ + public final Builder settings(SourceOnlyRepositorySettings value) { + this.settings = value; + return this; + } + + /** + * Required - API name: {@code settings} + */ + public final Builder settings( + Function> fn) { + return this.settings(fn.apply(new SourceOnlyRepositorySettings.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link SourceOnlyRepository}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SourceOnlyRepository build() { + _checkSingleUse(); + + return new SourceOnlyRepository(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SourceOnlyRepository} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SourceOnlyRepository::setupSourceOnlyRepositoryDeserializer); + + protected static void setupSourceOnlyRepositoryDeserializer(ObjectDeserializer op) { + RepositoryBase.setupRepositoryBaseDeserializer(op); + op.add(Builder::settings, SourceOnlyRepositorySettings._DESERIALIZER, "settings"); + + op.ignore("type"); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/SourceOnlyRepositorySettings.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/SourceOnlyRepositorySettings.java new file mode 100644 index 000000000..9230140c0 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/snapshot/SourceOnlyRepositorySettings.java @@ -0,0 +1,207 @@ +/* + * 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.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.Integer; +import java.lang.String; +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.SourceOnlyRepositorySettings + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class SourceOnlyRepositorySettings extends RepositorySettingsBase { + @Nullable + private final String delegateType; + + @Nullable + private final Integer maxNumberOfSnapshots; + + @Nullable + private final Boolean readOnly; + + // --------------------------------------------------------------------------------------------- + + private SourceOnlyRepositorySettings(Builder builder) { + super(builder); + + this.delegateType = builder.delegateType; + this.maxNumberOfSnapshots = builder.maxNumberOfSnapshots; + this.readOnly = builder.readOnly; + + } + + public static SourceOnlyRepositorySettings of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code delegate_type} + */ + @Nullable + public final String delegateType() { + return this.delegateType; + } + + /** + * API name: {@code max_number_of_snapshots} + */ + @Nullable + public final Integer maxNumberOfSnapshots() { + return this.maxNumberOfSnapshots; + } + + /** + * API name: {@code read_only} + */ + @Nullable + public final Boolean readOnly() { + return this.readOnly; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + if (this.delegateType != null) { + generator.writeKey("delegate_type"); + generator.write(this.delegateType); + + } + if (this.maxNumberOfSnapshots != null) { + generator.writeKey("max_number_of_snapshots"); + generator.write(this.maxNumberOfSnapshots); + + } + if (this.readOnly != null) { + generator.writeKey("read_only"); + generator.write(this.readOnly); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SourceOnlyRepositorySettings}. + */ + + public static class Builder extends RepositorySettingsBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private String delegateType; + + @Nullable + private Integer maxNumberOfSnapshots; + + @Nullable + private Boolean readOnly; + + /** + * API name: {@code delegate_type} + */ + public final Builder delegateType(@Nullable String value) { + this.delegateType = value; + return this; + } + + /** + * API name: {@code max_number_of_snapshots} + */ + public final Builder maxNumberOfSnapshots(@Nullable Integer value) { + this.maxNumberOfSnapshots = value; + return this; + } + + /** + * API name: {@code read_only} + */ + public final Builder readOnly(@Nullable Boolean value) { + this.readOnly = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link SourceOnlyRepositorySettings}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SourceOnlyRepositorySettings build() { + _checkSingleUse(); + + return new SourceOnlyRepositorySettings(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SourceOnlyRepositorySettings} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SourceOnlyRepositorySettings::setupSourceOnlyRepositorySettingsDeserializer); + + protected static void setupSourceOnlyRepositorySettingsDeserializer( + ObjectDeserializer op) { + RepositorySettingsBase.setupRepositorySettingsBaseDeserializer(op); + op.add(Builder::delegateType, JsonpDeserializer.stringDeserializer(), "delegate_type"); + op.add(Builder::maxNumberOfSnapshots, JsonpDeserializer.integerDeserializer(), "max_number_of_snapshots"); + op.add(Builder::readOnly, JsonpDeserializer.booleanDeserializer(), "read_only", "readonly"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/ElasticsearchTextStructureAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/ElasticsearchTextStructureAsyncClient.java index a36d05e99..023a616f6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/ElasticsearchTextStructureAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/ElasticsearchTextStructureAsyncClient.java @@ -73,7 +73,7 @@ public ElasticsearchTextStructureAsyncClient withTransportOptions(@Nullable Tran * Tests a Grok pattern on some text. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/test-grok-pattern.html">Documentation * on elastic.co */ @@ -91,7 +91,7 @@ public CompletableFuture testGrokPattern(TestGrokPatter * a function that initializes a builder to create the * {@link TestGrokPatternRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/test-grok-pattern.html">Documentation * on elastic.co */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/ElasticsearchTextStructureClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/ElasticsearchTextStructureClient.java index c74243504..6fabfaaaa 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/ElasticsearchTextStructureClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/text_structure/ElasticsearchTextStructureClient.java @@ -74,7 +74,7 @@ public ElasticsearchTextStructureClient withTransportOptions(@Nullable Transport * Tests a Grok pattern on some text. * * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/test-grok-pattern.html">Documentation * on elastic.co */ @@ -93,7 +93,7 @@ public TestGrokPatternResponse testGrokPattern(TestGrokPatternRequest request) * a function that initializes a builder to create the * {@link TestGrokPatternRequest} * @see Documentation + * "https://www.elastic.co/guide/en/elasticsearch/reference/master/test-grok-pattern.html">Documentation * on elastic.co */