diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/Rank.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/Rank.java new file mode 100644 index 000000000..43d26d43e --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/Rank.java @@ -0,0 +1,180 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch._types; + +import co.elastic.clients.json.JsonEnum; +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.TaggedUnion; +import co.elastic.clients.util.TaggedUnionUtils; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Object; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: _types.RankContainer + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class Rank implements TaggedUnion, JsonpSerializable { + + /** + * {@link Rank} variant kinds. + * + * @see API + * specification + */ + + public enum Kind implements JsonEnum { + Rrf("rrf"), + + ; + + private final String jsonValue; + + Kind(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + public Rank(RankVariant value) { + + this._kind = ApiTypeHelper.requireNonNull(value._rankKind(), this, ""); + this._value = ApiTypeHelper.requireNonNull(value, this, ""); + + } + + private Rank(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + } + + public static Rank of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code rrf}? + */ + public boolean isRrf() { + return _kind == Kind.Rrf; + } + + /** + * Get the {@code rrf} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code rrf} kind. + */ + public RrfRank rrf() { + return TaggedUnionUtils.get(this, Kind.Rrf); + } + + @Override + @SuppressWarnings("unchecked") + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeStartObject(); + + generator.writeKey(_kind.jsonValue()); + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } + + generator.writeEnd(); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + + @Override + protected Builder self() { + return this; + } + public ObjectBuilder rrf(RrfRank v) { + this._kind = Kind.Rrf; + this._value = v; + return this; + } + + public ObjectBuilder rrf(Function> fn) { + return this.rrf(fn.apply(new RrfRank.Builder()).build()); + } + + public Rank build() { + _checkSingleUse(); + return new Rank(this); + } + + } + + protected static void setupRankDeserializer(ObjectDeserializer op) { + + op.add(Builder::rrf, RrfRank._DESERIALIZER, "rrf"); + + } + + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + Rank::setupRankDeserializer, Builder::build); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/RankBase.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/RankBase.java new file mode 100644 index 000000000..89e7bc8f8 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/RankBase.java @@ -0,0 +1,54 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch._types; + +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.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; + +// typedef: _types.RankBase + +/** + * + * @see API + * specification + */ + +public abstract class RankBase { + public RankBase() { + } + + public abstract static class AbstractBuilder> + extends + WithJsonObjectBuilderBase { + protected abstract BuilderT self(); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/RankBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/RankBuilders.java new file mode 100644 index 000000000..1ec42a03c --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/RankBuilders.java @@ -0,0 +1,52 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch._types; + +import co.elastic.clients.util.ObjectBuilder; +import java.util.function.Function; + +/** + * Builders for {@link Rank} variants. + */ +public class RankBuilders { + private RankBuilders() { + } + + /** + * Creates a builder for the {@link RrfRank rrf} {@code Rank} variant. + */ + public static RrfRank.Builder rrf() { + return new RrfRank.Builder(); + } + + /** + * Creates a Rank of the {@link RrfRank rrf} {@code Rank} variant. + */ + public static Rank rrf(Function> fn) { + Rank.Builder builder = new Rank.Builder(); + builder.rrf(fn.apply(new RrfRank.Builder()).build()); + return builder.build(); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/RankVariant.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/RankVariant.java new file mode 100644 index 000000000..9c3fcd31b --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/RankVariant.java @@ -0,0 +1,37 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch._types; + +/** + * Base interface for {@link Rank} variants. + */ +public interface RankVariant { + + Rank.Kind _rankKind(); + + default Rank _toRank() { + return new Rank(this); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/RrfRank.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/RrfRank.java new file mode 100644 index 000000000..01bfbfb6b --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/RrfRank.java @@ -0,0 +1,193 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +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.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.Long; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: _types.RrfRank + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class RrfRank extends RankBase implements RankVariant, JsonpSerializable { + @Nullable + private final Long rankConstant; + + @Nullable + private final Long windowSize; + + // --------------------------------------------------------------------------------------------- + + private RrfRank(Builder builder) { + + this.rankConstant = builder.rankConstant; + this.windowSize = builder.windowSize; + + } + + public static RrfRank of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Rank variant kind. + */ + @Override + public Rank.Kind _rankKind() { + return Rank.Kind.Rrf; + } + + /** + * How much influence documents in individual result sets per query have over + * the final ranked result set + *

