diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html b/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html index e0c065c0b..54d69bf26 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html @@ -1302,12 +1302,20 @@ 'graph._types.VertexInclude': 'graph/_types/Vertex.ts#L61-L64', 'graph.explore.Request': 'graph/explore/GraphExploreRequest.ts#L28-L72', 'graph.explore.Response': 'graph/explore/GraphExploreResponse.ts#L25-L33', -'ilm._types.Configurations': 'ilm/_types/Phase.ts#L50-L54', -'ilm._types.ForceMergeConfiguration': 'ilm/_types/Phase.ts#L56-L58', -'ilm._types.Phase': 'ilm/_types/Phase.ts#L25-L36', -'ilm._types.Phases': 'ilm/_types/Phase.ts#L38-L44', +'ilm._types.Actions': 'ilm/_types/Phase.ts#L42-L91', +'ilm._types.AllocateAction': 'ilm/_types/Phase.ts#L131-L137', +'ilm._types.DeleteAction': 'ilm/_types/Phase.ts#L147-L149', +'ilm._types.DownsampleAction': 'ilm/_types/Phase.ts#L110-L113', +'ilm._types.ForceMergeAction': 'ilm/_types/Phase.ts#L121-L124', +'ilm._types.MigrateAction': 'ilm/_types/Phase.ts#L139-L141', +'ilm._types.Phase': 'ilm/_types/Phase.ts#L26-L32', +'ilm._types.Phases': 'ilm/_types/Phase.ts#L34-L40', 'ilm._types.Policy': 'ilm/_types/Policy.ts#L23-L26', -'ilm._types.ShrinkConfiguration': 'ilm/_types/Phase.ts#L60-L62', +'ilm._types.RolloverAction': 'ilm/_types/Phase.ts#L97-L108', +'ilm._types.SearchableSnapshotAction': 'ilm/_types/Phase.ts#L126-L129', +'ilm._types.SetPriorityAction': 'ilm/_types/Phase.ts#L93-L95', +'ilm._types.ShrinkAction': 'ilm/_types/Phase.ts#L115-L119', +'ilm._types.WaitForSnapshotAction': 'ilm/_types/Phase.ts#L143-L145', 'ilm.delete_lifecycle.Request': 'ilm/delete_lifecycle/DeleteLifecycleRequest.ts#L24-L51', 'ilm.delete_lifecycle.Response': 'ilm/delete_lifecycle/DeleteLifecycleResponse.ts#L22-L24', 'ilm.explain_lifecycle.LifecycleExplain': 'ilm/explain_lifecycle/types.ts#L59-L62', @@ -2835,10 +2843,10 @@ if (hash.length > 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/dc27d463a2aad41f76fd3b1e2d57d08ade035f01/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/b0bf13170793e6e66db261a456ff726a690216d8/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/ilm/Actions.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/Actions.java new file mode 100644 index 000000000..17d18ecd0 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/Actions.java @@ -0,0 +1,635 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.ilm; + +import co.elastic.clients.elasticsearch._types.EmptyObject; +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; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: ilm._types.Actions + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class Actions implements JsonpSerializable { + @Nullable + private final AllocateAction allocate; + + @Nullable + private final DeleteAction delete; + + @Nullable + private final DownsampleAction downsample; + + @Nullable + private final ForceMergeAction forcemerge; + + @Nullable + private final MigrateAction migrate; + + @Nullable + private final EmptyObject readonly; + + @Nullable + private final RolloverAction rollover; + + @Nullable + private final SetPriorityAction setPriority; + + @Nullable + private final SearchableSnapshotAction searchableSnapshot; + + @Nullable + private final ShrinkAction shrink; + + @Nullable + private final EmptyObject unfollow; + + @Nullable + private final WaitForSnapshotAction waitForSnapshot; + + // --------------------------------------------------------------------------------------------- + + private Actions(Builder builder) { + + this.allocate = builder.allocate; + this.delete = builder.delete; + this.downsample = builder.downsample; + this.forcemerge = builder.forcemerge; + this.migrate = builder.migrate; + this.readonly = builder.readonly; + this.rollover = builder.rollover; + this.setPriority = builder.setPriority; + this.searchableSnapshot = builder.searchableSnapshot; + this.shrink = builder.shrink; + this.unfollow = builder.unfollow; + this.waitForSnapshot = builder.waitForSnapshot; + + } + + public static Actions of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Phases allowed: warm, cold. + *

+ * API name: {@code allocate} + */ + @Nullable + public final AllocateAction allocate() { + return this.allocate; + } + + /** + * Phases allowed: delete. + *

+ * API name: {@code delete} + */ + @Nullable + public final DeleteAction delete() { + return this.delete; + } + + /** + * Phases allowed: hot, warm, cold. + *

+ * API name: {@code downsample} + */ + @Nullable + public final DownsampleAction downsample() { + return this.downsample; + } + + /** + * Phases allowed: hot, warm. + *

+ * API name: {@code forcemerge} + */ + @Nullable + public final ForceMergeAction forcemerge() { + return this.forcemerge; + } + + /** + * Phases allowed: warm, cold. + *

+ * API name: {@code migrate} + */ + @Nullable + public final MigrateAction migrate() { + return this.migrate; + } + + /** + * Phases allowed: hot, warm, cold. + *

+ * API name: {@code readonly} + */ + @Nullable + public final EmptyObject readonly() { + return this.readonly; + } + + /** + * Phases allowed: hot. + *

+ * API name: {@code rollover} + */ + @Nullable + public final RolloverAction rollover() { + return this.rollover; + } + + /** + * Phases allowed: hot, warm, cold. + *

+ * API name: {@code set_priority} + */ + @Nullable + public final SetPriorityAction setPriority() { + return this.setPriority; + } + + /** + * Phases allowed: hot, cold, frozen. + *

+ * API name: {@code searchable_snapshot} + */ + @Nullable + public final SearchableSnapshotAction searchableSnapshot() { + return this.searchableSnapshot; + } + + /** + * Phases allowed: hot, warm. + *

+ * API name: {@code shrink} + */ + @Nullable + public final ShrinkAction shrink() { + return this.shrink; + } + + /** + * Phases allowed: hot, warm, cold, frozen. + *

+ * API name: {@code unfollow} + */ + @Nullable + public final EmptyObject unfollow() { + return this.unfollow; + } + + /** + * Phases allowed: delete. + *

+ * API name: {@code wait_for_snapshot} + */ + @Nullable + public final WaitForSnapshotAction waitForSnapshot() { + return this.waitForSnapshot; + } + + /** + * 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.allocate != null) { + generator.writeKey("allocate"); + this.allocate.serialize(generator, mapper); + + } + if (this.delete != null) { + generator.writeKey("delete"); + this.delete.serialize(generator, mapper); + + } + if (this.downsample != null) { + generator.writeKey("downsample"); + this.downsample.serialize(generator, mapper); + + } + if (this.forcemerge != null) { + generator.writeKey("forcemerge"); + this.forcemerge.serialize(generator, mapper); + + } + if (this.migrate != null) { + generator.writeKey("migrate"); + this.migrate.serialize(generator, mapper); + + } + if (this.readonly != null) { + generator.writeKey("readonly"); + this.readonly.serialize(generator, mapper); + + } + if (this.rollover != null) { + generator.writeKey("rollover"); + this.rollover.serialize(generator, mapper); + + } + if (this.setPriority != null) { + generator.writeKey("set_priority"); + this.setPriority.serialize(generator, mapper); + + } + if (this.searchableSnapshot != null) { + generator.writeKey("searchable_snapshot"); + this.searchableSnapshot.serialize(generator, mapper); + + } + if (this.shrink != null) { + generator.writeKey("shrink"); + this.shrink.serialize(generator, mapper); + + } + if (this.unfollow != null) { + generator.writeKey("unfollow"); + this.unfollow.serialize(generator, mapper); + + } + if (this.waitForSnapshot != null) { + generator.writeKey("wait_for_snapshot"); + this.waitForSnapshot.serialize(generator, mapper); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link Actions}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private AllocateAction allocate; + + @Nullable + private DeleteAction delete; + + @Nullable + private DownsampleAction downsample; + + @Nullable + private ForceMergeAction forcemerge; + + @Nullable + private MigrateAction migrate; + + @Nullable + private EmptyObject readonly; + + @Nullable + private RolloverAction rollover; + + @Nullable + private SetPriorityAction setPriority; + + @Nullable + private SearchableSnapshotAction searchableSnapshot; + + @Nullable + private ShrinkAction shrink; + + @Nullable + private EmptyObject unfollow; + + @Nullable + private WaitForSnapshotAction waitForSnapshot; + + /** + * Phases allowed: warm, cold. + *

+ * API name: {@code allocate} + */ + public final Builder allocate(@Nullable AllocateAction value) { + this.allocate = value; + return this; + } + + /** + * Phases allowed: warm, cold. + *

+ * API name: {@code allocate} + */ + public final Builder allocate(Function> fn) { + return this.allocate(fn.apply(new AllocateAction.Builder()).build()); + } + + /** + * Phases allowed: delete. + *

+ * API name: {@code delete} + */ + public final Builder delete(@Nullable DeleteAction value) { + this.delete = value; + return this; + } + + /** + * Phases allowed: delete. + *

+ * API name: {@code delete} + */ + public final Builder delete(Function> fn) { + return this.delete(fn.apply(new DeleteAction.Builder()).build()); + } + + /** + * Phases allowed: hot, warm, cold. + *

+ * API name: {@code downsample} + */ + public final Builder downsample(@Nullable DownsampleAction value) { + this.downsample = value; + return this; + } + + /** + * Phases allowed: hot, warm, cold. + *

+ * API name: {@code downsample} + */ + public final Builder downsample(Function> fn) { + return this.downsample(fn.apply(new DownsampleAction.Builder()).build()); + } + + /** + * Phases allowed: hot, warm. + *

+ * API name: {@code forcemerge} + */ + public final Builder forcemerge(@Nullable ForceMergeAction value) { + this.forcemerge = value; + return this; + } + + /** + * Phases allowed: hot, warm. + *

+ * API name: {@code forcemerge} + */ + public final Builder forcemerge(Function> fn) { + return this.forcemerge(fn.apply(new ForceMergeAction.Builder()).build()); + } + + /** + * Phases allowed: warm, cold. + *

+ * API name: {@code migrate} + */ + public final Builder migrate(@Nullable MigrateAction value) { + this.migrate = value; + return this; + } + + /** + * Phases allowed: warm, cold. + *

+ * API name: {@code migrate} + */ + public final Builder migrate(Function> fn) { + return this.migrate(fn.apply(new MigrateAction.Builder()).build()); + } + + /** + * Phases allowed: hot, warm, cold. + *

+ * API name: {@code readonly} + */ + public final Builder readonly(@Nullable EmptyObject value) { + this.readonly = value; + return this; + } + + /** + * Phases allowed: hot, warm, cold. + *

+ * API name: {@code readonly} + */ + public final Builder readonly(Function> fn) { + return this.readonly(fn.apply(new EmptyObject.Builder()).build()); + } + + /** + * Phases allowed: hot. + *

+ * API name: {@code rollover} + */ + public final Builder rollover(@Nullable RolloverAction value) { + this.rollover = value; + return this; + } + + /** + * Phases allowed: hot. + *

+ * API name: {@code rollover} + */ + public final Builder rollover(Function> fn) { + return this.rollover(fn.apply(new RolloverAction.Builder()).build()); + } + + /** + * Phases allowed: hot, warm, cold. + *

+ * API name: {@code set_priority} + */ + public final Builder setPriority(@Nullable SetPriorityAction value) { + this.setPriority = value; + return this; + } + + /** + * Phases allowed: hot, warm, cold. + *

+ * API name: {@code set_priority} + */ + public final Builder setPriority(Function> fn) { + return this.setPriority(fn.apply(new SetPriorityAction.Builder()).build()); + } + + /** + * Phases allowed: hot, cold, frozen. + *

+ * API name: {@code searchable_snapshot} + */ + public final Builder searchableSnapshot(@Nullable SearchableSnapshotAction value) { + this.searchableSnapshot = value; + return this; + } + + /** + * Phases allowed: hot, cold, frozen. + *

+ * API name: {@code searchable_snapshot} + */ + public final Builder searchableSnapshot( + Function> fn) { + return this.searchableSnapshot(fn.apply(new SearchableSnapshotAction.Builder()).build()); + } + + /** + * Phases allowed: hot, warm. + *

+ * API name: {@code shrink} + */ + public final Builder shrink(@Nullable ShrinkAction value) { + this.shrink = value; + return this; + } + + /** + * Phases allowed: hot, warm. + *

+ * API name: {@code shrink} + */ + public final Builder shrink(Function> fn) { + return this.shrink(fn.apply(new ShrinkAction.Builder()).build()); + } + + /** + * Phases allowed: hot, warm, cold, frozen. + *

+ * API name: {@code unfollow} + */ + public final Builder unfollow(@Nullable EmptyObject value) { + this.unfollow = value; + return this; + } + + /** + * Phases allowed: hot, warm, cold, frozen. + *

+ * API name: {@code unfollow} + */ + public final Builder unfollow(Function> fn) { + return this.unfollow(fn.apply(new EmptyObject.Builder()).build()); + } + + /** + * Phases allowed: delete. + *

+ * API name: {@code wait_for_snapshot} + */ + public final Builder waitForSnapshot(@Nullable WaitForSnapshotAction value) { + this.waitForSnapshot = value; + return this; + } + + /** + * Phases allowed: delete. + *

+ * API name: {@code wait_for_snapshot} + */ + public final Builder waitForSnapshot( + Function> fn) { + return this.waitForSnapshot(fn.apply(new WaitForSnapshotAction.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link Actions}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public Actions build() { + _checkSingleUse(); + + return new Actions(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Actions} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + Actions::setupActionsDeserializer); + + protected static void setupActionsDeserializer(ObjectDeserializer op) { + + op.add(Builder::allocate, AllocateAction._DESERIALIZER, "allocate"); + op.add(Builder::delete, DeleteAction._DESERIALIZER, "delete"); + op.add(Builder::downsample, DownsampleAction._DESERIALIZER, "downsample"); + op.add(Builder::forcemerge, ForceMergeAction._DESERIALIZER, "forcemerge"); + op.add(Builder::migrate, MigrateAction._DESERIALIZER, "migrate"); + op.add(Builder::readonly, EmptyObject._DESERIALIZER, "readonly"); + op.add(Builder::rollover, RolloverAction._DESERIALIZER, "rollover"); + op.add(Builder::setPriority, SetPriorityAction._DESERIALIZER, "set_priority"); + op.add(Builder::searchableSnapshot, SearchableSnapshotAction._DESERIALIZER, "searchable_snapshot"); + op.add(Builder::shrink, ShrinkAction._DESERIALIZER, "shrink"); + op.add(Builder::unfollow, EmptyObject._DESERIALIZER, "unfollow"); + op.add(Builder::waitForSnapshot, WaitForSnapshotAction._DESERIALIZER, "wait_for_snapshot"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/AllocateAction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/AllocateAction.java new file mode 100644 index 000000000..72c0c78d0 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/AllocateAction.java @@ -0,0 +1,328 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.ilm; + +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.Integer; +import java.lang.String; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: ilm._types.AllocateAction + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class AllocateAction implements JsonpSerializable { + @Nullable + private final Integer numberOfReplicas; + + @Nullable + private final Integer totalShardsPerNode; + + private final Map include; + + private final Map exclude; + + private final Map require; + + // --------------------------------------------------------------------------------------------- + + private AllocateAction(Builder builder) { + + this.numberOfReplicas = builder.numberOfReplicas; + this.totalShardsPerNode = builder.totalShardsPerNode; + this.include = ApiTypeHelper.unmodifiable(builder.include); + this.exclude = ApiTypeHelper.unmodifiable(builder.exclude); + this.require = ApiTypeHelper.unmodifiable(builder.require); + + } + + public static AllocateAction of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code number_of_replicas} + */ + @Nullable + public final Integer numberOfReplicas() { + return this.numberOfReplicas; + } + + /** + * API name: {@code total_shards_per_node} + */ + @Nullable + public final Integer totalShardsPerNode() { + return this.totalShardsPerNode; + } + + /** + * API name: {@code include} + */ + public final Map include() { + return this.include; + } + + /** + * API name: {@code exclude} + */ + public final Map exclude() { + return this.exclude; + } + + /** + * API name: {@code require} + */ + public final Map require() { + return this.require; + } + + /** + * 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.numberOfReplicas != null) { + generator.writeKey("number_of_replicas"); + generator.write(this.numberOfReplicas); + + } + if (this.totalShardsPerNode != null) { + generator.writeKey("total_shards_per_node"); + generator.write(this.totalShardsPerNode); + + } + if (ApiTypeHelper.isDefined(this.include)) { + generator.writeKey("include"); + generator.writeStartObject(); + for (Map.Entry item0 : this.include.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.exclude)) { + generator.writeKey("exclude"); + generator.writeStartObject(); + for (Map.Entry item0 : this.exclude.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.require)) { + generator.writeKey("require"); + generator.writeStartObject(); + for (Map.Entry item0 : this.require.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link AllocateAction}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private Integer numberOfReplicas; + + @Nullable + private Integer totalShardsPerNode; + + @Nullable + private Map include; + + @Nullable + private Map exclude; + + @Nullable + private Map require; + + /** + * API name: {@code number_of_replicas} + */ + public final Builder numberOfReplicas(@Nullable Integer value) { + this.numberOfReplicas = value; + return this; + } + + /** + * API name: {@code total_shards_per_node} + */ + public final Builder totalShardsPerNode(@Nullable Integer value) { + this.totalShardsPerNode = value; + return this; + } + + /** + * API name: {@code include} + *

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

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

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

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

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

+ * Adds an entry to require. + */ + public final Builder require(String key, String value) { + this.require = _mapPut(this.require, key, value); + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link AllocateAction}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public AllocateAction build() { + _checkSingleUse(); + + return new AllocateAction(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link AllocateAction} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + AllocateAction::setupAllocateActionDeserializer); + + protected static void setupAllocateActionDeserializer(ObjectDeserializer op) { + + op.add(Builder::numberOfReplicas, JsonpDeserializer.integerDeserializer(), "number_of_replicas"); + op.add(Builder::totalShardsPerNode, JsonpDeserializer.integerDeserializer(), "total_shards_per_node"); + op.add(Builder::include, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), + "include"); + op.add(Builder::exclude, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), + "exclude"); + op.add(Builder::require, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), + "require"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/DeleteAction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/DeleteAction.java new file mode 100644 index 000000000..5bc55b978 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/DeleteAction.java @@ -0,0 +1,159 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.ilm; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: ilm._types.DeleteAction + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DeleteAction implements JsonpSerializable { + @Nullable + private final Boolean deleteSearchableSnapshot; + + // --------------------------------------------------------------------------------------------- + + private DeleteAction(Builder builder) { + + this.deleteSearchableSnapshot = builder.deleteSearchableSnapshot; + + } + + public static DeleteAction of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code delete_searchable_snapshot} + */ + @Nullable + public final Boolean deleteSearchableSnapshot() { + return this.deleteSearchableSnapshot; + } + + /** + * 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.deleteSearchableSnapshot != null) { + generator.writeKey("delete_searchable_snapshot"); + generator.write(this.deleteSearchableSnapshot); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteAction}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private Boolean deleteSearchableSnapshot; + + /** + * API name: {@code delete_searchable_snapshot} + */ + public final Builder deleteSearchableSnapshot(@Nullable Boolean value) { + this.deleteSearchableSnapshot = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DeleteAction}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DeleteAction build() { + _checkSingleUse(); + + return new DeleteAction(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DeleteAction} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + DeleteAction::setupDeleteActionDeserializer); + + protected static void setupDeleteActionDeserializer(ObjectDeserializer op) { + + op.add(Builder::deleteSearchableSnapshot, JsonpDeserializer.booleanDeserializer(), + "delete_searchable_snapshot"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/DownsampleAction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/DownsampleAction.java new file mode 100644 index 000000000..e6235594a --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/DownsampleAction.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. + */ + +package co.elastic.clients.elasticsearch.ilm; + +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.ApiTypeHelper; +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; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: ilm._types.DownsampleAction + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DownsampleAction implements JsonpSerializable { + private final Time fixedInterval; + + @Nullable + private final Time waitTimeout; + + // --------------------------------------------------------------------------------------------- + + private DownsampleAction(Builder builder) { + + this.fixedInterval = ApiTypeHelper.requireNonNull(builder.fixedInterval, this, "fixedInterval"); + this.waitTimeout = builder.waitTimeout; + + } + + public static DownsampleAction of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code fixed_interval} + */ + public final Time fixedInterval() { + return this.fixedInterval; + } + + /** + * API name: {@code wait_timeout} + */ + @Nullable + public final Time waitTimeout() { + return this.waitTimeout; + } + + /** + * 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("fixed_interval"); + this.fixedInterval.serialize(generator, mapper); + + if (this.waitTimeout != null) { + generator.writeKey("wait_timeout"); + this.waitTimeout.serialize(generator, mapper); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DownsampleAction}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private Time fixedInterval; + + @Nullable + private Time waitTimeout; + + /** + * Required - API name: {@code fixed_interval} + */ + public final Builder fixedInterval(Time value) { + this.fixedInterval = value; + return this; + } + + /** + * Required - API name: {@code fixed_interval} + */ + public final Builder fixedInterval(Function> fn) { + return this.fixedInterval(fn.apply(new Time.Builder()).build()); + } + + /** + * API name: {@code wait_timeout} + */ + public final Builder waitTimeout(@Nullable Time value) { + this.waitTimeout = value; + return this; + } + + /** + * API name: {@code wait_timeout} + */ + public final Builder waitTimeout(Function> fn) { + return this.waitTimeout(fn.apply(new Time.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DownsampleAction}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DownsampleAction build() { + _checkSingleUse(); + + return new DownsampleAction(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DownsampleAction} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + DownsampleAction::setupDownsampleActionDeserializer); + + protected static void setupDownsampleActionDeserializer(ObjectDeserializer op) { + + op.add(Builder::fixedInterval, Time._DESERIALIZER, "fixed_interval"); + op.add(Builder::waitTimeout, Time._DESERIALIZER, "wait_timeout"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ForceMergeConfiguration.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ForceMergeAction.java similarity index 71% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ForceMergeConfiguration.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ForceMergeAction.java index 6fd3dd6ce..58dd9d1f8 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ForceMergeConfiguration.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ForceMergeAction.java @@ -31,8 +31,10 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.Integer; +import java.lang.String; import java.util.Objects; import java.util.function.Function; +import javax.annotation.Nullable; //---------------------------------------------------------------- // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. @@ -49,27 +51,30 @@ // //---------------------------------------------------------------- -// typedef: ilm._types.ForceMergeConfiguration +// typedef: ilm._types.ForceMergeAction /** * - * @see API + * @see API * specification */ @JsonpDeserializable -public class ForceMergeConfiguration implements JsonpSerializable { +public class ForceMergeAction implements JsonpSerializable { private final int maxNumSegments; + @Nullable + private final String indexCodec; + // --------------------------------------------------------------------------------------------- - private ForceMergeConfiguration(Builder builder) { + private ForceMergeAction(Builder builder) { this.maxNumSegments = ApiTypeHelper.requireNonNull(builder.maxNumSegments, this, "maxNumSegments"); + this.indexCodec = builder.indexCodec; } - public static ForceMergeConfiguration of(Function> fn) { + public static ForceMergeAction of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -80,6 +85,14 @@ public final int maxNumSegments() { return this.maxNumSegments; } + /** + * API name: {@code index_codec} + */ + @Nullable + public final String indexCodec() { + return this.indexCodec; + } + /** * Serialize this object to JSON. */ @@ -94,6 +107,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("max_num_segments"); generator.write(this.maxNumSegments); + if (this.indexCodec != null) { + generator.writeKey("index_codec"); + generator.write(this.indexCodec); + + } + } @Override @@ -104,14 +123,15 @@ public String toString() { // --------------------------------------------------------------------------------------------- /** - * Builder for {@link ForceMergeConfiguration}. + * Builder for {@link ForceMergeAction}. */ - public static class Builder extends WithJsonObjectBuilderBase - implements - ObjectBuilder { + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { private Integer maxNumSegments; + @Nullable + private String indexCodec; + /** * Required - API name: {@code max_num_segments} */ @@ -120,36 +140,44 @@ public final Builder maxNumSegments(int value) { return this; } + /** + * API name: {@code index_codec} + */ + public final Builder indexCodec(@Nullable String value) { + this.indexCodec = value; + return this; + } + @Override protected Builder self() { return this; } /** - * Builds a {@link ForceMergeConfiguration}. + * Builds a {@link ForceMergeAction}. * * @throws NullPointerException * if some of the required fields are null. */ - public ForceMergeConfiguration build() { + public ForceMergeAction build() { _checkSingleUse(); - return new ForceMergeConfiguration(this); + return new ForceMergeAction(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link ForceMergeConfiguration} + * Json deserializer for {@link ForceMergeAction} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, ForceMergeConfiguration::setupForceMergeConfigurationDeserializer); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + ForceMergeAction::setupForceMergeActionDeserializer); - protected static void setupForceMergeConfigurationDeserializer( - ObjectDeserializer op) { + protected static void setupForceMergeActionDeserializer(ObjectDeserializer op) { op.add(Builder::maxNumSegments, JsonpDeserializer.integerDeserializer(), "max_num_segments"); + op.add(Builder::indexCodec, JsonpDeserializer.stringDeserializer(), "index_codec"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/MigrateAction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/MigrateAction.java new file mode 100644 index 000000000..15b9f2080 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/MigrateAction.java @@ -0,0 +1,158 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.ilm; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: ilm._types.MigrateAction + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class MigrateAction implements JsonpSerializable { + @Nullable + private final Boolean enabled; + + // --------------------------------------------------------------------------------------------- + + private MigrateAction(Builder builder) { + + this.enabled = builder.enabled; + + } + + public static MigrateAction of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code enabled} + */ + @Nullable + public final Boolean enabled() { + return this.enabled; + } + + /** + * 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.enabled != null) { + generator.writeKey("enabled"); + generator.write(this.enabled); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link MigrateAction}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private Boolean enabled; + + /** + * API name: {@code enabled} + */ + public final Builder enabled(@Nullable Boolean value) { + this.enabled = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link MigrateAction}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public MigrateAction build() { + _checkSingleUse(); + + return new MigrateAction(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link MigrateAction} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + MigrateAction::setupMigrateActionDeserializer); + + protected static void setupMigrateActionDeserializer(ObjectDeserializer op) { + + op.add(Builder::enabled, JsonpDeserializer.booleanDeserializer(), "enabled"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/Phase.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/Phase.java index a3d93a9b6..85fb4d9a1 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/Phase.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/Phase.java @@ -20,7 +20,6 @@ package co.elastic.clients.elasticsearch.ilm; import co.elastic.clients.elasticsearch._types.Time; -import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -60,21 +59,17 @@ @JsonpDeserializable public class Phase implements JsonpSerializable { @Nullable - private final JsonData actions; + private final Actions actions; @Nullable private final Time minAge; - @Nullable - private final Configurations configurations; - // --------------------------------------------------------------------------------------------- private Phase(Builder builder) { this.actions = builder.actions; this.minAge = builder.minAge; - this.configurations = builder.configurations; } @@ -86,7 +81,7 @@ public static Phase of(Function> fn) { * API name: {@code actions} */ @Nullable - public final JsonData actions() { + public final Actions actions() { return this.actions; } @@ -98,14 +93,6 @@ public final Time minAge() { return this.minAge; } - /** - * API name: {@code configurations} - */ - @Nullable - public final Configurations configurations() { - return this.configurations; - } - /** * Serialize this object to JSON. */ @@ -127,11 +114,6 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.minAge.serialize(generator, mapper); } - if (this.configurations != null) { - generator.writeKey("configurations"); - this.configurations.serialize(generator, mapper); - - } } @@ -148,22 +130,26 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { @Nullable - private JsonData actions; + private Actions actions; @Nullable private Time minAge; - @Nullable - private Configurations configurations; - /** * API name: {@code actions} */ - public final Builder actions(@Nullable JsonData value) { + public final Builder actions(@Nullable Actions value) { this.actions = value; return this; } + /** + * API name: {@code actions} + */ + public final Builder actions(Function> fn) { + return this.actions(fn.apply(new Actions.Builder()).build()); + } + /** * API name: {@code min_age} */ @@ -179,21 +165,6 @@ public final Builder minAge(Function> fn) { return this.minAge(fn.apply(new Time.Builder()).build()); } - /** - * API name: {@code configurations} - */ - public final Builder configurations(@Nullable Configurations value) { - this.configurations = value; - return this; - } - - /** - * API name: {@code configurations} - */ - public final Builder configurations(Function> fn) { - return this.configurations(fn.apply(new Configurations.Builder()).build()); - } - @Override protected Builder self() { return this; @@ -222,9 +193,8 @@ public Phase build() { protected static void setupPhaseDeserializer(ObjectDeserializer op) { - op.add(Builder::actions, JsonData._DESERIALIZER, "actions"); + op.add(Builder::actions, Actions._DESERIALIZER, "actions"); op.add(Builder::minAge, Time._DESERIALIZER, "min_age"); - op.add(Builder::configurations, Configurations._DESERIALIZER, "configurations"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/RolloverAction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/RolloverAction.java new file mode 100644 index 000000000..75c844449 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/RolloverAction.java @@ -0,0 +1,435 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.ilm; + +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; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: ilm._types.RolloverAction + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class RolloverAction implements JsonpSerializable { + @Nullable + private final String maxSize; + + @Nullable + private final String maxPrimaryShardSize; + + @Nullable + private final Time maxAge; + + @Nullable + private final Long maxDocs; + + @Nullable + private final Long maxPrimaryShardDocs; + + @Nullable + private final String minSize; + + @Nullable + private final String minPrimaryShardSize; + + @Nullable + private final Time minAge; + + @Nullable + private final Long minDocs; + + @Nullable + private final Long minPrimaryShardDocs; + + // --------------------------------------------------------------------------------------------- + + private RolloverAction(Builder builder) { + + this.maxSize = builder.maxSize; + this.maxPrimaryShardSize = builder.maxPrimaryShardSize; + this.maxAge = builder.maxAge; + this.maxDocs = builder.maxDocs; + this.maxPrimaryShardDocs = builder.maxPrimaryShardDocs; + this.minSize = builder.minSize; + this.minPrimaryShardSize = builder.minPrimaryShardSize; + this.minAge = builder.minAge; + this.minDocs = builder.minDocs; + this.minPrimaryShardDocs = builder.minPrimaryShardDocs; + + } + + public static RolloverAction of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code max_size} + */ + @Nullable + public final String maxSize() { + return this.maxSize; + } + + /** + * API name: {@code max_primary_shard_size} + */ + @Nullable + public final String maxPrimaryShardSize() { + return this.maxPrimaryShardSize; + } + + /** + * API name: {@code max_age} + */ + @Nullable + public final Time maxAge() { + return this.maxAge; + } + + /** + * API name: {@code max_docs} + */ + @Nullable + public final Long maxDocs() { + return this.maxDocs; + } + + /** + * API name: {@code max_primary_shard_docs} + */ + @Nullable + public final Long maxPrimaryShardDocs() { + return this.maxPrimaryShardDocs; + } + + /** + * API name: {@code min_size} + */ + @Nullable + public final String minSize() { + return this.minSize; + } + + /** + * API name: {@code min_primary_shard_size} + */ + @Nullable + public final String minPrimaryShardSize() { + return this.minPrimaryShardSize; + } + + /** + * API name: {@code min_age} + */ + @Nullable + public final Time minAge() { + return this.minAge; + } + + /** + * API name: {@code min_docs} + */ + @Nullable + public final Long minDocs() { + return this.minDocs; + } + + /** + * API name: {@code min_primary_shard_docs} + */ + @Nullable + public final Long minPrimaryShardDocs() { + return this.minPrimaryShardDocs; + } + + /** + * 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.maxSize != null) { + generator.writeKey("max_size"); + generator.write(this.maxSize); + + } + if (this.maxPrimaryShardSize != null) { + generator.writeKey("max_primary_shard_size"); + generator.write(this.maxPrimaryShardSize); + + } + if (this.maxAge != null) { + generator.writeKey("max_age"); + this.maxAge.serialize(generator, mapper); + + } + if (this.maxDocs != null) { + generator.writeKey("max_docs"); + generator.write(this.maxDocs); + + } + if (this.maxPrimaryShardDocs != null) { + generator.writeKey("max_primary_shard_docs"); + generator.write(this.maxPrimaryShardDocs); + + } + if (this.minSize != null) { + generator.writeKey("min_size"); + generator.write(this.minSize); + + } + if (this.minPrimaryShardSize != null) { + generator.writeKey("min_primary_shard_size"); + generator.write(this.minPrimaryShardSize); + + } + if (this.minAge != null) { + generator.writeKey("min_age"); + this.minAge.serialize(generator, mapper); + + } + if (this.minDocs != null) { + generator.writeKey("min_docs"); + generator.write(this.minDocs); + + } + if (this.minPrimaryShardDocs != null) { + generator.writeKey("min_primary_shard_docs"); + generator.write(this.minPrimaryShardDocs); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RolloverAction}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private String maxSize; + + @Nullable + private String maxPrimaryShardSize; + + @Nullable + private Time maxAge; + + @Nullable + private Long maxDocs; + + @Nullable + private Long maxPrimaryShardDocs; + + @Nullable + private String minSize; + + @Nullable + private String minPrimaryShardSize; + + @Nullable + private Time minAge; + + @Nullable + private Long minDocs; + + @Nullable + private Long minPrimaryShardDocs; + + /** + * API name: {@code max_size} + */ + public final Builder maxSize(@Nullable String value) { + this.maxSize = 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 max_age} + */ + public final Builder maxAge(@Nullable Time value) { + this.maxAge = value; + return this; + } + + /** + * API name: {@code max_age} + */ + public final Builder maxAge(Function> fn) { + return this.maxAge(fn.apply(new Time.Builder()).build()); + } + + /** + * API name: {@code max_docs} + */ + public final Builder maxDocs(@Nullable Long value) { + this.maxDocs = value; + return this; + } + + /** + * API name: {@code max_primary_shard_docs} + */ + public final Builder maxPrimaryShardDocs(@Nullable Long value) { + this.maxPrimaryShardDocs = value; + return this; + } + + /** + * API name: {@code min_size} + */ + public final Builder minSize(@Nullable String value) { + this.minSize = 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 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 min_docs} + */ + public final Builder minDocs(@Nullable Long value) { + this.minDocs = value; + return this; + } + + /** + * API name: {@code min_primary_shard_docs} + */ + public final Builder minPrimaryShardDocs(@Nullable Long value) { + this.minPrimaryShardDocs = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link RolloverAction}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public RolloverAction build() { + _checkSingleUse(); + + return new RolloverAction(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RolloverAction} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + RolloverAction::setupRolloverActionDeserializer); + + protected static void setupRolloverActionDeserializer(ObjectDeserializer op) { + + op.add(Builder::maxSize, JsonpDeserializer.stringDeserializer(), "max_size"); + op.add(Builder::maxPrimaryShardSize, JsonpDeserializer.stringDeserializer(), "max_primary_shard_size"); + op.add(Builder::maxAge, Time._DESERIALIZER, "max_age"); + op.add(Builder::maxDocs, JsonpDeserializer.longDeserializer(), "max_docs"); + op.add(Builder::maxPrimaryShardDocs, JsonpDeserializer.longDeserializer(), "max_primary_shard_docs"); + op.add(Builder::minSize, JsonpDeserializer.stringDeserializer(), "min_size"); + op.add(Builder::minPrimaryShardSize, JsonpDeserializer.stringDeserializer(), "min_primary_shard_size"); + op.add(Builder::minAge, Time._DESERIALIZER, "min_age"); + op.add(Builder::minDocs, JsonpDeserializer.longDeserializer(), "min_docs"); + op.add(Builder::minPrimaryShardDocs, JsonpDeserializer.longDeserializer(), "min_primary_shard_docs"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/SearchableSnapshotAction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/SearchableSnapshotAction.java new file mode 100644 index 000000000..cb88f95eb --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/SearchableSnapshotAction.java @@ -0,0 +1,188 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.ilm; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: ilm._types.SearchableSnapshotAction + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class SearchableSnapshotAction implements JsonpSerializable { + private final String snapshotRepository; + + @Nullable + private final Boolean forceMergeIndex; + + // --------------------------------------------------------------------------------------------- + + private SearchableSnapshotAction(Builder builder) { + + this.snapshotRepository = ApiTypeHelper.requireNonNull(builder.snapshotRepository, this, "snapshotRepository"); + this.forceMergeIndex = builder.forceMergeIndex; + + } + + public static SearchableSnapshotAction of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code snapshot_repository} + */ + public final String snapshotRepository() { + return this.snapshotRepository; + } + + /** + * API name: {@code force_merge_index} + */ + @Nullable + public final Boolean forceMergeIndex() { + return this.forceMergeIndex; + } + + /** + * 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("snapshot_repository"); + generator.write(this.snapshotRepository); + + if (this.forceMergeIndex != null) { + generator.writeKey("force_merge_index"); + generator.write(this.forceMergeIndex); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SearchableSnapshotAction}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private String snapshotRepository; + + @Nullable + private Boolean forceMergeIndex; + + /** + * Required - API name: {@code snapshot_repository} + */ + public final Builder snapshotRepository(String value) { + this.snapshotRepository = value; + return this; + } + + /** + * API name: {@code force_merge_index} + */ + public final Builder forceMergeIndex(@Nullable Boolean value) { + this.forceMergeIndex = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link SearchableSnapshotAction}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SearchableSnapshotAction build() { + _checkSingleUse(); + + return new SearchableSnapshotAction(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SearchableSnapshotAction} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SearchableSnapshotAction::setupSearchableSnapshotActionDeserializer); + + protected static void setupSearchableSnapshotActionDeserializer( + ObjectDeserializer op) { + + op.add(Builder::snapshotRepository, JsonpDeserializer.stringDeserializer(), "snapshot_repository"); + op.add(Builder::forceMergeIndex, JsonpDeserializer.booleanDeserializer(), "force_merge_index"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/SetPriorityAction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/SetPriorityAction.java new file mode 100644 index 000000000..b48822cb5 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/SetPriorityAction.java @@ -0,0 +1,158 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.ilm; + +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.Integer; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: ilm._types.SetPriorityAction + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class SetPriorityAction implements JsonpSerializable { + @Nullable + private final Integer priority; + + // --------------------------------------------------------------------------------------------- + + private SetPriorityAction(Builder builder) { + + this.priority = builder.priority; + + } + + public static SetPriorityAction of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code priority} + */ + @Nullable + public final Integer priority() { + return this.priority; + } + + /** + * 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.priority != null) { + generator.writeKey("priority"); + generator.write(this.priority); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link SetPriorityAction}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private Integer priority; + + /** + * API name: {@code priority} + */ + public final Builder priority(@Nullable Integer value) { + this.priority = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link SetPriorityAction}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public SetPriorityAction build() { + _checkSingleUse(); + + return new SetPriorityAction(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SetPriorityAction} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, SetPriorityAction::setupSetPriorityActionDeserializer); + + protected static void setupSetPriorityActionDeserializer(ObjectDeserializer op) { + + op.add(Builder::priority, JsonpDeserializer.integerDeserializer(), "priority"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/Configurations.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ShrinkAction.java similarity index 51% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/Configurations.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ShrinkAction.java index 7110d45ee..5fa316122 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/Configurations.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ShrinkAction.java @@ -19,7 +19,6 @@ package co.elastic.clients.elasticsearch.ilm; -import co.elastic.clients.elasticsearch.indices.rollover.RolloverConditions; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -30,6 +29,9 @@ import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.Integer; +import java.lang.String; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -49,60 +51,60 @@ // //---------------------------------------------------------------- -// typedef: ilm._types.Configurations +// typedef: ilm._types.ShrinkAction /** * - * @see API + * @see API * specification */ @JsonpDeserializable -public class Configurations implements JsonpSerializable { +public class ShrinkAction implements JsonpSerializable { @Nullable - private final RolloverConditions rollover; + private final Integer numberOfShards; @Nullable - private final ForceMergeConfiguration forcemerge; + private final String maxPrimaryShardSize; @Nullable - private final ShrinkConfiguration shrink; + private final Boolean allowWriteAfterShrink; // --------------------------------------------------------------------------------------------- - private Configurations(Builder builder) { + private ShrinkAction(Builder builder) { - this.rollover = builder.rollover; - this.forcemerge = builder.forcemerge; - this.shrink = builder.shrink; + this.numberOfShards = builder.numberOfShards; + this.maxPrimaryShardSize = builder.maxPrimaryShardSize; + this.allowWriteAfterShrink = builder.allowWriteAfterShrink; } - public static Configurations of(Function> fn) { + public static ShrinkAction of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * API name: {@code rollover} + * API name: {@code number_of_shards} */ @Nullable - public final RolloverConditions rollover() { - return this.rollover; + public final Integer numberOfShards() { + return this.numberOfShards; } /** - * API name: {@code forcemerge} + * API name: {@code max_primary_shard_size} */ @Nullable - public final ForceMergeConfiguration forcemerge() { - return this.forcemerge; + public final String maxPrimaryShardSize() { + return this.maxPrimaryShardSize; } /** - * API name: {@code shrink} + * API name: {@code allow_write_after_shrink} */ @Nullable - public final ShrinkConfiguration shrink() { - return this.shrink; + public final Boolean allowWriteAfterShrink() { + return this.allowWriteAfterShrink; } /** @@ -116,19 +118,19 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.rollover != null) { - generator.writeKey("rollover"); - this.rollover.serialize(generator, mapper); + if (this.numberOfShards != null) { + generator.writeKey("number_of_shards"); + generator.write(this.numberOfShards); } - if (this.forcemerge != null) { - generator.writeKey("forcemerge"); - this.forcemerge.serialize(generator, mapper); + if (this.maxPrimaryShardSize != null) { + generator.writeKey("max_primary_shard_size"); + generator.write(this.maxPrimaryShardSize); } - if (this.shrink != null) { - generator.writeKey("shrink"); - this.shrink.serialize(generator, mapper); + if (this.allowWriteAfterShrink != null) { + generator.writeKey("allow_write_after_shrink"); + generator.write(this.allowWriteAfterShrink); } @@ -142,96 +144,74 @@ public String toString() { // --------------------------------------------------------------------------------------------- /** - * Builder for {@link Configurations}. + * Builder for {@link ShrinkAction}. */ - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { @Nullable - private RolloverConditions rollover; + private Integer numberOfShards; @Nullable - private ForceMergeConfiguration forcemerge; + private String maxPrimaryShardSize; @Nullable - private ShrinkConfiguration shrink; + private Boolean allowWriteAfterShrink; /** - * API name: {@code rollover} + * API name: {@code number_of_shards} */ - public final Builder rollover(@Nullable RolloverConditions value) { - this.rollover = value; + public final Builder numberOfShards(@Nullable Integer value) { + this.numberOfShards = value; return this; } /** - * API name: {@code rollover} + * API name: {@code max_primary_shard_size} */ - public final Builder rollover(Function> fn) { - return this.rollover(fn.apply(new RolloverConditions.Builder()).build()); - } - - /** - * API name: {@code forcemerge} - */ - public final Builder forcemerge(@Nullable ForceMergeConfiguration value) { - this.forcemerge = value; + public final Builder maxPrimaryShardSize(@Nullable String value) { + this.maxPrimaryShardSize = value; return this; } /** - * API name: {@code forcemerge} - */ - public final Builder forcemerge( - Function> fn) { - return this.forcemerge(fn.apply(new ForceMergeConfiguration.Builder()).build()); - } - - /** - * API name: {@code shrink} + * API name: {@code allow_write_after_shrink} */ - public final Builder shrink(@Nullable ShrinkConfiguration value) { - this.shrink = value; + public final Builder allowWriteAfterShrink(@Nullable Boolean value) { + this.allowWriteAfterShrink = value; return this; } - /** - * API name: {@code shrink} - */ - public final Builder shrink(Function> fn) { - return this.shrink(fn.apply(new ShrinkConfiguration.Builder()).build()); - } - @Override protected Builder self() { return this; } /** - * Builds a {@link Configurations}. + * Builds a {@link ShrinkAction}. * * @throws NullPointerException * if some of the required fields are null. */ - public Configurations build() { + public ShrinkAction build() { _checkSingleUse(); - return new Configurations(this); + return new ShrinkAction(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link Configurations} + * Json deserializer for {@link ShrinkAction} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Configurations::setupConfigurationsDeserializer); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + ShrinkAction::setupShrinkActionDeserializer); - protected static void setupConfigurationsDeserializer(ObjectDeserializer op) { + protected static void setupShrinkActionDeserializer(ObjectDeserializer op) { - op.add(Builder::rollover, RolloverConditions._DESERIALIZER, "rollover"); - op.add(Builder::forcemerge, ForceMergeConfiguration._DESERIALIZER, "forcemerge"); - op.add(Builder::shrink, ShrinkConfiguration._DESERIALIZER, "shrink"); + op.add(Builder::numberOfShards, JsonpDeserializer.integerDeserializer(), "number_of_shards"); + op.add(Builder::maxPrimaryShardSize, JsonpDeserializer.stringDeserializer(), "max_primary_shard_size"); + op.add(Builder::allowWriteAfterShrink, JsonpDeserializer.booleanDeserializer(), "allow_write_after_shrink"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ShrinkConfiguration.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/WaitForSnapshotAction.java similarity index 67% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ShrinkConfiguration.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/WaitForSnapshotAction.java index acff9f3fc..01d7188ce 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/ShrinkConfiguration.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ilm/WaitForSnapshotAction.java @@ -30,9 +30,10 @@ import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; -import java.lang.Integer; +import java.lang.String; import java.util.Objects; import java.util.function.Function; +import javax.annotation.Nullable; //---------------------------------------------------------------- // THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. @@ -49,34 +50,35 @@ // //---------------------------------------------------------------- -// typedef: ilm._types.ShrinkConfiguration +// typedef: ilm._types.WaitForSnapshotAction /** * - * @see API + * @see API * specification */ @JsonpDeserializable -public class ShrinkConfiguration implements JsonpSerializable { - private final int numberOfShards; +public class WaitForSnapshotAction implements JsonpSerializable { + private final String policy; // --------------------------------------------------------------------------------------------- - private ShrinkConfiguration(Builder builder) { + private WaitForSnapshotAction(Builder builder) { - this.numberOfShards = ApiTypeHelper.requireNonNull(builder.numberOfShards, this, "numberOfShards"); + this.policy = ApiTypeHelper.requireNonNull(builder.policy, this, "policy"); } - public static ShrinkConfiguration of(Function> fn) { + public static WaitForSnapshotAction of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code number_of_shards} + * Required - API name: {@code policy} */ - public final int numberOfShards() { - return this.numberOfShards; + public final String policy() { + return this.policy; } /** @@ -90,8 +92,8 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("number_of_shards"); - generator.write(this.numberOfShards); + generator.writeKey("policy"); + generator.write(this.policy); } @@ -103,19 +105,19 @@ public String toString() { // --------------------------------------------------------------------------------------------- /** - * Builder for {@link ShrinkConfiguration}. + * Builder for {@link WaitForSnapshotAction}. */ public static class Builder extends WithJsonObjectBuilderBase implements - ObjectBuilder { - private Integer numberOfShards; + ObjectBuilder { + private String policy; /** - * Required - API name: {@code number_of_shards} + * Required - API name: {@code policy} */ - public final Builder numberOfShards(int value) { - this.numberOfShards = value; + public final Builder policy(String value) { + this.policy = value; return this; } @@ -125,29 +127,29 @@ protected Builder self() { } /** - * Builds a {@link ShrinkConfiguration}. + * Builds a {@link WaitForSnapshotAction}. * * @throws NullPointerException * if some of the required fields are null. */ - public ShrinkConfiguration build() { + public WaitForSnapshotAction build() { _checkSingleUse(); - return new ShrinkConfiguration(this); + return new WaitForSnapshotAction(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link ShrinkConfiguration} + * Json deserializer for {@link WaitForSnapshotAction} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, ShrinkConfiguration::setupShrinkConfigurationDeserializer); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, WaitForSnapshotAction::setupWaitForSnapshotActionDeserializer); - protected static void setupShrinkConfigurationDeserializer(ObjectDeserializer op) { + protected static void setupWaitForSnapshotActionDeserializer(ObjectDeserializer op) { - op.add(Builder::numberOfShards, JsonpDeserializer.integerDeserializer(), "number_of_shards"); + op.add(Builder::policy, JsonpDeserializer.stringDeserializer(), "policy"); }