+ * API name: {@code rank_constant} + */ + @Nullable + public final Long rankConstant() { + return this.rankConstant; + } + + /** + * Size of the individual result sets per query + *

+ * API name: {@code window_size} + */ + @Nullable + public final Long windowSize() { + return this.windowSize; + } + + /** + * 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.rankConstant != null) { + generator.writeKey("rank_constant"); + generator.write(this.rankConstant); + + } + if (this.windowSize != null) { + generator.writeKey("window_size"); + generator.write(this.windowSize); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RrfRank}. + */ + + public static class Builder extends RankBase.AbstractBuilder implements ObjectBuilder { + @Nullable + private Long rankConstant; + + @Nullable + private Long windowSize; + + /** + * How much influence documents in individual result sets per query have over + * the final ranked result set + *

+ * API name: {@code rank_constant} + */ + public final Builder rankConstant(@Nullable Long value) { + this.rankConstant = value; + return this; + } + + /** + * Size of the individual result sets per query + *

+ * API name: {@code window_size} + */ + public final Builder windowSize(@Nullable Long value) { + this.windowSize = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link RrfRank}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public RrfRank build() { + _checkSingleUse(); + + return new RrfRank(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RrfRank} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + RrfRank::setupRrfRankDeserializer); + + protected static void setupRrfRankDeserializer(ObjectDeserializer op) { + + op.add(Builder::rankConstant, JsonpDeserializer.longDeserializer(), "rank_constant"); + op.add(Builder::windowSize, JsonpDeserializer.longDeserializer(), "window_size"); + + } + +} 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 2b1f79669..0044a840e 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 @@ -170,6 +170,8 @@ public enum Kind implements JsonEnum { TermsSet("terms_set"), + TextExpansion("text_expansion"), + Wildcard("wildcard"), Wrapper("wrapper"), @@ -1109,6 +1111,23 @@ public TermsSetQuery termsSet() { return TaggedUnionUtils.get(this, Kind.TermsSet); } + /** + * Is this variant instance of kind {@code text_expansion}? + */ + public boolean isTextExpansion() { + return _kind == Kind.TextExpansion; + } + + /** + * Get the {@code text_expansion} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code text_expansion} kind. + */ + public TextExpansionQuery textExpansion() { + return TaggedUnionUtils.get(this, Kind.TextExpansion); + } + /** * Is this variant instance of kind {@code wildcard}? */ @@ -1745,6 +1764,17 @@ public ObjectBuilder termsSet(Function textExpansion(TextExpansionQuery v) { + this._kind = Kind.TextExpansion; + this._value = v; + return this; + } + + public ObjectBuilder textExpansion( + Function> fn) { + return this.textExpansion(fn.apply(new TextExpansionQuery.Builder()).build()); + } + public ObjectBuilder wildcard(WildcardQuery v) { this._kind = Kind.Wildcard; this._value = v; @@ -1851,6 +1881,7 @@ protected static void setupQueryDeserializer(ObjectDeserializer op) { op.add(Builder::term, TermQuery._DESERIALIZER, "term"); op.add(Builder::terms, TermsQuery._DESERIALIZER, "terms"); op.add(Builder::termsSet, TermsSetQuery._DESERIALIZER, "terms_set"); + op.add(Builder::textExpansion, TextExpansionQuery._DESERIALIZER, "text_expansion"); op.add(Builder::wildcard, WildcardQuery._DESERIALIZER, "wildcard"); op.add(Builder::wrapper, WrapperQuery._DESERIALIZER, "wrapper"); op.add(Builder::type, TypeQuery._DESERIALIZER, "type"); 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 45baa13ab..e72085f4c 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 @@ -914,6 +914,24 @@ public static Query termsSet(Function> fn) { + Query.Builder builder = new Query.Builder(); + builder.textExpansion(fn.apply(new TextExpansionQuery.Builder()).build()); + return builder.build(); + } + /** * Creates a builder for the {@link WildcardQuery wildcard} {@code Query} * variant. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/TextExpansionQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/TextExpansionQuery.java new file mode 100644 index 000000000..5b3e7235d --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/query_dsl/TextExpansionQuery.java @@ -0,0 +1,200 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch._types.query_dsl; + +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.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: _types.query_dsl.TextExpansionQuery + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class TextExpansionQuery extends QueryBase implements QueryVariant { + private final String value; + + private final String modelId; + + private final String modelText; + + // --------------------------------------------------------------------------------------------- + + private TextExpansionQuery(Builder builder) { + super(builder); + + this.value = ApiTypeHelper.requireNonNull(builder.value, this, "value"); + this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + this.modelText = ApiTypeHelper.requireNonNull(builder.modelText, this, "modelText"); + + } + + public static TextExpansionQuery of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Query variant kind. + */ + @Override + public Query.Kind _queryKind() { + return Query.Kind.TextExpansion; + } + + /** + * Required - The name of the rank features field to search against + *

+ * API name: {@code value} + */ + public final String value() { + return this.value; + } + + /** + * Required - The text expansion NLP model to use + *

+ * API name: {@code model_id} + */ + public final String modelId() { + return this.modelId; + } + + /** + * Required - The query text + *

+ * API name: {@code model_text} + */ + public final String modelText() { + return this.modelText; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + generator.writeKey("value"); + generator.write(this.value); + + generator.writeKey("model_id"); + generator.write(this.modelId); + + generator.writeKey("model_text"); + generator.write(this.modelText); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link TextExpansionQuery}. + */ + + public static class Builder extends QueryBase.AbstractBuilder + implements + ObjectBuilder { + private String value; + + private String modelId; + + private String modelText; + + /** + * Required - The name of the rank features field to search against + *

+ * API name: {@code value} + */ + public final Builder value(String value) { + this.value = value; + return this; + } + + /** + * Required - The text expansion NLP model to use + *

+ * API name: {@code model_id} + */ + public final Builder modelId(String value) { + this.modelId = value; + return this; + } + + /** + * Required - The query text + *

+ * API name: {@code model_text} + */ + public final Builder modelText(String value) { + this.modelText = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link TextExpansionQuery}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public TextExpansionQuery build() { + _checkSingleUse(); + + return new TextExpansionQuery(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link TextExpansionQuery} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, TextExpansionQuery::setupTextExpansionQueryDeserializer); + + protected static void setupTextExpansionQueryDeserializer(ObjectDeserializer op) { + QueryBase.setupQueryBaseDeserializer(op); + op.add(Builder::value, JsonpDeserializer.stringDeserializer(), "value"); + op.add(Builder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); + op.add(Builder::modelText, JsonpDeserializer.stringDeserializer(), "model_text"); + + op.shortcutProperty("value"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ComponentTemplateSummary.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ComponentTemplateSummary.java index 32dd281a0..fe99ec257 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ComponentTemplateSummary.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/ComponentTemplateSummary.java @@ -25,6 +25,7 @@ import co.elastic.clients.elasticsearch._types.mapping.TypeMapping; import co.elastic.clients.elasticsearch.indices.AliasDefinition; +import co.elastic.clients.elasticsearch.indices.DataLifecycleWithRollover; import co.elastic.clients.elasticsearch.indices.IndexSettings; import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; @@ -67,6 +68,9 @@ public class ComponentTemplateSummary implements JsonpSerializable { private final Map aliases; + @Nullable + private final DataLifecycleWithRollover lifecycle; + // --------------------------------------------------------------------------------------------- private ComponentTemplateSummary(Builder builder) { @@ -76,6 +80,7 @@ private ComponentTemplateSummary(Builder builder) { this.settings = ApiTypeHelper.unmodifiable(builder.settings); this.mappings = builder.mappings; this.aliases = ApiTypeHelper.unmodifiable(builder.aliases); + this.lifecycle = builder.lifecycle; } @@ -120,6 +125,14 @@ public final Map aliases() { return this.aliases; } + /** + * API name: {@code lifecycle} + */ + @Nullable + public final DataLifecycleWithRollover lifecycle() { + return this.lifecycle; + } + /** * Serialize this object to JSON. */ @@ -174,6 +187,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } + if (this.lifecycle != null) { + generator.writeKey("lifecycle"); + this.lifecycle.serialize(generator, mapper); + + } } @@ -206,6 +224,9 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private Map aliases; + @Nullable + private DataLifecycleWithRollover lifecycle; + /** * API name: {@code _meta} *

@@ -307,6 +328,22 @@ public final Builder aliases(String key, Function> fn) { + return this.lifecycle(fn.apply(new DataLifecycleWithRollover.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -341,6 +378,7 @@ protected static void setupComponentTemplateSummaryDeserializer( op.add(Builder::settings, JsonpDeserializer.stringMapDeserializer(IndexSettings._DESERIALIZER), "settings"); op.add(Builder::mappings, TypeMapping._DESERIALIZER, "mappings"); op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(AliasDefinition._DESERIALIZER), "aliases"); + op.add(Builder::lifecycle, DataLifecycleWithRollover._DESERIALIZER, "lifecycle"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/GetComponentTemplateRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/GetComponentTemplateRequest.java index 5a5650d08..ad62cffda 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/GetComponentTemplateRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/cluster/GetComponentTemplateRequest.java @@ -56,6 +56,9 @@ public class GetComponentTemplateRequest extends RequestBase { @Nullable private final Boolean flatSettings; + @Nullable + private final Boolean includeDefaults; + @Nullable private final Boolean local; @@ -70,6 +73,7 @@ public class GetComponentTemplateRequest extends RequestBase { private GetComponentTemplateRequest(Builder builder) { this.flatSettings = builder.flatSettings; + this.includeDefaults = builder.includeDefaults; this.local = builder.local; this.masterTimeout = builder.masterTimeout; this.name = builder.name; @@ -88,6 +92,16 @@ public final Boolean flatSettings() { return this.flatSettings; } + /** + * Return all default configurations for the component template (default: false) + *

+ * API name: {@code include_defaults} + */ + @Nullable + public final Boolean includeDefaults() { + return this.includeDefaults; + } + /** * Return local information, do not retrieve the state from master node * (default: false) @@ -131,6 +145,9 @@ public static class Builder extends RequestBase.AbstractBuilder @Nullable private Boolean flatSettings; + @Nullable + private Boolean includeDefaults; + @Nullable private Boolean local; @@ -148,6 +165,16 @@ public final Builder flatSettings(@Nullable Boolean value) { return this; } + /** + * Return all default configurations for the component template (default: false) + *

+ * API name: {@code include_defaults} + */ + public final Builder includeDefaults(@Nullable Boolean value) { + this.includeDefaults = value; + return this; + } + /** * Return local information, do not retrieve the state from master node * (default: false) @@ -254,6 +281,9 @@ public GetComponentTemplateRequest build() { if (request.flatSettings != null) { params.put("flat_settings", String.valueOf(request.flatSettings)); } + if (request.includeDefaults != null) { + params.put("include_defaults", String.valueOf(request.includeDefaults)); + } if (request.local != null) { params.put("local", String.valueOf(request.local)); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/SearchRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/SearchRequest.java index 8f8b43707..80c8ac554 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/core/SearchRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/core/SearchRequest.java @@ -27,6 +27,7 @@ import co.elastic.clients.elasticsearch._types.ExpandWildcard; import co.elastic.clients.elasticsearch._types.FieldValue; import co.elastic.clients.elasticsearch._types.KnnQuery; +import co.elastic.clients.elasticsearch._types.Rank; import co.elastic.clients.elasticsearch._types.RequestBase; import co.elastic.clients.elasticsearch._types.ScriptField; import co.elastic.clients.elasticsearch._types.SearchType; @@ -174,6 +175,9 @@ public class SearchRequest extends RequestBase implements JsonpSerializable { @Nullable private final Query query; + @Nullable + private final Rank rank; + @Nullable private final Boolean requestCache; @@ -265,6 +269,7 @@ private SearchRequest(Builder builder) { this.profile = builder.profile; this.q = builder.q; this.query = builder.query; + this.rank = builder.rank; this.requestCache = builder.requestCache; this.rescore = ApiTypeHelper.unmodifiable(builder.rescore); this.routing = builder.routing; @@ -645,6 +650,16 @@ public final Query query() { return this.query; } + /** + * Defines the Reciprocal Rank Fusion (RRF) to use + *

+ * API name: {@code rank} + */ + @Nullable + public final Rank rank() { + return this.rank; + } + /** * Specify if request cache should be used for this request or not, defaults to * index level setting @@ -978,6 +993,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("query"); this.query.serialize(generator, mapper); + } + if (this.rank != null) { + generator.writeKey("rank"); + this.rank.serialize(generator, mapper); + } if (ApiTypeHelper.isDefined(this.rescore)) { generator.writeKey("rescore"); @@ -1208,6 +1228,9 @@ public static class Builder extends RequestBase.AbstractBuilder impleme @Nullable private Query query; + @Nullable + private Rank rank; + @Nullable private Boolean requestCache; @@ -1837,6 +1860,25 @@ public final Builder query(Function> fn) { return this.query(fn.apply(new Query.Builder()).build()); } + /** + * Defines the Reciprocal Rank Fusion (RRF) to use + *

+ * API name: {@code rank} + */ + public final Builder rank(@Nullable Rank value) { + this.rank = value; + return this; + } + + /** + * Defines the Reciprocal Rank Fusion (RRF) to use + *

+ * API name: {@code rank} + */ + public final Builder rank(Function> fn) { + return this.rank(fn.apply(new Rank.Builder()).build()); + } + /** * Specify if request cache should be used for this request or not, defaults to * index level setting @@ -2281,6 +2323,7 @@ protected static void setupSearchRequestDeserializer(ObjectDeserializer 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/819413aa006cfc829eb9abd18068a82d972279e7/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/0a58ae2e52dd1bc6227f65da9cbbcea5b61dde96/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/indices/DataLifecycle.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataLifecycle.java new file mode 100644 index 000000000..25ac7f4ae --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataLifecycle.java @@ -0,0 +1,156 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.indices; + +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.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.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: indices._types.DataLifecycle + +/** + * Data lifecycle denotes that a data stream is managed by DLM and contains the + * configuration. + * + * @see API + * specification + */ +@JsonpDeserializable +public class DataLifecycle implements JsonpSerializable { + @Nullable + private final Time dataRetention; + + // --------------------------------------------------------------------------------------------- + + private DataLifecycle(Builder builder) { + + this.dataRetention = builder.dataRetention; + + } + + public static DataLifecycle of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code data_retention} + */ + @Nullable + public final Time dataRetention() { + return this.dataRetention; + } + + /** + * 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.dataRetention != null) { + generator.writeKey("data_retention"); + this.dataRetention.serialize(generator, mapper); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DataLifecycle}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private Time dataRetention; + + /** + * API name: {@code data_retention} + */ + public final Builder dataRetention(@Nullable Time value) { + this.dataRetention = value; + return this; + } + + /** + * API name: {@code data_retention} + */ + public final Builder dataRetention(Function> fn) { + return this.dataRetention(fn.apply(new Time.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DataLifecycle}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DataLifecycle build() { + _checkSingleUse(); + + return new DataLifecycle(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DataLifecycle} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + DataLifecycle::setupDataLifecycleDeserializer); + + protected static void setupDataLifecycleDeserializer(ObjectDeserializer op) { + + op.add(Builder::dataRetention, Time._DESERIALIZER, "data_retention"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataLifecycleWithRollover.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataLifecycleWithRollover.java new file mode 100644 index 000000000..10ccd378c --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataLifecycleWithRollover.java @@ -0,0 +1,197 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.indices; + +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.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.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: indices._types.DataLifecycleWithRollover + +/** + * Data lifecycle with rollover can be used to display the configuration + * including the default rollover conditions, if asked. + * + * @see API + * specification + */ +@JsonpDeserializable +public class DataLifecycleWithRollover implements JsonpSerializable { + @Nullable + private final Time dataRetention; + + @Nullable + private final DlmRolloverConditions rollover; + + // --------------------------------------------------------------------------------------------- + + private DataLifecycleWithRollover(Builder builder) { + + this.dataRetention = builder.dataRetention; + this.rollover = builder.rollover; + + } + + public static DataLifecycleWithRollover of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code data_retention} + */ + @Nullable + public final Time dataRetention() { + return this.dataRetention; + } + + /** + * API name: {@code rollover} + */ + @Nullable + public final DlmRolloverConditions rollover() { + return this.rollover; + } + + /** + * 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.dataRetention != null) { + generator.writeKey("data_retention"); + this.dataRetention.serialize(generator, mapper); + + } + if (this.rollover != null) { + generator.writeKey("rollover"); + this.rollover.serialize(generator, mapper); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DataLifecycleWithRollover}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + @Nullable + private Time dataRetention; + + @Nullable + private DlmRolloverConditions rollover; + + /** + * API name: {@code data_retention} + */ + public final Builder dataRetention(@Nullable Time value) { + this.dataRetention = value; + return this; + } + + /** + * API name: {@code data_retention} + */ + public final Builder dataRetention(Function> fn) { + return this.dataRetention(fn.apply(new Time.Builder()).build()); + } + + /** + * API name: {@code rollover} + */ + public final Builder rollover(@Nullable DlmRolloverConditions value) { + this.rollover = value; + return this; + } + + /** + * API name: {@code rollover} + */ + public final Builder rollover( + Function> fn) { + return this.rollover(fn.apply(new DlmRolloverConditions.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DataLifecycleWithRollover}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DataLifecycleWithRollover build() { + _checkSingleUse(); + + return new DataLifecycleWithRollover(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DataLifecycleWithRollover} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DataLifecycleWithRollover::setupDataLifecycleWithRolloverDeserializer); + + protected static void setupDataLifecycleWithRolloverDeserializer( + ObjectDeserializer op) { + + op.add(Builder::dataRetention, Time._DESERIALIZER, "data_retention"); + op.add(Builder::rollover, DlmRolloverConditions._DESERIALIZER, "rollover"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStream.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStream.java index 3e88410c0..5e75bcf18 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStream.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DataStream.java @@ -82,6 +82,9 @@ public class DataStream implements JsonpSerializable { @Nullable private final Boolean allowCustomRouting; + @Nullable + private final DataLifecycleWithRollover lifecycle; + // --------------------------------------------------------------------------------------------- private DataStream(Builder builder) { @@ -98,6 +101,7 @@ private DataStream(Builder builder) { this.ilmPolicy = builder.ilmPolicy; this.meta = ApiTypeHelper.unmodifiable(builder.meta); this.allowCustomRouting = builder.allowCustomRouting; + this.lifecycle = builder.lifecycle; } @@ -193,6 +197,14 @@ public final Boolean allowCustomRouting() { return this.allowCustomRouting; } + /** + * API name: {@code lifecycle} + */ + @Nullable + public final DataLifecycleWithRollover lifecycle() { + return this.lifecycle; + } + /** * Serialize this object to JSON. */ @@ -262,6 +274,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.allowCustomRouting); } + if (this.lifecycle != null) { + generator.writeKey("lifecycle"); + this.lifecycle.serialize(generator, mapper); + + } } @@ -306,6 +323,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private Boolean allowCustomRouting; + @Nullable + private DataLifecycleWithRollover lifecycle; + /** * Required - API name: {@code name} */ @@ -443,6 +463,22 @@ public final Builder allowCustomRouting(@Nullable Boolean value) { return this; } + /** + * API name: {@code lifecycle} + */ + public final Builder lifecycle(@Nullable DataLifecycleWithRollover value) { + this.lifecycle = value; + return this; + } + + /** + * API name: {@code lifecycle} + */ + public final Builder lifecycle( + Function> fn) { + return this.lifecycle(fn.apply(new DataLifecycleWithRollover.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -483,6 +519,7 @@ protected static void setupDataStreamDeserializer(ObjectDeserializerAPI + * specification + */ + +public class DeleteDataLifecycleRequest extends RequestBase { + private final List expandWildcards; + + @Nullable + private final Time masterTimeout; + + private final List name; + + @Nullable + private final Time timeout; + + // --------------------------------------------------------------------------------------------- + + private DeleteDataLifecycleRequest(Builder builder) { + + this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); + this.masterTimeout = builder.masterTimeout; + this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); + this.timeout = builder.timeout; + + } + + public static DeleteDataLifecycleRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Whether wildcard expressions should get expanded to open or closed indices + * (default: open) + *

+ * API name: {@code expand_wildcards} + */ + public final List expandWildcards() { + return this.expandWildcards; + } + + /** + * Specify timeout for connection to master + *

+ * API name: {@code master_timeout} + */ + @Nullable + public final Time masterTimeout() { + return this.masterTimeout; + } + + /** + * Required - A comma-separated list of data streams of which the data lifecycle + * will be deleted; use * to get all data streams + *

+ * API name: {@code name} + */ + public final List name() { + return this.name; + } + + /** + * Explicit timestamp for the document + *

+ * API name: {@code timeout} + */ + @Nullable + public final Time timeout() { + return this.timeout; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteDataLifecycleRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private List expandWildcards; + + @Nullable + private Time masterTimeout; + + private List name; + + @Nullable + private Time timeout; + + /** + * Whether wildcard expressions should get expanded to open or closed indices + * (default: open) + *

+ * 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; + } + + /** + * Whether wildcard expressions should get expanded to open or closed indices + * (default: open) + *

+ * 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; + } + + /** + * Specify timeout for connection to master + *

+ * API name: {@code master_timeout} + */ + public final Builder masterTimeout(@Nullable Time value) { + this.masterTimeout = value; + return this; + } + + /** + * Specify timeout for connection to master + *

+ * API name: {@code master_timeout} + */ + public final Builder masterTimeout(Function> fn) { + return this.masterTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - A comma-separated list of data streams of which the data lifecycle + * will be deleted; use * to get all data streams + *

+ * 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 - A comma-separated list of data streams of which the data lifecycle + * will be deleted; use * to get all data streams + *

+ * 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; + } + + /** + * Explicit timestamp for the document + *

+ * API name: {@code timeout} + */ + public final Builder timeout(@Nullable Time value) { + this.timeout = value; + return this; + } + + /** + * Explicit timestamp for the document + *

+ * API name: {@code timeout} + */ + public final Builder timeout(Function> fn) { + return this.timeout(fn.apply(new Time.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DeleteDataLifecycleRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DeleteDataLifecycleRequest build() { + _checkSingleUse(); + + return new DeleteDataLifecycleRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code indices.delete_data_lifecycle}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/indices.delete_data_lifecycle", + + // Request method + request -> { + return "DELETE"; + + }, + + // Request path + request -> { + final int _name = 1 << 0; + + int propsSet = 0; + + propsSet |= _name; + + if (propsSet == (_name)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_data_stream"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); + buf.append("/_lifecycle"); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } + if (ApiTypeHelper.isDefined(request.expandWildcards)) { + params.put("expand_wildcards", + request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); + } + if (request.timeout != null) { + params.put("timeout", request.timeout._toJsonString()); + } + return params; + + }, SimpleEndpoint.emptyMap(), false, DeleteDataLifecycleResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteDataLifecycleResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteDataLifecycleResponse.java new file mode 100644 index 000000000..86ab655f3 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DeleteDataLifecycleResponse.java @@ -0,0 +1,98 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.indices; + +import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; +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.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; + +// typedef: indices.delete_data_lifecycle.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DeleteDataLifecycleResponse extends AcknowledgedResponseBase { + // --------------------------------------------------------------------------------------------- + + private DeleteDataLifecycleResponse(Builder builder) { + super(builder); + + } + + public static DeleteDataLifecycleResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteDataLifecycleResponse}. + */ + + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DeleteDataLifecycleResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DeleteDataLifecycleResponse build() { + _checkSingleUse(); + + return new DeleteDataLifecycleResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DeleteDataLifecycleResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DeleteDataLifecycleResponse::setupDeleteDataLifecycleResponseDeserializer); + + protected static void setupDeleteDataLifecycleResponseDeserializer( + ObjectDeserializer op) { + AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DlmRolloverConditions.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DlmRolloverConditions.java new file mode 100644 index 000000000..7b88799be --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/DlmRolloverConditions.java @@ -0,0 +1,420 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.indices; + +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.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.Long; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: indices._types.DlmRolloverConditions + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DlmRolloverConditions implements JsonpSerializable { + @Nullable + private final Time minAge; + + @Nullable + private final String maxAge; + + @Nullable + private final Long minDocs; + + @Nullable + private final Long maxDocs; + + @Nullable + private final String minSize; + + @Nullable + private final String maxSize; + + @Nullable + private final String minPrimaryShardSize; + + @Nullable + private final String maxPrimaryShardSize; + + @Nullable + private final Long minPrimaryShardDocs; + + @Nullable + private final Long maxPrimaryShardDocs; + + // --------------------------------------------------------------------------------------------- + + private DlmRolloverConditions(Builder builder) { + + this.minAge = builder.minAge; + this.maxAge = builder.maxAge; + this.minDocs = builder.minDocs; + this.maxDocs = builder.maxDocs; + this.minSize = builder.minSize; + this.maxSize = builder.maxSize; + this.minPrimaryShardSize = builder.minPrimaryShardSize; + this.maxPrimaryShardSize = builder.maxPrimaryShardSize; + this.minPrimaryShardDocs = builder.minPrimaryShardDocs; + this.maxPrimaryShardDocs = builder.maxPrimaryShardDocs; + + } + + public static DlmRolloverConditions of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code min_age} + */ + @Nullable + public final Time minAge() { + return this.minAge; + } + + /** + * API name: {@code max_age} + */ + @Nullable + public final String maxAge() { + return this.maxAge; + } + + /** + * API name: {@code min_docs} + */ + @Nullable + public final Long minDocs() { + return this.minDocs; + } + + /** + * API name: {@code max_docs} + */ + @Nullable + public final Long maxDocs() { + return this.maxDocs; + } + + /** + * API name: {@code min_size} + */ + @Nullable + public final String minSize() { + return this.minSize; + } + + /** + * API name: {@code max_size} + */ + @Nullable + public final String maxSize() { + return this.maxSize; + } + + /** + * API name: {@code min_primary_shard_size} + */ + @Nullable + public final String minPrimaryShardSize() { + return this.minPrimaryShardSize; + } + + /** + * API name: {@code max_primary_shard_size} + */ + @Nullable + public final String maxPrimaryShardSize() { + return this.maxPrimaryShardSize; + } + + /** + * API name: {@code min_primary_shard_docs} + */ + @Nullable + public final Long minPrimaryShardDocs() { + return this.minPrimaryShardDocs; + } + + /** + * API name: {@code max_primary_shard_docs} + */ + @Nullable + public final Long maxPrimaryShardDocs() { + return this.maxPrimaryShardDocs; + } + + /** + * 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.minAge != null) { + generator.writeKey("min_age"); + this.minAge.serialize(generator, mapper); + + } + if (this.maxAge != null) { + generator.writeKey("max_age"); + generator.write(this.maxAge); + + } + if (this.minDocs != null) { + generator.writeKey("min_docs"); + generator.write(this.minDocs); + + } + if (this.maxDocs != null) { + generator.writeKey("max_docs"); + generator.write(this.maxDocs); + + } + if (this.minSize != null) { + generator.writeKey("min_size"); + generator.write(this.minSize); + + } + if (this.maxSize != null) { + generator.writeKey("max_size"); + generator.write(this.maxSize); + + } + if (this.minPrimaryShardSize != null) { + generator.writeKey("min_primary_shard_size"); + generator.write(this.minPrimaryShardSize); + + } + if (this.maxPrimaryShardSize != null) { + generator.writeKey("max_primary_shard_size"); + generator.write(this.maxPrimaryShardSize); + + } + if (this.minPrimaryShardDocs != null) { + generator.writeKey("min_primary_shard_docs"); + generator.write(this.minPrimaryShardDocs); + + } + if (this.maxPrimaryShardDocs != null) { + generator.writeKey("max_primary_shard_docs"); + generator.write(this.maxPrimaryShardDocs); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DlmRolloverConditions}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + @Nullable + private Time minAge; + + @Nullable + private String maxAge; + + @Nullable + private Long minDocs; + + @Nullable + private Long maxDocs; + + @Nullable + private String minSize; + + @Nullable + private String maxSize; + + @Nullable + private String minPrimaryShardSize; + + @Nullable + private String maxPrimaryShardSize; + + @Nullable + private Long minPrimaryShardDocs; + + @Nullable + private Long maxPrimaryShardDocs; + + /** + * API name: {@code min_age} + */ + public final Builder minAge(@Nullable Time value) { + this.minAge = value; + return this; + } + + /** + * API name: {@code min_age} + */ + public final Builder minAge(Function> fn) { + return this.minAge(fn.apply(new Time.Builder()).build()); + } + + /** + * API name: {@code max_age} + */ + public final Builder maxAge(@Nullable String value) { + this.maxAge = value; + return this; + } + + /** + * API name: {@code min_docs} + */ + public final Builder minDocs(@Nullable Long value) { + this.minDocs = value; + return this; + } + + /** + * API name: {@code max_docs} + */ + public final Builder maxDocs(@Nullable Long value) { + this.maxDocs = value; + return this; + } + + /** + * API name: {@code min_size} + */ + public final Builder minSize(@Nullable String value) { + this.minSize = value; + return this; + } + + /** + * API name: {@code max_size} + */ + public final Builder maxSize(@Nullable String value) { + this.maxSize = value; + return this; + } + + /** + * API name: {@code min_primary_shard_size} + */ + public final Builder minPrimaryShardSize(@Nullable String value) { + this.minPrimaryShardSize = value; + return this; + } + + /** + * API name: {@code max_primary_shard_size} + */ + public final Builder maxPrimaryShardSize(@Nullable String value) { + this.maxPrimaryShardSize = value; + return this; + } + + /** + * API name: {@code min_primary_shard_docs} + */ + public final Builder minPrimaryShardDocs(@Nullable Long value) { + this.minPrimaryShardDocs = value; + return this; + } + + /** + * API name: {@code max_primary_shard_docs} + */ + public final Builder maxPrimaryShardDocs(@Nullable Long value) { + this.maxPrimaryShardDocs = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DlmRolloverConditions}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DlmRolloverConditions build() { + _checkSingleUse(); + + return new DlmRolloverConditions(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DlmRolloverConditions} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DlmRolloverConditions::setupDlmRolloverConditionsDeserializer); + + protected static void setupDlmRolloverConditionsDeserializer(ObjectDeserializer op) { + + op.add(Builder::minAge, Time._DESERIALIZER, "min_age"); + op.add(Builder::maxAge, JsonpDeserializer.stringDeserializer(), "max_age"); + op.add(Builder::minDocs, JsonpDeserializer.longDeserializer(), "min_docs"); + op.add(Builder::maxDocs, JsonpDeserializer.longDeserializer(), "max_docs"); + op.add(Builder::minSize, JsonpDeserializer.stringDeserializer(), "min_size"); + op.add(Builder::maxSize, JsonpDeserializer.stringDeserializer(), "max_size"); + op.add(Builder::minPrimaryShardSize, JsonpDeserializer.stringDeserializer(), "min_primary_shard_size"); + op.add(Builder::maxPrimaryShardSize, JsonpDeserializer.stringDeserializer(), "max_primary_shard_size"); + op.add(Builder::minPrimaryShardDocs, JsonpDeserializer.longDeserializer(), "min_primary_shard_docs"); + op.add(Builder::maxPrimaryShardDocs, JsonpDeserializer.longDeserializer(), "max_primary_shard_docs"); + + } + +} 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 b216f8c75..53cbc1007 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 @@ -429,6 +429,39 @@ public final CompletableFuture deleteAlias( return deleteAlias(fn.apply(new DeleteAliasRequest.Builder()).build()); } + // ----- Endpoint: indices.delete_data_lifecycle + + /** + * Deletes the data lifecycle of the selected data streams. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture deleteDataLifecycle(DeleteDataLifecycleRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) DeleteDataLifecycleRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Deletes the data lifecycle of the selected data streams. + * + * @param fn + * a function that initializes a builder to create the + * {@link DeleteDataLifecycleRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture deleteDataLifecycle( + Function> fn) { + return deleteDataLifecycle(fn.apply(new DeleteDataLifecycleRequest.Builder()).build()); + } + // ----- Endpoint: indices.delete_data_stream /** @@ -726,6 +759,41 @@ public final CompletableFuture existsTemplate( return existsTemplate(fn.apply(new ExistsTemplateRequest.Builder()).build()); } + // ----- Endpoint: indices.explain_data_lifecycle + + /** + * Retrieves information about the index's current DLM lifecycle, such as any + * potential encountered error, time since creation etc. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture explainDataLifecycle(ExplainDataLifecycleRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) ExplainDataLifecycleRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Retrieves information about the index's current DLM lifecycle, such as any + * potential encountered error, time since creation etc. + * + * @param fn + * a function that initializes a builder to create the + * {@link ExplainDataLifecycleRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture explainDataLifecycle( + Function> fn) { + return explainDataLifecycle(fn.apply(new ExplainDataLifecycleRequest.Builder()).build()); + } + // ----- Endpoint: indices.field_usage_stats /** @@ -930,6 +998,39 @@ public CompletableFuture getAlias() { this.transportOptions); } + // ----- Endpoint: indices.get_data_lifecycle + + /** + * Returns the data lifecycle of the selected data streams. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture getDataLifecycle(GetDataLifecycleRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) GetDataLifecycleRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Returns the data lifecycle of the selected data streams. + * + * @param fn + * a function that initializes a builder to create the + * {@link GetDataLifecycleRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture getDataLifecycle( + Function> fn) { + return getDataLifecycle(fn.apply(new GetDataLifecycleRequest.Builder()).build()); + } + // ----- Endpoint: indices.get_data_stream /** @@ -1359,6 +1460,39 @@ public final CompletableFuture putAlias( return putAlias(fn.apply(new PutAliasRequest.Builder()).build()); } + // ----- Endpoint: indices.put_data_lifecycle + + /** + * Updates the data lifecycle of the selected data streams. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture putDataLifecycle(PutDataLifecycleRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) PutDataLifecycleRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Updates the data lifecycle of the selected data streams. + * + * @param fn + * a function that initializes a builder to create the + * {@link PutDataLifecycleRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture putDataLifecycle( + Function> fn) { + return putDataLifecycle(fn.apply(new PutDataLifecycleRequest.Builder()).build()); + } + // ----- Endpoint: indices.put_index_template /** 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 d0e720117..63b93d6dc 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 @@ -432,6 +432,41 @@ public final DeleteAliasResponse deleteAlias( return deleteAlias(fn.apply(new DeleteAliasRequest.Builder()).build()); } + // ----- Endpoint: indices.delete_data_lifecycle + + /** + * Deletes the data lifecycle of the selected data streams. + * + * @see Documentation + * on elastic.co + */ + + public DeleteDataLifecycleResponse deleteDataLifecycle(DeleteDataLifecycleRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) DeleteDataLifecycleRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Deletes the data lifecycle of the selected data streams. + * + * @param fn + * a function that initializes a builder to create the + * {@link DeleteDataLifecycleRequest} + * @see Documentation + * on elastic.co + */ + + public final DeleteDataLifecycleResponse deleteDataLifecycle( + Function> fn) + throws IOException, ElasticsearchException { + return deleteDataLifecycle(fn.apply(new DeleteDataLifecycleRequest.Builder()).build()); + } + // ----- Endpoint: indices.delete_data_stream /** @@ -738,6 +773,43 @@ public final BooleanResponse existsTemplate( return existsTemplate(fn.apply(new ExistsTemplateRequest.Builder()).build()); } + // ----- Endpoint: indices.explain_data_lifecycle + + /** + * Retrieves information about the index's current DLM lifecycle, such as any + * potential encountered error, time since creation etc. + * + * @see Documentation + * on elastic.co + */ + + public ExplainDataLifecycleResponse explainDataLifecycle(ExplainDataLifecycleRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) ExplainDataLifecycleRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Retrieves information about the index's current DLM lifecycle, such as any + * potential encountered error, time since creation etc. + * + * @param fn + * a function that initializes a builder to create the + * {@link ExplainDataLifecycleRequest} + * @see Documentation + * on elastic.co + */ + + public final ExplainDataLifecycleResponse explainDataLifecycle( + Function> fn) + throws IOException, ElasticsearchException { + return explainDataLifecycle(fn.apply(new ExplainDataLifecycleRequest.Builder()).build()); + } + // ----- Endpoint: indices.field_usage_stats /** @@ -944,6 +1016,41 @@ public GetAliasResponse getAlias() throws IOException, ElasticsearchException { this.transportOptions); } + // ----- Endpoint: indices.get_data_lifecycle + + /** + * Returns the data lifecycle of the selected data streams. + * + * @see Documentation + * on elastic.co + */ + + public GetDataLifecycleResponse getDataLifecycle(GetDataLifecycleRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) GetDataLifecycleRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Returns the data lifecycle of the selected data streams. + * + * @param fn + * a function that initializes a builder to create the + * {@link GetDataLifecycleRequest} + * @see Documentation + * on elastic.co + */ + + public final GetDataLifecycleResponse getDataLifecycle( + Function> fn) + throws IOException, ElasticsearchException { + return getDataLifecycle(fn.apply(new GetDataLifecycleRequest.Builder()).build()); + } + // ----- Endpoint: indices.get_data_stream /** @@ -1389,6 +1496,41 @@ public final PutAliasResponse putAlias(FunctionDocumentation + * on elastic.co + */ + + public PutDataLifecycleResponse putDataLifecycle(PutDataLifecycleRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) PutDataLifecycleRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Updates the data lifecycle of the selected data streams. + * + * @param fn + * a function that initializes a builder to create the + * {@link PutDataLifecycleRequest} + * @see Documentation + * on elastic.co + */ + + public final PutDataLifecycleResponse putDataLifecycle( + Function> fn) + throws IOException, ElasticsearchException { + return putDataLifecycle(fn.apply(new PutDataLifecycleRequest.Builder()).build()); + } + // ----- Endpoint: indices.put_index_template /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ExplainDataLifecycleRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ExplainDataLifecycleRequest.java new file mode 100644 index 000000000..15c304296 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ExplainDataLifecycleRequest.java @@ -0,0 +1,247 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.indices; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.elasticsearch._types.RequestBase; +import co.elastic.clients.elasticsearch._types.Time; +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; + +// typedef: indices.explain_data_lifecycle.Request + +/** + * Retrieves information about the index's current DLM lifecycle, such as any + * potential encountered error, time since creation etc. + * + * @see API + * specification + */ + +public class ExplainDataLifecycleRequest extends RequestBase { + @Nullable + private final Boolean includeDefaults; + + private final List index; + + @Nullable + private final Time masterTimeout; + + // --------------------------------------------------------------------------------------------- + + private ExplainDataLifecycleRequest(Builder builder) { + + this.includeDefaults = builder.includeDefaults; + this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); + this.masterTimeout = builder.masterTimeout; + + } + + public static ExplainDataLifecycleRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * indicates if the API should return the default values the system uses for the + * index's lifecycle + *

+ * API name: {@code include_defaults} + */ + @Nullable + public final Boolean includeDefaults() { + return this.includeDefaults; + } + + /** + * Required - The name of the index to explain + *

+ * API name: {@code index} + */ + public final List index() { + return this.index; + } + + /** + * Specify timeout for connection to master + *

+ * API name: {@code master_timeout} + */ + @Nullable + public final Time masterTimeout() { + return this.masterTimeout; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ExplainDataLifecycleRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private Boolean includeDefaults; + + private List index; + + @Nullable + private Time masterTimeout; + + /** + * indicates if the API should return the default values the system uses for the + * index's lifecycle + *

+ * API name: {@code include_defaults} + */ + public final Builder includeDefaults(@Nullable Boolean value) { + this.includeDefaults = value; + return this; + } + + /** + * Required - The name of the index to explain + *

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

+ * Adds all elements of list to index. + */ + public final Builder index(List list) { + this.index = _listAddAll(this.index, list); + return this; + } + + /** + * Required - The name of the index to explain + *

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

+ * Adds one or more values to index. + */ + public final Builder index(String value, String... values) { + this.index = _listAdd(this.index, value, values); + return this; + } + + /** + * Specify timeout for connection to master + *

+ * API name: {@code master_timeout} + */ + public final Builder masterTimeout(@Nullable Time value) { + this.masterTimeout = value; + return this; + } + + /** + * Specify timeout for connection to master + *

+ * API name: {@code master_timeout} + */ + public final Builder masterTimeout(Function> fn) { + return this.masterTimeout(fn.apply(new Time.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ExplainDataLifecycleRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ExplainDataLifecycleRequest build() { + _checkSingleUse(); + + return new ExplainDataLifecycleRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code indices.explain_data_lifecycle}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/indices.explain_data_lifecycle", + + // Request method + request -> { + return "GET"; + + }, + + // Request path + request -> { + final int _index = 1 << 0; + + int propsSet = 0; + + propsSet |= _index; + + if (propsSet == (_index)) { + StringBuilder buf = new StringBuilder(); + buf.append("/"); + SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); + buf.append("/_lifecycle"); + buf.append("/explain"); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } + if (request.includeDefaults != null) { + params.put("include_defaults", String.valueOf(request.includeDefaults)); + } + return params; + + }, SimpleEndpoint.emptyMap(), false, ExplainDataLifecycleResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ExplainDataLifecycleResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ExplainDataLifecycleResponse.java new file mode 100644 index 000000000..4bf9961b3 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ExplainDataLifecycleResponse.java @@ -0,0 +1,180 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.indices; + +import co.elastic.clients.elasticsearch.indices.explain_data_lifecycle.DataLifecycleExplain; +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.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: indices.explain_data_lifecycle.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class ExplainDataLifecycleResponse implements JsonpSerializable { + private final Map indices; + + // --------------------------------------------------------------------------------------------- + + private ExplainDataLifecycleResponse(Builder builder) { + + this.indices = ApiTypeHelper.unmodifiableRequired(builder.indices, this, "indices"); + + } + + public static ExplainDataLifecycleResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code indices} + */ + public final Map indices() { + return this.indices; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (ApiTypeHelper.isDefined(this.indices)) { + generator.writeKey("indices"); + generator.writeStartObject(); + for (Map.Entry item0 : this.indices.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ExplainDataLifecycleResponse}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private Map indices; + + /** + * Required - API name: {@code indices} + *

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

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

+ * Adds an entry to indices using a builder lambda. + */ + public final Builder indices(String key, + Function> fn) { + return indices(key, fn.apply(new DataLifecycleExplain.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ExplainDataLifecycleResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ExplainDataLifecycleResponse build() { + _checkSingleUse(); + + return new ExplainDataLifecycleResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ExplainDataLifecycleResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, ExplainDataLifecycleResponse::setupExplainDataLifecycleResponseDeserializer); + + protected static void setupExplainDataLifecycleResponseDeserializer( + ObjectDeserializer op) { + + op.add(Builder::indices, JsonpDeserializer.stringMapDeserializer(DataLifecycleExplain._DESERIALIZER), + "indices"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataLifecycleRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataLifecycleRequest.java new file mode 100644 index 000000000..d75cbb591 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataLifecycleRequest.java @@ -0,0 +1,256 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +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; + +// typedef: indices.get_data_lifecycle.Request + +/** + * Retrieves the data lifecycle configuration of one or more data streams. + * + * @see API + * specification + */ + +public class GetDataLifecycleRequest extends RequestBase { + private final List expandWildcards; + + @Nullable + private final Boolean includeDefaults; + + private final List name; + + // --------------------------------------------------------------------------------------------- + + private GetDataLifecycleRequest(Builder builder) { + + this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); + this.includeDefaults = builder.includeDefaults; + this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); + + } + + public static GetDataLifecycleRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Whether wildcard expressions should get expanded to open or closed indices + * (default: open) + *

+ * API name: {@code expand_wildcards} + */ + public final List expandWildcards() { + return this.expandWildcards; + } + + /** + * Return all relevant default configurations for the data stream (default: + * false) + *

+ * API name: {@code include_defaults} + */ + @Nullable + public final Boolean includeDefaults() { + return this.includeDefaults; + } + + /** + * Required - A comma-separated list of data streams to get; use * + * to get all data streams + *

+ * API name: {@code name} + */ + public final List name() { + return this.name; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetDataLifecycleRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private List expandWildcards; + + @Nullable + private Boolean includeDefaults; + + private List name; + + /** + * Whether wildcard expressions should get expanded to open or closed indices + * (default: open) + *

+ * 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; + } + + /** + * Whether wildcard expressions should get expanded to open or closed indices + * (default: open) + *

+ * 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; + } + + /** + * Return all relevant default configurations for the data stream (default: + * false) + *

+ * API name: {@code include_defaults} + */ + public final Builder includeDefaults(@Nullable Boolean value) { + this.includeDefaults = value; + return this; + } + + /** + * Required - A comma-separated list of data streams to get; use * + * to get all data streams + *

+ * 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 - A comma-separated list of data streams to get; use * + * to get all data streams + *

+ * 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 GetDataLifecycleRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetDataLifecycleRequest build() { + _checkSingleUse(); + + return new GetDataLifecycleRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code indices.get_data_lifecycle}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/indices.get_data_lifecycle", + + // 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("/_data_stream"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); + buf.append("/_lifecycle"); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // 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.includeDefaults != null) { + params.put("include_defaults", String.valueOf(request.includeDefaults)); + } + return params; + + }, SimpleEndpoint.emptyMap(), false, GetDataLifecycleResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataLifecycleResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataLifecycleResponse.java new file mode 100644 index 000000000..5ff94c21c --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataLifecycleResponse.java @@ -0,0 +1,177 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.indices; + +import co.elastic.clients.elasticsearch.indices.get_data_lifecycle.DataStreamLifecycle; +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.util.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: indices.get_data_lifecycle.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class GetDataLifecycleResponse implements JsonpSerializable { + private final List dataStreams; + + // --------------------------------------------------------------------------------------------- + + private GetDataLifecycleResponse(Builder builder) { + + this.dataStreams = ApiTypeHelper.unmodifiableRequired(builder.dataStreams, this, "dataStreams"); + + } + + public static GetDataLifecycleResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code data_streams} + */ + public final List dataStreams() { + return this.dataStreams; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (ApiTypeHelper.isDefined(this.dataStreams)) { + generator.writeKey("data_streams"); + generator.writeStartArray(); + for (DataStreamLifecycle item0 : this.dataStreams) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetDataLifecycleResponse}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private List dataStreams; + + /** + * Required - API name: {@code data_streams} + *

+ * Adds all elements of list to dataStreams. + */ + public final Builder dataStreams(List list) { + this.dataStreams = _listAddAll(this.dataStreams, list); + return this; + } + + /** + * Required - API name: {@code data_streams} + *

+ * Adds one or more values to dataStreams. + */ + public final Builder dataStreams(DataStreamLifecycle value, DataStreamLifecycle... values) { + this.dataStreams = _listAdd(this.dataStreams, value, values); + return this; + } + + /** + * Required - API name: {@code data_streams} + *

+ * Adds a value to dataStreams using a builder lambda. + */ + public final Builder dataStreams(Function> fn) { + return dataStreams(fn.apply(new DataStreamLifecycle.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link GetDataLifecycleResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetDataLifecycleResponse build() { + _checkSingleUse(); + + return new GetDataLifecycleResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetDataLifecycleResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, GetDataLifecycleResponse::setupGetDataLifecycleResponseDeserializer); + + protected static void setupGetDataLifecycleResponseDeserializer( + ObjectDeserializer op) { + + op.add(Builder::dataStreams, JsonpDeserializer.arrayDeserializer(DataStreamLifecycle._DESERIALIZER), + "data_streams"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataStreamRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataStreamRequest.java index 9e25fb572..4550a3054 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataStreamRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/GetDataStreamRequest.java @@ -35,6 +35,7 @@ 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; @@ -56,6 +57,9 @@ public class GetDataStreamRequest extends RequestBase { private final List expandWildcards; + @Nullable + private final Boolean includeDefaults; + private final List name; // --------------------------------------------------------------------------------------------- @@ -63,6 +67,7 @@ public class GetDataStreamRequest extends RequestBase { private GetDataStreamRequest(Builder builder) { this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); + this.includeDefaults = builder.includeDefaults; this.name = ApiTypeHelper.unmodifiable(builder.name); } @@ -81,6 +86,16 @@ public final List expandWildcards() { return this.expandWildcards; } + /** + * If true, returns all relevant default configurations for the index template. + *

+ * API name: {@code include_defaults} + */ + @Nullable + public final Boolean includeDefaults() { + return this.includeDefaults; + } + /** * A comma-separated list of data streams to get; use * to get all * data streams @@ -103,6 +118,9 @@ public static class Builder extends RequestBase.AbstractBuilder @Nullable private List expandWildcards; + @Nullable + private Boolean includeDefaults; + @Nullable private List name; @@ -132,6 +150,16 @@ public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... val return this; } + /** + * If true, returns all relevant default configurations for the index template. + *

+ * API name: {@code include_defaults} + */ + public final Builder includeDefaults(@Nullable Boolean value) { + this.includeDefaults = value; + return this; + } + /** * A comma-separated list of data streams to get; use * to get all * data streams @@ -222,6 +250,9 @@ public GetDataStreamRequest build() { params.put("expand_wildcards", request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); } + if (request.includeDefaults != null) { + params.put("include_defaults", String.valueOf(request.includeDefaults)); + } return params; }, SimpleEndpoint.emptyMap(), false, GetDataStreamResponse._DESERIALIZER); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndexTemplateRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndexTemplateRequest.java index 0a8a2b1ed..e2ccabe8e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndexTemplateRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/GetIndexTemplateRequest.java @@ -56,6 +56,9 @@ public class GetIndexTemplateRequest extends RequestBase { @Nullable private final Boolean flatSettings; + @Nullable + private final Boolean includeDefaults; + @Nullable private final Boolean local; @@ -70,6 +73,7 @@ public class GetIndexTemplateRequest extends RequestBase { private GetIndexTemplateRequest(Builder builder) { this.flatSettings = builder.flatSettings; + this.includeDefaults = builder.includeDefaults; this.local = builder.local; this.masterTimeout = builder.masterTimeout; this.name = builder.name; @@ -90,6 +94,16 @@ public final Boolean flatSettings() { return this.flatSettings; } + /** + * If true, returns all relevant default configurations for the index template. + *

+ * API name: {@code include_defaults} + */ + @Nullable + public final Boolean includeDefaults() { + return this.includeDefaults; + } + /** * If true, the request retrieves information from the local node only. Defaults * to false, which means information is retrieved from the master node. @@ -135,6 +149,9 @@ public static class Builder extends RequestBase.AbstractBuilder @Nullable private Boolean flatSettings; + @Nullable + private Boolean includeDefaults; + @Nullable private Boolean local; @@ -154,6 +171,16 @@ public final Builder flatSettings(@Nullable Boolean value) { return this; } + /** + * If true, returns all relevant default configurations for the index template. + *

+ * API name: {@code include_defaults} + */ + public final Builder includeDefaults(@Nullable Boolean value) { + this.includeDefaults = value; + return this; + } + /** * If true, the request retrieves information from the local node only. Defaults * to false, which means information is retrieved from the master node. @@ -263,6 +290,9 @@ public GetIndexTemplateRequest build() { if (request.flatSettings != null) { params.put("flat_settings", String.valueOf(request.flatSettings)); } + if (request.includeDefaults != null) { + params.put("include_defaults", String.valueOf(request.includeDefaults)); + } if (request.local != null) { params.put("local", String.valueOf(request.local)); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexState.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexState.java index 7937bc3d3..9ec8fc30c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexState.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexState.java @@ -64,6 +64,9 @@ public class IndexState implements JsonpSerializable { @Nullable private final String dataStream; + @Nullable + private final DataLifecycle lifecycle; + // --------------------------------------------------------------------------------------------- private IndexState(Builder builder) { @@ -73,6 +76,7 @@ private IndexState(Builder builder) { this.settings = builder.settings; this.defaults = builder.defaults; this.dataStream = builder.dataStream; + this.lifecycle = builder.lifecycle; } @@ -122,6 +126,16 @@ public final String dataStream() { return this.dataStream; } + /** + * Data lifecycle applicable iff this is a data stream. + *

+ * API name: {@code lifecycle} + */ + @Nullable + public final DataLifecycle lifecycle() { + return this.lifecycle; + } + /** * Serialize this object to JSON. */ @@ -164,6 +178,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.dataStream); } + if (this.lifecycle != null) { + generator.writeKey("lifecycle"); + this.lifecycle.serialize(generator, mapper); + + } } @@ -194,6 +213,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private String dataStream; + @Nullable + private DataLifecycle lifecycle; + /** * API name: {@code aliases} *

@@ -282,6 +304,25 @@ public final Builder dataStream(@Nullable String value) { return this; } + /** + * Data lifecycle applicable iff this is a data stream. + *

+ * API name: {@code lifecycle} + */ + public final Builder lifecycle(@Nullable DataLifecycle value) { + this.lifecycle = value; + return this; + } + + /** + * Data lifecycle applicable iff this is a data stream. + *

+ * API name: {@code lifecycle} + */ + public final Builder lifecycle(Function> fn) { + return this.lifecycle(fn.apply(new DataLifecycle.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -315,6 +356,7 @@ protected static void setupIndexStateDeserializer(ObjectDeserializer @Nullable private IndexSettings settings; + @Nullable + private DataLifecycleWithRollover lifecycle; + /** * API name: {@code aliases} *

@@ -213,6 +233,22 @@ public final Builder settings(Function> fn) { + return this.lifecycle(fn.apply(new DataLifecycleWithRollover.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -244,6 +280,7 @@ protected static void setupIndexTemplateSummaryDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public class PutDataLifecycleRequest extends RequestBase implements JsonpSerializable { + @Nullable + private final Time dataRetention; + + private final List expandWildcards; + + @Nullable + private final Time masterTimeout; + + private final List name; + + @Nullable + private final Time timeout; + + // --------------------------------------------------------------------------------------------- + + private PutDataLifecycleRequest(Builder builder) { + + this.dataRetention = builder.dataRetention; + this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); + this.masterTimeout = builder.masterTimeout; + this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); + this.timeout = builder.timeout; + + } + + public static PutDataLifecycleRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code data_retention} + */ + @Nullable + public final Time dataRetention() { + return this.dataRetention; + } + + /** + * Whether wildcard expressions should get expanded to open or closed indices + * (default: open) + *

+ * API name: {@code expand_wildcards} + */ + public final List expandWildcards() { + return this.expandWildcards; + } + + /** + * Specify timeout for connection to master + *

+ * API name: {@code master_timeout} + */ + @Nullable + public final Time masterTimeout() { + return this.masterTimeout; + } + + /** + * Required - A comma-separated list of data streams whose lifecycle will be + * updated; use * to set the lifecycle to all data streams + *

+ * API name: {@code name} + */ + public final List name() { + return this.name; + } + + /** + * Explicit timestamp for the document + *

+ * API name: {@code timeout} + */ + @Nullable + public final Time timeout() { + return this.timeout; + } + + /** + * 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.dataRetention != null) { + generator.writeKey("data_retention"); + this.dataRetention.serialize(generator, mapper); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link PutDataLifecycleRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private Time dataRetention; + + @Nullable + private List expandWildcards; + + @Nullable + private Time masterTimeout; + + private List name; + + @Nullable + private Time timeout; + + /** + * API name: {@code data_retention} + */ + public final Builder dataRetention(@Nullable Time value) { + this.dataRetention = value; + return this; + } + + /** + * API name: {@code data_retention} + */ + public final Builder dataRetention(Function> fn) { + return this.dataRetention(fn.apply(new Time.Builder()).build()); + } + + /** + * Whether wildcard expressions should get expanded to open or closed indices + * (default: open) + *

+ * 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; + } + + /** + * Whether wildcard expressions should get expanded to open or closed indices + * (default: open) + *

+ * 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; + } + + /** + * Specify timeout for connection to master + *

+ * API name: {@code master_timeout} + */ + public final Builder masterTimeout(@Nullable Time value) { + this.masterTimeout = value; + return this; + } + + /** + * Specify timeout for connection to master + *

+ * API name: {@code master_timeout} + */ + public final Builder masterTimeout(Function> fn) { + return this.masterTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - A comma-separated list of data streams whose lifecycle will be + * updated; use * to set the lifecycle to all data streams + *

+ * 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 - A comma-separated list of data streams whose lifecycle will be + * updated; use * to set the lifecycle to all data streams + *

+ * 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; + } + + /** + * Explicit timestamp for the document + *

+ * API name: {@code timeout} + */ + public final Builder timeout(@Nullable Time value) { + this.timeout = value; + return this; + } + + /** + * Explicit timestamp for the document + *

+ * API name: {@code timeout} + */ + public final Builder timeout(Function> fn) { + return this.timeout(fn.apply(new Time.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link PutDataLifecycleRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public PutDataLifecycleRequest build() { + _checkSingleUse(); + + return new PutDataLifecycleRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PutDataLifecycleRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, PutDataLifecycleRequest::setupPutDataLifecycleRequestDeserializer); + + protected static void setupPutDataLifecycleRequestDeserializer( + ObjectDeserializer op) { + + op.add(Builder::dataRetention, Time._DESERIALIZER, "data_retention"); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code indices.put_data_lifecycle}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/indices.put_data_lifecycle", + + // Request method + request -> { + return "PUT"; + + }, + + // Request path + request -> { + final int _name = 1 << 0; + + int propsSet = 0; + + propsSet |= _name; + + if (propsSet == (_name)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_data_stream"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); + buf.append("/_lifecycle"); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } + if (ApiTypeHelper.isDefined(request.expandWildcards)) { + params.put("expand_wildcards", + request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); + } + if (request.timeout != null) { + params.put("timeout", request.timeout._toJsonString()); + } + return params; + + }, SimpleEndpoint.emptyMap(), true, PutDataLifecycleResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/PutDataLifecycleResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/PutDataLifecycleResponse.java new file mode 100644 index 000000000..6fb604435 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/PutDataLifecycleResponse.java @@ -0,0 +1,98 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.indices; + +import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; +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.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; + +// typedef: indices.put_data_lifecycle.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class PutDataLifecycleResponse extends AcknowledgedResponseBase { + // --------------------------------------------------------------------------------------------- + + private PutDataLifecycleResponse(Builder builder) { + super(builder); + + } + + public static PutDataLifecycleResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link PutDataLifecycleResponse}. + */ + + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link PutDataLifecycleResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public PutDataLifecycleResponse build() { + _checkSingleUse(); + + return new PutDataLifecycleResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PutDataLifecycleResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, PutDataLifecycleResponse::setupPutDataLifecycleResponseDeserializer); + + protected static void setupPutDataLifecycleResponseDeserializer( + ObjectDeserializer op) { + AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateIndexTemplateRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateIndexTemplateRequest.java index 0d8767fe8..addad2d0b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateIndexTemplateRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateIndexTemplateRequest.java @@ -75,6 +75,9 @@ public class SimulateIndexTemplateRequest extends RequestBase implements JsonpSe @Nullable private final DataStreamVisibility dataStream; + @Nullable + private final Boolean includeDefaults; + private final List indexPatterns; @Nullable @@ -100,6 +103,7 @@ private SimulateIndexTemplateRequest(Builder builder) { this.composedOf = ApiTypeHelper.unmodifiable(builder.composedOf); this.create = builder.create; this.dataStream = builder.dataStream; + this.includeDefaults = builder.includeDefaults; this.indexPatterns = ApiTypeHelper.unmodifiable(builder.indexPatterns); this.masterTimeout = builder.masterTimeout; this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); @@ -157,6 +161,16 @@ public final DataStreamVisibility dataStream() { return this.dataStream; } + /** + * If true, returns all relevant default configurations for the index template. + *

+ * API name: {@code include_defaults} + */ + @Nullable + public final Boolean includeDefaults() { + return this.includeDefaults; + } + /** * API name: {@code index_patterns} */ @@ -302,6 +316,9 @@ public static class Builder extends RequestBase.AbstractBuilder @Nullable private DataStreamVisibility dataStream; + @Nullable + private Boolean includeDefaults; + @Nullable private List indexPatterns; @@ -397,6 +414,16 @@ public final Builder dataStream( return this.dataStream(fn.apply(new DataStreamVisibility.Builder()).build()); } + /** + * If true, returns all relevant default configurations for the index template. + *

+ * API name: {@code include_defaults} + */ + public final Builder includeDefaults(@Nullable Boolean value) { + this.includeDefaults = value; + return this; + } + /** * API name: {@code index_patterns} *

@@ -564,6 +591,9 @@ protected static void setupSimulateIndexTemplateRequestDeserializer( if (request.create != null) { params.put("create", String.valueOf(request.create)); } + if (request.includeDefaults != null) { + params.put("include_defaults", String.valueOf(request.includeDefaults)); + } return params; }, SimpleEndpoint.emptyMap(), true, SimulateIndexTemplateResponse._DESERIALIZER); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateTemplateRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateTemplateRequest.java index 8c38fdbf9..29975804f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateTemplateRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/SimulateTemplateRequest.java @@ -61,6 +61,9 @@ public class SimulateTemplateRequest extends RequestBase implements JsonpSeriali @Nullable private final Boolean create; + @Nullable + private final Boolean includeDefaults; + @Nullable private final Time masterTimeout; @@ -74,6 +77,7 @@ public class SimulateTemplateRequest extends RequestBase implements JsonpSeriali private SimulateTemplateRequest(Builder builder) { this.create = builder.create; + this.includeDefaults = builder.includeDefaults; this.masterTimeout = builder.masterTimeout; this.name = builder.name; this.template = ApiTypeHelper.requireNonNull(builder.template, this, "template"); @@ -97,6 +101,16 @@ public final Boolean create() { return this.create; } + /** + * If true, returns all relevant default configurations for the index template. + *

+ * API name: {@code include_defaults} + */ + @Nullable + public final Boolean includeDefaults() { + return this.includeDefaults; + } + /** * Period to wait for a connection to the master node. If no response is * received before the timeout expires, the request fails and returns an error. @@ -147,6 +161,9 @@ public static class Builder extends RequestBase.AbstractBuilder @Nullable private Boolean create; + @Nullable + private Boolean includeDefaults; + @Nullable private Time masterTimeout; @@ -168,6 +185,16 @@ public final Builder create(@Nullable Boolean value) { return this; } + /** + * If true, returns all relevant default configurations for the index template. + *

+ * API name: {@code include_defaults} + */ + public final Builder includeDefaults(@Nullable Boolean value) { + this.includeDefaults = value; + return this; + } + /** * Period to wait for a connection to the master node. If no response is * received before the timeout expires, the request fails and returns an error. @@ -301,6 +328,9 @@ protected static JsonpDeserializer createSimulateTempla if (request.create != null) { params.put("create", String.valueOf(request.create)); } + if (request.includeDefaults != null) { + params.put("include_defaults", String.valueOf(request.includeDefaults)); + } return params; }, SimpleEndpoint.emptyMap(), true, SimulateTemplateResponse._DESERIALIZER); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/explain_data_lifecycle/DataLifecycleExplain.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/explain_data_lifecycle/DataLifecycleExplain.java new file mode 100644 index 000000000..013169b6e --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/explain_data_lifecycle/DataLifecycleExplain.java @@ -0,0 +1,406 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.indices.explain_data_lifecycle; + +import co.elastic.clients.elasticsearch._types.Time; +import co.elastic.clients.elasticsearch.indices.DataLifecycleWithRollover; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.Long; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: indices.explain_data_lifecycle.DataLifecycleExplain + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DataLifecycleExplain implements JsonpSerializable { + private final String index; + + private final boolean managedByDlm; + + @Nullable + private final Long indexCreationDateMillis; + + @Nullable + private final Time timeSinceIndexCreation; + + @Nullable + private final Long rolloverDateMillis; + + @Nullable + private final Time timeSinceRollover; + + @Nullable + private final DataLifecycleWithRollover lifecycle; + + @Nullable + private final Time generationTime; + + @Nullable + private final String error; + + // --------------------------------------------------------------------------------------------- + + private DataLifecycleExplain(Builder builder) { + + this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); + this.managedByDlm = ApiTypeHelper.requireNonNull(builder.managedByDlm, this, "managedByDlm"); + this.indexCreationDateMillis = builder.indexCreationDateMillis; + this.timeSinceIndexCreation = builder.timeSinceIndexCreation; + this.rolloverDateMillis = builder.rolloverDateMillis; + this.timeSinceRollover = builder.timeSinceRollover; + this.lifecycle = builder.lifecycle; + this.generationTime = builder.generationTime; + this.error = builder.error; + + } + + public static DataLifecycleExplain of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code index} + */ + public final String index() { + return this.index; + } + + /** + * Required - API name: {@code managed_by_dlm} + */ + public final boolean managedByDlm() { + return this.managedByDlm; + } + + /** + * API name: {@code index_creation_date_millis} + */ + @Nullable + public final Long indexCreationDateMillis() { + return this.indexCreationDateMillis; + } + + /** + * API name: {@code time_since_index_creation} + */ + @Nullable + public final Time timeSinceIndexCreation() { + return this.timeSinceIndexCreation; + } + + /** + * API name: {@code rollover_date_millis} + */ + @Nullable + public final Long rolloverDateMillis() { + return this.rolloverDateMillis; + } + + /** + * API name: {@code time_since_rollover} + */ + @Nullable + public final Time timeSinceRollover() { + return this.timeSinceRollover; + } + + /** + * API name: {@code lifecycle} + */ + @Nullable + public final DataLifecycleWithRollover lifecycle() { + return this.lifecycle; + } + + /** + * API name: {@code generation_time} + */ + @Nullable + public final Time generationTime() { + return this.generationTime; + } + + /** + * API name: {@code error} + */ + @Nullable + public final String error() { + return this.error; + } + + /** + * 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("index"); + generator.write(this.index); + + generator.writeKey("managed_by_dlm"); + generator.write(this.managedByDlm); + + if (this.indexCreationDateMillis != null) { + generator.writeKey("index_creation_date_millis"); + generator.write(this.indexCreationDateMillis); + + } + if (this.timeSinceIndexCreation != null) { + generator.writeKey("time_since_index_creation"); + this.timeSinceIndexCreation.serialize(generator, mapper); + + } + if (this.rolloverDateMillis != null) { + generator.writeKey("rollover_date_millis"); + generator.write(this.rolloverDateMillis); + + } + if (this.timeSinceRollover != null) { + generator.writeKey("time_since_rollover"); + this.timeSinceRollover.serialize(generator, mapper); + + } + if (this.lifecycle != null) { + generator.writeKey("lifecycle"); + this.lifecycle.serialize(generator, mapper); + + } + if (this.generationTime != null) { + generator.writeKey("generation_time"); + this.generationTime.serialize(generator, mapper); + + } + if (this.error != null) { + generator.writeKey("error"); + generator.write(this.error); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DataLifecycleExplain}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private String index; + + private Boolean managedByDlm; + + @Nullable + private Long indexCreationDateMillis; + + @Nullable + private Time timeSinceIndexCreation; + + @Nullable + private Long rolloverDateMillis; + + @Nullable + private Time timeSinceRollover; + + @Nullable + private DataLifecycleWithRollover lifecycle; + + @Nullable + private Time generationTime; + + @Nullable + private String error; + + /** + * Required - API name: {@code index} + */ + public final Builder index(String value) { + this.index = value; + return this; + } + + /** + * Required - API name: {@code managed_by_dlm} + */ + public final Builder managedByDlm(boolean value) { + this.managedByDlm = value; + return this; + } + + /** + * API name: {@code index_creation_date_millis} + */ + public final Builder indexCreationDateMillis(@Nullable Long value) { + this.indexCreationDateMillis = value; + return this; + } + + /** + * API name: {@code time_since_index_creation} + */ + public final Builder timeSinceIndexCreation(@Nullable Time value) { + this.timeSinceIndexCreation = value; + return this; + } + + /** + * API name: {@code time_since_index_creation} + */ + public final Builder timeSinceIndexCreation(Function> fn) { + return this.timeSinceIndexCreation(fn.apply(new Time.Builder()).build()); + } + + /** + * API name: {@code rollover_date_millis} + */ + public final Builder rolloverDateMillis(@Nullable Long value) { + this.rolloverDateMillis = value; + return this; + } + + /** + * API name: {@code time_since_rollover} + */ + public final Builder timeSinceRollover(@Nullable Time value) { + this.timeSinceRollover = value; + return this; + } + + /** + * API name: {@code time_since_rollover} + */ + public final Builder timeSinceRollover(Function> fn) { + return this.timeSinceRollover(fn.apply(new Time.Builder()).build()); + } + + /** + * API name: {@code lifecycle} + */ + public final Builder lifecycle(@Nullable DataLifecycleWithRollover value) { + this.lifecycle = value; + return this; + } + + /** + * API name: {@code lifecycle} + */ + public final Builder lifecycle( + Function> fn) { + return this.lifecycle(fn.apply(new DataLifecycleWithRollover.Builder()).build()); + } + + /** + * API name: {@code generation_time} + */ + public final Builder generationTime(@Nullable Time value) { + this.generationTime = value; + return this; + } + + /** + * API name: {@code generation_time} + */ + public final Builder generationTime(Function> fn) { + return this.generationTime(fn.apply(new Time.Builder()).build()); + } + + /** + * API name: {@code error} + */ + public final Builder error(@Nullable String value) { + this.error = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DataLifecycleExplain}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DataLifecycleExplain build() { + _checkSingleUse(); + + return new DataLifecycleExplain(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DataLifecycleExplain} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DataLifecycleExplain::setupDataLifecycleExplainDeserializer); + + protected static void setupDataLifecycleExplainDeserializer(ObjectDeserializer op) { + + op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); + op.add(Builder::managedByDlm, JsonpDeserializer.booleanDeserializer(), "managed_by_dlm"); + op.add(Builder::indexCreationDateMillis, JsonpDeserializer.longDeserializer(), "index_creation_date_millis"); + op.add(Builder::timeSinceIndexCreation, Time._DESERIALIZER, "time_since_index_creation"); + op.add(Builder::rolloverDateMillis, JsonpDeserializer.longDeserializer(), "rollover_date_millis"); + op.add(Builder::timeSinceRollover, Time._DESERIALIZER, "time_since_rollover"); + op.add(Builder::lifecycle, DataLifecycleWithRollover._DESERIALIZER, "lifecycle"); + op.add(Builder::generationTime, Time._DESERIALIZER, "generation_time"); + op.add(Builder::error, JsonpDeserializer.stringDeserializer(), "error"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_lifecycle/DataStreamLifecycle.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_lifecycle/DataStreamLifecycle.java new file mode 100644 index 000000000..3abac00cc --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/get_data_lifecycle/DataStreamLifecycle.java @@ -0,0 +1,183 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.indices.get_data_lifecycle; + +import co.elastic.clients.elasticsearch.indices.DataLifecycle; +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; + +// typedef: indices.get_data_lifecycle.DataStreamLifecycle + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DataStreamLifecycle implements JsonpSerializable { + private final String name; + + @Nullable + private final DataLifecycle lifecycle; + + // --------------------------------------------------------------------------------------------- + + private DataStreamLifecycle(Builder builder) { + + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.lifecycle = builder.lifecycle; + + } + + public static DataStreamLifecycle of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code name} + */ + public final String name() { + return this.name; + } + + /** + * API name: {@code lifecycle} + */ + @Nullable + public final DataLifecycle lifecycle() { + return this.lifecycle; + } + + /** + * 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("name"); + generator.write(this.name); + + if (this.lifecycle != null) { + generator.writeKey("lifecycle"); + this.lifecycle.serialize(generator, mapper); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DataStreamLifecycle}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private String name; + + @Nullable + private DataLifecycle lifecycle; + + /** + * Required - API name: {@code name} + */ + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * API name: {@code lifecycle} + */ + public final Builder lifecycle(@Nullable DataLifecycle value) { + this.lifecycle = value; + return this; + } + + /** + * API name: {@code lifecycle} + */ + public final Builder lifecycle(Function> fn) { + return this.lifecycle(fn.apply(new DataLifecycle.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DataStreamLifecycle}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DataStreamLifecycle build() { + _checkSingleUse(); + + return new DataStreamLifecycle(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DataStreamLifecycle} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DataStreamLifecycle::setupDataStreamLifecycleDeserializer); + + protected static void setupDataStreamLifecycleDeserializer(ObjectDeserializer op) { + + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::lifecycle, DataLifecycle._DESERIALIZER, "lifecycle"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/put_index_template/IndexTemplateMapping.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/put_index_template/IndexTemplateMapping.java index d621c2887..d17d83911 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/put_index_template/IndexTemplateMapping.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/put_index_template/IndexTemplateMapping.java @@ -25,6 +25,7 @@ import co.elastic.clients.elasticsearch._types.mapping.TypeMapping; import co.elastic.clients.elasticsearch.indices.Alias; +import co.elastic.clients.elasticsearch.indices.DataLifecycle; import co.elastic.clients.elasticsearch.indices.IndexSettings; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; @@ -61,6 +62,9 @@ public class IndexTemplateMapping implements JsonpSerializable { @Nullable private final IndexSettings settings; + @Nullable + private final DataLifecycle lifecycle; + // --------------------------------------------------------------------------------------------- private IndexTemplateMapping(Builder builder) { @@ -68,6 +72,7 @@ private IndexTemplateMapping(Builder builder) { this.aliases = ApiTypeHelper.unmodifiable(builder.aliases); this.mappings = builder.mappings; this.settings = builder.settings; + this.lifecycle = builder.lifecycle; } @@ -98,6 +103,14 @@ public final IndexSettings settings() { return this.settings; } + /** + * API name: {@code lifecycle} + */ + @Nullable + public final DataLifecycle lifecycle() { + return this.lifecycle; + } + /** * Serialize this object to JSON. */ @@ -130,6 +143,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.settings.serialize(generator, mapper); } + if (this.lifecycle != null) { + generator.writeKey("lifecycle"); + this.lifecycle.serialize(generator, mapper); + + } } @@ -156,6 +174,9 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private IndexSettings settings; + @Nullable + private DataLifecycle lifecycle; + /** * API name: {@code aliases} *

@@ -215,6 +236,21 @@ public final Builder settings(Function> fn) { + return this.lifecycle(fn.apply(new DataLifecycle.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -246,6 +282,7 @@ protected static void setupIndexTemplateMappingDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public class AnalyticsCollection implements JsonpSerializable { + private final EventDataStream eventDataStream; + + // --------------------------------------------------------------------------------------------- + + private AnalyticsCollection(Builder builder) { + + this.eventDataStream = ApiTypeHelper.requireNonNull(builder.eventDataStream, this, "eventDataStream"); + + } + + public static AnalyticsCollection of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Data stream for the collection + *

+ * API name: {@code event_data_stream} + */ + public final EventDataStream eventDataStream() { + return this.eventDataStream; + } + + /** + * 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("event_data_stream"); + this.eventDataStream.serialize(generator, mapper); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link AnalyticsCollection}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private EventDataStream eventDataStream; + + /** + * Required - Data stream for the collection + *

+ * API name: {@code event_data_stream} + */ + public final Builder eventDataStream(EventDataStream value) { + this.eventDataStream = value; + return this; + } + + /** + * Required - Data stream for the collection + *

+ * API name: {@code event_data_stream} + */ + public final Builder eventDataStream(Function> fn) { + return this.eventDataStream(fn.apply(new EventDataStream.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link AnalyticsCollection}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public AnalyticsCollection build() { + _checkSingleUse(); + + return new AnalyticsCollection(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link AnalyticsCollection} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, AnalyticsCollection::setupAnalyticsCollectionDeserializer); + + protected static void setupAnalyticsCollectionDeserializer(ObjectDeserializer op) { + + op.add(Builder::eventDataStream, EventDataStream._DESERIALIZER, "event_data_stream"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/DeleteBehavioralAnalyticsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/DeleteBehavioralAnalyticsRequest.java new file mode 100644 index 000000000..4014560a7 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/DeleteBehavioralAnalyticsRequest.java @@ -0,0 +1,156 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.search_application; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +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.String; +import java.util.Collections; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: search_application.delete_behavioral_analytics.Request + +/** + * Delete a behavioral analytics collection. + * + * @see API + * specification + */ + +public class DeleteBehavioralAnalyticsRequest extends RequestBase { + private final String name; + + // --------------------------------------------------------------------------------------------- + + private DeleteBehavioralAnalyticsRequest(Builder builder) { + + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + + } + + public static DeleteBehavioralAnalyticsRequest of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The name of the analytics collection to be deleted + *

+ * API name: {@code name} + */ + public final String name() { + return this.name; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteBehavioralAnalyticsRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + private String name; + + /** + * Required - The name of the analytics collection to be deleted + *

+ * API name: {@code name} + */ + public final Builder name(String value) { + this.name = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DeleteBehavioralAnalyticsRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DeleteBehavioralAnalyticsRequest build() { + _checkSingleUse(); + + return new DeleteBehavioralAnalyticsRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code search_application.delete_behavioral_analytics}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/search_application.delete_behavioral_analytics", + + // Request method + request -> { + return "DELETE"; + + }, + + // Request path + request -> { + final int _name = 1 << 0; + + int propsSet = 0; + + propsSet |= _name; + + if (propsSet == (_name)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_application"); + buf.append("/analytics"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.name, buf); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), false, DeleteBehavioralAnalyticsResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/DeleteBehavioralAnalyticsResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/DeleteBehavioralAnalyticsResponse.java new file mode 100644 index 000000000..c5aab92fc --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/DeleteBehavioralAnalyticsResponse.java @@ -0,0 +1,99 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.search_application; + +import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; +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.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; + +// typedef: search_application.delete_behavioral_analytics.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DeleteBehavioralAnalyticsResponse extends AcknowledgedResponseBase { + // --------------------------------------------------------------------------------------------- + + private DeleteBehavioralAnalyticsResponse(Builder builder) { + super(builder); + + } + + public static DeleteBehavioralAnalyticsResponse of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteBehavioralAnalyticsResponse}. + */ + + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DeleteBehavioralAnalyticsResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DeleteBehavioralAnalyticsResponse build() { + _checkSingleUse(); + + return new DeleteBehavioralAnalyticsResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DeleteBehavioralAnalyticsResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DeleteBehavioralAnalyticsResponse::setupDeleteBehavioralAnalyticsResponseDeserializer); + + protected static void setupDeleteBehavioralAnalyticsResponseDeserializer( + ObjectDeserializer op) { + AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/ElasticsearchSearchApplicationAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/ElasticsearchSearchApplicationAsyncClient.java index 9f02e7725..4fe85dd95 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/ElasticsearchSearchApplicationAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/ElasticsearchSearchApplicationAsyncClient.java @@ -91,6 +91,40 @@ public final CompletableFuture delete( return delete(fn.apply(new DeleteSearchApplicationRequest.Builder()).build()); } + // ----- Endpoint: search_application.delete_behavioral_analytics + + /** + * Delete a behavioral analytics collection. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture deleteBehavioralAnalytics( + DeleteBehavioralAnalyticsRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) DeleteBehavioralAnalyticsRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Delete a behavioral analytics collection. + * + * @param fn + * a function that initializes a builder to create the + * {@link DeleteBehavioralAnalyticsRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture deleteBehavioralAnalytics( + Function> fn) { + return deleteBehavioralAnalytics(fn.apply(new DeleteBehavioralAnalyticsRequest.Builder()).build()); + } + // ----- Endpoint: search_application.get /** @@ -124,6 +158,53 @@ public final CompletableFuture get( return get(fn.apply(new GetSearchApplicationRequest.Builder()).build()); } + // ----- Endpoint: search_application.get_behavioral_analytics + + /** + * Returns the existing behavioral analytics collections. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture getBehavioralAnalytics( + GetBehavioralAnalyticsRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) GetBehavioralAnalyticsRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Returns the existing behavioral analytics collections. + * + * @param fn + * a function that initializes a builder to create the + * {@link GetBehavioralAnalyticsRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture getBehavioralAnalytics( + Function> fn) { + return getBehavioralAnalytics(fn.apply(new GetBehavioralAnalyticsRequest.Builder()).build()); + } + + /** + * Returns the existing behavioral analytics collections. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture getBehavioralAnalytics() { + return this.transport.performRequestAsync(new GetBehavioralAnalyticsRequest.Builder().build(), + GetBehavioralAnalyticsRequest._ENDPOINT, this.transportOptions); + } + // ----- Endpoint: search_application.list /** @@ -201,6 +282,40 @@ public final CompletableFuture put(FunctionDocumentation + * on elastic.co + */ + + public CompletableFuture putBehavioralAnalytics( + PutBehavioralAnalyticsRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) PutBehavioralAnalyticsRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Creates a behavioral analytics collection. + * + * @param fn + * a function that initializes a builder to create the + * {@link PutBehavioralAnalyticsRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture putBehavioralAnalytics( + Function> fn) { + return putBehavioralAnalytics(fn.apply(new PutBehavioralAnalyticsRequest.Builder()).build()); + } + // ----- Endpoint: search_application.search /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/ElasticsearchSearchApplicationClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/ElasticsearchSearchApplicationClient.java index 01f613374..39f4cd916 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/ElasticsearchSearchApplicationClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/ElasticsearchSearchApplicationClient.java @@ -94,6 +94,41 @@ public final DeleteSearchApplicationResponse delete( return delete(fn.apply(new DeleteSearchApplicationRequest.Builder()).build()); } + // ----- Endpoint: search_application.delete_behavioral_analytics + + /** + * Delete a behavioral analytics collection. + * + * @see Documentation + * on elastic.co + */ + + public DeleteBehavioralAnalyticsResponse deleteBehavioralAnalytics(DeleteBehavioralAnalyticsRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) DeleteBehavioralAnalyticsRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Delete a behavioral analytics collection. + * + * @param fn + * a function that initializes a builder to create the + * {@link DeleteBehavioralAnalyticsRequest} + * @see Documentation + * on elastic.co + */ + + public final DeleteBehavioralAnalyticsResponse deleteBehavioralAnalytics( + Function> fn) + throws IOException, ElasticsearchException { + return deleteBehavioralAnalytics(fn.apply(new DeleteBehavioralAnalyticsRequest.Builder()).build()); + } + // ----- Endpoint: search_application.get /** @@ -129,6 +164,54 @@ public final GetSearchApplicationResponse get( return get(fn.apply(new GetSearchApplicationRequest.Builder()).build()); } + // ----- Endpoint: search_application.get_behavioral_analytics + + /** + * Returns the existing behavioral analytics collections. + * + * @see Documentation + * on elastic.co + */ + + public GetBehavioralAnalyticsResponse getBehavioralAnalytics(GetBehavioralAnalyticsRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) GetBehavioralAnalyticsRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Returns the existing behavioral analytics collections. + * + * @param fn + * a function that initializes a builder to create the + * {@link GetBehavioralAnalyticsRequest} + * @see Documentation + * on elastic.co + */ + + public final GetBehavioralAnalyticsResponse getBehavioralAnalytics( + Function> fn) + throws IOException, ElasticsearchException { + return getBehavioralAnalytics(fn.apply(new GetBehavioralAnalyticsRequest.Builder()).build()); + } + + /** + * Returns the existing behavioral analytics collections. + * + * @see Documentation + * on elastic.co + */ + + public GetBehavioralAnalyticsResponse getBehavioralAnalytics() throws IOException, ElasticsearchException { + return this.transport.performRequest(new GetBehavioralAnalyticsRequest.Builder().build(), + GetBehavioralAnalyticsRequest._ENDPOINT, this.transportOptions); + } + // ----- Endpoint: search_application.list /** @@ -208,6 +291,41 @@ public final PutResponse put(FunctionDocumentation + * on elastic.co + */ + + public PutBehavioralAnalyticsResponse putBehavioralAnalytics(PutBehavioralAnalyticsRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) PutBehavioralAnalyticsRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Creates a behavioral analytics collection. + * + * @param fn + * a function that initializes a builder to create the + * {@link PutBehavioralAnalyticsRequest} + * @see Documentation + * on elastic.co + */ + + public final PutBehavioralAnalyticsResponse putBehavioralAnalytics( + Function> fn) + throws IOException, ElasticsearchException { + return putBehavioralAnalytics(fn.apply(new PutBehavioralAnalyticsRequest.Builder()).build()); + } + // ----- Endpoint: search_application.search /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/EventDataStream.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/EventDataStream.java new file mode 100644 index 000000000..5fdc2a430 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/EventDataStream.java @@ -0,0 +1,143 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.search_application; + +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; + +// typedef: search_application._types.EventDataStream + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class EventDataStream implements JsonpSerializable { + private final String name; + + // --------------------------------------------------------------------------------------------- + + private EventDataStream(Builder builder) { + + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + + } + + public static EventDataStream of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code name} + */ + public final String name() { + return this.name; + } + + /** + * 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("name"); + generator.write(this.name); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link EventDataStream}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private String name; + + /** + * Required - API name: {@code name} + */ + public final Builder name(String value) { + this.name = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link EventDataStream}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public EventDataStream build() { + _checkSingleUse(); + + return new EventDataStream(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link EventDataStream} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + EventDataStream::setupEventDataStreamDeserializer); + + protected static void setupEventDataStreamDeserializer(ObjectDeserializer op) { + + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/GetBehavioralAnalyticsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/GetBehavioralAnalyticsRequest.java new file mode 100644 index 000000000..b2aa3e9bf --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/GetBehavioralAnalyticsRequest.java @@ -0,0 +1,179 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.search_application; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +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.String; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import java.util.stream.Collectors; +import javax.annotation.Nullable; + +// typedef: search_application.get_behavioral_analytics.Request + +/** + * Returns the existing behavioral analytics collections. + * + * @see API + * specification + */ + +public class GetBehavioralAnalyticsRequest extends RequestBase { + private final List name; + + // --------------------------------------------------------------------------------------------- + + private GetBehavioralAnalyticsRequest(Builder builder) { + + this.name = ApiTypeHelper.unmodifiable(builder.name); + + } + + public static GetBehavioralAnalyticsRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * A list of analytics collections to limit the returned information + *

+ * API name: {@code name} + */ + public final List name() { + return this.name; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetBehavioralAnalyticsRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private List name; + + /** + * A list of analytics collections to limit the returned information + *

+ * 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; + } + + /** + * A list of analytics collections to limit the returned information + *

+ * 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 GetBehavioralAnalyticsRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetBehavioralAnalyticsRequest build() { + _checkSingleUse(); + + return new GetBehavioralAnalyticsRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code search_application.get_behavioral_analytics}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/search_application.get_behavioral_analytics", + + // Request method + request -> { + return "GET"; + + }, + + // Request path + request -> { + final int _name = 1 << 0; + + int propsSet = 0; + + if (ApiTypeHelper.isDefined(request.name())) + propsSet |= _name; + + if (propsSet == 0) { + StringBuilder buf = new StringBuilder(); + buf.append("/_application"); + buf.append("/analytics"); + return buf.toString(); + } + if (propsSet == (_name)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_application"); + buf.append("/analytics"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), false, GetBehavioralAnalyticsResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/GetBehavioralAnalyticsResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/GetBehavioralAnalyticsResponse.java new file mode 100644 index 000000000..ec9f4de46 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/GetBehavioralAnalyticsResponse.java @@ -0,0 +1,181 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.search_application; + +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; + +// typedef: search_application.get_behavioral_analytics.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class GetBehavioralAnalyticsResponse implements JsonpSerializable { + private final Map result; + + // --------------------------------------------------------------------------------------------- + + private GetBehavioralAnalyticsResponse(Builder builder) { + + this.result = ApiTypeHelper.unmodifiableRequired(builder.result, this, "result"); + + } + + public static GetBehavioralAnalyticsResponse 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 AnalyticsCollection 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 GetBehavioralAnalyticsResponse}. + */ + + 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, AnalyticsCollection 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 AnalyticsCollection.Builder()).build()); + } + + @Override + public Builder withJson(JsonParser parser, JsonpMapper mapper) { + + @SuppressWarnings("unchecked") + Map value = (Map) JsonpDeserializer + .stringMapDeserializer(AnalyticsCollection._DESERIALIZER).deserialize(parser, mapper); + return this.result(value); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link GetBehavioralAnalyticsResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetBehavioralAnalyticsResponse build() { + _checkSingleUse(); + + return new GetBehavioralAnalyticsResponse(this); + } + } + + public static final JsonpDeserializer _DESERIALIZER = createGetBehavioralAnalyticsResponseDeserializer(); + protected static JsonpDeserializer createGetBehavioralAnalyticsResponseDeserializer() { + + JsonpDeserializer> valueDeserializer = JsonpDeserializer + .stringMapDeserializer(AnalyticsCollection._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/search_application/PutBehavioralAnalyticsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/PutBehavioralAnalyticsRequest.java new file mode 100644 index 000000000..bccdedcd7 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/PutBehavioralAnalyticsRequest.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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.search_application; + +import co.elastic.clients.elasticsearch._types.ErrorResponse; +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.String; +import java.util.Collections; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +// typedef: search_application.put_behavioral_analytics.Request + +/** + * Creates a behavioral analytics collection + * + * @see API + * specification + */ + +public class PutBehavioralAnalyticsRequest extends RequestBase { + private final String name; + + // --------------------------------------------------------------------------------------------- + + private PutBehavioralAnalyticsRequest(Builder builder) { + + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + + } + + public static PutBehavioralAnalyticsRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The name of the analytics collection to be created or updated + *

+ * API name: {@code name} + */ + public final String name() { + return this.name; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link PutBehavioralAnalyticsRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + private String name; + + /** + * Required - The name of the analytics collection to be created or updated + *

+ * API name: {@code name} + */ + public final Builder name(String value) { + this.name = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link PutBehavioralAnalyticsRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public PutBehavioralAnalyticsRequest build() { + _checkSingleUse(); + + return new PutBehavioralAnalyticsRequest(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code search_application.put_behavioral_analytics}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/search_application.put_behavioral_analytics", + + // Request method + request -> { + return "PUT"; + + }, + + // Request path + request -> { + final int _name = 1 << 0; + + int propsSet = 0; + + propsSet |= _name; + + if (propsSet == (_name)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_application"); + buf.append("/analytics"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.name, buf); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), false, PutBehavioralAnalyticsResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/PutBehavioralAnalyticsResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/PutBehavioralAnalyticsResponse.java new file mode 100644 index 000000000..978e53b4c --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/PutBehavioralAnalyticsResponse.java @@ -0,0 +1,99 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.search_application; + +import co.elastic.clients.elasticsearch.search_application.put_behavioral_analytics.AnalyticsAcknowledgeResponseBase; +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.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.util.Objects; +import java.util.function.Function; + +// typedef: search_application.put_behavioral_analytics.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class PutBehavioralAnalyticsResponse extends AnalyticsAcknowledgeResponseBase { + // --------------------------------------------------------------------------------------------- + + private PutBehavioralAnalyticsResponse(Builder builder) { + super(builder); + + } + + public static PutBehavioralAnalyticsResponse of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link PutBehavioralAnalyticsResponse}. + */ + + public static class Builder extends AnalyticsAcknowledgeResponseBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link PutBehavioralAnalyticsResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public PutBehavioralAnalyticsResponse build() { + _checkSingleUse(); + + return new PutBehavioralAnalyticsResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PutBehavioralAnalyticsResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, PutBehavioralAnalyticsResponse::setupPutBehavioralAnalyticsResponseDeserializer); + + protected static void setupPutBehavioralAnalyticsResponseDeserializer( + ObjectDeserializer op) { + AnalyticsAcknowledgeResponseBase.setupAnalyticsAcknowledgeResponseBaseDeserializer(op); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/put_behavioral_analytics/AnalyticsAcknowledgeResponseBase.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/put_behavioral_analytics/AnalyticsAcknowledgeResponseBase.java new file mode 100644 index 000000000..6f1eb2c83 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/search_application/put_behavioral_analytics/AnalyticsAcknowledgeResponseBase.java @@ -0,0 +1,103 @@ +/* + * 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. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package co.elastic.clients.elasticsearch.search_application.put_behavioral_analytics; + +import co.elastic.clients.elasticsearch._types.AcknowledgedResponseBase; +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 co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Objects; +import javax.annotation.Nullable; + +// typedef: search_application.put_behavioral_analytics.AnalyticsAcknowledgeResponseBase + +/** + * + * @see API + * specification + */ + +public abstract class AnalyticsAcknowledgeResponseBase extends AcknowledgedResponseBase { + private final String name; + + // --------------------------------------------------------------------------------------------- + + protected AnalyticsAcknowledgeResponseBase(AbstractBuilder builder) { + super(builder); + + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + + } + + /** + * Required - The name of the analytics collection created or updated + *

+ * API name: {@code name} + */ + public final String name() { + return this.name; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + generator.writeKey("name"); + generator.write(this.name); + + } + + public abstract static class AbstractBuilder> + extends + AcknowledgedResponseBase.AbstractBuilder { + private String name; + + /** + * Required - The name of the analytics collection created or updated + *

+ * API name: {@code name} + */ + public final BuilderT name(String value) { + this.name = value; + return self(); + } + + } + + // --------------------------------------------------------------------------------------------- + protected static > void setupAnalyticsAcknowledgeResponseBaseDeserializer( + ObjectDeserializer op) { + AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + op.add(AbstractBuilder::name, JsonpDeserializer.stringDeserializer(), "name"); + + } + +}