diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchAsyncClient.java index 2c8fac0c11..693401f744 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchAsyncClient.java @@ -116,6 +116,7 @@ import co.elastic.clients.elasticsearch.core.UpdateRequest; import co.elastic.clients.elasticsearch.core.UpdateResponse; import co.elastic.clients.elasticsearch.dangling_indices.ElasticsearchDanglingIndicesAsyncClient; +import co.elastic.clients.elasticsearch.encryption.ElasticsearchEncryptionAsyncClient; import co.elastic.clients.elasticsearch.enrich.ElasticsearchEnrichAsyncClient; import co.elastic.clients.elasticsearch.eql.ElasticsearchEqlAsyncClient; import co.elastic.clients.elasticsearch.esql.ElasticsearchEsqlAsyncClient; @@ -246,6 +247,10 @@ public ElasticsearchDanglingIndicesAsyncClient danglingIndices() { return new ElasticsearchDanglingIndicesAsyncClient(this.transport, this.transportOptions); } + public ElasticsearchEncryptionAsyncClient encryption() { + return new ElasticsearchEncryptionAsyncClient(this.transport, this.transportOptions); + } + public ElasticsearchEnrichAsyncClient enrich() { return new ElasticsearchEnrichAsyncClient(this.transport, this.transportOptions); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchClient.java index 0b6ee66feb..77f9e67844 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ElasticsearchClient.java @@ -117,6 +117,7 @@ import co.elastic.clients.elasticsearch.core.UpdateRequest; import co.elastic.clients.elasticsearch.core.UpdateResponse; import co.elastic.clients.elasticsearch.dangling_indices.ElasticsearchDanglingIndicesClient; +import co.elastic.clients.elasticsearch.encryption.ElasticsearchEncryptionClient; import co.elastic.clients.elasticsearch.enrich.ElasticsearchEnrichClient; import co.elastic.clients.elasticsearch.eql.ElasticsearchEqlClient; import co.elastic.clients.elasticsearch.esql.ElasticsearchEsqlClient; @@ -246,6 +247,10 @@ public ElasticsearchDanglingIndicesClient danglingIndices() { return new ElasticsearchDanglingIndicesClient(this.transport, this.transportOptions); } + public ElasticsearchEncryptionClient encryption() { + return new ElasticsearchEncryptionClient(this.transport, this.transportOptions); + } + public ElasticsearchEnrichClient enrich() { return new ElasticsearchEnrichClient(this.transport, this.transportOptions); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/FlushStats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/FlushStats.java index 6eb63872d1..6e75539fb3 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/FlushStats.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/FlushStats.java @@ -68,6 +68,11 @@ public class FlushStats implements JsonpSerializable { private final long totalTimeInMillis; + @Nullable + private final Time totalTimeExcludingWaiting; + + private final long totalTimeExcludingWaitingOnLockInMillis; + // --------------------------------------------------------------------------------------------- private FlushStats(Builder builder) { @@ -76,6 +81,9 @@ private FlushStats(Builder builder) { this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total", 0); this.totalTime = builder.totalTime; this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis", 0); + this.totalTimeExcludingWaiting = builder.totalTimeExcludingWaiting; + this.totalTimeExcludingWaitingOnLockInMillis = ApiTypeHelper.requireNonNull( + builder.totalTimeExcludingWaitingOnLockInMillis, this, "totalTimeExcludingWaitingOnLockInMillis", 0); } @@ -112,6 +120,21 @@ public final long totalTimeInMillis() { return this.totalTimeInMillis; } + /** + * API name: {@code total_time_excluding_waiting} + */ + @Nullable + public final Time totalTimeExcludingWaiting() { + return this.totalTimeExcludingWaiting; + } + + /** + * Required - API name: {@code total_time_excluding_waiting_on_lock_in_millis} + */ + public final long totalTimeExcludingWaitingOnLockInMillis() { + return this.totalTimeExcludingWaitingOnLockInMillis; + } + /** * Serialize this object to JSON. */ @@ -137,6 +160,14 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("total_time_in_millis"); generator.write(this.totalTimeInMillis); + if (this.totalTimeExcludingWaiting != null) { + generator.writeKey("total_time_excluding_waiting"); + this.totalTimeExcludingWaiting.serialize(generator, mapper); + + } + generator.writeKey("total_time_excluding_waiting_on_lock_in_millis"); + generator.write(this.totalTimeExcludingWaitingOnLockInMillis); + } @Override @@ -160,6 +191,11 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Long totalTimeInMillis; + @Nullable + private Time totalTimeExcludingWaiting; + + private Long totalTimeExcludingWaitingOnLockInMillis; + public Builder() { } private Builder(FlushStats instance) { @@ -167,6 +203,8 @@ private Builder(FlushStats instance) { this.total = instance.total; this.totalTime = instance.totalTime; this.totalTimeInMillis = instance.totalTimeInMillis; + this.totalTimeExcludingWaiting = instance.totalTimeExcludingWaiting; + this.totalTimeExcludingWaitingOnLockInMillis = instance.totalTimeExcludingWaitingOnLockInMillis; } /** @@ -208,6 +246,29 @@ public final Builder totalTimeInMillis(long value) { return this; } + /** + * API name: {@code total_time_excluding_waiting} + */ + public final Builder totalTimeExcludingWaiting(@Nullable Time value) { + this.totalTimeExcludingWaiting = value; + return this; + } + + /** + * API name: {@code total_time_excluding_waiting} + */ + public final Builder totalTimeExcludingWaiting(Function> fn) { + return this.totalTimeExcludingWaiting(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - API name: {@code total_time_excluding_waiting_on_lock_in_millis} + */ + public final Builder totalTimeExcludingWaitingOnLockInMillis(long value) { + this.totalTimeExcludingWaitingOnLockInMillis = value; + return this; + } + @Override protected Builder self() { return this; @@ -246,6 +307,9 @@ protected static void setupFlushStatsDeserializer(ObjectDeserializer implement private Long missingTotal; @Nullable - private Time time; + private Time gettime; private Long timeInMillis; @@ -272,7 +272,7 @@ private Builder(GetStats instance) { this.missingTime = instance.missingTime; this.missingTimeInMillis = instance.missingTimeInMillis; this.missingTotal = instance.missingTotal; - this.time = instance.time; + this.gettime = instance.gettime; this.timeInMillis = instance.timeInMillis; this.total = instance.total; @@ -348,18 +348,18 @@ public final Builder missingTotal(long value) { } /** - * API name: {@code time} + * API name: {@code getTime} */ - public final Builder time(@Nullable Time value) { - this.time = value; + public final Builder gettime(@Nullable Time value) { + this.gettime = value; return this; } /** - * API name: {@code time} + * API name: {@code getTime} */ - public final Builder time(Function> fn) { - return this.time(fn.apply(new Time.Builder()).build()); + public final Builder gettime(Function> fn) { + return this.gettime(fn.apply(new Time.Builder()).build()); } /** @@ -419,7 +419,7 @@ protected static void setupGetStatsDeserializer(ObjectDeserializer types; @Nullable @@ -122,6 +124,8 @@ private IndexingStats(Builder builder) { this.indexTimeInMillis = ApiTypeHelper.requireNonNull(builder.indexTimeInMillis, this, "indexTimeInMillis", 0); this.indexTotal = ApiTypeHelper.requireNonNull(builder.indexTotal, this, "indexTotal", 0); this.indexFailed = ApiTypeHelper.requireNonNull(builder.indexFailed, this, "indexFailed", 0); + this.indexFailedDueToVersionConflict = ApiTypeHelper.requireNonNull(builder.indexFailedDueToVersionConflict, + this, "indexFailedDueToVersionConflict", 0); this.types = ApiTypeHelper.unmodifiable(builder.types); this.writeLoad = builder.writeLoad; this.recentWriteLoad = builder.recentWriteLoad; @@ -227,6 +231,13 @@ public final long indexFailed() { return this.indexFailed; } + /** + * Required - API name: {@code index_failed_due_to_version_conflict} + */ + public final long indexFailedDueToVersionConflict() { + return this.indexFailedDueToVersionConflict; + } + /** * API name: {@code types} */ @@ -314,6 +325,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("index_failed"); generator.write(this.indexFailed); + generator.writeKey("index_failed_due_to_version_conflict"); + generator.write(this.indexFailedDueToVersionConflict); + if (ApiTypeHelper.isDefined(this.types)) { generator.writeKey("types"); generator.writeStartObject(); @@ -384,6 +398,8 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Long indexFailed; + private Long indexFailedDueToVersionConflict; + @Nullable private Map types; @@ -412,6 +428,7 @@ private Builder(IndexingStats instance) { this.indexTimeInMillis = instance.indexTimeInMillis; this.indexTotal = instance.indexTotal; this.indexFailed = instance.indexFailed; + this.indexFailedDueToVersionConflict = instance.indexFailedDueToVersionConflict; this.types = instance.types; this.writeLoad = instance.writeLoad; this.recentWriteLoad = instance.recentWriteLoad; @@ -543,6 +560,14 @@ public final Builder indexFailed(long value) { return this; } + /** + * Required - API name: {@code index_failed_due_to_version_conflict} + */ + public final Builder indexFailedDueToVersionConflict(long value) { + this.indexFailedDueToVersionConflict = value; + return this; + } + /** * API name: {@code types} *

@@ -643,6 +668,8 @@ protected static void setupIndexingStatsDeserializer(ObjectDeserializer implements ObjectBuilder { private Long currentAsSource; + @Nullable + private Long currentAsSourceQueued; + private Long currentAsTarget; + @Nullable + private Long currentAsTargetQueued; + + @Nullable + private Long currentFromStore; + + @Nullable + private Long currentFromStoreQueued; + @Nullable private Time throttleTime; @@ -165,7 +245,11 @@ public Builder() { } private Builder(RecoveryStats instance) { this.currentAsSource = instance.currentAsSource; + this.currentAsSourceQueued = instance.currentAsSourceQueued; this.currentAsTarget = instance.currentAsTarget; + this.currentAsTargetQueued = instance.currentAsTargetQueued; + this.currentFromStore = instance.currentFromStore; + this.currentFromStoreQueued = instance.currentFromStoreQueued; this.throttleTime = instance.throttleTime; this.throttleTimeInMillis = instance.throttleTimeInMillis; @@ -178,6 +262,14 @@ public final Builder currentAsSource(long value) { return this; } + /** + * API name: {@code current_as_source_queued} + */ + public final Builder currentAsSourceQueued(@Nullable Long value) { + this.currentAsSourceQueued = value; + return this; + } + /** * Required - API name: {@code current_as_target} */ @@ -186,6 +278,30 @@ public final Builder currentAsTarget(long value) { return this; } + /** + * API name: {@code current_as_target_queued} + */ + public final Builder currentAsTargetQueued(@Nullable Long value) { + this.currentAsTargetQueued = value; + return this; + } + + /** + * API name: {@code current_from_store} + */ + public final Builder currentFromStore(@Nullable Long value) { + this.currentFromStore = value; + return this; + } + + /** + * API name: {@code current_from_store_queued} + */ + public final Builder currentFromStoreQueued(@Nullable Long value) { + this.currentFromStoreQueued = value; + return this; + } + /** * API name: {@code throttle_time} */ @@ -244,7 +360,11 @@ public Builder rebuild() { protected static void setupRecoveryStatsDeserializer(ObjectDeserializer op) { op.add(Builder::currentAsSource, JsonpDeserializer.longDeserializer(), "current_as_source"); + op.add(Builder::currentAsSourceQueued, JsonpDeserializer.longDeserializer(), "current_as_source_queued"); op.add(Builder::currentAsTarget, JsonpDeserializer.longDeserializer(), "current_as_target"); + op.add(Builder::currentAsTargetQueued, JsonpDeserializer.longDeserializer(), "current_as_target_queued"); + op.add(Builder::currentFromStore, JsonpDeserializer.longDeserializer(), "current_from_store"); + op.add(Builder::currentFromStoreQueued, JsonpDeserializer.longDeserializer(), "current_from_store_queued"); op.add(Builder::throttleTime, Time._DESERIALIZER, "throttle_time"); op.add(Builder::throttleTimeInMillis, JsonpDeserializer.longDeserializer(), "throttle_time_in_millis"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/RefreshStats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/RefreshStats.java index 740c554694..71624cfbb6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/RefreshStats.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/RefreshStats.java @@ -61,6 +61,9 @@ public class RefreshStats implements JsonpSerializable { private final long externalTotal; + @Nullable + private final Time externalTotalTime; + private final long externalTotalTimeInMillis; private final long listeners; @@ -77,6 +80,7 @@ public class RefreshStats implements JsonpSerializable { private RefreshStats(Builder builder) { this.externalTotal = ApiTypeHelper.requireNonNull(builder.externalTotal, this, "externalTotal", 0); + this.externalTotalTime = builder.externalTotalTime; this.externalTotalTimeInMillis = ApiTypeHelper.requireNonNull(builder.externalTotalTimeInMillis, this, "externalTotalTimeInMillis", 0); this.listeners = ApiTypeHelper.requireNonNull(builder.listeners, this, "listeners", 0); @@ -97,6 +101,14 @@ public final long externalTotal() { return this.externalTotal; } + /** + * API name: {@code external_total_time} + */ + @Nullable + public final Time externalTotalTime() { + return this.externalTotalTime; + } + /** * Required - API name: {@code external_total_time_in_millis} */ @@ -147,6 +159,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("external_total"); generator.write(this.externalTotal); + if (this.externalTotalTime != null) { + generator.writeKey("external_total_time"); + this.externalTotalTime.serialize(generator, mapper); + + } generator.writeKey("external_total_time_in_millis"); generator.write(this.externalTotalTimeInMillis); @@ -180,6 +197,9 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { private Long externalTotal; + @Nullable + private Time externalTotalTime; + private Long externalTotalTimeInMillis; private Long listeners; @@ -195,6 +215,7 @@ public Builder() { } private Builder(RefreshStats instance) { this.externalTotal = instance.externalTotal; + this.externalTotalTime = instance.externalTotalTime; this.externalTotalTimeInMillis = instance.externalTotalTimeInMillis; this.listeners = instance.listeners; this.total = instance.total; @@ -210,6 +231,21 @@ public final Builder externalTotal(long value) { return this; } + /** + * API name: {@code external_total_time} + */ + public final Builder externalTotalTime(@Nullable Time value) { + this.externalTotalTime = value; + return this; + } + + /** + * API name: {@code external_total_time} + */ + public final Builder externalTotalTime(Function> fn) { + return this.externalTotalTime(fn.apply(new Time.Builder()).build()); + } + /** * Required - API name: {@code external_total_time_in_millis} */ @@ -292,6 +328,7 @@ public Builder rebuild() { protected static void setupRefreshStatsDeserializer(ObjectDeserializer op) { op.add(Builder::externalTotal, JsonpDeserializer.longDeserializer(), "external_total"); + op.add(Builder::externalTotalTime, Time._DESERIALIZER, "external_total_time"); op.add(Builder::externalTotalTimeInMillis, JsonpDeserializer.longDeserializer(), "external_total_time_in_millis"); op.add(Builder::listeners, JsonpDeserializer.longDeserializer(), "listeners"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ScriptTransform.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ScriptTransform.java index cad5e080ac..a3d898d704 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ScriptTransform.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/_types/ScriptTransform.java @@ -289,6 +289,8 @@ protected static void setupScriptTransformDeserializer(ObjectDeserializer - Please see the Elasticsearch API specification. + Please see the Elasticsearch API specification. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/encryption/ElasticsearchEncryptionAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/encryption/ElasticsearchEncryptionAsyncClient.java new file mode 100644 index 0000000000..41885c184a --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/encryption/ElasticsearchEncryptionAsyncClient.java @@ -0,0 +1,131 @@ +/* + * 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.encryption; + +import co.elastic.clients.ApiClient; +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.transport.ElasticsearchTransport; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.JsonEndpoint; +import co.elastic.clients.transport.Transport; +import co.elastic.clients.transport.TransportOptions; +import co.elastic.clients.util.ObjectBuilder; +import java.util.concurrent.CompletableFuture; +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. +// +//---------------------------------------------------------------- + +/** + * Client for the encryption namespace. + */ +public class ElasticsearchEncryptionAsyncClient + extends + ApiClient { + + public ElasticsearchEncryptionAsyncClient(ElasticsearchTransport transport) { + super(transport, null); + } + + public ElasticsearchEncryptionAsyncClient(ElasticsearchTransport transport, + @Nullable TransportOptions transportOptions) { + super(transport, transportOptions); + } + + @Override + public ElasticsearchEncryptionAsyncClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new ElasticsearchEncryptionAsyncClient(this.transport, transportOptions); + } + + // ----- Endpoint: encryption.reset + + /** + * Reset the project encryption key. + *

+ * Destroy the current project encryption key (PEK) and generate a new one. This + * is the recovery path for when the on-disk encrypted PEK becomes permanently + * inaccessible, for example because the key encryption material protecting it + * was lost. + *

+ * All data that was encrypted under the destroyed key becomes permanently + * unrecoverable. Each feature that stores encrypted data decides how to handle + * its own data during the reset: some features drop the encrypted values + * entirely, while others preserve the rest of the affected data and only clear + * the values that can no longer be decrypted. + *

+ * Because this operation causes permanent data loss, it requires the + * accept_data_loss query parameter to be set to true. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture reset(ResetRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) ResetRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Reset the project encryption key. + *

+ * Destroy the current project encryption key (PEK) and generate a new one. This + * is the recovery path for when the on-disk encrypted PEK becomes permanently + * inaccessible, for example because the key encryption material protecting it + * was lost. + *

+ * All data that was encrypted under the destroyed key becomes permanently + * unrecoverable. Each feature that stores encrypted data decides how to handle + * its own data during the reset: some features drop the encrypted values + * entirely, while others preserve the rest of the affected data and only clear + * the values that can no longer be decrypted. + *

+ * Because this operation causes permanent data loss, it requires the + * accept_data_loss query parameter to be set to true. + * + * @param fn + * a function that initializes a builder to create the + * {@link ResetRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture reset( + Function> fn) { + return reset(fn.apply(new ResetRequest.Builder()).build()); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/encryption/ElasticsearchEncryptionClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/encryption/ElasticsearchEncryptionClient.java new file mode 100644 index 0000000000..63685ea984 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/encryption/ElasticsearchEncryptionClient.java @@ -0,0 +1,130 @@ +/* + * 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.encryption; + +import co.elastic.clients.ApiClient; +import co.elastic.clients.elasticsearch._types.ElasticsearchException; +import co.elastic.clients.elasticsearch._types.ErrorResponse; +import co.elastic.clients.transport.ElasticsearchTransport; +import co.elastic.clients.transport.Endpoint; +import co.elastic.clients.transport.JsonEndpoint; +import co.elastic.clients.transport.Transport; +import co.elastic.clients.transport.TransportOptions; +import co.elastic.clients.util.ObjectBuilder; +import java.io.IOException; +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. +// +//---------------------------------------------------------------- + +/** + * Client for the encryption namespace. + */ +public class ElasticsearchEncryptionClient extends ApiClient { + + public ElasticsearchEncryptionClient(ElasticsearchTransport transport) { + super(transport, null); + } + + public ElasticsearchEncryptionClient(ElasticsearchTransport transport, + @Nullable TransportOptions transportOptions) { + super(transport, transportOptions); + } + + @Override + public ElasticsearchEncryptionClient withTransportOptions(@Nullable TransportOptions transportOptions) { + return new ElasticsearchEncryptionClient(this.transport, transportOptions); + } + + // ----- Endpoint: encryption.reset + + /** + * Reset the project encryption key. + *

+ * Destroy the current project encryption key (PEK) and generate a new one. This + * is the recovery path for when the on-disk encrypted PEK becomes permanently + * inaccessible, for example because the key encryption material protecting it + * was lost. + *

+ * All data that was encrypted under the destroyed key becomes permanently + * unrecoverable. Each feature that stores encrypted data decides how to handle + * its own data during the reset: some features drop the encrypted values + * entirely, while others preserve the rest of the affected data and only clear + * the values that can no longer be decrypted. + *

+ * Because this operation causes permanent data loss, it requires the + * accept_data_loss query parameter to be set to true. + * + * @see Documentation + * on elastic.co + */ + + public ResetResponse reset(ResetRequest request) throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) ResetRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Reset the project encryption key. + *

+ * Destroy the current project encryption key (PEK) and generate a new one. This + * is the recovery path for when the on-disk encrypted PEK becomes permanently + * inaccessible, for example because the key encryption material protecting it + * was lost. + *

+ * All data that was encrypted under the destroyed key becomes permanently + * unrecoverable. Each feature that stores encrypted data decides how to handle + * its own data during the reset: some features drop the encrypted values + * entirely, while others preserve the rest of the affected data and only clear + * the values that can no longer be decrypted. + *

+ * Because this operation causes permanent data loss, it requires the + * accept_data_loss query parameter to be set to true. + * + * @param fn + * a function that initializes a builder to create the + * {@link ResetRequest} + * @see Documentation + * on elastic.co + */ + + public final ResetResponse reset(Function> fn) + throws IOException, ElasticsearchException { + return reset(fn.apply(new ResetRequest.Builder()).build()); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/encryption/ResetRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/encryption/ResetRequest.java new file mode 100644 index 0000000000..f7793d8f77 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/encryption/ResetRequest.java @@ -0,0 +1,275 @@ +/* + * 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.encryption; + +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.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: encryption.reset.Request + +/** + * Reset the project encryption key. + *

+ * Destroy the current project encryption key (PEK) and generate a new one. This + * is the recovery path for when the on-disk encrypted PEK becomes permanently + * inaccessible, for example because the key encryption material protecting it + * was lost. + *

+ * All data that was encrypted under the destroyed key becomes permanently + * unrecoverable. Each feature that stores encrypted data decides how to handle + * its own data during the reset: some features drop the encrypted values + * entirely, while others preserve the rest of the affected data and only clear + * the values that can no longer be decrypted. + *

+ * Because this operation causes permanent data loss, it requires the + * accept_data_loss query parameter to be set to true. + * + * @see API + * specification + */ + +public class ResetRequest extends RequestBase { + private final boolean acceptDataLoss; + + @Nullable + private final Time masterTimeout; + + @Nullable + private final Time timeout; + + // --------------------------------------------------------------------------------------------- + + private ResetRequest(Builder builder) { + + this.acceptDataLoss = ApiTypeHelper.requireNonNull(builder.acceptDataLoss, this, "acceptDataLoss", false); + this.masterTimeout = builder.masterTimeout; + this.timeout = builder.timeout; + + } + + public static ResetRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Acknowledge that resetting the project encryption key permanently + * destroys all data that was encrypted under the current key. The request fails + * if this is not set to true. + *

+ * API name: {@code accept_data_loss} + */ + public final boolean acceptDataLoss() { + return this.acceptDataLoss; + } + + /** + * The 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. + *

+ * API name: {@code master_timeout} + */ + @Nullable + public final Time masterTimeout() { + return this.masterTimeout; + } + + /** + * The period to wait for a response. If no response is received before the + * timeout expires, the request fails and returns an error. + *

+ * API name: {@code timeout} + */ + @Nullable + public final Time timeout() { + return this.timeout; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ResetRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { + private Boolean acceptDataLoss; + + @Nullable + private Time masterTimeout; + + @Nullable + private Time timeout; + + public Builder() { + } + private Builder(ResetRequest instance) { + this.acceptDataLoss = instance.acceptDataLoss; + this.masterTimeout = instance.masterTimeout; + this.timeout = instance.timeout; + + } + /** + * Required - Acknowledge that resetting the project encryption key permanently + * destroys all data that was encrypted under the current key. The request fails + * if this is not set to true. + *

+ * API name: {@code accept_data_loss} + */ + public final Builder acceptDataLoss(boolean value) { + this.acceptDataLoss = value; + return this; + } + + /** + * The 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. + *

+ * API name: {@code master_timeout} + */ + public final Builder masterTimeout(@Nullable Time value) { + this.masterTimeout = value; + return this; + } + + /** + * The 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. + *

+ * API name: {@code master_timeout} + */ + public final Builder masterTimeout(Function> fn) { + return this.masterTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * The period to wait for a response. If no response is received before the + * timeout expires, the request fails and returns an error. + *

+ * API name: {@code timeout} + */ + public final Builder timeout(@Nullable Time value) { + this.timeout = value; + return this; + } + + /** + * The period to wait for a response. If no response is received before the + * timeout expires, the request fails and returns an error. + *

+ * 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 ResetRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ResetRequest build() { + _checkSingleUse(); + + return new ResetRequest(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code encryption.reset}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/encryption.reset", + + // Request method + request -> { + return "POST"; + + }, + + // Request path + request -> { + return "/_encryption/_reset"; + + }, + + // Path parameters + request -> { + return Collections.emptyMap(); + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } + params.put("accept_data_loss", String.valueOf(request.acceptDataLoss)); + if (request.timeout != null) { + params.put("timeout", request.timeout._toJsonString()); + } + return params; + + }, SimpleEndpoint.emptyMap(), false, ResetResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/encryption/ResetResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/encryption/ResetResponse.java new file mode 100644 index 0000000000..0bd9d749c8 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/encryption/ResetResponse.java @@ -0,0 +1,107 @@ +/* + * 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.encryption; + +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; + +//---------------------------------------------------------------- +// 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: encryption.reset.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class ResetResponse extends AcknowledgedResponseBase { + // --------------------------------------------------------------------------------------------- + + private ResetResponse(Builder builder) { + super(builder); + + } + + public static ResetResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ResetResponse}. + */ + + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ResetResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ResetResponse build() { + _checkSingleUse(); + + return new ResetResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ResetResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + ResetResponse::setupResetResponseDeserializer); + + protected static void setupResetResponseDeserializer(ObjectDeserializer op) { + AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/DatasetFieldMapping.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/DatasetFieldMapping.java new file mode 100644 index 0000000000..8e9de01da3 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/DatasetFieldMapping.java @@ -0,0 +1,245 @@ +/* + * 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.esql; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: esql._types.DatasetFieldMapping + +/** + * A per-column declaration inside a dataset mapping's properties. + * + * @see API + * specification + */ +@JsonpDeserializable +public class DatasetFieldMapping implements JsonpSerializable { + private final String type; + + @Nullable + private final String path; + + @Nullable + private final String format; + + // --------------------------------------------------------------------------------------------- + + private DatasetFieldMapping(Builder builder) { + + this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); + this.path = builder.path; + this.format = builder.format; + + } + + public static DatasetFieldMapping of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The declared column type. + *

+ * API name: {@code type} + */ + public final String type() { + return this.type; + } + + /** + * The underlying file column that this logical column reads from. This is a + * read-path rename: the physical column becomes this single logical column. + *

+ * API name: {@code path} + */ + @Nullable + public final String path() { + return this.path; + } + + /** + * The date-parse pattern for a declared date column, mirroring the + * index date-field format. + *

+ * API name: {@code format} + */ + @Nullable + public final String format() { + return this.format; + } + + /** + * 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("type"); + generator.write(this.type); + + if (this.path != null) { + generator.writeKey("path"); + generator.write(this.path); + + } + if (this.format != null) { + generator.writeKey("format"); + generator.write(this.format); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DatasetFieldMapping}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private String type; + + @Nullable + private String path; + + @Nullable + private String format; + + public Builder() { + } + private Builder(DatasetFieldMapping instance) { + this.type = instance.type; + this.path = instance.path; + this.format = instance.format; + + } + /** + * Required - The declared column type. + *

+ * API name: {@code type} + */ + public final Builder type(String value) { + this.type = value; + return this; + } + + /** + * The underlying file column that this logical column reads from. This is a + * read-path rename: the physical column becomes this single logical column. + *

+ * API name: {@code path} + */ + public final Builder path(@Nullable String value) { + this.path = value; + return this; + } + + /** + * The date-parse pattern for a declared date column, mirroring the + * index date-field format. + *

+ * API name: {@code format} + */ + public final Builder format(@Nullable String value) { + this.format = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DatasetFieldMapping}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DatasetFieldMapping build() { + _checkSingleUse(); + + return new DatasetFieldMapping(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DatasetFieldMapping} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DatasetFieldMapping::setupDatasetFieldMappingDeserializer); + + protected static void setupDatasetFieldMappingDeserializer(ObjectDeserializer op) { + + op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + op.add(Builder::path, JsonpDeserializer.stringDeserializer(), "path"); + op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/DatasetMapping.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/DatasetMapping.java new file mode 100644 index 0000000000..f5a1057e7d --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/DatasetMapping.java @@ -0,0 +1,295 @@ +/* + * 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.esql; + +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; + +//---------------------------------------------------------------- +// 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: esql._types.DatasetMapping + +/** + * A user-declared mapping (the mappings block) attached to a + * dataset. It is entirely optional: a dataset with no declared mapping relies + * on inference. + * + * @see API + * specification + */ +@JsonpDeserializable +public class DatasetMapping implements JsonpSerializable { + @Nullable + private final Dynamic dynamic; + + private final Map properties; + + @Nullable + private final IdPath id; + + // --------------------------------------------------------------------------------------------- + + private DatasetMapping(Builder builder) { + + this.dynamic = builder.dynamic; + this.properties = ApiTypeHelper.unmodifiable(builder.properties); + this.id = builder.id; + + } + + public static DatasetMapping of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The policy for columns that are not declared in properties. + * true (the default) infers undeclared columns and overlays the + * declarations; false makes the declaration the entire schema, so + * undeclared columns are not queryable. + *

+ * API name: {@code dynamic} + */ + @Nullable + public final Dynamic dynamic() { + return this.dynamic; + } + + /** + * The per-column declarations, keyed by logical column name. + *

+ * API name: {@code properties} + */ + public final Map properties() { + return this.properties; + } + + /** + * The _id meta-field configuration, sourcing the document identity + * from a column. + *

+ * API name: {@code _id} + */ + @Nullable + public final IdPath id() { + return this.id; + } + + /** + * 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.dynamic != null) { + generator.writeKey("dynamic"); + this.dynamic.serialize(generator, mapper); + } + if (ApiTypeHelper.isDefined(this.properties)) { + generator.writeKey("properties"); + generator.writeStartObject(); + for (Map.Entry item0 : this.properties.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (this.id != null) { + generator.writeKey("_id"); + this.id.serialize(generator, mapper); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DatasetMapping}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private Dynamic dynamic; + + @Nullable + private Map properties; + + @Nullable + private IdPath id; + + public Builder() { + } + private Builder(DatasetMapping instance) { + this.dynamic = instance.dynamic; + this.properties = instance.properties; + this.id = instance.id; + + } + /** + * The policy for columns that are not declared in properties. + * true (the default) infers undeclared columns and overlays the + * declarations; false makes the declaration the entire schema, so + * undeclared columns are not queryable. + *

+ * API name: {@code dynamic} + */ + public final Builder dynamic(@Nullable Dynamic value) { + this.dynamic = value; + return this; + } + + /** + * The per-column declarations, keyed by logical column name. + *

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

+ * Adds all entries of map to properties. + */ + public final Builder properties(Map map) { + this.properties = _mapPutAll(this.properties, map); + return this; + } + + /** + * The per-column declarations, keyed by logical column name. + *

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

+ * Adds an entry to properties. + */ + public final Builder properties(String key, DatasetFieldMapping value) { + this.properties = _mapPut(this.properties, key, value); + return this; + } + + /** + * The per-column declarations, keyed by logical column name. + *

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

+ * Adds an entry to properties using a builder lambda. + */ + public final Builder properties(String key, + Function> fn) { + return properties(key, fn.apply(new DatasetFieldMapping.Builder()).build()); + } + + /** + * The _id meta-field configuration, sourcing the document identity + * from a column. + *

+ * API name: {@code _id} + */ + public final Builder id(@Nullable IdPath value) { + this.id = value; + return this; + } + + /** + * The _id meta-field configuration, sourcing the document identity + * from a column. + *

+ * API name: {@code _id} + */ + public final Builder id(Function> fn) { + return this.id(fn.apply(new IdPath.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DatasetMapping}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DatasetMapping build() { + _checkSingleUse(); + + return new DatasetMapping(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DatasetMapping} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + DatasetMapping::setupDatasetMappingDeserializer); + + protected static void setupDatasetMappingDeserializer(ObjectDeserializer op) { + + op.add(Builder::dynamic, Dynamic._DESERIALIZER, "dynamic"); + op.add(Builder::properties, JsonpDeserializer.stringMapDeserializer(DatasetFieldMapping._DESERIALIZER), + "properties"); + op.add(Builder::id, IdPath._DESERIALIZER, "_id"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/DeleteDataSourceRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/DeleteDataSourceRequest.java new file mode 100644 index 0000000000..00d9f30b9a --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/DeleteDataSourceRequest.java @@ -0,0 +1,298 @@ +/* + * 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.esql; + +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.String; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import java.util.stream.Collectors; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: esql.delete_data_source.Request + +/** + * Delete ES|QL data sources. + *

+ * Deletes one or more data sources used in ES|QL data federation. Fails with + * 409 if any dataset references one of the named data sources; + * delete the dependent datasets first. + * + * @see API + * specification + */ + +public class DeleteDataSourceRequest extends RequestBase { + @Nullable + private final Time masterTimeout; + + private final List name; + + @Nullable + private final Time timeout; + + // --------------------------------------------------------------------------------------------- + + private DeleteDataSourceRequest(Builder builder) { + + this.masterTimeout = builder.masterTimeout; + this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); + this.timeout = builder.timeout; + + } + + public static DeleteDataSourceRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Period to wait for a connection to the master node. + *

+ * API name: {@code master_timeout} + */ + @Nullable + public final Time masterTimeout() { + return this.masterTimeout; + } + + /** + * Required - A comma-separated list of data source names to delete. + *

+ * API name: {@code name} + */ + public final List name() { + return this.name; + } + + /** + * The time to wait for the request to be completed. + *

+ * API name: {@code timeout} + */ + @Nullable + public final Time timeout() { + return this.timeout; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteDataSourceRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private Time masterTimeout; + + private List name; + + @Nullable + private Time timeout; + + public Builder() { + } + private Builder(DeleteDataSourceRequest instance) { + this.masterTimeout = instance.masterTimeout; + this.name = instance.name; + this.timeout = instance.timeout; + + } + /** + * Period to wait for a connection to the master node. + *

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

+ * 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 source names to delete. + *

+ * 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 source names to delete. + *

+ * 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; + } + + /** + * The time to wait for the request to be completed. + *

+ * API name: {@code timeout} + */ + public final Builder timeout(@Nullable Time value) { + this.timeout = value; + return this; + } + + /** + * The time to wait for the request to be completed. + *

+ * 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 DeleteDataSourceRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DeleteDataSourceRequest build() { + _checkSingleUse(); + + return new DeleteDataSourceRequest(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code esql.delete_data_source}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/esql.delete_data_source", + + // 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("/_query"); + buf.append("/data_source"); + buf.append("/"); + SimpleEndpoint.pathEncode( + request.name.stream().map(v -> v).filter(Objects::nonNull).collect(Collectors.joining(",")), + buf); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Path parameters + request -> { + Map params = new HashMap<>(); + final int _name = 1 << 0; + + int propsSet = 0; + + propsSet |= _name; + + if (propsSet == (_name)) { + params.put("name", request.name.stream().map(v -> v).filter(Objects::nonNull) + .collect(Collectors.joining(","))); + } + return params; + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } + if (request.timeout != null) { + params.put("timeout", request.timeout._toJsonString()); + } + return params; + + }, SimpleEndpoint.emptyMap(), false, DeleteDataSourceResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/DeleteDataSourceResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/DeleteDataSourceResponse.java new file mode 100644 index 0000000000..fb0a524af0 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/DeleteDataSourceResponse.java @@ -0,0 +1,109 @@ +/* + * 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.esql; + +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; + +//---------------------------------------------------------------- +// 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: esql.delete_data_source.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DeleteDataSourceResponse extends AcknowledgedResponseBase { + // --------------------------------------------------------------------------------------------- + + private DeleteDataSourceResponse(Builder builder) { + super(builder); + + } + + public static DeleteDataSourceResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteDataSourceResponse}. + */ + + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DeleteDataSourceResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DeleteDataSourceResponse build() { + _checkSingleUse(); + + return new DeleteDataSourceResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DeleteDataSourceResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DeleteDataSourceResponse::setupDeleteDataSourceResponseDeserializer); + + protected static void setupDeleteDataSourceResponseDeserializer( + ObjectDeserializer op) { + AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/DeleteDatasetRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/DeleteDatasetRequest.java new file mode 100644 index 0000000000..a63b70e1b3 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/DeleteDatasetRequest.java @@ -0,0 +1,297 @@ +/* + * 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.esql; + +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.String; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import java.util.stream.Collectors; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: esql.delete_dataset.Request + +/** + * Delete ES|QL datasets. + *

+ * Deletes one or more datasets used in ES|QL data federation. If any specified + * dataset does not exist, the request fails and no datasets are deleted. + * + * @see API + * specification + */ + +public class DeleteDatasetRequest extends RequestBase { + @Nullable + private final Time masterTimeout; + + private final List name; + + @Nullable + private final Time timeout; + + // --------------------------------------------------------------------------------------------- + + private DeleteDatasetRequest(Builder builder) { + + this.masterTimeout = builder.masterTimeout; + this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); + this.timeout = builder.timeout; + + } + + public static DeleteDatasetRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Period to wait for a connection to the master node. + *

+ * API name: {@code master_timeout} + */ + @Nullable + public final Time masterTimeout() { + return this.masterTimeout; + } + + /** + * Required - A comma-separated list of dataset names to delete. + *

+ * API name: {@code name} + */ + public final List name() { + return this.name; + } + + /** + * The time to wait for the request to be completed. + *

+ * API name: {@code timeout} + */ + @Nullable + public final Time timeout() { + return this.timeout; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteDatasetRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private Time masterTimeout; + + private List name; + + @Nullable + private Time timeout; + + public Builder() { + } + private Builder(DeleteDatasetRequest instance) { + this.masterTimeout = instance.masterTimeout; + this.name = instance.name; + this.timeout = instance.timeout; + + } + /** + * Period to wait for a connection to the master node. + *

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

+ * 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 dataset names to delete. + *

+ * 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 dataset names to delete. + *

+ * 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; + } + + /** + * The time to wait for the request to be completed. + *

+ * API name: {@code timeout} + */ + public final Builder timeout(@Nullable Time value) { + this.timeout = value; + return this; + } + + /** + * The time to wait for the request to be completed. + *

+ * 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 DeleteDatasetRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DeleteDatasetRequest build() { + _checkSingleUse(); + + return new DeleteDatasetRequest(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code esql.delete_dataset}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/esql.delete_dataset", + + // 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("/_query"); + buf.append("/dataset"); + buf.append("/"); + SimpleEndpoint.pathEncode( + request.name.stream().map(v -> v).filter(Objects::nonNull).collect(Collectors.joining(",")), + buf); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Path parameters + request -> { + Map params = new HashMap<>(); + final int _name = 1 << 0; + + int propsSet = 0; + + propsSet |= _name; + + if (propsSet == (_name)) { + params.put("name", request.name.stream().map(v -> v).filter(Objects::nonNull) + .collect(Collectors.joining(","))); + } + return params; + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } + if (request.timeout != null) { + params.put("timeout", request.timeout._toJsonString()); + } + return params; + + }, SimpleEndpoint.emptyMap(), false, DeleteDatasetResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/DeleteDatasetResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/DeleteDatasetResponse.java new file mode 100644 index 0000000000..cce3294a34 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/DeleteDatasetResponse.java @@ -0,0 +1,107 @@ +/* + * 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.esql; + +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; + +//---------------------------------------------------------------- +// 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: esql.delete_dataset.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DeleteDatasetResponse extends AcknowledgedResponseBase { + // --------------------------------------------------------------------------------------------- + + private DeleteDatasetResponse(Builder builder) { + super(builder); + + } + + public static DeleteDatasetResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteDatasetResponse}. + */ + + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DeleteDatasetResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DeleteDatasetResponse build() { + _checkSingleUse(); + + return new DeleteDatasetResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DeleteDatasetResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DeleteDatasetResponse::setupDeleteDatasetResponseDeserializer); + + protected static void setupDeleteDatasetResponseDeserializer(ObjectDeserializer op) { + AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/Dynamic.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/Dynamic.java new file mode 100644 index 0000000000..78512cde83 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/Dynamic.java @@ -0,0 +1,65 @@ +/* + * 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.esql; + +import co.elastic.clients.json.JsonEnum; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public enum Dynamic implements JsonEnum { + True("true"), + + False("false"), + + ; + + private final String jsonValue; + + Dynamic(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Dynamic.values()); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLDataSource.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLDataSource.java new file mode 100644 index 0000000000..c30f7463c6 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLDataSource.java @@ -0,0 +1,289 @@ +/* + * 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.esql; + +import co.elastic.clients.json.JsonData; +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; + +//---------------------------------------------------------------- +// 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: esql._types.ESQLDataSource + +/** + * Represents a data source definition stored in cluster state. A data source + * holds connection settings (credentials, endpoints, auth) for an external data + * provider. + * + * @see API + * specification + */ +@JsonpDeserializable +public class ESQLDataSource implements JsonpSerializable { + private final String name; + + private final String type; + + @Nullable + private final String description; + + private final Map settings; + + // --------------------------------------------------------------------------------------------- + + private ESQLDataSource(Builder builder) { + + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); + this.description = builder.description; + this.settings = ApiTypeHelper.unmodifiableRequired(builder.settings, this, "settings"); + + } + + public static ESQLDataSource of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The data source name. + *

+ * API name: {@code name} + */ + public final String name() { + return this.name; + } + + /** + * Required - The data source type. Currently, s3 is supported. + *

+ * API name: {@code type} + */ + public final String type() { + return this.type; + } + + /** + * A free-text description. + *

+ * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + + /** + * Required - Type-specific connection and authentication settings. + *

+ * API name: {@code settings} + */ + public final Map settings() { + return this.settings; + } + + /** + * 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); + + generator.writeKey("type"); + generator.write(this.type); + + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + + } + if (ApiTypeHelper.isDefined(this.settings)) { + generator.writeKey("settings"); + generator.writeStartObject(); + for (Map.Entry item0 : this.settings.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ESQLDataSource}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private String name; + + private String type; + + @Nullable + private String description; + + private Map settings; + + public Builder() { + } + private Builder(ESQLDataSource instance) { + this.name = instance.name; + this.type = instance.type; + this.description = instance.description; + this.settings = instance.settings; + + } + /** + * Required - The data source name. + *

+ * API name: {@code name} + */ + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * Required - The data source type. Currently, s3 is supported. + *

+ * API name: {@code type} + */ + public final Builder type(String value) { + this.type = value; + return this; + } + + /** + * A free-text description. + *

+ * API name: {@code description} + */ + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * Required - Type-specific connection and authentication settings. + *

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

+ * Adds all entries of map to settings. + */ + public final Builder settings(Map map) { + this.settings = _mapPutAll(this.settings, map); + return this; + } + + /** + * Required - Type-specific connection and authentication settings. + *

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

+ * Adds an entry to settings. + */ + public final Builder settings(String key, JsonData value) { + this.settings = _mapPut(this.settings, key, value); + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ESQLDataSource}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ESQLDataSource build() { + _checkSingleUse(); + + return new ESQLDataSource(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ESQLDataSource} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + ESQLDataSource::setupESQLDataSourceDeserializer); + + protected static void setupESQLDataSourceDeserializer(ObjectDeserializer op) { + + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::settings, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "settings"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLDataset.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLDataset.java new file mode 100644 index 0000000000..465e43344a --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ESQLDataset.java @@ -0,0 +1,378 @@ +/* + * 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.esql; + +import co.elastic.clients.json.JsonData; +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; + +//---------------------------------------------------------------- +// 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: esql._types.ESQLDataset + +/** + * Represents a dataset definition stored in cluster state. A dataset is a named + * reference to external data that participates in the index namespace alongside + * indices, aliases, and views. Datasets inherit credentials from their + * referenced data source at query time. + * + * @see API + * specification + */ +@JsonpDeserializable +public class ESQLDataset implements JsonpSerializable { + private final String name; + + private final String dataSource; + + private final String resource; + + @Nullable + private final String description; + + private final Map settings; + + @Nullable + private final DatasetMapping mappings; + + // --------------------------------------------------------------------------------------------- + + private ESQLDataset(Builder builder) { + + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.dataSource = ApiTypeHelper.requireNonNull(builder.dataSource, this, "dataSource"); + this.resource = ApiTypeHelper.requireNonNull(builder.resource, this, "resource"); + this.description = builder.description; + this.settings = ApiTypeHelper.unmodifiable(builder.settings); + this.mappings = builder.mappings; + + } + + public static ESQLDataset of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The dataset name. + *

+ * API name: {@code name} + */ + public final String name() { + return this.name; + } + + /** + * Required - The name of the referenced data source. + *

+ * API name: {@code data_source} + */ + public final String dataSource() { + return this.dataSource; + } + + /** + * Required - The URI that identifies the data to read, resolved against the + * referenced data source. It can include glob patterns, for example a recursive + * pattern that matches Parquet files under + * s3://logs-bucket/access. + *

+ * API name: {@code resource} + */ + public final String resource() { + return this.resource; + } + + /** + * A free-text description. + *

+ * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + + /** + * Format- and parsing-specific settings that configure how the resource is + * read. Common keys include format and + * partition_detection. Additional keys depend on the format + * reader; compression can be inferred from the resource URI. + *

+ * API name: {@code settings} + */ + public final Map settings() { + return this.settings; + } + + /** + * The user-declared mapping on the dataset definition. + *

+ * API name: {@code mappings} + */ + @Nullable + public final DatasetMapping mappings() { + return this.mappings; + } + + /** + * 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); + + generator.writeKey("data_source"); + generator.write(this.dataSource); + + generator.writeKey("resource"); + generator.write(this.resource); + + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + + } + if (ApiTypeHelper.isDefined(this.settings)) { + generator.writeKey("settings"); + generator.writeStartObject(); + for (Map.Entry item0 : this.settings.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (this.mappings != null) { + generator.writeKey("mappings"); + this.mappings.serialize(generator, mapper); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ESQLDataset}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private String name; + + private String dataSource; + + private String resource; + + @Nullable + private String description; + + @Nullable + private Map settings; + + @Nullable + private DatasetMapping mappings; + + public Builder() { + } + private Builder(ESQLDataset instance) { + this.name = instance.name; + this.dataSource = instance.dataSource; + this.resource = instance.resource; + this.description = instance.description; + this.settings = instance.settings; + this.mappings = instance.mappings; + + } + /** + * Required - The dataset name. + *

+ * API name: {@code name} + */ + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * Required - The name of the referenced data source. + *

+ * API name: {@code data_source} + */ + public final Builder dataSource(String value) { + this.dataSource = value; + return this; + } + + /** + * Required - The URI that identifies the data to read, resolved against the + * referenced data source. It can include glob patterns, for example a recursive + * pattern that matches Parquet files under + * s3://logs-bucket/access. + *

+ * API name: {@code resource} + */ + public final Builder resource(String value) { + this.resource = value; + return this; + } + + /** + * A free-text description. + *

+ * API name: {@code description} + */ + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * Format- and parsing-specific settings that configure how the resource is + * read. Common keys include format and + * partition_detection. Additional keys depend on the format + * reader; compression can be inferred from the resource URI. + *

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

+ * Adds all entries of map to settings. + */ + public final Builder settings(Map map) { + this.settings = _mapPutAll(this.settings, map); + return this; + } + + /** + * Format- and parsing-specific settings that configure how the resource is + * read. Common keys include format and + * partition_detection. Additional keys depend on the format + * reader; compression can be inferred from the resource URI. + *

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

+ * Adds an entry to settings. + */ + public final Builder settings(String key, JsonData value) { + this.settings = _mapPut(this.settings, key, value); + return this; + } + + /** + * The user-declared mapping on the dataset definition. + *

+ * API name: {@code mappings} + */ + public final Builder mappings(@Nullable DatasetMapping value) { + this.mappings = value; + return this; + } + + /** + * The user-declared mapping on the dataset definition. + *

+ * API name: {@code mappings} + */ + public final Builder mappings(Function> fn) { + return this.mappings(fn.apply(new DatasetMapping.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ESQLDataset}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ESQLDataset build() { + _checkSingleUse(); + + return new ESQLDataset(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ESQLDataset} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + ESQLDataset::setupESQLDatasetDeserializer); + + protected static void setupESQLDatasetDeserializer(ObjectDeserializer op) { + + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::dataSource, JsonpDeserializer.stringDeserializer(), "data_source"); + op.add(Builder::resource, JsonpDeserializer.stringDeserializer(), "resource"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::settings, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "settings"); + op.add(Builder::mappings, DatasetMapping._DESERIALIZER, "mappings"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlAsyncClient.java index bd0dbfc1ee..3db7549c01 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlAsyncClient.java @@ -67,6 +67,86 @@ public ElasticsearchEsqlAsyncClient withTransportOptions(@Nullable TransportOpti return new ElasticsearchEsqlAsyncClient(this.transport, transportOptions); } + // ----- Endpoint: esql.delete_data_source + + /** + * Delete ES|QL data sources. + *

+ * Deletes one or more data sources used in ES|QL data federation. Fails with + * 409 if any dataset references one of the named data sources; + * delete the dependent datasets first. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture deleteDataSource(DeleteDataSourceRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) DeleteDataSourceRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Delete ES|QL data sources. + *

+ * Deletes one or more data sources used in ES|QL data federation. Fails with + * 409 if any dataset references one of the named data sources; + * delete the dependent datasets first. + * + * @param fn + * a function that initializes a builder to create the + * {@link DeleteDataSourceRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture deleteDataSource( + Function> fn) { + return deleteDataSource(fn.apply(new DeleteDataSourceRequest.Builder()).build()); + } + + // ----- Endpoint: esql.delete_dataset + + /** + * Delete ES|QL datasets. + *

+ * Deletes one or more datasets used in ES|QL data federation. If any specified + * dataset does not exist, the request fails and no datasets are deleted. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture deleteDataset(DeleteDatasetRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) DeleteDatasetRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Delete ES|QL datasets. + *

+ * Deletes one or more datasets used in ES|QL data federation. If any specified + * dataset does not exist, the request fails and no datasets are deleted. + * + * @param fn + * a function that initializes a builder to create the + * {@link DeleteDatasetRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture deleteDataset( + Function> fn) { + return deleteDataset(fn.apply(new DeleteDatasetRequest.Builder()).build()); + } + // ----- Endpoint: esql.delete_view /** @@ -104,6 +184,122 @@ public final CompletableFuture deleteView( return deleteView(fn.apply(new DeleteViewRequest.Builder()).build()); } + // ----- Endpoint: esql.get_data_source + + /** + * Get ES|QL data sources. + *

+ * Returns one or more data sources used in ES|QL data federation. A + * concrete-name miss returns 404; a wildcard pattern or list-all + * request with no match returns 200 with an empty array. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture getDataSource(GetDataSourceRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) GetDataSourceRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Get ES|QL data sources. + *

+ * Returns one or more data sources used in ES|QL data federation. A + * concrete-name miss returns 404; a wildcard pattern or list-all + * request with no match returns 200 with an empty array. + * + * @param fn + * a function that initializes a builder to create the + * {@link GetDataSourceRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture getDataSource( + Function> fn) { + return getDataSource(fn.apply(new GetDataSourceRequest.Builder()).build()); + } + + /** + * Get ES|QL data sources. + *

+ * Returns one or more data sources used in ES|QL data federation. A + * concrete-name miss returns 404; a wildcard pattern or list-all + * request with no match returns 200 with an empty array. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture getDataSource() { + return this.transport.performRequestAsync(new GetDataSourceRequest.Builder().build(), + GetDataSourceRequest._ENDPOINT, this.transportOptions); + } + + // ----- Endpoint: esql.get_dataset + + /** + * Get ES|QL datasets. + *

+ * Returns one or more datasets used in ES|QL data federation. A concrete-name + * miss returns 404; a wildcard pattern or list-all request with no + * match returns 200 with an empty array. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture getDataset(GetDatasetRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) GetDatasetRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Get ES|QL datasets. + *

+ * Returns one or more datasets used in ES|QL data federation. A concrete-name + * miss returns 404; a wildcard pattern or list-all request with no + * match returns 200 with an empty array. + * + * @param fn + * a function that initializes a builder to create the + * {@link GetDatasetRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture getDataset( + Function> fn) { + return getDataset(fn.apply(new GetDatasetRequest.Builder()).build()); + } + + /** + * Get ES|QL datasets. + *

+ * Returns one or more datasets used in ES|QL data federation. A concrete-name + * miss returns 404; a wildcard pattern or list-all request with no + * match returns 200 with an empty array. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture getDataset() { + return this.transport.performRequestAsync(new GetDatasetRequest.Builder().build(), GetDatasetRequest._ENDPOINT, + this.transportOptions); + } + // ----- Endpoint: esql.get_query /** @@ -210,6 +406,92 @@ public CompletableFuture listQueries() { this.transportOptions); } + // ----- Endpoint: esql.put_data_source + + /** + * Create or update an ES|QL data source. + *

+ * Creates or replaces a named, type-specific data source configuration for + * ES|QL data federation. Datasets reference data source configurations to + * access external data. Names must be lowercase and follow index or alias + * naming rules. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture putDataSource(PutDataSourceRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) PutDataSourceRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Create or update an ES|QL data source. + *

+ * Creates or replaces a named, type-specific data source configuration for + * ES|QL data federation. Datasets reference data source configurations to + * access external data. Names must be lowercase and follow index or alias + * naming rules. + * + * @param fn + * a function that initializes a builder to create the + * {@link PutDataSourceRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture putDataSource( + Function> fn) { + return putDataSource(fn.apply(new PutDataSourceRequest.Builder()).build()); + } + + // ----- Endpoint: esql.put_dataset + + /** + * Create or update an ES|QL dataset. + *

+ * Creates or replaces a dataset that references a data source in ES|QL data + * federation. Dataset names participate in the index namespace and must follow + * index or alias naming rules. Returns 404 if the referenced data + * source does not exist. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture putDataset(PutDatasetRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) PutDatasetRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Create or update an ES|QL dataset. + *

+ * Creates or replaces a dataset that references a data source in ES|QL data + * federation. Dataset names participate in the index namespace and must follow + * index or alias naming rules. Returns 404 if the referenced data + * source does not exist. + * + * @param fn + * a function that initializes a builder to create the + * {@link PutDatasetRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture putDataset( + Function> fn) { + return putDataset(fn.apply(new PutDatasetRequest.Builder()).build()); + } + // ----- Endpoint: esql.put_view /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlClient.java index f8b871a43d..c71c03695b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/ElasticsearchEsqlClient.java @@ -68,6 +68,90 @@ public ElasticsearchEsqlClient withTransportOptions(@Nullable TransportOptions t return new ElasticsearchEsqlClient(this.transport, transportOptions); } + // ----- Endpoint: esql.delete_data_source + + /** + * Delete ES|QL data sources. + *

+ * Deletes one or more data sources used in ES|QL data federation. Fails with + * 409 if any dataset references one of the named data sources; + * delete the dependent datasets first. + * + * @see Documentation + * on elastic.co + */ + + public DeleteDataSourceResponse deleteDataSource(DeleteDataSourceRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) DeleteDataSourceRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Delete ES|QL data sources. + *

+ * Deletes one or more data sources used in ES|QL data federation. Fails with + * 409 if any dataset references one of the named data sources; + * delete the dependent datasets first. + * + * @param fn + * a function that initializes a builder to create the + * {@link DeleteDataSourceRequest} + * @see Documentation + * on elastic.co + */ + + public final DeleteDataSourceResponse deleteDataSource( + Function> fn) + throws IOException, ElasticsearchException { + return deleteDataSource(fn.apply(new DeleteDataSourceRequest.Builder()).build()); + } + + // ----- Endpoint: esql.delete_dataset + + /** + * Delete ES|QL datasets. + *

+ * Deletes one or more datasets used in ES|QL data federation. If any specified + * dataset does not exist, the request fails and no datasets are deleted. + * + * @see Documentation + * on elastic.co + */ + + public DeleteDatasetResponse deleteDataset(DeleteDatasetRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) DeleteDatasetRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Delete ES|QL datasets. + *

+ * Deletes one or more datasets used in ES|QL data federation. If any specified + * dataset does not exist, the request fails and no datasets are deleted. + * + * @param fn + * a function that initializes a builder to create the + * {@link DeleteDatasetRequest} + * @see Documentation + * on elastic.co + */ + + public final DeleteDatasetResponse deleteDataset( + Function> fn) + throws IOException, ElasticsearchException { + return deleteDataset(fn.apply(new DeleteDatasetRequest.Builder()).build()); + } + // ----- Endpoint: esql.delete_view /** @@ -105,6 +189,124 @@ public final DeleteViewResponse deleteView(Function + * Returns one or more data sources used in ES|QL data federation. A + * concrete-name miss returns 404; a wildcard pattern or list-all + * request with no match returns 200 with an empty array. + * + * @see Documentation + * on elastic.co + */ + + public GetDataSourceResponse getDataSource(GetDataSourceRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) GetDataSourceRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Get ES|QL data sources. + *

+ * Returns one or more data sources used in ES|QL data federation. A + * concrete-name miss returns 404; a wildcard pattern or list-all + * request with no match returns 200 with an empty array. + * + * @param fn + * a function that initializes a builder to create the + * {@link GetDataSourceRequest} + * @see Documentation + * on elastic.co + */ + + public final GetDataSourceResponse getDataSource( + Function> fn) + throws IOException, ElasticsearchException { + return getDataSource(fn.apply(new GetDataSourceRequest.Builder()).build()); + } + + /** + * Get ES|QL data sources. + *

+ * Returns one or more data sources used in ES|QL data federation. A + * concrete-name miss returns 404; a wildcard pattern or list-all + * request with no match returns 200 with an empty array. + * + * @see Documentation + * on elastic.co + */ + + public GetDataSourceResponse getDataSource() throws IOException, ElasticsearchException { + return this.transport.performRequest(new GetDataSourceRequest.Builder().build(), GetDataSourceRequest._ENDPOINT, + this.transportOptions); + } + + // ----- Endpoint: esql.get_dataset + + /** + * Get ES|QL datasets. + *

+ * Returns one or more datasets used in ES|QL data federation. A concrete-name + * miss returns 404; a wildcard pattern or list-all request with no + * match returns 200 with an empty array. + * + * @see Documentation + * on elastic.co + */ + + public GetDatasetResponse getDataset(GetDatasetRequest request) throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) GetDatasetRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Get ES|QL datasets. + *

+ * Returns one or more datasets used in ES|QL data federation. A concrete-name + * miss returns 404; a wildcard pattern or list-all request with no + * match returns 200 with an empty array. + * + * @param fn + * a function that initializes a builder to create the + * {@link GetDatasetRequest} + * @see Documentation + * on elastic.co + */ + + public final GetDatasetResponse getDataset(Function> fn) + throws IOException, ElasticsearchException { + return getDataset(fn.apply(new GetDatasetRequest.Builder()).build()); + } + + /** + * Get ES|QL datasets. + *

+ * Returns one or more datasets used in ES|QL data federation. A concrete-name + * miss returns 404; a wildcard pattern or list-all request with no + * match returns 200 with an empty array. + * + * @see Documentation + * on elastic.co + */ + + public GetDatasetResponse getDataset() throws IOException, ElasticsearchException { + return this.transport.performRequest(new GetDatasetRequest.Builder().build(), GetDatasetRequest._ENDPOINT, + this.transportOptions); + } + // ----- Endpoint: esql.get_query /** @@ -211,6 +413,94 @@ public ListQueriesResponse listQueries() throws IOException, ElasticsearchExcept this.transportOptions); } + // ----- Endpoint: esql.put_data_source + + /** + * Create or update an ES|QL data source. + *

+ * Creates or replaces a named, type-specific data source configuration for + * ES|QL data federation. Datasets reference data source configurations to + * access external data. Names must be lowercase and follow index or alias + * naming rules. + * + * @see Documentation + * on elastic.co + */ + + public PutDataSourceResponse putDataSource(PutDataSourceRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) PutDataSourceRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Create or update an ES|QL data source. + *

+ * Creates or replaces a named, type-specific data source configuration for + * ES|QL data federation. Datasets reference data source configurations to + * access external data. Names must be lowercase and follow index or alias + * naming rules. + * + * @param fn + * a function that initializes a builder to create the + * {@link PutDataSourceRequest} + * @see Documentation + * on elastic.co + */ + + public final PutDataSourceResponse putDataSource( + Function> fn) + throws IOException, ElasticsearchException { + return putDataSource(fn.apply(new PutDataSourceRequest.Builder()).build()); + } + + // ----- Endpoint: esql.put_dataset + + /** + * Create or update an ES|QL dataset. + *

+ * Creates or replaces a dataset that references a data source in ES|QL data + * federation. Dataset names participate in the index namespace and must follow + * index or alias naming rules. Returns 404 if the referenced data + * source does not exist. + * + * @see Documentation + * on elastic.co + */ + + public PutDatasetResponse putDataset(PutDatasetRequest request) throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) PutDatasetRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Create or update an ES|QL dataset. + *

+ * Creates or replaces a dataset that references a data source in ES|QL data + * federation. Dataset names participate in the index namespace and must follow + * index or alias naming rules. Returns 404 if the referenced data + * source does not exist. + * + * @param fn + * a function that initializes a builder to create the + * {@link PutDatasetRequest} + * @see Documentation + * on elastic.co + */ + + public final PutDatasetResponse putDataset(Function> fn) + throws IOException, ElasticsearchException { + return putDataset(fn.apply(new PutDatasetRequest.Builder()).build()); + } + // ----- Endpoint: esql.put_view /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/EsqlApproximation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/EsqlApproximation.java new file mode 100644 index 0000000000..d869b5723b --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/EsqlApproximation.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. + */ + +package co.elastic.clients.elasticsearch.esql; + +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.ObjectDeserializer; +import co.elastic.clients.json.UnionDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import co.elastic.clients.util.TaggedUnion; +import co.elastic.clients.util.TaggedUnionUtils; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.Object; +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: esql._types.EsqlApproximation + +/** + * The approximation query setting. It can be a boolean that + * toggles query approximation with default settings, or a map that enables it + * with custom settings. + * + * @see API + * specification + */ +@JsonpDeserializable +public class EsqlApproximation implements TaggedUnion, JsonpSerializable { + + public enum Kind { + Settings, Enabled + + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + private EsqlApproximation(Kind kind, Object value) { + this._kind = kind; + this._value = value; + } + + private EsqlApproximation(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + } + + public static EsqlApproximation of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code settings}? + */ + public boolean isSettings() { + return _kind == Kind.Settings; + } + + /** + * Get the {@code settings} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code settings} kind. + */ + public EsqlApproximationSettings settings() { + return TaggedUnionUtils.get(this, Kind.Settings); + } + + /** + * Is this variant instance of kind {@code enabled}? + */ + public boolean isEnabled() { + return _kind == Kind.Enabled; + } + + /** + * Get the {@code enabled} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code enabled} kind. + */ + public Boolean enabled() { + return TaggedUnionUtils.get(this, Kind.Enabled); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } else { + switch (_kind) { + case Enabled : + generator.write(((Boolean) this._value)); + + break; + } + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + + public ObjectBuilder settings(EsqlApproximationSettings v) { + this._kind = Kind.Settings; + this._value = v; + return this; + } + + public ObjectBuilder settings( + Function> fn) { + return this.settings(fn.apply(new EsqlApproximationSettings.Builder()).build()); + } + + public ObjectBuilder enabled(Boolean v) { + this._kind = Kind.Enabled; + this._value = v; + return this; + } + + public EsqlApproximation build() { + _checkSingleUse(); + return new EsqlApproximation(this); + } + + } + + private static JsonpDeserializer buildEsqlApproximationDeserializer() { + return new UnionDeserializer.Builder(EsqlApproximation::new, false) + .addMember(Kind.Settings, EsqlApproximationSettings._DESERIALIZER) + .addMember(Kind.Enabled, JsonpDeserializer.booleanDeserializer()).build(); + } + + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer + .lazy(EsqlApproximation::buildEsqlApproximationDeserializer); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/EsqlApproximationBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/EsqlApproximationBuilders.java new file mode 100644 index 0000000000..559958e929 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/EsqlApproximationBuilders.java @@ -0,0 +1,59 @@ +/* + * 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.esql; + +import co.elastic.clients.util.ObjectBuilder; +import java.util.function.Function; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +/** + * Builders for {@link EsqlApproximation} variants. + *

+ * Variants enabled are not available here as they don't have a + * dedicated class. Use {@link EsqlApproximation}'s builder for these. + * + */ +public class EsqlApproximationBuilders { + private EsqlApproximationBuilders() { + } + + /** + * Creates a builder for the {@link EsqlApproximationSettings settings} + * {@code EsqlApproximation} variant. + */ + public static EsqlApproximationSettings.Builder settings() { + return new EsqlApproximationSettings.Builder(); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/EsqlApproximationSettings.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/EsqlApproximationSettings.java new file mode 100644 index 0000000000..deaa743133 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/EsqlApproximationSettings.java @@ -0,0 +1,217 @@ +/* + * 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.esql; + +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.Double; +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: esql._types.EsqlApproximationSettings + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class EsqlApproximationSettings implements JsonpSerializable { + @Nullable + private final Integer rows; + + @Nullable + private final Double confidenceLevel; + + // --------------------------------------------------------------------------------------------- + + private EsqlApproximationSettings(Builder builder) { + + this.rows = builder.rows; + this.confidenceLevel = builder.confidenceLevel; + + } + + public static EsqlApproximationSettings of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The number of sampled rows used for approximating the query. It must be at + * least 10,000. A null value uses the system default. + *

+ * API name: {@code rows} + */ + @Nullable + public final Integer rows() { + return this.rows; + } + + /** + * The confidence level of the computed confidence intervals. A null value + * disables computing confidence intervals. + *

+ * API name: {@code confidence_level} + */ + @Nullable + public final Double confidenceLevel() { + return this.confidenceLevel; + } + + /** + * 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.rows != null) { + generator.writeKey("rows"); + generator.write(this.rows); + + } + if (this.confidenceLevel != null) { + generator.writeKey("confidence_level"); + generator.write(this.confidenceLevel); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link EsqlApproximationSettings}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + @Nullable + private Integer rows; + + @Nullable + private Double confidenceLevel; + + public Builder() { + } + private Builder(EsqlApproximationSettings instance) { + this.rows = instance.rows; + this.confidenceLevel = instance.confidenceLevel; + + } + /** + * The number of sampled rows used for approximating the query. It must be at + * least 10,000. A null value uses the system default. + *

+ * API name: {@code rows} + */ + public final Builder rows(@Nullable Integer value) { + this.rows = value; + return this; + } + + /** + * The confidence level of the computed confidence intervals. A null value + * disables computing confidence intervals. + *

+ * API name: {@code confidence_level} + */ + public final Builder confidenceLevel(@Nullable Double value) { + this.confidenceLevel = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link EsqlApproximationSettings}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public EsqlApproximationSettings build() { + _checkSingleUse(); + + return new EsqlApproximationSettings(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link EsqlApproximationSettings} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, EsqlApproximationSettings::setupEsqlApproximationSettingsDeserializer); + + protected static void setupEsqlApproximationSettingsDeserializer( + ObjectDeserializer op) { + + op.add(Builder::rows, JsonpDeserializer.integerDeserializer(), "rows"); + op.add(Builder::confidenceLevel, JsonpDeserializer.doubleDeserializer(), "confidence_level"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/EsqlQuerySettings.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/EsqlQuerySettings.java new file mode 100644 index 0000000000..d5f37c3ee4 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/EsqlQuerySettings.java @@ -0,0 +1,314 @@ +/* + * 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.esql; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.String; +import java.util.Objects; +import 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: esql._types.EsqlQuerySettings + +/** + * Per-query settings supplied through the request body. This is the + * request-body equivalent of the in-query SET command. Only + * settings that are exposed as request-body parameters can be set here; other + * SET-only settings (such as unmapped_fields) must be + * supplied in the query itself. + * + * @see API + * specification + */ +@JsonpDeserializable +public class EsqlQuerySettings implements JsonpSerializable { + @Nullable + private final String timeZone; + + @Nullable + private final EsqlApproximation approximation; + + @Nullable + private final Boolean columnMetadata; + + @Nullable + private final String projectRouting; + + // --------------------------------------------------------------------------------------------- + + private EsqlQuerySettings(Builder builder) { + + this.timeZone = builder.timeZone; + this.approximation = builder.approximation; + this.columnMetadata = builder.columnMetadata; + this.projectRouting = builder.projectRouting; + + } + + public static EsqlQuerySettings of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The default timezone to be used in the query. It defaults to UTC and + * overrides the time_zone request parameter. + *

+ * API name: {@code time_zone} + */ + @Nullable + public final String timeZone() { + return this.timeZone; + } + + /** + * Enables query approximation if possible for the query. false + * (the default) disables query approximation and true enables it + * with default settings. A map value enables query approximation with custom + * settings. + *

+ * API name: {@code approximation} + */ + @Nullable + public final EsqlApproximation approximation() { + return this.approximation; + } + + /** + * When enabled, column metadata is added to the query response as additional + * _meta properties. Currently, only _meta.bucket is + * added for columns corresponding to the BUCKET function, + * containing the bucket interval and unit for queries where it can be + * determined. + *

+ * API name: {@code column_metadata} + */ + @Nullable + public final Boolean columnMetadata() { + return this.columnMetadata; + } + + /** + * Limits the scope of a cross-project search (CPS) to specific projects before + * query execution, based on a Lucene query expression evaluated against project + * tags. Excluded projects are not queried, which can reduce cost and latency. + *

+ * API name: {@code project_routing} + */ + @Nullable + public final String projectRouting() { + return this.projectRouting; + } + + /** + * 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.timeZone != null) { + generator.writeKey("time_zone"); + generator.write(this.timeZone); + + } + if (this.approximation != null) { + generator.writeKey("approximation"); + this.approximation.serialize(generator, mapper); + + } + if (this.columnMetadata != null) { + generator.writeKey("column_metadata"); + generator.write(this.columnMetadata); + + } + if (this.projectRouting != null) { + generator.writeKey("project_routing"); + generator.write(this.projectRouting); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link EsqlQuerySettings}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private String timeZone; + + @Nullable + private EsqlApproximation approximation; + + @Nullable + private Boolean columnMetadata; + + @Nullable + private String projectRouting; + + public Builder() { + } + private Builder(EsqlQuerySettings instance) { + this.timeZone = instance.timeZone; + this.approximation = instance.approximation; + this.columnMetadata = instance.columnMetadata; + this.projectRouting = instance.projectRouting; + + } + /** + * The default timezone to be used in the query. It defaults to UTC and + * overrides the time_zone request parameter. + *

+ * API name: {@code time_zone} + */ + public final Builder timeZone(@Nullable String value) { + this.timeZone = value; + return this; + } + + /** + * Enables query approximation if possible for the query. false + * (the default) disables query approximation and true enables it + * with default settings. A map value enables query approximation with custom + * settings. + *

+ * API name: {@code approximation} + */ + public final Builder approximation(@Nullable EsqlApproximation value) { + this.approximation = value; + return this; + } + + /** + * Enables query approximation if possible for the query. false + * (the default) disables query approximation and true enables it + * with default settings. A map value enables query approximation with custom + * settings. + *

+ * API name: {@code approximation} + */ + public final Builder approximation(Function> fn) { + return this.approximation(fn.apply(new EsqlApproximation.Builder()).build()); + } + + /** + * When enabled, column metadata is added to the query response as additional + * _meta properties. Currently, only _meta.bucket is + * added for columns corresponding to the BUCKET function, + * containing the bucket interval and unit for queries where it can be + * determined. + *

+ * API name: {@code column_metadata} + */ + public final Builder columnMetadata(@Nullable Boolean value) { + this.columnMetadata = value; + return this; + } + + /** + * Limits the scope of a cross-project search (CPS) to specific projects before + * query execution, based on a Lucene query expression evaluated against project + * tags. Excluded projects are not queried, which can reduce cost and latency. + *

+ * API name: {@code project_routing} + */ + public final Builder projectRouting(@Nullable String value) { + this.projectRouting = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link EsqlQuerySettings}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public EsqlQuerySettings build() { + _checkSingleUse(); + + return new EsqlQuerySettings(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link EsqlQuerySettings} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, EsqlQuerySettings::setupEsqlQuerySettingsDeserializer); + + protected static void setupEsqlQuerySettingsDeserializer(ObjectDeserializer op) { + + op.add(Builder::timeZone, JsonpDeserializer.stringDeserializer(), "time_zone"); + op.add(Builder::approximation, EsqlApproximation._DESERIALIZER, "approximation"); + op.add(Builder::columnMetadata, JsonpDeserializer.booleanDeserializer(), "column_metadata"); + op.add(Builder::projectRouting, JsonpDeserializer.stringDeserializer(), "project_routing"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/GetDataSourceRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/GetDataSourceRequest.java new file mode 100644 index 0000000000..1d9eedd0b6 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/GetDataSourceRequest.java @@ -0,0 +1,272 @@ +/* + * 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.esql; + +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.String; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import java.util.stream.Collectors; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: esql.get_data_source.Request + +/** + * Get ES|QL data sources. + *

+ * Returns one or more data sources used in ES|QL data federation. A + * concrete-name miss returns 404; a wildcard pattern or list-all + * request with no match returns 200 with an empty array. + * + * @see API + * specification + */ + +public class GetDataSourceRequest extends RequestBase { + @Nullable + private final Time masterTimeout; + + private final List name; + + // --------------------------------------------------------------------------------------------- + + private GetDataSourceRequest(Builder builder) { + + this.masterTimeout = builder.masterTimeout; + this.name = ApiTypeHelper.unmodifiable(builder.name); + + } + + public static GetDataSourceRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Period to wait for a connection to the master node. + *

+ * API name: {@code master_timeout} + */ + @Nullable + public final Time masterTimeout() { + return this.masterTimeout; + } + + /** + * A comma-separated list of data source names or wildcard patterns. Omit to + * return all data sources. + *

+ * API name: {@code name} + */ + public final List name() { + return this.name; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetDataSourceRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private Time masterTimeout; + + @Nullable + private List name; + + public Builder() { + } + private Builder(GetDataSourceRequest instance) { + this.masterTimeout = instance.masterTimeout; + this.name = instance.name; + + } + /** + * Period to wait for a connection to the master node. + *

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

+ * API name: {@code master_timeout} + */ + public final Builder masterTimeout(Function> fn) { + return this.masterTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * A comma-separated list of data source names or wildcard patterns. Omit to + * return all data sources. + *

+ * 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 comma-separated list of data source names or wildcard patterns. Omit to + * return all data sources. + *

+ * 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 GetDataSourceRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetDataSourceRequest build() { + _checkSingleUse(); + + return new GetDataSourceRequest(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code esql.get_data_source}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/esql.get_data_source", + + // 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("/_query"); + buf.append("/data_source"); + return buf.toString(); + } + if (propsSet == (_name)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_query"); + buf.append("/data_source"); + buf.append("/"); + SimpleEndpoint.pathEncode( + request.name.stream().map(v -> v).filter(Objects::nonNull).collect(Collectors.joining(",")), + buf); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Path parameters + request -> { + Map params = new HashMap<>(); + final int _name = 1 << 0; + + int propsSet = 0; + + if (ApiTypeHelper.isDefined(request.name())) + propsSet |= _name; + + if (propsSet == 0) { + } + if (propsSet == (_name)) { + params.put("name", request.name.stream().map(v -> v).filter(Objects::nonNull) + .collect(Collectors.joining(","))); + } + return params; + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } + return params; + + }, SimpleEndpoint.emptyMap(), false, GetDataSourceResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/GetDataSourceResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/GetDataSourceResponse.java new file mode 100644 index 0000000000..80c0d83d64 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/GetDataSourceResponse.java @@ -0,0 +1,196 @@ +/* + * 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.esql; + +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; + +//---------------------------------------------------------------- +// 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: esql.get_data_source.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class GetDataSourceResponse implements JsonpSerializable { + private final List dataSources; + + // --------------------------------------------------------------------------------------------- + + private GetDataSourceResponse(Builder builder) { + + this.dataSources = ApiTypeHelper.unmodifiableRequired(builder.dataSources, this, "dataSources"); + + } + + public static GetDataSourceResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The matching data sources. Credential values in each data source's + * settings are redacted as ::es_redacted:: in the response. + *

+ * API name: {@code data_sources} + */ + public final List dataSources() { + return this.dataSources; + } + + /** + * 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.dataSources)) { + generator.writeKey("data_sources"); + generator.writeStartArray(); + for (ESQLDataSource item0 : this.dataSources) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetDataSourceResponse}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private List dataSources; + + /** + * Required - The matching data sources. Credential values in each data source's + * settings are redacted as ::es_redacted:: in the response. + *

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

+ * Adds all elements of list to dataSources. + */ + public final Builder dataSources(List list) { + this.dataSources = _listAddAll(this.dataSources, list); + return this; + } + + /** + * Required - The matching data sources. Credential values in each data source's + * settings are redacted as ::es_redacted:: in the response. + *

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

+ * Adds one or more values to dataSources. + */ + public final Builder dataSources(ESQLDataSource value, ESQLDataSource... values) { + this.dataSources = _listAdd(this.dataSources, value, values); + return this; + } + + /** + * Required - The matching data sources. Credential values in each data source's + * settings are redacted as ::es_redacted:: in the response. + *

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

+ * Adds a value to dataSources using a builder lambda. + */ + public final Builder dataSources(Function> fn) { + return dataSources(fn.apply(new ESQLDataSource.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link GetDataSourceResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetDataSourceResponse build() { + _checkSingleUse(); + + return new GetDataSourceResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetDataSourceResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, GetDataSourceResponse::setupGetDataSourceResponseDeserializer); + + protected static void setupGetDataSourceResponseDeserializer(ObjectDeserializer op) { + + op.add(Builder::dataSources, JsonpDeserializer.arrayDeserializer(ESQLDataSource._DESERIALIZER), "data_sources"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/GetDatasetRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/GetDatasetRequest.java new file mode 100644 index 0000000000..db6709d786 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/GetDatasetRequest.java @@ -0,0 +1,272 @@ +/* + * 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.esql; + +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.String; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import java.util.stream.Collectors; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: esql.get_dataset.Request + +/** + * Get ES|QL datasets. + *

+ * Returns one or more datasets used in ES|QL data federation. A concrete-name + * miss returns 404; a wildcard pattern or list-all request with no + * match returns 200 with an empty array. + * + * @see API + * specification + */ + +public class GetDatasetRequest extends RequestBase { + @Nullable + private final Time masterTimeout; + + private final List name; + + // --------------------------------------------------------------------------------------------- + + private GetDatasetRequest(Builder builder) { + + this.masterTimeout = builder.masterTimeout; + this.name = ApiTypeHelper.unmodifiable(builder.name); + + } + + public static GetDatasetRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Period to wait for a connection to the master node. + *

+ * API name: {@code master_timeout} + */ + @Nullable + public final Time masterTimeout() { + return this.masterTimeout; + } + + /** + * A comma-separated list of dataset names or wildcard patterns. Omit to return + * all datasets. + *

+ * API name: {@code name} + */ + public final List name() { + return this.name; + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetDatasetRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private Time masterTimeout; + + @Nullable + private List name; + + public Builder() { + } + private Builder(GetDatasetRequest instance) { + this.masterTimeout = instance.masterTimeout; + this.name = instance.name; + + } + /** + * Period to wait for a connection to the master node. + *

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

+ * API name: {@code master_timeout} + */ + public final Builder masterTimeout(Function> fn) { + return this.masterTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * A comma-separated list of dataset names or wildcard patterns. Omit to return + * all datasets. + *

+ * 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 comma-separated list of dataset names or wildcard patterns. Omit to return + * all datasets. + *

+ * 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 GetDatasetRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetDatasetRequest build() { + _checkSingleUse(); + + return new GetDatasetRequest(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code esql.get_dataset}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/esql.get_dataset", + + // 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("/_query"); + buf.append("/dataset"); + return buf.toString(); + } + if (propsSet == (_name)) { + StringBuilder buf = new StringBuilder(); + buf.append("/_query"); + buf.append("/dataset"); + buf.append("/"); + SimpleEndpoint.pathEncode( + request.name.stream().map(v -> v).filter(Objects::nonNull).collect(Collectors.joining(",")), + buf); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Path parameters + request -> { + Map params = new HashMap<>(); + final int _name = 1 << 0; + + int propsSet = 0; + + if (ApiTypeHelper.isDefined(request.name())) + propsSet |= _name; + + if (propsSet == 0) { + } + if (propsSet == (_name)) { + params.put("name", request.name.stream().map(v -> v).filter(Objects::nonNull) + .collect(Collectors.joining(","))); + } + return params; + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } + return params; + + }, SimpleEndpoint.emptyMap(), false, GetDatasetResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/GetDatasetResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/GetDatasetResponse.java new file mode 100644 index 0000000000..b80c401ea8 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/GetDatasetResponse.java @@ -0,0 +1,192 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.esql; + +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; + +//---------------------------------------------------------------- +// 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: esql.get_dataset.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class GetDatasetResponse implements JsonpSerializable { + private final List datasets; + + // --------------------------------------------------------------------------------------------- + + private GetDatasetResponse(Builder builder) { + + this.datasets = ApiTypeHelper.unmodifiableRequired(builder.datasets, this, "datasets"); + + } + + public static GetDatasetResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The matching datasets. + *

+ * API name: {@code datasets} + */ + public final List datasets() { + return this.datasets; + } + + /** + * 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.datasets)) { + generator.writeKey("datasets"); + generator.writeStartArray(); + for (ESQLDataset item0 : this.datasets) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetDatasetResponse}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private List datasets; + + /** + * Required - The matching datasets. + *

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

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

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

+ * Adds one or more values to datasets. + */ + public final Builder datasets(ESQLDataset value, ESQLDataset... values) { + this.datasets = _listAdd(this.datasets, value, values); + return this; + } + + /** + * Required - The matching datasets. + *

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

+ * Adds a value to datasets using a builder lambda. + */ + public final Builder datasets(Function> fn) { + return datasets(fn.apply(new ESQLDataset.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link GetDatasetResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetDatasetResponse build() { + _checkSingleUse(); + + return new GetDatasetResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetDatasetResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, GetDatasetResponse::setupGetDatasetResponseDeserializer); + + protected static void setupGetDatasetResponseDeserializer(ObjectDeserializer op) { + + op.add(Builder::datasets, JsonpDeserializer.arrayDeserializer(ESQLDataset._DESERIALIZER), "datasets"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/IdPath.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/IdPath.java new file mode 100644 index 0000000000..168fc8f4f3 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/IdPath.java @@ -0,0 +1,170 @@ +/* + * 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.esql; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: esql._types.IdPath + +/** + * The _id meta-field of a dataset mapping. + * + * @see API + * specification + */ +@JsonpDeserializable +public class IdPath implements JsonpSerializable { + private final String path; + + // --------------------------------------------------------------------------------------------- + + private IdPath(Builder builder) { + + this.path = ApiTypeHelper.requireNonNull(builder.path, this, "path"); + + } + + public static IdPath of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The name of the column that provides the document identity. + *

+ * API name: {@code path} + */ + public final String path() { + return this.path; + } + + /** + * 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("path"); + generator.write(this.path); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link IdPath}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private String path; + + public Builder() { + } + private Builder(IdPath instance) { + this.path = instance.path; + + } + /** + * Required - The name of the column that provides the document identity. + *

+ * API name: {@code path} + */ + public final Builder path(String value) { + this.path = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link IdPath}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public IdPath build() { + _checkSingleUse(); + + return new IdPath(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link IdPath} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + IdPath::setupIdPathDeserializer); + + protected static void setupIdPathDeserializer(ObjectDeserializer op) { + + op.add(Builder::path, JsonpDeserializer.stringDeserializer(), "path"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/PutDataSourceRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/PutDataSourceRequest.java new file mode 100644 index 0000000000..0df673abc7 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/PutDataSourceRequest.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.esql; + +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.JsonData; +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.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.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: esql.put_data_source.Request + +/** + * Create or update an ES|QL data source. + *

+ * Creates or replaces a named, type-specific data source configuration for + * ES|QL data federation. Datasets reference data source configurations to + * access external data. Names must be lowercase and follow index or alias + * naming rules. + * + * @see API + * specification + */ +@JsonpDeserializable +public class PutDataSourceRequest extends RequestBase implements JsonpSerializable { + @Nullable + private final String description; + + @Nullable + private final Time masterTimeout; + + private final String name; + + private final Map settings; + + @Nullable + private final Time timeout; + + private final String type; + + // --------------------------------------------------------------------------------------------- + + private PutDataSourceRequest(Builder builder) { + + this.description = builder.description; + this.masterTimeout = builder.masterTimeout; + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.settings = ApiTypeHelper.unmodifiable(builder.settings); + this.timeout = builder.timeout; + this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); + + } + + public static PutDataSourceRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * A free-text description of the data source. + *

+ * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + + /** + * Period to wait for a connection to the master node. + *

+ * API name: {@code master_timeout} + */ + @Nullable + public final Time masterTimeout() { + return this.masterTimeout; + } + + /** + * Required - The data source name to create or update. + *

+ * API name: {@code name} + */ + public final String name() { + return this.name; + } + + /** + * Type-specific connection and authentication settings. For s3, + * connection settings include region and endpoint. + * Authentication settings include auth and the credentials + * required by the selected authentication method. + *

+ * API name: {@code settings} + */ + public final Map settings() { + return this.settings; + } + + /** + * The time to wait for the request to be completed. + *

+ * API name: {@code timeout} + */ + @Nullable + public final Time timeout() { + return this.timeout; + } + + /** + * Required - The data source type. Currently, s3 is supported. The + * value must be lowercase and contain no whitespace. + *

+ * API name: {@code type} + */ + public final String type() { + return this.type; + } + + /** + * 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.description != null) { + generator.writeKey("description"); + generator.write(this.description); + + } + if (ApiTypeHelper.isDefined(this.settings)) { + generator.writeKey("settings"); + generator.writeStartObject(); + for (Map.Entry item0 : this.settings.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + generator.writeKey("type"); + generator.write(this.type); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link PutDataSourceRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private String description; + + @Nullable + private Time masterTimeout; + + private String name; + + @Nullable + private Map settings; + + @Nullable + private Time timeout; + + private String type; + + public Builder() { + } + private Builder(PutDataSourceRequest instance) { + this.description = instance.description; + this.masterTimeout = instance.masterTimeout; + this.name = instance.name; + this.settings = instance.settings; + this.timeout = instance.timeout; + this.type = instance.type; + + } + /** + * A free-text description of the data source. + *

+ * API name: {@code description} + */ + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * Period to wait for a connection to the master node. + *

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

+ * API name: {@code master_timeout} + */ + public final Builder masterTimeout(Function> fn) { + return this.masterTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - The data source name to create or update. + *

+ * API name: {@code name} + */ + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * Type-specific connection and authentication settings. For s3, + * connection settings include region and endpoint. + * Authentication settings include auth and the credentials + * required by the selected authentication method. + *

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

+ * Adds all entries of map to settings. + */ + public final Builder settings(Map map) { + this.settings = _mapPutAll(this.settings, map); + return this; + } + + /** + * Type-specific connection and authentication settings. For s3, + * connection settings include region and endpoint. + * Authentication settings include auth and the credentials + * required by the selected authentication method. + *

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

+ * Adds an entry to settings. + */ + public final Builder settings(String key, JsonData value) { + this.settings = _mapPut(this.settings, key, value); + return this; + } + + /** + * The time to wait for the request to be completed. + *

+ * API name: {@code timeout} + */ + public final Builder timeout(@Nullable Time value) { + this.timeout = value; + return this; + } + + /** + * The time to wait for the request to be completed. + *

+ * API name: {@code timeout} + */ + public final Builder timeout(Function> fn) { + return this.timeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - The data source type. Currently, s3 is supported. The + * value must be lowercase and contain no whitespace. + *

+ * API name: {@code type} + */ + public final Builder type(String value) { + this.type = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link PutDataSourceRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public PutDataSourceRequest build() { + _checkSingleUse(); + + return new PutDataSourceRequest(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PutDataSourceRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, PutDataSourceRequest::setupPutDataSourceRequestDeserializer); + + protected static void setupPutDataSourceRequestDeserializer(ObjectDeserializer op) { + + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::settings, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "settings"); + op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code esql.put_data_source}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/esql.put_data_source", + + // 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("/_query"); + buf.append("/data_source"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.name, buf); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Path parameters + request -> { + Map params = new HashMap<>(); + final int _name = 1 << 0; + + int propsSet = 0; + + propsSet |= _name; + + if (propsSet == (_name)) { + params.put("name", request.name); + } + return params; + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } + if (request.timeout != null) { + params.put("timeout", request.timeout._toJsonString()); + } + return params; + + }, SimpleEndpoint.emptyMap(), true, PutDataSourceResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/PutDataSourceResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/PutDataSourceResponse.java new file mode 100644 index 0000000000..54930dd3df --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/PutDataSourceResponse.java @@ -0,0 +1,107 @@ +/* + * 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.esql; + +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; + +//---------------------------------------------------------------- +// 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: esql.put_data_source.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class PutDataSourceResponse extends AcknowledgedResponseBase { + // --------------------------------------------------------------------------------------------- + + private PutDataSourceResponse(Builder builder) { + super(builder); + + } + + public static PutDataSourceResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link PutDataSourceResponse}. + */ + + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link PutDataSourceResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public PutDataSourceResponse build() { + _checkSingleUse(); + + return new PutDataSourceResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PutDataSourceResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, PutDataSourceResponse::setupPutDataSourceResponseDeserializer); + + protected static void setupPutDataSourceResponseDeserializer(ObjectDeserializer op) { + AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/PutDatasetRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/PutDatasetRequest.java new file mode 100644 index 0000000000..ceb5f4f243 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/PutDatasetRequest.java @@ -0,0 +1,520 @@ +/* + * 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.esql; + +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.JsonData; +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.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.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: esql.put_dataset.Request + +/** + * Create or update an ES|QL dataset. + *

+ * Creates or replaces a dataset that references a data source in ES|QL data + * federation. Dataset names participate in the index namespace and must follow + * index or alias naming rules. Returns 404 if the referenced data + * source does not exist. + * + * @see API + * specification + */ +@JsonpDeserializable +public class PutDatasetRequest extends RequestBase implements JsonpSerializable { + private final String dataSource; + + @Nullable + private final String description; + + @Nullable + private final DatasetMapping mappings; + + @Nullable + private final Time masterTimeout; + + private final String name; + + private final String resource; + + private final Map settings; + + @Nullable + private final Time timeout; + + // --------------------------------------------------------------------------------------------- + + private PutDatasetRequest(Builder builder) { + + this.dataSource = ApiTypeHelper.requireNonNull(builder.dataSource, this, "dataSource"); + this.description = builder.description; + this.mappings = builder.mappings; + this.masterTimeout = builder.masterTimeout; + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.resource = ApiTypeHelper.requireNonNull(builder.resource, this, "resource"); + this.settings = ApiTypeHelper.unmodifiable(builder.settings); + this.timeout = builder.timeout; + + } + + public static PutDatasetRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The name of the referenced data source. The data source must + * already exist. + *

+ * API name: {@code data_source} + */ + public final String dataSource() { + return this.dataSource; + } + + /** + * A free-text description of the dataset. + *

+ * API name: {@code description} + */ + @Nullable + public final String description() { + return this.description; + } + + /** + * User-declared mapping on the dataset definition + *

+ * API name: {@code mappings} + */ + @Nullable + public final DatasetMapping mappings() { + return this.mappings; + } + + /** + * Period to wait for a connection to the master node. + *

+ * API name: {@code master_timeout} + */ + @Nullable + public final Time masterTimeout() { + return this.masterTimeout; + } + + /** + * Required - The dataset name to create or update. + *

+ * API name: {@code name} + */ + public final String name() { + return this.name; + } + + /** + * Required - The URI that identifies the data to read, resolved against the + * referenced data source. It can include glob patterns. For example, a + * recursive pattern can match all Parquet files under the + * s3://logs-bucket/access prefix. + *

+ * API name: {@code resource} + */ + public final String resource() { + return this.resource; + } + + /** + * Format and parsing-specific settings that configure how the resource is read. + * Common keys include format, which explicitly selects a + * registered format, and partition_detection, which accepts + * auto, hive, template, or + * none. Additional keys depend on the format reader. Compression + * can be inferred from the resource URI. + *

+ * API name: {@code settings} + */ + public final Map settings() { + return this.settings; + } + + /** + * The time to wait for the request to be completed. + *

+ * 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) { + + generator.writeKey("data_source"); + generator.write(this.dataSource); + + if (this.description != null) { + generator.writeKey("description"); + generator.write(this.description); + + } + if (this.mappings != null) { + generator.writeKey("mappings"); + this.mappings.serialize(generator, mapper); + + } + generator.writeKey("resource"); + generator.write(this.resource); + + if (ApiTypeHelper.isDefined(this.settings)) { + generator.writeKey("settings"); + generator.writeStartObject(); + for (Map.Entry item0 : this.settings.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link PutDatasetRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + private String dataSource; + + @Nullable + private String description; + + @Nullable + private DatasetMapping mappings; + + @Nullable + private Time masterTimeout; + + private String name; + + private String resource; + + @Nullable + private Map settings; + + @Nullable + private Time timeout; + + public Builder() { + } + private Builder(PutDatasetRequest instance) { + this.dataSource = instance.dataSource; + this.description = instance.description; + this.mappings = instance.mappings; + this.masterTimeout = instance.masterTimeout; + this.name = instance.name; + this.resource = instance.resource; + this.settings = instance.settings; + this.timeout = instance.timeout; + + } + /** + * Required - The name of the referenced data source. The data source must + * already exist. + *

+ * API name: {@code data_source} + */ + public final Builder dataSource(String value) { + this.dataSource = value; + return this; + } + + /** + * A free-text description of the dataset. + *

+ * API name: {@code description} + */ + public final Builder description(@Nullable String value) { + this.description = value; + return this; + } + + /** + * User-declared mapping on the dataset definition + *

+ * API name: {@code mappings} + */ + public final Builder mappings(@Nullable DatasetMapping value) { + this.mappings = value; + return this; + } + + /** + * User-declared mapping on the dataset definition + *

+ * API name: {@code mappings} + */ + public final Builder mappings(Function> fn) { + return this.mappings(fn.apply(new DatasetMapping.Builder()).build()); + } + + /** + * Period to wait for a connection to the master node. + *

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

+ * API name: {@code master_timeout} + */ + public final Builder masterTimeout(Function> fn) { + return this.masterTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - The dataset name to create or update. + *

+ * API name: {@code name} + */ + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * Required - The URI that identifies the data to read, resolved against the + * referenced data source. It can include glob patterns. For example, a + * recursive pattern can match all Parquet files under the + * s3://logs-bucket/access prefix. + *

+ * API name: {@code resource} + */ + public final Builder resource(String value) { + this.resource = value; + return this; + } + + /** + * Format and parsing-specific settings that configure how the resource is read. + * Common keys include format, which explicitly selects a + * registered format, and partition_detection, which accepts + * auto, hive, template, or + * none. Additional keys depend on the format reader. Compression + * can be inferred from the resource URI. + *

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

+ * Adds all entries of map to settings. + */ + public final Builder settings(Map map) { + this.settings = _mapPutAll(this.settings, map); + return this; + } + + /** + * Format and parsing-specific settings that configure how the resource is read. + * Common keys include format, which explicitly selects a + * registered format, and partition_detection, which accepts + * auto, hive, template, or + * none. Additional keys depend on the format reader. Compression + * can be inferred from the resource URI. + *

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

+ * Adds an entry to settings. + */ + public final Builder settings(String key, JsonData value) { + this.settings = _mapPut(this.settings, key, value); + return this; + } + + /** + * The time to wait for the request to be completed. + *

+ * API name: {@code timeout} + */ + public final Builder timeout(@Nullable Time value) { + this.timeout = value; + return this; + } + + /** + * The time to wait for the request to be completed. + *

+ * 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 PutDatasetRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public PutDatasetRequest build() { + _checkSingleUse(); + + return new PutDatasetRequest(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PutDatasetRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, PutDatasetRequest::setupPutDatasetRequestDeserializer); + + protected static void setupPutDatasetRequestDeserializer(ObjectDeserializer op) { + + op.add(Builder::dataSource, JsonpDeserializer.stringDeserializer(), "data_source"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::mappings, DatasetMapping._DESERIALIZER, "mappings"); + op.add(Builder::resource, JsonpDeserializer.stringDeserializer(), "resource"); + op.add(Builder::settings, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "settings"); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code esql.put_dataset}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/esql.put_dataset", + + // 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("/_query"); + buf.append("/dataset"); + buf.append("/"); + SimpleEndpoint.pathEncode(request.name, buf); + return buf.toString(); + } + throw SimpleEndpoint.noPathTemplateFound("path"); + + }, + + // Path parameters + request -> { + Map params = new HashMap<>(); + final int _name = 1 << 0; + + int propsSet = 0; + + propsSet |= _name; + + if (propsSet == (_name)) { + params.put("name", request.name); + } + return params; + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } + if (request.timeout != null) { + params.put("timeout", request.timeout._toJsonString()); + } + return params; + + }, SimpleEndpoint.emptyMap(), true, PutDatasetResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/PutDatasetResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/PutDatasetResponse.java new file mode 100644 index 0000000000..975ad77e6b --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/PutDatasetResponse.java @@ -0,0 +1,107 @@ +/* + * 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.esql; + +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; + +//---------------------------------------------------------------- +// 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: esql.put_dataset.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class PutDatasetResponse extends AcknowledgedResponseBase { + // --------------------------------------------------------------------------------------------- + + private PutDatasetResponse(Builder builder) { + super(builder); + + } + + public static PutDatasetResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link PutDatasetResponse}. + */ + + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link PutDatasetResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public PutDatasetResponse build() { + _checkSingleUse(); + + return new PutDatasetResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PutDatasetResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, PutDatasetResponse::setupPutDatasetResponseDeserializer); + + protected static void setupPutDatasetResponseDeserializer(ObjectDeserializer op) { + AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/QueryRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/QueryRequest.java index 1c34bd238a..a4a08d2c4b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/QueryRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/esql/QueryRequest.java @@ -111,6 +111,9 @@ public class QueryRequest extends RequestBase implements JsonpSerializable { private final String query; + @Nullable + private final EsqlQuerySettings settings; + private final Map> tables; @Nullable @@ -133,6 +136,7 @@ private QueryRequest(Builder builder) { this.profile = builder.profile; this.projectRouting = builder.projectRouting; this.query = ApiTypeHelper.requireNonNull(builder.query, this, "query"); + this.settings = builder.settings; this.tables = ApiTypeHelper.unmodifiable(builder.tables); this.timeZone = builder.timeZone; @@ -306,6 +310,18 @@ public final String query() { return this.query; } + /** + * Per-query settings, the request-body equivalent of the in-query + * SET command. For example, time_zone can be supplied + * here instead of as a top-level field. + *

+ * API name: {@code settings} + */ + @Nullable + public final EsqlQuerySettings settings() { + return this.settings; + } + /** * Tables to use with the LOOKUP operation. The top level key is the table name * and the next level key is the column name. @@ -385,6 +401,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("query"); generator.write(this.query); + if (this.settings != null) { + generator.writeKey("settings"); + this.settings.serialize(generator, mapper); + + } if (ApiTypeHelper.isDefined(this.tables)) { generator.writeKey("tables"); generator.writeStartObject(); @@ -457,6 +478,9 @@ public static class Builder extends RequestBase.AbstractBuilder impleme private String query; + @Nullable + private EsqlQuerySettings settings; + @Nullable private Map> tables; @@ -479,6 +503,7 @@ private Builder(QueryRequest instance) { this.profile = instance.profile; this.projectRouting = instance.projectRouting; this.query = instance.query; + this.settings = instance.settings; this.tables = instance.tables; this.timeZone = instance.timeZone; @@ -767,6 +792,29 @@ public final Builder query(String value) { return this; } + /** + * Per-query settings, the request-body equivalent of the in-query + * SET command. For example, time_zone can be supplied + * here instead of as a top-level field. + *

+ * API name: {@code settings} + */ + public final Builder settings(@Nullable EsqlQuerySettings value) { + this.settings = value; + return this; + } + + /** + * Per-query settings, the request-body equivalent of the in-query + * SET command. For example, time_zone can be supplied + * here instead of as a top-level field. + *

+ * API name: {@code settings} + */ + public final Builder settings(Function> fn) { + return this.settings(fn.apply(new EsqlQuerySettings.Builder()).build()); + } + /** * Tables to use with the LOOKUP operation. The top level key is the table name * and the next level key is the column name. @@ -847,6 +895,7 @@ protected static void setupQueryRequestDeserializer(ObjectDeserializer> fn) { + return this.unassigned(fn.apply(new IndexSettingsUnassigned.Builder()).build()); + } + /** * API name: {@code gc_deletes} */ @@ -2124,6 +2161,7 @@ protected static void setupIndexSettingsDeserializer(ObjectDeserializerkeyword dimension field; if the setting is unset + * or the field is missing or invalid, the metric temporality resolves to null. + *

+ * API name: {@code temporality_field} + */ + @Nullable + public final String temporalityField() { + return this.temporalityField; + } + /** * Serialize this object to JSON. */ @@ -113,6 +130,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("start_time"); this.startTime.serialize(generator, mapper); } + if (this.temporalityField != null) { + generator.writeKey("temporality_field"); + generator.write(this.temporalityField); + + } } @@ -136,11 +158,15 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private DateTime startTime; + @Nullable + private String temporalityField; + public Builder() { } private Builder(IndexSettingsTimeSeries instance) { this.endTime = instance.endTime; this.startTime = instance.startTime; + this.temporalityField = instance.temporalityField; } /** @@ -159,6 +185,18 @@ public final Builder startTime(@Nullable DateTime value) { return this; } + /** + * The name of the field that stores the temporality of a metric. The referenced + * field must be a keyword dimension field; if the setting is unset + * or the field is missing or invalid, the metric temporality resolves to null. + *

+ * API name: {@code temporality_field} + */ + public final Builder temporalityField(@Nullable String value) { + this.temporalityField = value; + return this; + } + @Override protected Builder self() { return this; @@ -196,6 +234,7 @@ protected static void setupIndexSettingsTimeSeriesDeserializer( op.add(Builder::endTime, DateTime._DESERIALIZER, "end_time"); op.add(Builder::startTime, DateTime._DESERIALIZER, "start_time"); + op.add(Builder::temporalityField, JsonpDeserializer.stringDeserializer(), "temporality_field"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsUnassigned.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsUnassigned.java new file mode 100644 index 0000000000..25e55d63cb --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsUnassigned.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. + */ + +package co.elastic.clients.elasticsearch.indices; + +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: indices._types.IndexSettingsUnassigned + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class IndexSettingsUnassigned implements JsonpSerializable { + @Nullable + private final IndexSettingsUnassignedNodeLeft nodeLeft; + + // --------------------------------------------------------------------------------------------- + + private IndexSettingsUnassigned(Builder builder) { + + this.nodeLeft = builder.nodeLeft; + + } + + public static IndexSettingsUnassigned of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code node_left} + */ + @Nullable + public final IndexSettingsUnassignedNodeLeft nodeLeft() { + return this.nodeLeft; + } + + /** + * 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.nodeLeft != null) { + generator.writeKey("node_left"); + this.nodeLeft.serialize(generator, mapper); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link IndexSettingsUnassigned}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + @Nullable + private IndexSettingsUnassignedNodeLeft nodeLeft; + + public Builder() { + } + private Builder(IndexSettingsUnassigned instance) { + this.nodeLeft = instance.nodeLeft; + + } + /** + * API name: {@code node_left} + */ + public final Builder nodeLeft(@Nullable IndexSettingsUnassignedNodeLeft value) { + this.nodeLeft = value; + return this; + } + + /** + * API name: {@code node_left} + */ + public final Builder nodeLeft( + Function> fn) { + return this.nodeLeft(fn.apply(new IndexSettingsUnassignedNodeLeft.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link IndexSettingsUnassigned}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public IndexSettingsUnassigned build() { + _checkSingleUse(); + + return new IndexSettingsUnassigned(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link IndexSettingsUnassigned} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, IndexSettingsUnassigned::setupIndexSettingsUnassignedDeserializer); + + protected static void setupIndexSettingsUnassignedDeserializer( + ObjectDeserializer op) { + + op.add(Builder::nodeLeft, IndexSettingsUnassignedNodeLeft._DESERIALIZER, "node_left"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsUnassignedNodeLeft.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsUnassignedNodeLeft.java new file mode 100644 index 0000000000..21de1ea8a1 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/IndexSettingsUnassignedNodeLeft.java @@ -0,0 +1,191 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.indices; + +import co.elastic.clients.elasticsearch._types.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; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: indices._types.IndexSettingsUnassignedNodeLeft + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class IndexSettingsUnassignedNodeLeft implements JsonpSerializable { + @Nullable + private final Time delayedTimeout; + + // --------------------------------------------------------------------------------------------- + + private IndexSettingsUnassignedNodeLeft(Builder builder) { + + this.delayedTimeout = builder.delayedTimeout; + + } + + public static IndexSettingsUnassignedNodeLeft of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The amount of time to wait for a node that has left before assuming its + * shards are permanently missing and starting to allocate replacement replicas. + *

+ * API name: {@code delayed_timeout} + */ + @Nullable + public final Time delayedTimeout() { + return this.delayedTimeout; + } + + /** + * 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.delayedTimeout != null) { + generator.writeKey("delayed_timeout"); + this.delayedTimeout.serialize(generator, mapper); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link IndexSettingsUnassignedNodeLeft}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + @Nullable + private Time delayedTimeout; + + public Builder() { + } + private Builder(IndexSettingsUnassignedNodeLeft instance) { + this.delayedTimeout = instance.delayedTimeout; + + } + /** + * The amount of time to wait for a node that has left before assuming its + * shards are permanently missing and starting to allocate replacement replicas. + *

+ * API name: {@code delayed_timeout} + */ + public final Builder delayedTimeout(@Nullable Time value) { + this.delayedTimeout = value; + return this; + } + + /** + * The amount of time to wait for a node that has left before assuming its + * shards are permanently missing and starting to allocate replacement replicas. + *

+ * API name: {@code delayed_timeout} + */ + public final Builder delayedTimeout(Function> fn) { + return this.delayedTimeout(fn.apply(new Time.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link IndexSettingsUnassignedNodeLeft}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public IndexSettingsUnassignedNodeLeft build() { + _checkSingleUse(); + + return new IndexSettingsUnassignedNodeLeft(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link IndexSettingsUnassignedNodeLeft} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, IndexSettingsUnassignedNodeLeft::setupIndexSettingsUnassignedNodeLeftDeserializer); + + protected static void setupIndexSettingsUnassignedNodeLeftDeserializer( + ObjectDeserializer op) { + + op.add(Builder::delayedTimeout, Time._DESERIALIZER, "delayed_timeout"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ValidateQueryRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ValidateQueryRequest.java index f74980feb7..b9389993be 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ValidateQueryRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/ValidateQueryRequest.java @@ -113,6 +113,11 @@ public class ValidateQueryRequest extends RequestBase implements JsonpSerializab @Nullable private final Boolean rewrite; + @Nullable + private final String routeSlice; + + private final List routing; + // --------------------------------------------------------------------------------------------- private ValidateQueryRequest(Builder builder) { @@ -131,6 +136,8 @@ private ValidateQueryRequest(Builder builder) { this.q = builder.q; this.query = builder.query; this.rewrite = builder.rewrite; + this.routeSlice = builder.routeSlice; + this.routing = ApiTypeHelper.unmodifiable(builder.routing); } @@ -298,6 +305,31 @@ public final Boolean rewrite() { return this.rewrite; } + /** + * The slice identifier used to route the operation to a specific slice. Use the + * special value _all to target all slices without restricting to a + * routing value. Required when index.slice.enabled is + * true for the target index; not allowed when + * index.slice.enabled is false. + *

+ * API name: {@code _slice} + */ + @Nullable + public final String routeSlice() { + return this.routeSlice; + } + + /** + * A custom value used to route operations to a specific shard. Not allowed when + * index.slice.enabled is true for the target index; + * use _slice instead. + *

+ * API name: {@code routing} + */ + public final List routing() { + return this.routing; + } + /** * Serialize this object to JSON. */ @@ -368,6 +400,12 @@ public static class Builder extends RequestBase.AbstractBuilder @Nullable private Boolean rewrite; + @Nullable + private String routeSlice; + + @Nullable + private List routing; + public Builder() { } private Builder(ValidateQueryRequest instance) { @@ -385,6 +423,8 @@ private Builder(ValidateQueryRequest instance) { this.q = instance.q; this.query = instance.query; this.rewrite = instance.rewrite; + this.routeSlice = instance.routeSlice; + this.routing = instance.routing; } /** @@ -601,6 +641,48 @@ public final Builder rewrite(@Nullable Boolean value) { return this; } + /** + * The slice identifier used to route the operation to a specific slice. Use the + * special value _all to target all slices without restricting to a + * routing value. Required when index.slice.enabled is + * true for the target index; not allowed when + * index.slice.enabled is false. + *

+ * API name: {@code _slice} + */ + public final Builder routeSlice(@Nullable String value) { + this.routeSlice = value; + return this; + } + + /** + * A custom value used to route operations to a specific shard. Not allowed when + * index.slice.enabled is true for the target index; + * use _slice instead. + *

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

+ * Adds all elements of list to routing. + */ + public final Builder routing(List list) { + this.routing = _listAddAll(this.routing, list); + return this; + } + + /** + * A custom value used to route operations to a specific shard. Not allowed when + * index.slice.enabled is true for the target index; + * use _slice instead. + *

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

+ * Adds one or more values to routing. + */ + public final Builder routing(String value, String... values) { + this.routing = _listAdd(this.routing, value, values); + return this; + } + @Override protected Builder self() { return this; @@ -706,11 +788,31 @@ protected static void setupValidateQueryRequestDeserializer(ObjectDeserializer v.jsonValue()) + .filter(Objects::nonNull).collect(Collectors.joining(","))); + } + if (request.analyzeWildcard != null) { + params.put("analyze_wildcard", String.valueOf(request.analyzeWildcard)); + } + if (request.routeSlice != null) { + params.put("_slice", request.routeSlice); + } + if (request.lenient != null) { + params.put("lenient", String.valueOf(request.lenient)); + } + if (request.rewrite != null) { + params.put("rewrite", String.valueOf(request.rewrite)); + } if (request.q != null) { params.put("q", request.q); } - if (request.df != null) { - params.put("df", request.df); + if (ApiTypeHelper.isDefined(request.routing)) { + params.put("routing", request.routing.stream().map(v -> v).filter(Objects::nonNull) + .collect(Collectors.joining(","))); } if (request.defaultOperator != null) { params.put("default_operator", request.defaultOperator.jsonValue()); @@ -718,10 +820,6 @@ protected static void setupValidateQueryRequestDeserializer(ObjectDeserializer v.jsonValue()) - .filter(Objects::nonNull).collect(Collectors.joining(","))); - } if (request.ignoreUnavailable != null) { params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); } @@ -731,15 +829,6 @@ protected static void setupValidateQueryRequestDeserializer(ObjectDeserializer removeBackingIndex( return this.removeBackingIndex(fn.apply(new IndexAndDataStreamAction.Builder()).build()); } + public ObjectBuilder deleteBackingIndex(IndexAndDataStreamAction v) { + this._kind = Kind.DeleteBackingIndex; + this._value = v; + return this; + } + + public ObjectBuilder deleteBackingIndex( + Function> fn) { + return this.deleteBackingIndex(fn.apply(new IndexAndDataStreamAction.Builder()).build()); + } + public Action build() { _checkSingleUse(); return new Action(this); @@ -219,6 +250,7 @@ protected static void setupActionDeserializer(ObjectDeserializer op) { op.add(Builder::addBackingIndex, IndexAndDataStreamAction._DESERIALIZER, "add_backing_index"); op.add(Builder::removeBackingIndex, IndexAndDataStreamAction._DESERIALIZER, "remove_backing_index"); + op.add(Builder::deleteBackingIndex, IndexAndDataStreamAction._DESERIALIZER, "delete_backing_index"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/modify_data_stream/ActionBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/modify_data_stream/ActionBuilders.java index 966068fba9..6b1a4a450d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/modify_data_stream/ActionBuilders.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/modify_data_stream/ActionBuilders.java @@ -82,4 +82,23 @@ public static Action removeBackingIndex( return builder.build(); } + /** + * Creates a builder for the {@link IndexAndDataStreamAction + * delete_backing_index} {@code Action} variant. + */ + public static IndexAndDataStreamAction.Builder deleteBackingIndex() { + return new IndexAndDataStreamAction.Builder(); + } + + /** + * Creates a Action of the {@link IndexAndDataStreamAction delete_backing_index} + * {@code Action} variant. + */ + public static Action deleteBackingIndex( + Function> fn) { + Action.Builder builder = new Action.Builder(); + builder.deleteBackingIndex(fn.apply(new IndexAndDataStreamAction.Builder()).build()); + return builder.build(); + } + } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/modify_data_stream/IndexAndDataStreamAction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/modify_data_stream/IndexAndDataStreamAction.java index 5c37239e63..348b05e396 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/modify_data_stream/IndexAndDataStreamAction.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/indices/modify_data_stream/IndexAndDataStreamAction.java @@ -82,7 +82,7 @@ public static IndexAndDataStreamAction of(Function implement private Long totalEstimatedOverheadInBytes; + private Long totalSegments; + + private Long totalSegmentFields; + + private Long averageFieldsPerSegment; + public Builder() { } private Builder(MappingStats instance) { this.totalCount = instance.totalCount; this.totalEstimatedOverhead = instance.totalEstimatedOverhead; this.totalEstimatedOverheadInBytes = instance.totalEstimatedOverheadInBytes; + this.totalSegments = instance.totalSegments; + this.totalSegmentFields = instance.totalSegmentFields; + this.averageFieldsPerSegment = instance.averageFieldsPerSegment; } /** @@ -179,6 +229,30 @@ public final Builder totalEstimatedOverheadInBytes(long value) { return this; } + /** + * Required - API name: {@code total_segments} + */ + public final Builder totalSegments(long value) { + this.totalSegments = value; + return this; + } + + /** + * Required - API name: {@code total_segment_fields} + */ + public final Builder totalSegmentFields(long value) { + this.totalSegmentFields = value; + return this; + } + + /** + * Required - API name: {@code average_fields_per_segment} + */ + public final Builder averageFieldsPerSegment(long value) { + this.averageFieldsPerSegment = value; + return this; + } + @Override protected Builder self() { return this; @@ -217,6 +291,9 @@ protected static void setupMappingStatsDeserializer(ObjectDeserializer implement private Long hitCount; + @Nullable + private String memorySize; + private Long memorySizeInBytes; private Long missCount; @@ -207,6 +229,7 @@ private Builder(ShardQueryCache instance) { this.cacheSize = instance.cacheSize; this.evictions = instance.evictions; this.hitCount = instance.hitCount; + this.memorySize = instance.memorySize; this.memorySizeInBytes = instance.memorySizeInBytes; this.missCount = instance.missCount; this.totalCount = instance.totalCount; @@ -244,6 +267,14 @@ public final Builder hitCount(long value) { return this; } + /** + * API name: {@code memory_size} + */ + public final Builder memorySize(@Nullable String value) { + this.memorySize = value; + return this; + } + /** * Required - API name: {@code memory_size_in_bytes} */ @@ -306,6 +337,7 @@ protected static void setupShardQueryCacheDeserializer(ObjectDeserializer indices; // --------------------------------------------------------------------------------------------- @@ -160,6 +167,7 @@ private ShardStats(Builder builder) { this.commit = builder.commit; this.completion = builder.completion; + this.denseVector = builder.denseVector; this.docs = builder.docs; this.fielddata = builder.fielddata; this.flush = builder.flush; @@ -177,13 +185,14 @@ private ShardStats(Builder builder) { this.search = builder.search; this.segments = builder.segments; this.seqNo = builder.seqNo; + this.sparseVector = builder.sparseVector; this.store = builder.store; this.translog = builder.translog; this.warmer = builder.warmer; this.bulk = builder.bulk; this.shards = ApiTypeHelper.unmodifiable(builder.shards); this.shardStats = builder.shardStats; - this.indices = builder.indices; + this.indices = ApiTypeHelper.unmodifiable(builder.indices); } @@ -207,6 +216,14 @@ public final CompletionStats completion() { return this.completion; } + /** + * API name: {@code dense_vector} + */ + @Nullable + public final DenseVectorStats denseVector() { + return this.denseVector; + } + /** * API name: {@code docs} */ @@ -343,6 +360,14 @@ public final ShardSequenceNumber seqNo() { return this.seqNo; } + /** + * API name: {@code sparse_vector} + */ + @Nullable + public final SparseVectorStats sparseVector() { + return this.sparseVector; + } + /** * API name: {@code store} */ @@ -393,8 +418,7 @@ public final ShardsTotalStats shardStats() { /** * API name: {@code indices} */ - @Nullable - public final IndicesStats indices() { + public final Map indices() { return this.indices; } @@ -418,6 +442,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("completion"); this.completion.serialize(generator, mapper); + } + if (this.denseVector != null) { + generator.writeKey("dense_vector"); + this.denseVector.serialize(generator, mapper); + } if (this.docs != null) { generator.writeKey("docs"); @@ -503,6 +532,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("seq_no"); this.seqNo.serialize(generator, mapper); + } + if (this.sparseVector != null) { + generator.writeKey("sparse_vector"); + this.sparseVector.serialize(generator, mapper); + } if (this.store != null) { generator.writeKey("store"); @@ -540,9 +574,15 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.shardStats.serialize(generator, mapper); } - if (this.indices != null) { + if (ApiTypeHelper.isDefined(this.indices)) { generator.writeKey("indices"); - this.indices.serialize(generator, mapper); + generator.writeStartObject(); + for (Map.Entry item0 : this.indices.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); } @@ -566,6 +606,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private CompletionStats completion; + @Nullable + private DenseVectorStats denseVector; + @Nullable private DocStats docs; @@ -617,6 +660,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private ShardSequenceNumber seqNo; + @Nullable + private SparseVectorStats sparseVector; + @Nullable private StoreStats store; @@ -636,13 +682,14 @@ public static class Builder extends WithJsonObjectBuilderBase implement private ShardsTotalStats shardStats; @Nullable - private IndicesStats indices; + private Map indices; public Builder() { } private Builder(ShardStats instance) { this.commit = instance.commit; this.completion = instance.completion; + this.denseVector = instance.denseVector; this.docs = instance.docs; this.fielddata = instance.fielddata; this.flush = instance.flush; @@ -660,6 +707,7 @@ private Builder(ShardStats instance) { this.search = instance.search; this.segments = instance.segments; this.seqNo = instance.seqNo; + this.sparseVector = instance.sparseVector; this.store = instance.store; this.translog = instance.translog; this.warmer = instance.warmer; @@ -699,6 +747,21 @@ public final Builder completion(Function> fn) { + return this.denseVector(fn.apply(new DenseVectorStats.Builder()).build()); + } + /** * API name: {@code docs} */ @@ -955,6 +1018,21 @@ public final Builder seqNo(Function> fn) { + return this.sparseVector(fn.apply(new SparseVectorStats.Builder()).build()); + } + /** * API name: {@code store} */ @@ -1052,17 +1130,31 @@ public final Builder shardStats(Function + * Adds all entries of map to indices. + */ + public final Builder indices(Map map) { + this.indices = _mapPutAll(this.indices, map); + return this; + } + + /** + * API name: {@code indices} + *

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

+ * Adds an entry to indices using a builder lambda. */ - public final Builder indices(Function> fn) { - return this.indices(fn.apply(new IndicesStats.Builder()).build()); + public final Builder indices(String key, Function> fn) { + return indices(key, fn.apply(new ShardStats.Builder()).build()); } @Override @@ -1101,6 +1193,7 @@ protected static void setupShardStatsDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public class CspRegion implements JsonpSerializable { + private final String csp; + + private final String region; + + // --------------------------------------------------------------------------------------------- + + private CspRegion(Builder builder) { + + this.csp = ApiTypeHelper.requireNonNull(builder.csp, this, "csp"); + this.region = ApiTypeHelper.requireNonNull(builder.region, this, "region"); + + } + + public static CspRegion of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The cloud service provider, for example aws, + * gcp, or azure. + *

+ * API name: {@code csp} + */ + public final String csp() { + return this.csp; + } + + /** + * Required - The region of the cloud service provider, for example + * us-east-1. + *

+ * API name: {@code region} + */ + public final String region() { + return this.region; + } + + /** + * 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("csp"); + generator.write(this.csp); + + generator.writeKey("region"); + generator.write(this.region); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link CspRegion}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private String csp; + + private String region; + + public Builder() { + } + private Builder(CspRegion instance) { + this.csp = instance.csp; + this.region = instance.region; + + } + /** + * Required - The cloud service provider, for example aws, + * gcp, or azure. + *

+ * API name: {@code csp} + */ + public final Builder csp(String value) { + this.csp = value; + return this; + } + + /** + * Required - The region of the cloud service provider, for example + * us-east-1. + *

+ * API name: {@code region} + */ + public final Builder region(String value) { + this.region = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link CspRegion}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public CspRegion build() { + _checkSingleUse(); + + return new CspRegion(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CspRegion} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + CspRegion::setupCspRegionDeserializer); + + protected static void setupCspRegionDeserializer(ObjectDeserializer op) { + + op.add(Builder::csp, JsonpDeserializer.stringDeserializer(), "csp"); + op.add(Builder::region, JsonpDeserializer.stringDeserializer(), "region"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/CustomTaskSettings.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/CustomTaskSettings.java index f0ddcddf2f..b65ffcce1f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/CustomTaskSettings.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/CustomTaskSettings.java @@ -89,6 +89,14 @@ public static CustomTaskSettings of(Function * + * + *

+ *

+ * warn The task_settings.parameters cannot contain the same keys + * as secret_parameters. If they do, an error will be returned. + * This applies to PUT requests and POST requests. + *

+ *
*

* API name: {@code parameters} */ @@ -157,6 +165,14 @@ private Builder(CustomTaskSettings instance) { * } * * + * + *

+ *

+ * warn The task_settings.parameters cannot contain the same keys + * as secret_parameters. If they do, an error will be returned. + * This applies to PUT requests and POST requests. + *

+ *
*

* API name: {@code parameters} *

@@ -180,6 +196,14 @@ public final Builder parameters(Map map) { * } * * + * + *

+ *

+ * warn The task_settings.parameters cannot contain the same keys + * as secret_parameters. If they do, an error will be returned. + * This applies to PUT requests and POST requests. + *

+ *
*

* API name: {@code parameters} *

@@ -203,6 +227,14 @@ public final Builder parameters(String key, FieldValue value) { * } * * + * + *

+ *

+ * warn The task_settings.parameters cannot contain the same keys + * as secret_parameters. If they do, an error will be returned. + * This applies to PUT requests and POST requests. + *

+ *
*

* API name: {@code parameters} *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteRegionPolicyRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteRegionPolicyRequest.java new file mode 100644 index 0000000000..8b502ea1e7 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteRegionPolicyRequest.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. + */ + +package co.elastic.clients.elasticsearch.inference; + +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.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.util.Collections; +import java.util.Objects; + +//---------------------------------------------------------------- +// 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: inference.delete_region_policy.Request + +/** + * Delete the inference region policy. + * + * @see API + * specification + */ + +public class DeleteRegionPolicyRequest extends RequestBase { + public DeleteRegionPolicyRequest() { + } + + /** + * Singleton instance for {@link DeleteRegionPolicyRequest}. + */ + public static final DeleteRegionPolicyRequest _INSTANCE = new DeleteRegionPolicyRequest(); + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code inference.delete_region_policy}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/inference.delete_region_policy", + + // Request method + request -> { + return "DELETE"; + + }, + + // Request path + request -> { + return "/_inference/_region_policy"; + + }, + + // Path parameters + request -> { + return Collections.emptyMap(); + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), false, DeleteRegionPolicyResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteRegionPolicyResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteRegionPolicyResponse.java new file mode 100644 index 0000000000..c5ea59afbd --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteRegionPolicyResponse.java @@ -0,0 +1,109 @@ +/* + * 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.inference; + +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; + +//---------------------------------------------------------------- +// 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: inference.delete_region_policy.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DeleteRegionPolicyResponse extends AcknowledgedResponseBase { + // --------------------------------------------------------------------------------------------- + + private DeleteRegionPolicyResponse(Builder builder) { + super(builder); + + } + + public static DeleteRegionPolicyResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DeleteRegionPolicyResponse}. + */ + + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DeleteRegionPolicyResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DeleteRegionPolicyResponse build() { + _checkSingleUse(); + + return new DeleteRegionPolicyResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DeleteRegionPolicyResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DeleteRegionPolicyResponse::setupDeleteRegionPolicyResponseDeserializer); + + protected static void setupDeleteRegionPolicyResponseDeserializer( + ObjectDeserializer op) { + AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceAsyncClient.java index 6e5d0ad483..3fb814255c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceAsyncClient.java @@ -231,6 +231,20 @@ public final CompletableFuture delete( return delete(fn.apply(new DeleteInferenceRequest.Builder()).build()); } + // ----- Endpoint: inference.delete_region_policy + + /** + * Delete the inference region policy. + * + * @see Documentation + * on elastic.co + */ + public CompletableFuture deleteRegionPolicy() { + return this.transport.performRequestAsync(DeleteRegionPolicyRequest._INSTANCE, + DeleteRegionPolicyRequest._ENDPOINT, this.transportOptions); + } + // ----- Endpoint: inference.embedding /** @@ -322,6 +336,20 @@ public CompletableFuture get() { GetInferenceRequest._ENDPOINT, this.transportOptions); } + // ----- Endpoint: inference.get_region_policy + + /** + * Get the inference region policy. + * + * @see Documentation + * on elastic.co + */ + public CompletableFuture getRegionPolicy() { + return this.transport.performRequestAsync(GetRegionPolicyRequest._INSTANCE, GetRegionPolicyRequest._ENDPOINT, + this.transportOptions); + } + // ----- Endpoint: inference.inference /** @@ -1865,6 +1893,45 @@ public final CompletableFuture putOpenshiftAi( return putOpenshiftAi(fn.apply(new PutOpenshiftAiRequest.Builder()).build()); } + // ----- Endpoint: inference.put_region_policy + + /** + * Create or update the inference region policy. + *

+ * The region policy restricts inference to a set of allowed geographic areas or + * cloud service provider regions. + * + * @see Documentation + * on elastic.co + */ + + public CompletableFuture putRegionPolicy(PutRegionPolicyRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) PutRegionPolicyRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Create or update the inference region policy. + *

+ * The region policy restricts inference to a set of allowed geographic areas or + * cloud service provider regions. + * + * @param fn + * a function that initializes a builder to create the + * {@link PutRegionPolicyRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture putRegionPolicy( + Function> fn) { + return putRegionPolicy(fn.apply(new PutRegionPolicyRequest.Builder()).build()); + } + // ----- Endpoint: inference.put_voyageai /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceClient.java index 270d330c6f..5294f2e515 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceClient.java @@ -232,6 +232,20 @@ public final DeleteInferenceResponse delete( return delete(fn.apply(new DeleteInferenceRequest.Builder()).build()); } + // ----- Endpoint: inference.delete_region_policy + + /** + * Delete the inference region policy. + * + * @see Documentation + * on elastic.co + */ + public DeleteRegionPolicyResponse deleteRegionPolicy() throws IOException, ElasticsearchException { + return this.transport.performRequest(DeleteRegionPolicyRequest._INSTANCE, DeleteRegionPolicyRequest._ENDPOINT, + this.transportOptions); + } + // ----- Endpoint: inference.embedding /** @@ -323,6 +337,20 @@ public GetInferenceResponse get() throws IOException, ElasticsearchException { this.transportOptions); } + // ----- Endpoint: inference.get_region_policy + + /** + * Get the inference region policy. + * + * @see Documentation + * on elastic.co + */ + public GetRegionPolicyResponse getRegionPolicy() throws IOException, ElasticsearchException { + return this.transport.performRequest(GetRegionPolicyRequest._INSTANCE, GetRegionPolicyRequest._ENDPOINT, + this.transportOptions); + } + // ----- Endpoint: inference.inference /** @@ -1893,6 +1921,47 @@ public final PutOpenshiftAiResponse putOpenshiftAi( return putOpenshiftAi(fn.apply(new PutOpenshiftAiRequest.Builder()).build()); } + // ----- Endpoint: inference.put_region_policy + + /** + * Create or update the inference region policy. + *

+ * The region policy restricts inference to a set of allowed geographic areas or + * cloud service provider regions. + * + * @see Documentation + * on elastic.co + */ + + public PutRegionPolicyResponse putRegionPolicy(PutRegionPolicyRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) PutRegionPolicyRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Create or update the inference region policy. + *

+ * The region policy restricts inference to a set of allowed geographic areas or + * cloud service provider regions. + * + * @param fn + * a function that initializes a builder to create the + * {@link PutRegionPolicyRequest} + * @see Documentation + * on elastic.co + */ + + public final PutRegionPolicyResponse putRegionPolicy( + Function> fn) + throws IOException, ElasticsearchException { + return putRegionPolicy(fn.apply(new PutRegionPolicyRequest.Builder()).build()); + } + // ----- Endpoint: inference.put_voyageai /** diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/EmbeddingContentObjectItem.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/EmbeddingContentObjectItem.java index 14f022c2b2..05823014eb 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/EmbeddingContentObjectItem.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/EmbeddingContentObjectItem.java @@ -84,7 +84,8 @@ public static EmbeddingContentObjectItem of(Functionaudio, video, and pdf types + * are available in Elasticsearch 9.5.0 and later. *

* API name: {@code type} */ @@ -168,7 +169,8 @@ private Builder(EmbeddingContentObjectItem instance) { } /** * Required - The type of input to embed. Not all models support all input - * types. + * types. The audio, video, and pdf types + * are available in Elasticsearch 9.5.0 and later. *

* API name: {@code type} */ diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetRegionPolicyRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetRegionPolicyRequest.java new file mode 100644 index 0000000000..747cf09dfa --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetRegionPolicyRequest.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. + */ + +package co.elastic.clients.elasticsearch.inference; + +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.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.util.Collections; +import java.util.Objects; + +//---------------------------------------------------------------- +// 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: inference.get_region_policy.Request + +/** + * Get the inference region policy. + * + * @see API + * specification + */ + +public class GetRegionPolicyRequest extends RequestBase { + public GetRegionPolicyRequest() { + } + + /** + * Singleton instance for {@link GetRegionPolicyRequest}. + */ + public static final GetRegionPolicyRequest _INSTANCE = new GetRegionPolicyRequest(); + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code inference.get_region_policy}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/inference.get_region_policy", + + // Request method + request -> { + return "GET"; + + }, + + // Request path + request -> { + return "/_inference/_region_policy"; + + }, + + // Path parameters + request -> { + return Collections.emptyMap(); + }, + + // Request parameters + request -> { + return Collections.emptyMap(); + + }, SimpleEndpoint.emptyMap(), false, GetRegionPolicyResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetRegionPolicyResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetRegionPolicyResponse.java new file mode 100644 index 0000000000..04d085b4de --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetRegionPolicyResponse.java @@ -0,0 +1,108 @@ +/* + * 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.inference; + +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; + +//---------------------------------------------------------------- +// 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: inference.get_region_policy.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class GetRegionPolicyResponse extends RegionPolicyDoc { + // --------------------------------------------------------------------------------------------- + + private GetRegionPolicyResponse(Builder builder) { + super(builder); + + } + + public static GetRegionPolicyResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetRegionPolicyResponse}. + */ + + public static class Builder extends RegionPolicyDoc.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link GetRegionPolicyResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetRegionPolicyResponse build() { + _checkSingleUse(); + + return new GetRegionPolicyResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetRegionPolicyResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, GetRegionPolicyResponse::setupGetRegionPolicyResponseDeserializer); + + protected static void setupGetRegionPolicyResponseDeserializer( + ObjectDeserializer op) { + RegionPolicyDoc.setupRegionPolicyDocDeserializer(op); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutRegionPolicyRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutRegionPolicyRequest.java new file mode 100644 index 0000000000..bd8ce4e39f --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutRegionPolicyRequest.java @@ -0,0 +1,262 @@ +/* + * 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.inference; + +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.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +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.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: inference.put_region_policy.Request + +/** + * Create or update the inference region policy. + *

+ * The region policy restricts inference to a set of allowed geographic areas or + * cloud service provider regions. + * + * @see API + * specification + */ +@JsonpDeserializable +public class PutRegionPolicyRequest extends RequestBase implements JsonpSerializable { + @Nullable + private final Boolean force; + + private final RegionPolicy regionPolicy; + + // --------------------------------------------------------------------------------------------- + + private PutRegionPolicyRequest(Builder builder) { + + this.force = builder.force; + this.regionPolicy = ApiTypeHelper.requireNonNull(builder.regionPolicy, this, "regionPolicy"); + + } + + public static PutRegionPolicyRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * If true, the region policy is applied even if it would deny + * access to inference endpoints that are currently in use by ingest pipeline or + * indices. + *

+ * API name: {@code force} + */ + @Nullable + public final Boolean force() { + return this.force; + } + + /** + * Required - The region policy configuration. + *

+ * API name: {@code region_policy} + */ + public final RegionPolicy regionPolicy() { + return this.regionPolicy; + } + + /** + * 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("region_policy"); + this.regionPolicy.serialize(generator, mapper); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link PutRegionPolicyRequest}. + */ + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private Boolean force; + + private RegionPolicy regionPolicy; + + public Builder() { + } + private Builder(PutRegionPolicyRequest instance) { + this.force = instance.force; + this.regionPolicy = instance.regionPolicy; + + } + /** + * If true, the region policy is applied even if it would deny + * access to inference endpoints that are currently in use by ingest pipeline or + * indices. + *

+ * API name: {@code force} + */ + public final Builder force(@Nullable Boolean value) { + this.force = value; + return this; + } + + /** + * Required - The region policy configuration. + *

+ * API name: {@code region_policy} + */ + public final Builder regionPolicy(RegionPolicy value) { + this.regionPolicy = value; + return this; + } + + /** + * Required - The region policy configuration. + *

+ * API name: {@code region_policy} + */ + public final Builder regionPolicy(Function> fn) { + return this.regionPolicy(fn.apply(new RegionPolicy.Builder()).build()); + } + + /** + * Required - The region policy configuration. + *

+ * API name: {@code region_policy} + */ + public final Builder regionPolicy(RegionPolicyVariant value) { + this.regionPolicy = value._toRegionPolicy(); + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link PutRegionPolicyRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public PutRegionPolicyRequest build() { + _checkSingleUse(); + + return new PutRegionPolicyRequest(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PutRegionPolicyRequest} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, PutRegionPolicyRequest::setupPutRegionPolicyRequestDeserializer); + + protected static void setupPutRegionPolicyRequestDeserializer( + ObjectDeserializer op) { + + op.add(Builder::regionPolicy, RegionPolicy._DESERIALIZER, "region_policy"); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Endpoint "{@code inference.put_region_policy}". + */ + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/inference.put_region_policy", + + // Request method + request -> { + return "PUT"; + + }, + + // Request path + request -> { + return "/_inference/_region_policy"; + + }, + + // Path parameters + request -> { + return Collections.emptyMap(); + }, + + // Request parameters + request -> { + Map params = new HashMap<>(); + if (request.force != null) { + params.put("force", String.valueOf(request.force)); + } + return params; + + }, SimpleEndpoint.emptyMap(), true, PutRegionPolicyResponse._DESERIALIZER); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutRegionPolicyResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutRegionPolicyResponse.java new file mode 100644 index 0000000000..858d8be78e --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutRegionPolicyResponse.java @@ -0,0 +1,108 @@ +/* + * 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.inference; + +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; + +//---------------------------------------------------------------- +// 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: inference.put_region_policy.Response + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class PutRegionPolicyResponse extends RegionPolicyDoc { + // --------------------------------------------------------------------------------------------- + + private PutRegionPolicyResponse(Builder builder) { + super(builder); + + } + + public static PutRegionPolicyResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link PutRegionPolicyResponse}. + */ + + public static class Builder extends RegionPolicyDoc.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link PutRegionPolicyResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public PutRegionPolicyResponse build() { + _checkSingleUse(); + + return new PutRegionPolicyResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PutRegionPolicyResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, PutRegionPolicyResponse::setupPutRegionPolicyResponseDeserializer); + + protected static void setupPutRegionPolicyResponseDeserializer( + ObjectDeserializer op) { + RegionPolicyDoc.setupRegionPolicyDocDeserializer(op); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/RegionPolicy.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/RegionPolicy.java new file mode 100644 index 0000000000..d9d374f356 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/RegionPolicy.java @@ -0,0 +1,241 @@ +/* + * 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.inference; + +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.lang.String; +import java.util.List; +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: inference._types.RegionPolicy + +/** + * The region policy configuration. Specify exactly one of + * allowed_geos or allowed_regions. + * + * @see API + * specification + */ +@JsonpDeserializable +public class RegionPolicy implements TaggedUnion, JsonpSerializable { + + /** + * {@link RegionPolicy} variant kinds. + * + * @see API + * specification + */ + + public enum Kind implements JsonEnum { + AllowedGeos("allowed_geos"), + + AllowedRegions("allowed_regions"), + + ; + + 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 RegionPolicy(RegionPolicyVariant value) { + + this._kind = ApiTypeHelper.requireNonNull(value._regionPolicyKind(), this, ""); + this._value = ApiTypeHelper.requireNonNull(value, this, ""); + + } + + private RegionPolicy(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + } + + public static RegionPolicy of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code allowed_geos}? + */ + public boolean isAllowedGeos() { + return _kind == Kind.AllowedGeos; + } + + /** + * Get the {@code allowed_geos} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code allowed_geos} kind. + */ + public List allowedGeos() { + return TaggedUnionUtils.get(this, Kind.AllowedGeos); + } + + /** + * Is this variant instance of kind {@code allowed_regions}? + */ + public boolean isAllowedRegions() { + return _kind == Kind.AllowedRegions; + } + + /** + * Get the {@code allowed_regions} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code allowed_regions} + * kind. + */ + public List allowedRegions() { + return TaggedUnionUtils.get(this, Kind.AllowedRegions); + } + + @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); + } else { + switch (_kind) { + case AllowedGeos : + generator.writeStartArray(); + for (String item0 : ((List) this._value)) { + generator.write(item0); + + } + generator.writeEnd(); + + break; + case AllowedRegions : + generator.writeStartArray(); + for (CspRegion item0 : ((List) this._value)) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + break; + } + } + + 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 allowedGeos(List v) { + this._kind = Kind.AllowedGeos; + this._value = v; + return this; + } + + public ObjectBuilder allowedRegions(List v) { + this._kind = Kind.AllowedRegions; + this._value = v; + return this; + } + + public RegionPolicy build() { + _checkSingleUse(); + return new RegionPolicy(this); + } + + } + + protected static void setupRegionPolicyDeserializer(ObjectDeserializer op) { + + op.add(Builder::allowedGeos, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "allowed_geos"); + op.add(Builder::allowedRegions, JsonpDeserializer.arrayDeserializer(CspRegion._DESERIALIZER), + "allowed_regions"); + + } + + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + RegionPolicy::setupRegionPolicyDeserializer, Builder::build); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/RegionPolicyBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/RegionPolicyBuilders.java new file mode 100644 index 0000000000..e7eb473e8b --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/RegionPolicyBuilders.java @@ -0,0 +1,53 @@ +/* + * 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.inference; + +import co.elastic.clients.util.ObjectBuilder; +import java.lang.String; +import java.util.function.Function; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +/** + * Builders for {@link RegionPolicy} variants. + *

+ * Variants allowed_geos, allowed_regions are not + * available here as they don't have a dedicated class. Use + * {@link RegionPolicy}'s builder for these. + * + */ +public class RegionPolicyBuilders { + private RegionPolicyBuilders() { + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/RegionPolicyDoc.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/RegionPolicyDoc.java new file mode 100644 index 0000000000..c6e9dac27e --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/RegionPolicyDoc.java @@ -0,0 +1,269 @@ +/* + * 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.inference; + +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.DateTime; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: inference._types.RegionPolicyDoc + +/** + * The stored region policy document. + * + * @see API + * specification + */ + +public abstract class RegionPolicyDoc implements JsonpSerializable { + private final RegionPolicy regionPolicy; + + private final DateTime createdAt; + + @Nullable + private final String createdBy; + + @Nullable + private final DateTime updatedAt; + + @Nullable + private final String updatedBy; + + // --------------------------------------------------------------------------------------------- + + protected RegionPolicyDoc(AbstractBuilder builder) { + + this.regionPolicy = ApiTypeHelper.requireNonNull(builder.regionPolicy, this, "regionPolicy"); + this.createdAt = ApiTypeHelper.requireNonNull(builder.createdAt, this, "createdAt"); + this.createdBy = builder.createdBy; + this.updatedAt = builder.updatedAt; + this.updatedBy = builder.updatedBy; + + } + + /** + * Required - API name: {@code region_policy} + */ + public final RegionPolicy regionPolicy() { + return this.regionPolicy; + } + + /** + * Required - The date and time the region policy was created. + *

+ * API name: {@code created_at} + */ + public final DateTime createdAt() { + return this.createdAt; + } + + /** + * The user who created the region policy. + *

+ * API name: {@code created_by} + */ + @Nullable + public final String createdBy() { + return this.createdBy; + } + + /** + * The date and time the region policy was last updated. + *

+ * API name: {@code updated_at} + */ + @Nullable + public final DateTime updatedAt() { + return this.updatedAt; + } + + /** + * The user who last updated the region policy. + *

+ * API name: {@code updated_by} + */ + @Nullable + public final String updatedBy() { + return this.updatedBy; + } + + /** + * 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("region_policy"); + this.regionPolicy.serialize(generator, mapper); + + generator.writeKey("created_at"); + this.createdAt.serialize(generator, mapper); + if (this.createdBy != null) { + generator.writeKey("created_by"); + generator.write(this.createdBy); + + } + if (this.updatedAt != null) { + generator.writeKey("updated_at"); + this.updatedAt.serialize(generator, mapper); + } + if (this.updatedBy != null) { + generator.writeKey("updated_by"); + generator.write(this.updatedBy); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + public abstract static class AbstractBuilder> + extends + WithJsonObjectBuilderBase { + private RegionPolicy regionPolicy; + + private DateTime createdAt; + + @Nullable + private String createdBy; + + @Nullable + private DateTime updatedAt; + + @Nullable + private String updatedBy; + + /** + * Required - API name: {@code region_policy} + */ + public final BuilderT regionPolicy(RegionPolicy value) { + this.regionPolicy = value; + return self(); + } + + /** + * Required - API name: {@code region_policy} + */ + public final BuilderT regionPolicy(Function> fn) { + return this.regionPolicy(fn.apply(new RegionPolicy.Builder()).build()); + } + + /** + * Required - API name: {@code region_policy} + */ + public final BuilderT regionPolicy(RegionPolicyVariant value) { + this.regionPolicy = value._toRegionPolicy(); + return self(); + } + + /** + * Required - The date and time the region policy was created. + *

+ * API name: {@code created_at} + */ + public final BuilderT createdAt(DateTime value) { + this.createdAt = value; + return self(); + } + + /** + * The user who created the region policy. + *

+ * API name: {@code created_by} + */ + public final BuilderT createdBy(@Nullable String value) { + this.createdBy = value; + return self(); + } + + /** + * The date and time the region policy was last updated. + *

+ * API name: {@code updated_at} + */ + public final BuilderT updatedAt(@Nullable DateTime value) { + this.updatedAt = value; + return self(); + } + + /** + * The user who last updated the region policy. + *

+ * API name: {@code updated_by} + */ + public final BuilderT updatedBy(@Nullable String value) { + this.updatedBy = value; + return self(); + } + + protected abstract BuilderT self(); + + } + + // --------------------------------------------------------------------------------------------- + protected static > void setupRegionPolicyDocDeserializer( + ObjectDeserializer op) { + + op.add(AbstractBuilder::regionPolicy, RegionPolicy._DESERIALIZER, "region_policy"); + op.add(AbstractBuilder::createdAt, DateTime._DESERIALIZER, "created_at"); + op.add(AbstractBuilder::createdBy, JsonpDeserializer.stringDeserializer(), "created_by"); + op.add(AbstractBuilder::updatedAt, DateTime._DESERIALIZER, "updated_at"); + op.add(AbstractBuilder::updatedBy, JsonpDeserializer.stringDeserializer(), "updated_by"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/RegionPolicyVariant.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/RegionPolicyVariant.java new file mode 100644 index 0000000000..ca5ce7a28e --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/RegionPolicyVariant.java @@ -0,0 +1,48 @@ +/* + * 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.inference; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +/** + * Base interface for {@link RegionPolicy} variants. + */ +public interface RegionPolicyVariant { + + RegionPolicy.Kind _regionPolicyKind(); + + default RegionPolicy _toRegionPolicy() { + return new RegionPolicy(this); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/RequestEmbedding.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/RequestEmbedding.java index 32e2bf781e..9c5676ebc8 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/RequestEmbedding.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/RequestEmbedding.java @@ -89,7 +89,8 @@ public static RequestEmbedding of(Functioncontent objects may contain a single item or an array of items. * Models that support multiple items per content object will * return a single embedding for each content object, regardless of - * how many items it contains. + * how many items it contains. Support for multiple items in a single + * content object is available in Elasticsearch 9.5.0 and later. *

* string example: * @@ -140,7 +141,8 @@ public static RequestEmbedding of(Function * *

- * Multiple items in one content object example: + * Multiple items in one content object example (available in + * Elasticsearch 9.5.0 and later): * *

 	 * "input": [
@@ -267,7 +269,8 @@ private Builder(RequestEmbedding instance) {
 		 * content objects may contain a single item or an array of items.
 		 * Models that support multiple items per content object will
 		 * return a single embedding for each content object, regardless of
-		 * how many items it contains.
+		 * how many items it contains. Support for multiple items in a single
+		 * content object is available in Elasticsearch 9.5.0 and later.
 		 * 

* string example: * @@ -318,7 +321,8 @@ private Builder(RequestEmbedding instance) { * *

*

- * Multiple items in one content object example: + * Multiple items in one content object example (available in + * Elasticsearch 9.5.0 and later): * *

 		 * "input": [
@@ -352,7 +356,8 @@ public final Builder input(EmbeddingInput value) {
 		 * content objects may contain a single item or an array of items.
 		 * Models that support multiple items per content object will
 		 * return a single embedding for each content object, regardless of
-		 * how many items it contains.
+		 * how many items it contains. Support for multiple items in a single
+		 * content object is available in Elasticsearch 9.5.0 and later.
 		 * 

* string example: * @@ -403,7 +408,8 @@ public final Builder input(EmbeddingInput value) { * *

*

- * Multiple items in one content object example: + * Multiple items in one content object example (available in + * Elasticsearch 9.5.0 and later): * *

 		 * "input": [
diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/RerankRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/RerankRequest.java
index 9a0a98c264..05ce0a5a5b 100644
--- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/RerankRequest.java
+++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/RerankRequest.java
@@ -22,6 +22,8 @@
 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.elasticsearch.inference.rerank.RerankInput;
+import co.elastic.clients.elasticsearch.inference.rerank.RerankQuery;
 import co.elastic.clients.json.JsonData;
 import co.elastic.clients.json.JsonpDeserializable;
 import co.elastic.clients.json.JsonpDeserializer;
@@ -38,7 +40,6 @@
 import java.lang.Integer;
 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;
@@ -71,9 +72,9 @@
 public class RerankRequest extends RequestBase implements JsonpSerializable {
 	private final String inferenceId;
 
-	private final List input;
+	private final RerankInput input;
 
-	private final String query;
+	private final RerankQuery query;
 
 	@Nullable
 	private final Boolean returnDocuments;
@@ -92,7 +93,7 @@ public class RerankRequest extends RequestBase implements JsonpSerializable {
 	private RerankRequest(Builder builder) {
 
 		this.inferenceId = ApiTypeHelper.requireNonNull(builder.inferenceId, this, "inferenceId");
-		this.input = ApiTypeHelper.unmodifiableRequired(builder.input, this, "input");
+		this.input = ApiTypeHelper.requireNonNull(builder.input, this, "input");
 		this.query = ApiTypeHelper.requireNonNull(builder.query, this, "query");
 		this.returnDocuments = builder.returnDocuments;
 		this.taskSettings = builder.taskSettings;
@@ -115,20 +116,98 @@ public final String inferenceId() {
 	}
 
 	/**
-	 * Required - The documents to rank.
+	 * Required - The documents to rank. The input can be specified as a single
+	 * string or an array of strings, or as an object or an array of objects. The
+	 * object form additionally allows specifying non-text inputs, such as images.
+	 * 
+ *

+ * info Only the elastic service currently supports non-text inputs + * for the rerank task. For all other services, the input must be a + * string or an array of strings. + *

+ *
+ *

+ * string example: + * + *

+	 * "input": "some document text"
+	 * 
+	 * 
+ *

+ * string array example: + * + *

+	 * "input": ["some document text", "some more document text"]
+	 * 
+	 * 
+ *

+ * object example: + * + *

+	 * "input": {
+	 *   "type": "image",
+	 *   "format": "base64",
+	 *   "value": "data:image/jpeg;base64,..."
+	 * }
+	 * 
+	 * 
+ *

+ * object array example: + * + *

+	 * "input": [
+	 *   {
+	 *     "type": "text",
+	 *     "format": "text",
+	 *     "value": "some document text"
+	 *   },
+	 *   {
+	 *     "type": "image",
+	 *     "format": "base64",
+	 *     "value": "data:image/jpeg;base64,..."
+	 *   }
+	 * ]
+	 * 
+	 * 
*

* API name: {@code input} */ - public final List input() { + public final RerankInput input() { return this.input; } /** - * Required - Query input. + * Required - Query input. The query can be specified as a single string, or as + * an object. The object form additionally allows specifying non-text inputs, + * such as images.

+ *

+ * info Only the elastic service currently supports non-text + * queries for the rerank task. For all other services, the query + * must be a string. + *

+ *
+ *

+ * string example: + * + *

+	 * "query": "some query text"
+	 * 
+	 * 
+ *

+ * object example: + * + *

+	 * "query": {
+	 *   "type": "image",
+	 *   "format": "base64",
+	 *   "value": "data:image/jpeg;base64,..."
+	 * }
+	 * 
+	 * 
*

* API name: {@code query} */ - public final String query() { + public final RerankQuery query() { return this.query; } @@ -185,18 +264,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.input)) { - generator.writeKey("input"); - generator.writeStartArray(); - for (String item0 : this.input) { - generator.write(item0); - - } - generator.writeEnd(); + generator.writeKey("input"); + this.input.serialize(generator, mapper); - } generator.writeKey("query"); - generator.write(this.query); + this.query.serialize(generator, mapper); if (this.returnDocuments != null) { generator.writeKey("return_documents"); @@ -225,9 +297,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { private String inferenceId; - private List input; + private RerankInput input; - private String query; + private RerankQuery query; @Nullable private Boolean returnDocuments; @@ -264,39 +336,199 @@ public final Builder inferenceId(String value) { } /** - * Required - The documents to rank. + * Required - The documents to rank. The input can be specified as a single + * string or an array of strings, or as an object or an array of objects. The + * object form additionally allows specifying non-text inputs, such as images. + *

*

- * API name: {@code input} + * info Only the elastic service currently supports non-text inputs + * for the rerank task. For all other services, the input must be a + * string or an array of strings. + *

+ *
+ *

+ * string example: + * + *

+		 * "input": "some document text"
+		 * 
+		 * 
+ *

+ * string array example: + * + *

+		 * "input": ["some document text", "some more document text"]
+		 * 
+		 * 
+ *

+ * object example: + * + *

+		 * "input": {
+		 *   "type": "image",
+		 *   "format": "base64",
+		 *   "value": "data:image/jpeg;base64,..."
+		 * }
+		 * 
+		 * 
*

- * Adds all elements of list to input. + * object array example: + * + *

+		 * "input": [
+		 *   {
+		 *     "type": "text",
+		 *     "format": "text",
+		 *     "value": "some document text"
+		 *   },
+		 *   {
+		 *     "type": "image",
+		 *     "format": "base64",
+		 *     "value": "data:image/jpeg;base64,..."
+		 *   }
+		 * ]
+		 * 
+		 * 
+ *

+ * API name: {@code input} */ - public final Builder input(List list) { - this.input = _listAddAll(this.input, list); + public final Builder input(RerankInput value) { + this.input = value; return this; } /** - * Required - The documents to rank. + * Required - The documents to rank. The input can be specified as a single + * string or an array of strings, or as an object or an array of objects. The + * object form additionally allows specifying non-text inputs, such as images. + *

*

- * API name: {@code input} + * info Only the elastic service currently supports non-text inputs + * for the rerank task. For all other services, the input must be a + * string or an array of strings. + *

+ *
+ *

+ * string example: + * + *

+		 * "input": "some document text"
+		 * 
+		 * 
*

- * Adds one or more values to input. + * string array example: + * + *

+		 * "input": ["some document text", "some more document text"]
+		 * 
+		 * 
+ *

+ * object example: + * + *

+		 * "input": {
+		 *   "type": "image",
+		 *   "format": "base64",
+		 *   "value": "data:image/jpeg;base64,..."
+		 * }
+		 * 
+		 * 
+ *

+ * object array example: + * + *

+		 * "input": [
+		 *   {
+		 *     "type": "text",
+		 *     "format": "text",
+		 *     "value": "some document text"
+		 *   },
+		 *   {
+		 *     "type": "image",
+		 *     "format": "base64",
+		 *     "value": "data:image/jpeg;base64,..."
+		 *   }
+		 * ]
+		 * 
+		 * 
+ *

+ * API name: {@code input} */ - public final Builder input(String value, String... values) { - this.input = _listAdd(this.input, value, values); - return this; + public final Builder input(Function> fn) { + return this.input(fn.apply(new RerankInput.Builder()).build()); } /** - * Required - Query input. + * Required - Query input. The query can be specified as a single string, or as + * an object. The object form additionally allows specifying non-text inputs, + * such as images.

+ *

+ * info Only the elastic service currently supports non-text + * queries for the rerank task. For all other services, the query + * must be a string. + *

+ *
+ *

+ * string example: + * + *

+		 * "query": "some query text"
+		 * 
+		 * 
+ *

+ * object example: + * + *

+		 * "query": {
+		 *   "type": "image",
+		 *   "format": "base64",
+		 *   "value": "data:image/jpeg;base64,..."
+		 * }
+		 * 
+		 * 
*

* API name: {@code query} */ - public final Builder query(String value) { + public final Builder query(RerankQuery value) { this.query = value; return this; } + /** + * Required - Query input. The query can be specified as a single string, or as + * an object. The object form additionally allows specifying non-text inputs, + * such as images.

+ *

+ * info Only the elastic service currently supports non-text + * queries for the rerank task. For all other services, the query + * must be a string. + *

+ *
+ *

+ * string example: + * + *

+		 * "query": "some query text"
+		 * 
+		 * 
+ *

+ * object example: + * + *

+		 * "query": {
+		 *   "type": "image",
+		 *   "format": "base64",
+		 *   "value": "data:image/jpeg;base64,..."
+		 * }
+		 * 
+		 * 
+ *

+ * API name: {@code query} + */ + public final Builder query(Function> fn) { + return this.query(fn.apply(new RerankQuery.Builder()).build()); + } + /** * Include the document text in the response. *

@@ -382,8 +614,8 @@ public Builder rebuild() { protected static void setupRerankRequestDeserializer(ObjectDeserializer op) { - op.add(Builder::input, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "input"); - op.add(Builder::query, JsonpDeserializer.stringDeserializer(), "query"); + op.add(Builder::input, RerankInput._DESERIALIZER, "input"); + op.add(Builder::query, RerankQuery._DESERIALIZER, "query"); op.add(Builder::returnDocuments, JsonpDeserializer.booleanDeserializer(), "return_documents"); op.add(Builder::taskSettings, JsonData._DESERIALIZER, "task_settings"); op.add(Builder::topN, JsonpDeserializer.integerDeserializer(), "top_n"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/rerank/RerankInput.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/rerank/RerankInput.java new file mode 100644 index 0000000000..b6277e9d04 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/rerank/RerankInput.java @@ -0,0 +1,209 @@ +/* + * 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.inference.rerank; + +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.ObjectDeserializer; +import co.elastic.clients.json.UnionDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import co.elastic.clients.util.TaggedUnion; +import co.elastic.clients.util.TaggedUnionUtils; +import jakarta.json.stream.JsonGenerator; +import java.lang.Object; +import java.lang.String; +import java.util.List; +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: inference.rerank.RerankInput + +/** + * The documents to rank for the rerank task. Either a string, an + * array of strings, an object, or an array of objects. The object form + * additionally allows specifying non-text inputs, such as images.

+ *

+ * info Only the elastic service currently supports non-text inputs + * for the rerank task. + *

+ *
+ * + * @see API + * specification + */ +@JsonpDeserializable +public class RerankInput implements TaggedUnion, JsonpSerializable { + + public enum Kind { + Object, String + + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + private RerankInput(Kind kind, Object value) { + this._kind = kind; + this._value = value; + } + + private RerankInput(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + } + + public static RerankInput of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code object}? + */ + public boolean isObject() { + return _kind == Kind.Object; + } + + /** + * Get the {@code object} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code object} kind. + */ + public List object() { + return TaggedUnionUtils.get(this, Kind.Object); + } + + /** + * Is this variant instance of kind {@code string}? + */ + public boolean isString() { + return _kind == Kind.String; + } + + /** + * Get the {@code string} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code string} kind. + */ + public List string() { + return TaggedUnionUtils.get(this, Kind.String); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } else { + switch (_kind) { + case Object : + generator.writeStartArray(); + for (RerankInputObject item0 : ((List) this._value)) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + break; + case String : + generator.writeStartArray(); + for (String item0 : ((List) this._value)) { + generator.write(item0); + + } + generator.writeEnd(); + + break; + } + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + + public ObjectBuilder object(List v) { + this._kind = Kind.Object; + this._value = v; + return this; + } + + public ObjectBuilder string(List v) { + this._kind = Kind.String; + this._value = v; + return this; + } + + public RerankInput build() { + _checkSingleUse(); + return new RerankInput(this); + } + + } + + private static JsonpDeserializer buildRerankInputDeserializer() { + return new UnionDeserializer.Builder(RerankInput::new, false) + .addMember(Kind.Object, JsonpDeserializer.arrayDeserializer(RerankInputObject._DESERIALIZER)) + .addMember(Kind.String, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer())) + .build(); + } + + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer + .lazy(RerankInput::buildRerankInputDeserializer); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/rerank/RerankInputBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/rerank/RerankInputBuilders.java new file mode 100644 index 0000000000..466fe1caba --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/rerank/RerankInputBuilders.java @@ -0,0 +1,53 @@ +/* + * 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.inference.rerank; + +import co.elastic.clients.util.ObjectBuilder; +import java.lang.String; +import java.util.function.Function; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +/** + * Builders for {@link RerankInput} variants. + *

+ * Variants object, string are not available here as + * they don't have a dedicated class. Use {@link RerankInput}'s builder for + * these. + * + */ +public class RerankInputBuilders { + private RerankInputBuilders() { + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/rerank/RerankInputFormat.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/rerank/RerankInputFormat.java new file mode 100644 index 0000000000..9535e0fabe --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/rerank/RerankInputFormat.java @@ -0,0 +1,67 @@ +/* + * 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.inference.rerank; + +import co.elastic.clients.json.JsonEnum; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public enum RerankInputFormat implements JsonEnum { + Text("text"), + + Base64("base64"), + + ; + + private final String jsonValue; + + RerankInputFormat(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + RerankInputFormat.values()); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/rerank/RerankInputObject.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/rerank/RerankInputObject.java new file mode 100644 index 0000000000..ceb548e169 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/rerank/RerankInputObject.java @@ -0,0 +1,245 @@ +/* + * 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.inference.rerank; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: inference.rerank.RerankInputObject + +/** + * An object describing a single input for the rerank task, which + * additionally allows specifying non-text inputs, such as images. + * + * @see API + * specification + */ +@JsonpDeserializable +public class RerankInputObject implements JsonpSerializable { + private final RerankInputType type; + + @Nullable + private final RerankInputFormat format; + + private final String value; + + // --------------------------------------------------------------------------------------------- + + private RerankInputObject(Builder builder) { + + this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); + this.format = builder.format; + this.value = ApiTypeHelper.requireNonNull(builder.value, this, "value"); + + } + + public static RerankInputObject of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The type of input. Not all services and models support all input + * types. + *

+ * API name: {@code type} + */ + public final RerankInputType type() { + return this.type; + } + + /** + * The format of the input. For the text type this must be + * text. For the image type this must be + * base64. If not specified, this defaults to text for + * the text type and base64 for the image + * type. + *

+ * API name: {@code format} + */ + @Nullable + public final RerankInputFormat format() { + return this.format; + } + + /** + * Required - The value of the input. For images, this must be a base64-encoded + * data URI, that is, "data:content/type;base64,...". + *

+ * API name: {@code value} + */ + public final String value() { + return this.value; + } + + /** + * 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("type"); + this.type.serialize(generator, mapper); + if (this.format != null) { + generator.writeKey("format"); + this.format.serialize(generator, mapper); + } + generator.writeKey("value"); + generator.write(this.value); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RerankInputObject}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private RerankInputType type; + + @Nullable + private RerankInputFormat format; + + private String value; + + public Builder() { + } + private Builder(RerankInputObject instance) { + this.type = instance.type; + this.format = instance.format; + this.value = instance.value; + + } + /** + * Required - The type of input. Not all services and models support all input + * types. + *

+ * API name: {@code type} + */ + public final Builder type(RerankInputType value) { + this.type = value; + return this; + } + + /** + * The format of the input. For the text type this must be + * text. For the image type this must be + * base64. If not specified, this defaults to text for + * the text type and base64 for the image + * type. + *

+ * API name: {@code format} + */ + public final Builder format(@Nullable RerankInputFormat value) { + this.format = value; + return this; + } + + /** + * Required - The value of the input. For images, this must be a base64-encoded + * data URI, that is, "data:content/type;base64,...". + *

+ * API name: {@code value} + */ + public final Builder value(String value) { + this.value = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link RerankInputObject}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public RerankInputObject build() { + _checkSingleUse(); + + return new RerankInputObject(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RerankInputObject} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, RerankInputObject::setupRerankInputObjectDeserializer); + + protected static void setupRerankInputObjectDeserializer(ObjectDeserializer op) { + + op.add(Builder::type, RerankInputType._DESERIALIZER, "type"); + op.add(Builder::format, RerankInputFormat._DESERIALIZER, "format"); + op.add(Builder::value, JsonpDeserializer.stringDeserializer(), "value"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/rerank/RerankInputType.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/rerank/RerankInputType.java new file mode 100644 index 0000000000..78e1306636 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/rerank/RerankInputType.java @@ -0,0 +1,67 @@ +/* + * 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.inference.rerank; + +import co.elastic.clients.json.JsonEnum; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public enum RerankInputType implements JsonEnum { + Text("text"), + + Image("image"), + + ; + + private final String jsonValue; + + RerankInputType(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + RerankInputType.values()); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/rerank/RerankQuery.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/rerank/RerankQuery.java new file mode 100644 index 0000000000..4a66c9ed89 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/rerank/RerankQuery.java @@ -0,0 +1,198 @@ +/* + * 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.inference.rerank; + +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.ObjectDeserializer; +import co.elastic.clients.json.UnionDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.ObjectBuilderBase; +import co.elastic.clients.util.TaggedUnion; +import co.elastic.clients.util.TaggedUnionUtils; +import jakarta.json.stream.JsonGenerator; +import java.lang.Object; +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: inference.rerank.RerankQuery + +/** + * Query input for the rerank task. Either a string, or an object. + * The object form additionally allows specifying non-text inputs, such as + * images.

+ *

+ * info Only the elastic service currently supports non-text + * queries for the rerank task. + *

+ *
+ * + * @see API + * specification + */ +@JsonpDeserializable +public class RerankQuery implements TaggedUnion, JsonpSerializable { + + public enum Kind { + Object, String + + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + private RerankQuery(Kind kind, Object value) { + this._kind = kind; + this._value = value; + } + + private RerankQuery(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + } + + public static RerankQuery of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code object}? + */ + public boolean isObject() { + return _kind == Kind.Object; + } + + /** + * Get the {@code object} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code object} kind. + */ + public RerankInputObject object() { + return TaggedUnionUtils.get(this, Kind.Object); + } + + /** + * Is this variant instance of kind {@code string}? + */ + public boolean isString() { + return _kind == Kind.String; + } + + /** + * Get the {@code string} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code string} kind. + */ + public String string() { + return TaggedUnionUtils.get(this, Kind.String); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } else { + switch (_kind) { + case String : + generator.write(((String) this._value)); + + break; + } + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + + public ObjectBuilder object(RerankInputObject v) { + this._kind = Kind.Object; + this._value = v; + return this; + } + + public ObjectBuilder object( + Function> fn) { + return this.object(fn.apply(new RerankInputObject.Builder()).build()); + } + + public ObjectBuilder string(String v) { + this._kind = Kind.String; + this._value = v; + return this; + } + + public RerankQuery build() { + _checkSingleUse(); + return new RerankQuery(this); + } + + } + + private static JsonpDeserializer buildRerankQueryDeserializer() { + return new UnionDeserializer.Builder(RerankQuery::new, false) + .addMember(Kind.Object, RerankInputObject._DESERIALIZER) + .addMember(Kind.String, JsonpDeserializer.stringDeserializer()).build(); + } + + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer + .lazy(RerankQuery::buildRerankQueryDeserializer); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/rerank/RerankQueryBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/rerank/RerankQueryBuilders.java new file mode 100644 index 0000000000..f2a1cd89b1 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/rerank/RerankQueryBuilders.java @@ -0,0 +1,59 @@ +/* + * 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.inference.rerank; + +import co.elastic.clients.util.ObjectBuilder; +import java.util.function.Function; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +/** + * Builders for {@link RerankQuery} variants. + *

+ * Variants string are not available here as they don't have a + * dedicated class. Use {@link RerankQuery}'s builder for these. + * + */ +public class RerankQueryBuilders { + private RerankQueryBuilders() { + } + + /** + * Creates a builder for the {@link RerankInputObject object} + * {@code RerankQuery} variant. + */ + public static RerankInputObject.Builder object() { + return new RerankInputObject.Builder(); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/info/Defaults.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/info/Defaults.java index 5d0eaf2368..2dcc134233 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/info/Defaults.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/ml/info/Defaults.java @@ -62,12 +62,16 @@ public class Defaults implements JsonpSerializable { private final Datafeeds datafeeds; + private final ModelPlatformVariant modelPlatformVariant; + // --------------------------------------------------------------------------------------------- private Defaults(Builder builder) { this.anomalyDetectors = ApiTypeHelper.requireNonNull(builder.anomalyDetectors, this, "anomalyDetectors"); this.datafeeds = ApiTypeHelper.requireNonNull(builder.datafeeds, this, "datafeeds"); + this.modelPlatformVariant = ApiTypeHelper.requireNonNull(builder.modelPlatformVariant, this, + "modelPlatformVariant"); } @@ -89,6 +93,17 @@ public final Datafeeds datafeeds() { return this.datafeeds; } + /** + * Required - Returns linux-x86_64 when all ML nodes are x86, or + * when no ML nodes exist but the cluster is in Elastic Cloud. Returns + * platform_agnostic otherwise. + *

+ * API name: {@code model_platform_variant} + */ + public final ModelPlatformVariant modelPlatformVariant() { + return this.modelPlatformVariant; + } + /** * Serialize this object to JSON. */ @@ -106,6 +121,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("datafeeds"); this.datafeeds.serialize(generator, mapper); + generator.writeKey("model_platform_variant"); + this.modelPlatformVariant.serialize(generator, mapper); + } @Override @@ -124,11 +142,14 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Datafeeds datafeeds; + private ModelPlatformVariant modelPlatformVariant; + public Builder() { } private Builder(Defaults instance) { this.anomalyDetectors = instance.anomalyDetectors; this.datafeeds = instance.datafeeds; + this.modelPlatformVariant = instance.modelPlatformVariant; } /** @@ -161,6 +182,18 @@ public final Builder datafeeds(Functionlinux-x86_64 when all ML nodes are x86, or + * when no ML nodes exist but the cluster is in Elastic Cloud. Returns + * platform_agnostic otherwise. + *

+ * API name: {@code model_platform_variant} + */ + public final Builder modelPlatformVariant(ModelPlatformVariant value) { + this.modelPlatformVariant = value; + return this; + } + @Override protected Builder self() { return this; @@ -197,6 +230,7 @@ protected static void setupDefaultsDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public enum ModelPlatformVariant implements JsonEnum { + Linux86("linux-x86_64"), + + PlatformAgnostic("platform_agnostic"), + + ; + + private final String jsonValue; + + ModelPlatformVariant(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + ModelPlatformVariant.values()); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Allocations.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Allocations.java new file mode 100644 index 0000000000..fd1629fa29 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Allocations.java @@ -0,0 +1,382 @@ +/* + * 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.nodes; + +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.Double; +import java.lang.Integer; +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: nodes._types.Allocations + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class Allocations implements JsonpSerializable { + @Nullable + private final Integer shards; + + @Nullable + private final Integer undesiredShards; + + @Nullable + private final Double forecastedIngestLoad; + + @Nullable + private final String forecastedDiskUsage; + + @Nullable + private final Long forecastedDiskUsageInBytes; + + @Nullable + private final String currentDiskUsage; + + @Nullable + private final Long currentDiskUsageInBytes; + + // --------------------------------------------------------------------------------------------- + + private Allocations(Builder builder) { + + this.shards = builder.shards; + this.undesiredShards = builder.undesiredShards; + this.forecastedIngestLoad = builder.forecastedIngestLoad; + this.forecastedDiskUsage = builder.forecastedDiskUsage; + this.forecastedDiskUsageInBytes = builder.forecastedDiskUsageInBytes; + this.currentDiskUsage = builder.currentDiskUsage; + this.currentDiskUsageInBytes = builder.currentDiskUsageInBytes; + + } + + public static Allocations of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Number of shards allocated to the node. + *

+ * API name: {@code shards} + */ + @Nullable + public final Integer shards() { + return this.shards; + } + + /** + * Number of shards allocated to the node that are currently undesired. + *

+ * API name: {@code undesired_shards} + */ + @Nullable + public final Integer undesiredShards() { + return this.undesiredShards; + } + + /** + * Forecasted ingest load for the node. + *

+ * API name: {@code forecasted_ingest_load} + */ + @Nullable + public final Double forecastedIngestLoad() { + return this.forecastedIngestLoad; + } + + /** + * Forecasted disk usage for the node. + *

+ * API name: {@code forecasted_disk_usage} + */ + @Nullable + public final String forecastedDiskUsage() { + return this.forecastedDiskUsage; + } + + /** + * Forecasted disk usage, in bytes, for the node. + *

+ * API name: {@code forecasted_disk_usage_in_bytes} + */ + @Nullable + public final Long forecastedDiskUsageInBytes() { + return this.forecastedDiskUsageInBytes; + } + + /** + * Current disk usage for the node. + *

+ * API name: {@code current_disk_usage} + */ + @Nullable + public final String currentDiskUsage() { + return this.currentDiskUsage; + } + + /** + * Current disk usage, in bytes, for the node. + *

+ * API name: {@code current_disk_usage_in_bytes} + */ + @Nullable + public final Long currentDiskUsageInBytes() { + return this.currentDiskUsageInBytes; + } + + /** + * 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.shards != null) { + generator.writeKey("shards"); + generator.write(this.shards); + + } + if (this.undesiredShards != null) { + generator.writeKey("undesired_shards"); + generator.write(this.undesiredShards); + + } + if (this.forecastedIngestLoad != null) { + generator.writeKey("forecasted_ingest_load"); + generator.write(this.forecastedIngestLoad); + + } + if (this.forecastedDiskUsage != null) { + generator.writeKey("forecasted_disk_usage"); + generator.write(this.forecastedDiskUsage); + + } + if (this.forecastedDiskUsageInBytes != null) { + generator.writeKey("forecasted_disk_usage_in_bytes"); + generator.write(this.forecastedDiskUsageInBytes); + + } + if (this.currentDiskUsage != null) { + generator.writeKey("current_disk_usage"); + generator.write(this.currentDiskUsage); + + } + if (this.currentDiskUsageInBytes != null) { + generator.writeKey("current_disk_usage_in_bytes"); + generator.write(this.currentDiskUsageInBytes); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link Allocations}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private Integer shards; + + @Nullable + private Integer undesiredShards; + + @Nullable + private Double forecastedIngestLoad; + + @Nullable + private String forecastedDiskUsage; + + @Nullable + private Long forecastedDiskUsageInBytes; + + @Nullable + private String currentDiskUsage; + + @Nullable + private Long currentDiskUsageInBytes; + + public Builder() { + } + private Builder(Allocations instance) { + this.shards = instance.shards; + this.undesiredShards = instance.undesiredShards; + this.forecastedIngestLoad = instance.forecastedIngestLoad; + this.forecastedDiskUsage = instance.forecastedDiskUsage; + this.forecastedDiskUsageInBytes = instance.forecastedDiskUsageInBytes; + this.currentDiskUsage = instance.currentDiskUsage; + this.currentDiskUsageInBytes = instance.currentDiskUsageInBytes; + + } + /** + * Number of shards allocated to the node. + *

+ * API name: {@code shards} + */ + public final Builder shards(@Nullable Integer value) { + this.shards = value; + return this; + } + + /** + * Number of shards allocated to the node that are currently undesired. + *

+ * API name: {@code undesired_shards} + */ + public final Builder undesiredShards(@Nullable Integer value) { + this.undesiredShards = value; + return this; + } + + /** + * Forecasted ingest load for the node. + *

+ * API name: {@code forecasted_ingest_load} + */ + public final Builder forecastedIngestLoad(@Nullable Double value) { + this.forecastedIngestLoad = value; + return this; + } + + /** + * Forecasted disk usage for the node. + *

+ * API name: {@code forecasted_disk_usage} + */ + public final Builder forecastedDiskUsage(@Nullable String value) { + this.forecastedDiskUsage = value; + return this; + } + + /** + * Forecasted disk usage, in bytes, for the node. + *

+ * API name: {@code forecasted_disk_usage_in_bytes} + */ + public final Builder forecastedDiskUsageInBytes(@Nullable Long value) { + this.forecastedDiskUsageInBytes = value; + return this; + } + + /** + * Current disk usage for the node. + *

+ * API name: {@code current_disk_usage} + */ + public final Builder currentDiskUsage(@Nullable String value) { + this.currentDiskUsage = value; + return this; + } + + /** + * Current disk usage, in bytes, for the node. + *

+ * API name: {@code current_disk_usage_in_bytes} + */ + public final Builder currentDiskUsageInBytes(@Nullable Long value) { + this.currentDiskUsageInBytes = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link Allocations}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public Allocations build() { + _checkSingleUse(); + + return new Allocations(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Allocations} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + Allocations::setupAllocationsDeserializer); + + protected static void setupAllocationsDeserializer(ObjectDeserializer op) { + + op.add(Builder::shards, JsonpDeserializer.integerDeserializer(), "shards"); + op.add(Builder::undesiredShards, JsonpDeserializer.integerDeserializer(), "undesired_shards"); + op.add(Builder::forecastedIngestLoad, JsonpDeserializer.doubleDeserializer(), "forecasted_ingest_load"); + op.add(Builder::forecastedDiskUsage, JsonpDeserializer.stringDeserializer(), "forecasted_disk_usage"); + op.add(Builder::forecastedDiskUsageInBytes, JsonpDeserializer.longDeserializer(), + "forecasted_disk_usage_in_bytes"); + op.add(Builder::currentDiskUsage, JsonpDeserializer.stringDeserializer(), "current_disk_usage"); + op.add(Builder::currentDiskUsageInBytes, JsonpDeserializer.longDeserializer(), "current_disk_usage_in_bytes"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Client.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Client.java index 7651ba7500..337bccd8f4 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Client.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Client.java @@ -74,12 +74,21 @@ public class Client implements JsonpSerializable { @Nullable private final String lastUri; + @Nullable + private final String openedTime; + @Nullable private final Long openedTimeMillis; + @Nullable + private final String closedTime; + @Nullable private final Long closedTimeMillis; + @Nullable + private final String lastRequestTime; + @Nullable private final Long lastRequestTimeMillis; @@ -101,8 +110,11 @@ private Client(Builder builder) { this.localAddress = builder.localAddress; this.remoteAddress = builder.remoteAddress; this.lastUri = builder.lastUri; + this.openedTime = builder.openedTime; this.openedTimeMillis = builder.openedTimeMillis; + this.closedTime = builder.closedTime; this.closedTimeMillis = builder.closedTimeMillis; + this.lastRequestTime = builder.lastRequestTime; this.lastRequestTimeMillis = builder.lastRequestTimeMillis; this.requestCount = builder.requestCount; this.requestSizeBytes = builder.requestSizeBytes; @@ -165,6 +177,16 @@ public final String lastUri() { return this.lastUri; } + /** + * Time at which the client opened the connection. + *

+ * API name: {@code opened_time} + */ + @Nullable + public final String openedTime() { + return this.openedTime; + } + /** * Time at which the client opened the connection. *

@@ -175,6 +197,16 @@ public final Long openedTimeMillis() { return this.openedTimeMillis; } + /** + * Time at which the client closed the connection if the connection is closed. + *

+ * API name: {@code closed_time} + */ + @Nullable + public final String closedTime() { + return this.closedTime; + } + /** * Time at which the client closed the connection if the connection is closed. *

@@ -185,6 +217,16 @@ public final Long closedTimeMillis() { return this.closedTimeMillis; } + /** + * Time of the most recent request from this client. + *

+ * API name: {@code last_request_time} + */ + @Nullable + public final String lastRequestTime() { + return this.lastRequestTime; + } + /** * Time of the most recent request from this client. *

@@ -261,16 +303,31 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("last_uri"); generator.write(this.lastUri); + } + if (this.openedTime != null) { + generator.writeKey("opened_time"); + generator.write(this.openedTime); + } if (this.openedTimeMillis != null) { generator.writeKey("opened_time_millis"); generator.write(this.openedTimeMillis); + } + if (this.closedTime != null) { + generator.writeKey("closed_time"); + generator.write(this.closedTime); + } if (this.closedTimeMillis != null) { generator.writeKey("closed_time_millis"); generator.write(this.closedTimeMillis); + } + if (this.lastRequestTime != null) { + generator.writeKey("last_request_time"); + generator.write(this.lastRequestTime); + } if (this.lastRequestTimeMillis != null) { generator.writeKey("last_request_time_millis"); @@ -322,12 +379,21 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private String lastUri; + @Nullable + private String openedTime; + @Nullable private Long openedTimeMillis; + @Nullable + private String closedTime; + @Nullable private Long closedTimeMillis; + @Nullable + private String lastRequestTime; + @Nullable private Long lastRequestTimeMillis; @@ -348,8 +414,11 @@ private Builder(Client instance) { this.localAddress = instance.localAddress; this.remoteAddress = instance.remoteAddress; this.lastUri = instance.lastUri; + this.openedTime = instance.openedTime; this.openedTimeMillis = instance.openedTimeMillis; + this.closedTime = instance.closedTime; this.closedTimeMillis = instance.closedTimeMillis; + this.lastRequestTime = instance.lastRequestTime; this.lastRequestTimeMillis = instance.lastRequestTimeMillis; this.requestCount = instance.requestCount; this.requestSizeBytes = instance.requestSizeBytes; @@ -407,6 +476,16 @@ public final Builder lastUri(@Nullable String value) { return this; } + /** + * Time at which the client opened the connection. + *

+ * API name: {@code opened_time} + */ + public final Builder openedTime(@Nullable String value) { + this.openedTime = value; + return this; + } + /** * Time at which the client opened the connection. *

@@ -417,6 +496,16 @@ public final Builder openedTimeMillis(@Nullable Long value) { return this; } + /** + * Time at which the client closed the connection if the connection is closed. + *

+ * API name: {@code closed_time} + */ + public final Builder closedTime(@Nullable String value) { + this.closedTime = value; + return this; + } + /** * Time at which the client closed the connection if the connection is closed. *

@@ -427,6 +516,16 @@ public final Builder closedTimeMillis(@Nullable Long value) { return this; } + /** + * Time of the most recent request from this client. + *

+ * API name: {@code last_request_time} + */ + public final Builder lastRequestTime(@Nullable String value) { + this.lastRequestTime = value; + return this; + } + /** * Time of the most recent request from this client. *

@@ -507,8 +606,11 @@ protected static void setupClientDeserializer(ObjectDeserializer op.add(Builder::localAddress, JsonpDeserializer.stringDeserializer(), "local_address"); op.add(Builder::remoteAddress, JsonpDeserializer.stringDeserializer(), "remote_address"); op.add(Builder::lastUri, JsonpDeserializer.stringDeserializer(), "last_uri"); + op.add(Builder::openedTime, JsonpDeserializer.stringDeserializer(), "opened_time"); op.add(Builder::openedTimeMillis, JsonpDeserializer.longDeserializer(), "opened_time_millis"); + op.add(Builder::closedTime, JsonpDeserializer.stringDeserializer(), "closed_time"); op.add(Builder::closedTimeMillis, JsonpDeserializer.longDeserializer(), "closed_time_millis"); + op.add(Builder::lastRequestTime, JsonpDeserializer.stringDeserializer(), "last_request_time"); op.add(Builder::lastRequestTimeMillis, JsonpDeserializer.longDeserializer(), "last_request_time_millis"); op.add(Builder::requestCount, JsonpDeserializer.longDeserializer(), "request_count"); op.add(Builder::requestSizeBytes, JsonpDeserializer.longDeserializer(), "request_size_bytes"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Cpu.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Cpu.java index 3e4af8a218..306f85fd9d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Cpu.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Cpu.java @@ -64,6 +64,9 @@ */ @JsonpDeserializable public class Cpu implements JsonpSerializable { + @Nullable + private final Integer availableProcessors; + @Nullable private final Integer percent; @@ -91,6 +94,7 @@ public class Cpu implements JsonpSerializable { private Cpu(Builder builder) { + this.availableProcessors = builder.availableProcessors; this.percent = builder.percent; this.sys = builder.sys; this.sysInMillis = builder.sysInMillis; @@ -106,6 +110,16 @@ public static Cpu of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * The number of processors available to the Java virtual machine. + *

+ * API name: {@code available_processors} + */ + @Nullable + public final Integer availableProcessors() { + return this.availableProcessors; + } + /** * API name: {@code percent} */ @@ -180,6 +194,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.availableProcessors != null) { + generator.writeKey("available_processors"); + generator.write(this.availableProcessors); + + } if (this.percent != null) { generator.writeKey("percent"); generator.write(this.percent); @@ -241,6 +260,9 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private Integer availableProcessors; + @Nullable private Integer percent; @@ -268,6 +290,7 @@ public static class Builder extends WithJsonObjectBuilderBase implement public Builder() { } private Builder(Cpu instance) { + this.availableProcessors = instance.availableProcessors; this.percent = instance.percent; this.sys = instance.sys; this.sysInMillis = instance.sysInMillis; @@ -278,6 +301,16 @@ private Builder(Cpu instance) { this.loadAverage = instance.loadAverage; } + /** + * The number of processors available to the Java virtual machine. + *

+ * API name: {@code available_processors} + */ + public final Builder availableProcessors(@Nullable Integer value) { + this.availableProcessors = value; + return this; + } + /** * API name: {@code percent} */ @@ -409,6 +442,7 @@ public Builder rebuild() { protected static void setupCpuDeserializer(ObjectDeserializer op) { + op.add(Builder::availableProcessors, JsonpDeserializer.integerDeserializer(), "available_processors"); op.add(Builder::percent, JsonpDeserializer.integerDeserializer(), "percent"); op.add(Builder::sys, Time._DESERIALIZER, "sys"); op.add(Builder::sysInMillis, JsonpDeserializer.longDeserializer(), "sys_in_millis"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/DataPathStats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/DataPathStats.java index 4409eb2223..206305f537 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/DataPathStats.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/DataPathStats.java @@ -92,6 +92,30 @@ public class DataPathStats implements JsonpSerializable { @Nullable private final Long freeInBytes; + @Nullable + private final String lowWatermarkFreeSpace; + + @Nullable + private final Long lowWatermarkFreeSpaceInBytes; + + @Nullable + private final String highWatermarkFreeSpace; + + @Nullable + private final Long highWatermarkFreeSpaceInBytes; + + @Nullable + private final String floodStageFreeSpace; + + @Nullable + private final Long floodStageFreeSpaceInBytes; + + @Nullable + private final String frozenFloodStageFreeSpace; + + @Nullable + private final Long frozenFloodStageFreeSpaceInBytes; + @Nullable private final String mount; @@ -122,6 +146,14 @@ private DataPathStats(Builder builder) { this.diskWriteSizeInBytes = builder.diskWriteSizeInBytes; this.free = builder.free; this.freeInBytes = builder.freeInBytes; + this.lowWatermarkFreeSpace = builder.lowWatermarkFreeSpace; + this.lowWatermarkFreeSpaceInBytes = builder.lowWatermarkFreeSpaceInBytes; + this.highWatermarkFreeSpace = builder.highWatermarkFreeSpace; + this.highWatermarkFreeSpaceInBytes = builder.highWatermarkFreeSpaceInBytes; + this.floodStageFreeSpace = builder.floodStageFreeSpace; + this.floodStageFreeSpaceInBytes = builder.floodStageFreeSpaceInBytes; + this.frozenFloodStageFreeSpace = builder.frozenFloodStageFreeSpace; + this.frozenFloodStageFreeSpaceInBytes = builder.frozenFloodStageFreeSpaceInBytes; this.mount = builder.mount; this.path = builder.path; this.total = builder.total; @@ -232,6 +264,94 @@ public final Long freeInBytes() { return this.freeInBytes; } + /** + * The amount of free disk space that, once reached, triggers the low disk + * watermark. + *

+ * API name: {@code low_watermark_free_space} + */ + @Nullable + public final String lowWatermarkFreeSpace() { + return this.lowWatermarkFreeSpace; + } + + /** + * The amount of free disk space, in bytes, that, once reached, triggers the low + * disk watermark. + *

+ * API name: {@code low_watermark_free_space_in_bytes} + */ + @Nullable + public final Long lowWatermarkFreeSpaceInBytes() { + return this.lowWatermarkFreeSpaceInBytes; + } + + /** + * The amount of free disk space that, once reached, triggers the high disk + * watermark. + *

+ * API name: {@code high_watermark_free_space} + */ + @Nullable + public final String highWatermarkFreeSpace() { + return this.highWatermarkFreeSpace; + } + + /** + * The amount of free disk space, in bytes, that, once reached, triggers the + * high disk watermark. + *

+ * API name: {@code high_watermark_free_space_in_bytes} + */ + @Nullable + public final Long highWatermarkFreeSpaceInBytes() { + return this.highWatermarkFreeSpaceInBytes; + } + + /** + * The amount of free disk space that, once reached, triggers the flood stage + * disk watermark. + *

+ * API name: {@code flood_stage_free_space} + */ + @Nullable + public final String floodStageFreeSpace() { + return this.floodStageFreeSpace; + } + + /** + * The amount of free disk space, in bytes, that, once reached, triggers the + * flood stage disk watermark. + *

+ * API name: {@code flood_stage_free_space_in_bytes} + */ + @Nullable + public final Long floodStageFreeSpaceInBytes() { + return this.floodStageFreeSpaceInBytes; + } + + /** + * The amount of free disk space that, once reached, triggers the frozen flood + * stage disk watermark. + *

+ * API name: {@code frozen_flood_stage_free_space} + */ + @Nullable + public final String frozenFloodStageFreeSpace() { + return this.frozenFloodStageFreeSpace; + } + + /** + * The amount of free disk space, in bytes, that, once reached, triggers the + * frozen flood stage disk watermark. + *

+ * API name: {@code frozen_flood_stage_free_space_in_bytes} + */ + @Nullable + public final Long frozenFloodStageFreeSpaceInBytes() { + return this.frozenFloodStageFreeSpaceInBytes; + } + /** * Mount point of the file store (for example: /dev/sda2). *

@@ -347,6 +467,46 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("free_in_bytes"); generator.write(this.freeInBytes); + } + if (this.lowWatermarkFreeSpace != null) { + generator.writeKey("low_watermark_free_space"); + generator.write(this.lowWatermarkFreeSpace); + + } + if (this.lowWatermarkFreeSpaceInBytes != null) { + generator.writeKey("low_watermark_free_space_in_bytes"); + generator.write(this.lowWatermarkFreeSpaceInBytes); + + } + if (this.highWatermarkFreeSpace != null) { + generator.writeKey("high_watermark_free_space"); + generator.write(this.highWatermarkFreeSpace); + + } + if (this.highWatermarkFreeSpaceInBytes != null) { + generator.writeKey("high_watermark_free_space_in_bytes"); + generator.write(this.highWatermarkFreeSpaceInBytes); + + } + if (this.floodStageFreeSpace != null) { + generator.writeKey("flood_stage_free_space"); + generator.write(this.floodStageFreeSpace); + + } + if (this.floodStageFreeSpaceInBytes != null) { + generator.writeKey("flood_stage_free_space_in_bytes"); + generator.write(this.floodStageFreeSpaceInBytes); + + } + if (this.frozenFloodStageFreeSpace != null) { + generator.writeKey("frozen_flood_stage_free_space"); + generator.write(this.frozenFloodStageFreeSpace); + + } + if (this.frozenFloodStageFreeSpaceInBytes != null) { + generator.writeKey("frozen_flood_stage_free_space_in_bytes"); + generator.write(this.frozenFloodStageFreeSpaceInBytes); + } if (this.mount != null) { generator.writeKey("mount"); @@ -421,6 +581,30 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private Long freeInBytes; + @Nullable + private String lowWatermarkFreeSpace; + + @Nullable + private Long lowWatermarkFreeSpaceInBytes; + + @Nullable + private String highWatermarkFreeSpace; + + @Nullable + private Long highWatermarkFreeSpaceInBytes; + + @Nullable + private String floodStageFreeSpace; + + @Nullable + private Long floodStageFreeSpaceInBytes; + + @Nullable + private String frozenFloodStageFreeSpace; + + @Nullable + private Long frozenFloodStageFreeSpaceInBytes; + @Nullable private String mount; @@ -450,6 +634,14 @@ private Builder(DataPathStats instance) { this.diskWriteSizeInBytes = instance.diskWriteSizeInBytes; this.free = instance.free; this.freeInBytes = instance.freeInBytes; + this.lowWatermarkFreeSpace = instance.lowWatermarkFreeSpace; + this.lowWatermarkFreeSpaceInBytes = instance.lowWatermarkFreeSpaceInBytes; + this.highWatermarkFreeSpace = instance.highWatermarkFreeSpace; + this.highWatermarkFreeSpaceInBytes = instance.highWatermarkFreeSpaceInBytes; + this.floodStageFreeSpace = instance.floodStageFreeSpace; + this.floodStageFreeSpaceInBytes = instance.floodStageFreeSpaceInBytes; + this.frozenFloodStageFreeSpace = instance.frozenFloodStageFreeSpace; + this.frozenFloodStageFreeSpaceInBytes = instance.frozenFloodStageFreeSpaceInBytes; this.mount = instance.mount; this.path = instance.path; this.total = instance.total; @@ -555,6 +747,94 @@ public final Builder freeInBytes(@Nullable Long value) { return this; } + /** + * The amount of free disk space that, once reached, triggers the low disk + * watermark. + *

+ * API name: {@code low_watermark_free_space} + */ + public final Builder lowWatermarkFreeSpace(@Nullable String value) { + this.lowWatermarkFreeSpace = value; + return this; + } + + /** + * The amount of free disk space, in bytes, that, once reached, triggers the low + * disk watermark. + *

+ * API name: {@code low_watermark_free_space_in_bytes} + */ + public final Builder lowWatermarkFreeSpaceInBytes(@Nullable Long value) { + this.lowWatermarkFreeSpaceInBytes = value; + return this; + } + + /** + * The amount of free disk space that, once reached, triggers the high disk + * watermark. + *

+ * API name: {@code high_watermark_free_space} + */ + public final Builder highWatermarkFreeSpace(@Nullable String value) { + this.highWatermarkFreeSpace = value; + return this; + } + + /** + * The amount of free disk space, in bytes, that, once reached, triggers the + * high disk watermark. + *

+ * API name: {@code high_watermark_free_space_in_bytes} + */ + public final Builder highWatermarkFreeSpaceInBytes(@Nullable Long value) { + this.highWatermarkFreeSpaceInBytes = value; + return this; + } + + /** + * The amount of free disk space that, once reached, triggers the flood stage + * disk watermark. + *

+ * API name: {@code flood_stage_free_space} + */ + public final Builder floodStageFreeSpace(@Nullable String value) { + this.floodStageFreeSpace = value; + return this; + } + + /** + * The amount of free disk space, in bytes, that, once reached, triggers the + * flood stage disk watermark. + *

+ * API name: {@code flood_stage_free_space_in_bytes} + */ + public final Builder floodStageFreeSpaceInBytes(@Nullable Long value) { + this.floodStageFreeSpaceInBytes = value; + return this; + } + + /** + * The amount of free disk space that, once reached, triggers the frozen flood + * stage disk watermark. + *

+ * API name: {@code frozen_flood_stage_free_space} + */ + public final Builder frozenFloodStageFreeSpace(@Nullable String value) { + this.frozenFloodStageFreeSpace = value; + return this; + } + + /** + * The amount of free disk space, in bytes, that, once reached, triggers the + * frozen flood stage disk watermark. + *

+ * API name: {@code frozen_flood_stage_free_space_in_bytes} + */ + public final Builder frozenFloodStageFreeSpaceInBytes(@Nullable Long value) { + this.frozenFloodStageFreeSpaceInBytes = value; + return this; + } + /** * Mount point of the file store (for example: /dev/sda2). *

@@ -650,6 +930,19 @@ protected static void setupDataPathStatsDeserializer(ObjectDeserializer sizeHistogram; @@ -71,6 +75,7 @@ public class HttpRouteRequests implements JsonpSerializable { private HttpRouteRequests(Builder builder) { this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count", 0); + this.totalSize = builder.totalSize; this.totalSizeInBytes = ApiTypeHelper.requireNonNull(builder.totalSizeInBytes, this, "totalSizeInBytes", 0); this.sizeHistogram = ApiTypeHelper.unmodifiableRequired(builder.sizeHistogram, this, "sizeHistogram"); @@ -87,6 +92,14 @@ public final long count() { return this.count; } + /** + * API name: {@code total_size} + */ + @Nullable + public final String totalSize() { + return this.totalSize; + } + /** * Required - API name: {@code total_size_in_bytes} */ @@ -115,6 +128,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("count"); generator.write(this.count); + if (this.totalSize != null) { + generator.writeKey("total_size"); + generator.write(this.totalSize); + + } generator.writeKey("total_size_in_bytes"); generator.write(this.totalSizeInBytes); @@ -145,6 +163,9 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { private Long count; + @Nullable + private String totalSize; + private Long totalSizeInBytes; private List sizeHistogram; @@ -153,6 +174,7 @@ public Builder() { } private Builder(HttpRouteRequests instance) { this.count = instance.count; + this.totalSize = instance.totalSize; this.totalSizeInBytes = instance.totalSizeInBytes; this.sizeHistogram = instance.sizeHistogram; @@ -165,6 +187,14 @@ public final Builder count(long value) { return this; } + /** + * API name: {@code total_size} + */ + public final Builder totalSize(@Nullable String value) { + this.totalSize = value; + return this; + } + /** * Required - API name: {@code total_size_in_bytes} */ @@ -237,6 +267,7 @@ public Builder rebuild() { protected static void setupHttpRouteRequestsDeserializer(ObjectDeserializer op) { op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); + op.add(Builder::totalSize, JsonpDeserializer.stringDeserializer(), "total_size"); op.add(Builder::totalSizeInBytes, JsonpDeserializer.longDeserializer(), "total_size_in_bytes"); op.add(Builder::sizeHistogram, JsonpDeserializer.arrayDeserializer(SizeHttpHistogram._DESERIALIZER), "size_histogram"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/HttpRouteResponses.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/HttpRouteResponses.java index b3fe2a54dc..8b5869a9bc 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/HttpRouteResponses.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/HttpRouteResponses.java @@ -31,6 +31,7 @@ import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; import java.lang.Long; +import java.lang.String; import java.util.List; import java.util.Objects; import java.util.function.Function; @@ -62,6 +63,9 @@ public class HttpRouteResponses implements JsonpSerializable { private final long count; + @Nullable + private final String totalSize; + private final long totalSizeInBytes; private final List handlingTimeHistogram; @@ -73,6 +77,7 @@ public class HttpRouteResponses implements JsonpSerializable { private HttpRouteResponses(Builder builder) { this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count", 0); + this.totalSize = builder.totalSize; this.totalSizeInBytes = ApiTypeHelper.requireNonNull(builder.totalSizeInBytes, this, "totalSizeInBytes", 0); this.handlingTimeHistogram = ApiTypeHelper.unmodifiableRequired(builder.handlingTimeHistogram, this, "handlingTimeHistogram"); @@ -91,6 +96,14 @@ public final long count() { return this.count; } + /** + * API name: {@code total_size} + */ + @Nullable + public final String totalSize() { + return this.totalSize; + } + /** * Required - API name: {@code total_size_in_bytes} */ @@ -126,6 +139,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("count"); generator.write(this.count); + if (this.totalSize != null) { + generator.writeKey("total_size"); + generator.write(this.totalSize); + + } generator.writeKey("total_size_in_bytes"); generator.write(this.totalSizeInBytes); @@ -168,6 +186,9 @@ public static class Builder extends WithJsonObjectBuilderBase ObjectBuilder { private Long count; + @Nullable + private String totalSize; + private Long totalSizeInBytes; private List handlingTimeHistogram; @@ -178,6 +199,7 @@ public Builder() { } private Builder(HttpRouteResponses instance) { this.count = instance.count; + this.totalSize = instance.totalSize; this.totalSizeInBytes = instance.totalSizeInBytes; this.handlingTimeHistogram = instance.handlingTimeHistogram; this.sizeHistogram = instance.sizeHistogram; @@ -191,6 +213,14 @@ public final Builder count(long value) { return this; } + /** + * API name: {@code total_size} + */ + public final Builder totalSize(@Nullable String value) { + this.totalSize = value; + return this; + } + /** * Required - API name: {@code total_size_in_bytes} */ @@ -293,6 +323,7 @@ public Builder rebuild() { protected static void setupHttpRouteResponsesDeserializer(ObjectDeserializer op) { op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); + op.add(Builder::totalSize, JsonpDeserializer.stringDeserializer(), "total_size"); op.add(Builder::totalSizeInBytes, JsonpDeserializer.longDeserializer(), "total_size_in_bytes"); op.add(Builder::handlingTimeHistogram, JsonpDeserializer.arrayDeserializer(TimeHttpHistogram._DESERIALIZER), "handling_time_histogram"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/IngestStats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/IngestStats.java index 7bc5bed76f..a57c854b92 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/IngestStats.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/IngestStats.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch.nodes; +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; @@ -70,10 +71,19 @@ public class IngestStats implements JsonpSerializable { private final List> processors; + @Nullable + private final Time time; + private final long timeInMillis; + @Nullable + private final String ingestedAsFirstPipeline; + private final long ingestedAsFirstPipelineInBytes; + @Nullable + private final String producedAsFirstPipeline; + private final long producedAsFirstPipelineInBytes; // --------------------------------------------------------------------------------------------- @@ -84,9 +94,12 @@ private IngestStats(Builder builder) { this.current = ApiTypeHelper.requireNonNull(builder.current, this, "current", 0); this.failed = ApiTypeHelper.requireNonNull(builder.failed, this, "failed", 0); this.processors = ApiTypeHelper.unmodifiableRequired(builder.processors, this, "processors"); + this.time = builder.time; this.timeInMillis = ApiTypeHelper.requireNonNull(builder.timeInMillis, this, "timeInMillis", 0); + this.ingestedAsFirstPipeline = builder.ingestedAsFirstPipeline; this.ingestedAsFirstPipelineInBytes = ApiTypeHelper.requireNonNull(builder.ingestedAsFirstPipelineInBytes, this, "ingestedAsFirstPipelineInBytes", 0); + this.producedAsFirstPipeline = builder.producedAsFirstPipeline; this.producedAsFirstPipelineInBytes = ApiTypeHelper.requireNonNull(builder.producedAsFirstPipelineInBytes, this, "producedAsFirstPipelineInBytes", 0); @@ -134,6 +147,17 @@ public final List> processors() { return this.processors; } + /** + * Total time spent preprocessing ingest documents during the lifetime of this + * node. + *

+ * API name: {@code time} + */ + @Nullable + public final Time time() { + return this.time; + } + /** * Required - Total time, in milliseconds, spent preprocessing ingest documents * during the lifetime of this node. @@ -145,11 +169,24 @@ public final long timeInMillis() { } /** - * Required - Total number of bytes of all documents ingested by the pipeline. - * This field is only present on pipelines which are the first to process a - * document. Thus, it is not present on pipelines which only serve as a final + * Total size of all documents ingested by the pipeline. The value counts + * documents for which this pipeline was the first to process them; for + * pipelines that are not the first to process a document (for example, a final * pipeline after a default pipeline, a pipeline run after a reroute processor, - * or pipelines in pipeline processors. + * or a pipeline invoked by a pipeline processor), the value is 0. + *

+ * API name: {@code ingested_as_first_pipeline} + */ + @Nullable + public final String ingestedAsFirstPipeline() { + return this.ingestedAsFirstPipeline; + } + + /** + * Required - Total number of bytes of all documents ingested by the pipeline. + * The value counts documents for which this pipeline was the first to process + * them; for pipelines that are not the first to process a document, the value + * is 0. *

* API name: {@code ingested_as_first_pipeline_in_bytes} */ @@ -157,14 +194,26 @@ public final long ingestedAsFirstPipelineInBytes() { return this.ingestedAsFirstPipelineInBytes; } + /** + * Total size of all documents produced by the pipeline. The value counts + * documents for which this pipeline was the first to process them; for + * pipelines that are not the first to process a document, the value is + * 0. In situations where there are subsequent pipelines, the value + * represents the size of the document after all pipelines have run. + *

+ * API name: {@code produced_as_first_pipeline} + */ + @Nullable + public final String producedAsFirstPipeline() { + return this.producedAsFirstPipeline; + } + /** * Required - Total number of bytes of all documents produced by the pipeline. - * This field is only present on pipelines which are the first to process a - * document. Thus, it is not present on pipelines which only serve as a final - * pipeline after a default pipeline, a pipeline run after a reroute processor, - * or pipelines in pipeline processors. In situations where there are subsequent - * pipelines, the value represents the size of the document after all pipelines - * have run. + * The value counts documents for which this pipeline was the first to process + * them; for pipelines that are not the first to process a document, the value + * is 0. In situations where there are subsequent pipelines, the + * value represents the size of the document after all pipelines have run. *

* API name: {@code produced_as_first_pipeline_in_bytes} */ @@ -209,13 +258,28 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + if (this.time != null) { + generator.writeKey("time"); + this.time.serialize(generator, mapper); + } generator.writeKey("time_in_millis"); generator.write(this.timeInMillis); + if (this.ingestedAsFirstPipeline != null) { + generator.writeKey("ingested_as_first_pipeline"); + generator.write(this.ingestedAsFirstPipeline); + + } generator.writeKey("ingested_as_first_pipeline_in_bytes"); generator.write(this.ingestedAsFirstPipelineInBytes); + if (this.producedAsFirstPipeline != null) { + generator.writeKey("produced_as_first_pipeline"); + generator.write(this.producedAsFirstPipeline); + + } generator.writeKey("produced_as_first_pipeline_in_bytes"); generator.write(this.producedAsFirstPipelineInBytes); @@ -241,10 +305,19 @@ public static class Builder extends WithJsonObjectBuilderBase implement private List> processors; + @Nullable + private Time time; + private Long timeInMillis; + @Nullable + private String ingestedAsFirstPipeline; + private Long ingestedAsFirstPipelineInBytes; + @Nullable + private String producedAsFirstPipeline; + private Long producedAsFirstPipelineInBytes; public Builder() { @@ -254,8 +327,11 @@ private Builder(IngestStats instance) { this.current = instance.current; this.failed = instance.failed; this.processors = instance.processors; + this.time = instance.time; this.timeInMillis = instance.timeInMillis; + this.ingestedAsFirstPipeline = instance.ingestedAsFirstPipeline; this.ingestedAsFirstPipelineInBytes = instance.ingestedAsFirstPipelineInBytes; + this.producedAsFirstPipeline = instance.producedAsFirstPipeline; this.producedAsFirstPipelineInBytes = instance.producedAsFirstPipelineInBytes; } @@ -315,6 +391,27 @@ public final Builder processors(Map value, Map + * API name: {@code time} + */ + public final Builder time(@Nullable Time value) { + this.time = value; + return this; + } + + /** + * Total time spent preprocessing ingest documents during the lifetime of this + * node. + *

+ * API name: {@code time} + */ + public final Builder time(Function> fn) { + return this.time(fn.apply(new Time.Builder()).build()); + } + /** * Required - Total time, in milliseconds, spent preprocessing ingest documents * during the lifetime of this node. @@ -327,11 +424,24 @@ public final Builder timeInMillis(long value) { } /** - * Required - Total number of bytes of all documents ingested by the pipeline. - * This field is only present on pipelines which are the first to process a - * document. Thus, it is not present on pipelines which only serve as a final + * Total size of all documents ingested by the pipeline. The value counts + * documents for which this pipeline was the first to process them; for + * pipelines that are not the first to process a document (for example, a final * pipeline after a default pipeline, a pipeline run after a reroute processor, - * or pipelines in pipeline processors. + * or a pipeline invoked by a pipeline processor), the value is 0. + *

+ * API name: {@code ingested_as_first_pipeline} + */ + public final Builder ingestedAsFirstPipeline(@Nullable String value) { + this.ingestedAsFirstPipeline = value; + return this; + } + + /** + * Required - Total number of bytes of all documents ingested by the pipeline. + * The value counts documents for which this pipeline was the first to process + * them; for pipelines that are not the first to process a document, the value + * is 0. *

* API name: {@code ingested_as_first_pipeline_in_bytes} */ @@ -340,14 +450,26 @@ public final Builder ingestedAsFirstPipelineInBytes(long value) { return this; } + /** + * Total size of all documents produced by the pipeline. The value counts + * documents for which this pipeline was the first to process them; for + * pipelines that are not the first to process a document, the value is + * 0. In situations where there are subsequent pipelines, the value + * represents the size of the document after all pipelines have run. + *

+ * API name: {@code produced_as_first_pipeline} + */ + public final Builder producedAsFirstPipeline(@Nullable String value) { + this.producedAsFirstPipeline = value; + return this; + } + /** * Required - Total number of bytes of all documents produced by the pipeline. - * This field is only present on pipelines which are the first to process a - * document. Thus, it is not present on pipelines which only serve as a final - * pipeline after a default pipeline, a pipeline run after a reroute processor, - * or pipelines in pipeline processors. In situations where there are subsequent - * pipelines, the value represents the size of the document after all pipelines - * have run. + * The value counts documents for which this pipeline was the first to process + * them; for pipelines that are not the first to process a document, the value + * is 0. In situations where there are subsequent pipelines, the + * value represents the size of the document after all pipelines have run. *

* API name: {@code produced_as_first_pipeline_in_bytes} */ @@ -395,9 +517,12 @@ protected static void setupIngestStatsDeserializer(ObjectDeserializer + * API name: {@code time} + */ + @Nullable + public final Time time() { + return this.time; + } + /** * Required - Total time, in milliseconds, spent preprocessing ingest documents * during the lifetime of this node. @@ -140,6 +157,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("failed"); generator.write(this.failed); + if (this.time != null) { + generator.writeKey("time"); + this.time.serialize(generator, mapper); + + } generator.writeKey("time_in_millis"); generator.write(this.timeInMillis); @@ -163,6 +185,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement private Long failed; + @Nullable + private Time time; + private Long timeInMillis; public Builder() { @@ -171,6 +196,7 @@ private Builder(IngestTotal instance) { this.count = instance.count; this.current = instance.current; this.failed = instance.failed; + this.time = instance.time; this.timeInMillis = instance.timeInMillis; } @@ -206,6 +232,27 @@ public final Builder failed(long value) { return this; } + /** + * Total time spent preprocessing ingest documents during the lifetime of this + * node. + *

+ * API name: {@code time} + */ + public final Builder time(@Nullable Time value) { + this.time = value; + return this; + } + + /** + * Total time spent preprocessing ingest documents during the lifetime of this + * node. + *

+ * API name: {@code time} + */ + public final Builder time(Function> fn) { + return this.time(fn.apply(new Time.Builder()).build()); + } + /** * Required - Total time, in milliseconds, spent preprocessing ingest documents * during the lifetime of this node. @@ -254,6 +301,7 @@ protected static void setupIngestTotalDeserializer(ObjectDeserializer> return fn.apply(new Builder()).build(); } + /** + * Memory currently in use by the heap. + *

+ * API name: {@code heap_used} + */ + @Nullable + public final String heapUsed() { + return this.heapUsed; + } + /** * Memory, in bytes, currently in use by the heap. *

@@ -123,6 +149,16 @@ public final Long heapUsedPercent() { return this.heapUsedPercent; } + /** + * Amount of memory available for use by the heap. + *

+ * API name: {@code heap_committed} + */ + @Nullable + public final String heapCommitted() { + return this.heapCommitted; + } + /** * Amount of memory, in bytes, available for use by the heap. *

@@ -153,6 +189,16 @@ public final String heapMax() { return this.heapMax; } + /** + * Non-heap memory used. + *

+ * API name: {@code non_heap_used} + */ + @Nullable + public final String nonHeapUsed() { + return this.nonHeapUsed; + } + /** * Non-heap memory used, in bytes. *

@@ -163,6 +209,16 @@ public final Long nonHeapUsedInBytes() { return this.nonHeapUsedInBytes; } + /** + * Amount of non-heap memory available. + *

+ * API name: {@code non_heap_committed} + */ + @Nullable + public final String nonHeapCommitted() { + return this.nonHeapCommitted; + } + /** * Amount of non-heap memory available, in bytes. *

@@ -193,6 +249,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.heapUsed != null) { + generator.writeKey("heap_used"); + generator.write(this.heapUsed); + + } if (this.heapUsedInBytes != null) { generator.writeKey("heap_used_in_bytes"); generator.write(this.heapUsedInBytes); @@ -202,6 +263,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("heap_used_percent"); generator.write(this.heapUsedPercent); + } + if (this.heapCommitted != null) { + generator.writeKey("heap_committed"); + generator.write(this.heapCommitted); + } if (this.heapCommittedInBytes != null) { generator.writeKey("heap_committed_in_bytes"); @@ -217,11 +283,21 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("heap_max"); generator.write(this.heapMax); + } + if (this.nonHeapUsed != null) { + generator.writeKey("non_heap_used"); + generator.write(this.nonHeapUsed); + } if (this.nonHeapUsedInBytes != null) { generator.writeKey("non_heap_used_in_bytes"); generator.write(this.nonHeapUsedInBytes); + } + if (this.nonHeapCommitted != null) { + generator.writeKey("non_heap_committed"); + generator.write(this.nonHeapCommitted); + } if (this.nonHeapCommittedInBytes != null) { generator.writeKey("non_heap_committed_in_bytes"); @@ -254,12 +330,18 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private String heapUsed; + @Nullable private Long heapUsedInBytes; @Nullable private Long heapUsedPercent; + @Nullable + private String heapCommitted; + @Nullable private Long heapCommittedInBytes; @@ -269,9 +351,15 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private String heapMax; + @Nullable + private String nonHeapUsed; + @Nullable private Long nonHeapUsedInBytes; + @Nullable + private String nonHeapCommitted; + @Nullable private Long nonHeapCommittedInBytes; @@ -281,16 +369,30 @@ public static class Builder extends WithJsonObjectBuilderBase implement public Builder() { } private Builder(JvmMemoryStats instance) { + this.heapUsed = instance.heapUsed; this.heapUsedInBytes = instance.heapUsedInBytes; this.heapUsedPercent = instance.heapUsedPercent; + this.heapCommitted = instance.heapCommitted; this.heapCommittedInBytes = instance.heapCommittedInBytes; this.heapMaxInBytes = instance.heapMaxInBytes; this.heapMax = instance.heapMax; + this.nonHeapUsed = instance.nonHeapUsed; this.nonHeapUsedInBytes = instance.nonHeapUsedInBytes; + this.nonHeapCommitted = instance.nonHeapCommitted; this.nonHeapCommittedInBytes = instance.nonHeapCommittedInBytes; this.pools = instance.pools; } + /** + * Memory currently in use by the heap. + *

+ * API name: {@code heap_used} + */ + public final Builder heapUsed(@Nullable String value) { + this.heapUsed = value; + return this; + } + /** * Memory, in bytes, currently in use by the heap. *

@@ -311,6 +413,16 @@ public final Builder heapUsedPercent(@Nullable Long value) { return this; } + /** + * Amount of memory available for use by the heap. + *

+ * API name: {@code heap_committed} + */ + public final Builder heapCommitted(@Nullable String value) { + this.heapCommitted = value; + return this; + } + /** * Amount of memory, in bytes, available for use by the heap. *

@@ -341,6 +453,16 @@ public final Builder heapMax(@Nullable String value) { return this; } + /** + * Non-heap memory used. + *

+ * API name: {@code non_heap_used} + */ + public final Builder nonHeapUsed(@Nullable String value) { + this.nonHeapUsed = value; + return this; + } + /** * Non-heap memory used, in bytes. *

@@ -351,6 +473,16 @@ public final Builder nonHeapUsedInBytes(@Nullable Long value) { return this; } + /** + * Amount of non-heap memory available. + *

+ * API name: {@code non_heap_committed} + */ + public final Builder nonHeapCommitted(@Nullable String value) { + this.nonHeapCommitted = value; + return this; + } + /** * Amount of non-heap memory available, in bytes. *

@@ -430,12 +562,16 @@ public Builder rebuild() { protected static void setupJvmMemoryStatsDeserializer(ObjectDeserializer op) { + op.add(Builder::heapUsed, JsonpDeserializer.stringDeserializer(), "heap_used"); op.add(Builder::heapUsedInBytes, JsonpDeserializer.longDeserializer(), "heap_used_in_bytes"); op.add(Builder::heapUsedPercent, JsonpDeserializer.longDeserializer(), "heap_used_percent"); + op.add(Builder::heapCommitted, JsonpDeserializer.stringDeserializer(), "heap_committed"); op.add(Builder::heapCommittedInBytes, JsonpDeserializer.longDeserializer(), "heap_committed_in_bytes"); op.add(Builder::heapMaxInBytes, JsonpDeserializer.longDeserializer(), "heap_max_in_bytes"); op.add(Builder::heapMax, JsonpDeserializer.stringDeserializer(), "heap_max"); + op.add(Builder::nonHeapUsed, JsonpDeserializer.stringDeserializer(), "non_heap_used"); op.add(Builder::nonHeapUsedInBytes, JsonpDeserializer.longDeserializer(), "non_heap_used_in_bytes"); + op.add(Builder::nonHeapCommitted, JsonpDeserializer.stringDeserializer(), "non_heap_committed"); op.add(Builder::nonHeapCommittedInBytes, JsonpDeserializer.longDeserializer(), "non_heap_committed_in_bytes"); op.add(Builder::pools, JsonpDeserializer.stringMapDeserializer(Pool._DESERIALIZER), "pools"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/MemoryStats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/MemoryStats.java index 584157a12a..ef38d316d3 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/MemoryStats.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/MemoryStats.java @@ -59,6 +59,9 @@ */ @JsonpDeserializable public class MemoryStats implements JsonpSerializable { + @Nullable + private final String adjustedTotal; + @Nullable private final Long adjustedTotalInBytes; @@ -80,12 +83,21 @@ public class MemoryStats implements JsonpSerializable { @Nullable private final Long totalVirtualInBytes; + @Nullable + private final String total; + @Nullable private final Long totalInBytes; + @Nullable + private final String free; + @Nullable private final Long freeInBytes; + @Nullable + private final String used; + @Nullable private final Long usedInBytes; @@ -93,6 +105,7 @@ public class MemoryStats implements JsonpSerializable { protected MemoryStats(AbstractBuilder builder) { + this.adjustedTotal = builder.adjustedTotal; this.adjustedTotalInBytes = builder.adjustedTotalInBytes; this.resident = builder.resident; this.residentInBytes = builder.residentInBytes; @@ -100,8 +113,11 @@ protected MemoryStats(AbstractBuilder builder) { this.shareInBytes = builder.shareInBytes; this.totalVirtual = builder.totalVirtual; this.totalVirtualInBytes = builder.totalVirtualInBytes; + this.total = builder.total; this.totalInBytes = builder.totalInBytes; + this.free = builder.free; this.freeInBytes = builder.freeInBytes; + this.used = builder.used; this.usedInBytes = builder.usedInBytes; } @@ -110,6 +126,19 @@ public static MemoryStats memoryStatsOf(Functiones.total_memory_bytes system property then this + * reports the overridden value. Otherwise it reports the same value as + * total. + *

+ * API name: {@code adjusted_total} + */ + @Nullable + public final String adjustedTotal() { + return this.adjustedTotal; + } + /** * If the amount of physical memory has been overridden using the * es.total_memory_bytes system property then this @@ -171,6 +200,16 @@ public final Long totalVirtualInBytes() { return this.totalVirtualInBytes; } + /** + * Total amount of physical memory. + *

+ * API name: {@code total} + */ + @Nullable + public final String total() { + return this.total; + } + /** * Total amount of physical memory in bytes. *

@@ -181,6 +220,16 @@ public final Long totalInBytes() { return this.totalInBytes; } + /** + * Amount of free physical memory. + *

+ * API name: {@code free} + */ + @Nullable + public final String free() { + return this.free; + } + /** * Amount of free physical memory in bytes. *

@@ -191,6 +240,16 @@ public final Long freeInBytes() { return this.freeInBytes; } + /** + * Amount of used physical memory. + *

+ * API name: {@code used} + */ + @Nullable + public final String used() { + return this.used; + } + /** * Amount of used physical memory in bytes. *

@@ -212,6 +271,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.adjustedTotal != null) { + generator.writeKey("adjusted_total"); + generator.write(this.adjustedTotal); + + } if (this.adjustedTotalInBytes != null) { generator.writeKey("adjusted_total_in_bytes"); generator.write(this.adjustedTotalInBytes); @@ -246,16 +310,31 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("total_virtual_in_bytes"); generator.write(this.totalVirtualInBytes); + } + if (this.total != null) { + generator.writeKey("total"); + generator.write(this.total); + } if (this.totalInBytes != null) { generator.writeKey("total_in_bytes"); generator.write(this.totalInBytes); + } + if (this.free != null) { + generator.writeKey("free"); + generator.write(this.free); + } if (this.freeInBytes != null) { generator.writeKey("free_in_bytes"); generator.write(this.freeInBytes); + } + if (this.used != null) { + generator.writeKey("used"); + generator.write(this.used); + } if (this.usedInBytes != null) { generator.writeKey("used_in_bytes"); @@ -298,6 +377,9 @@ public MemoryStats build() { public abstract static class AbstractBuilder> extends WithJsonObjectBuilderBase { + @Nullable + private String adjustedTotal; + @Nullable private Long adjustedTotalInBytes; @@ -319,15 +401,37 @@ public abstract static class AbstractBuilderes.total_memory_bytes system property then this + * reports the overridden value. Otherwise it reports the same value as + * total. + *

+ * API name: {@code adjusted_total} + */ + public final BuilderT adjustedTotal(@Nullable String value) { + this.adjustedTotal = value; + return self(); + } + /** * If the amount of physical memory has been overridden using the * es.total_memory_bytes system property then this @@ -389,6 +493,16 @@ public final BuilderT totalVirtualInBytes(@Nullable Long value) { return self(); } + /** + * Total amount of physical memory. + *

+ * API name: {@code total} + */ + public final BuilderT total(@Nullable String value) { + this.total = value; + return self(); + } + /** * Total amount of physical memory in bytes. *

@@ -399,6 +513,16 @@ public final BuilderT totalInBytes(@Nullable Long value) { return self(); } + /** + * Amount of free physical memory. + *

+ * API name: {@code free} + */ + public final BuilderT free(@Nullable String value) { + this.free = value; + return self(); + } + /** * Amount of free physical memory in bytes. *

@@ -409,6 +533,16 @@ public final BuilderT freeInBytes(@Nullable Long value) { return self(); } + /** + * Amount of used physical memory. + *

+ * API name: {@code used} + */ + public final BuilderT used(@Nullable String value) { + this.used = value; + return self(); + } + /** * Amount of used physical memory in bytes. *

@@ -434,6 +568,7 @@ public final BuilderT usedInBytes(@Nullable Long value) { protected static > void setupMemoryStatsDeserializer( ObjectDeserializer op) { + op.add(AbstractBuilder::adjustedTotal, JsonpDeserializer.stringDeserializer(), "adjusted_total"); op.add(AbstractBuilder::adjustedTotalInBytes, JsonpDeserializer.longDeserializer(), "adjusted_total_in_bytes"); op.add(AbstractBuilder::resident, JsonpDeserializer.stringDeserializer(), "resident"); op.add(AbstractBuilder::residentInBytes, JsonpDeserializer.longDeserializer(), "resident_in_bytes"); @@ -441,8 +576,11 @@ protected static > void setupMemorySt op.add(AbstractBuilder::shareInBytes, JsonpDeserializer.longDeserializer(), "share_in_bytes"); op.add(AbstractBuilder::totalVirtual, JsonpDeserializer.stringDeserializer(), "total_virtual"); op.add(AbstractBuilder::totalVirtualInBytes, JsonpDeserializer.longDeserializer(), "total_virtual_in_bytes"); + op.add(AbstractBuilder::total, JsonpDeserializer.stringDeserializer(), "total"); op.add(AbstractBuilder::totalInBytes, JsonpDeserializer.longDeserializer(), "total_in_bytes"); + op.add(AbstractBuilder::free, JsonpDeserializer.stringDeserializer(), "free"); op.add(AbstractBuilder::freeInBytes, JsonpDeserializer.longDeserializer(), "free_in_bytes"); + op.add(AbstractBuilder::used, JsonpDeserializer.stringDeserializer(), "used"); op.add(AbstractBuilder::usedInBytes, JsonpDeserializer.longDeserializer(), "used_in_bytes"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Pool.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Pool.java index c59f654dee..2245e6683f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Pool.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Pool.java @@ -30,6 +30,7 @@ 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; @@ -58,15 +59,27 @@ */ @JsonpDeserializable public class Pool implements JsonpSerializable { + @Nullable + private final String used; + @Nullable private final Long usedInBytes; + @Nullable + private final String max; + @Nullable private final Long maxInBytes; + @Nullable + private final String peakUsed; + @Nullable private final Long peakUsedInBytes; + @Nullable + private final String peakMax; + @Nullable private final Long peakMaxInBytes; @@ -74,9 +87,13 @@ public class Pool implements JsonpSerializable { private Pool(Builder builder) { + this.used = builder.used; this.usedInBytes = builder.usedInBytes; + this.max = builder.max; this.maxInBytes = builder.maxInBytes; + this.peakUsed = builder.peakUsed; this.peakUsedInBytes = builder.peakUsedInBytes; + this.peakMax = builder.peakMax; this.peakMaxInBytes = builder.peakMaxInBytes; } @@ -85,6 +102,16 @@ public static Pool of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * Memory used by the heap. + *

+ * API name: {@code used} + */ + @Nullable + public final String used() { + return this.used; + } + /** * Memory, in bytes, used by the heap. *

@@ -95,6 +122,16 @@ public final Long usedInBytes() { return this.usedInBytes; } + /** + * Maximum amount of memory available for use by the heap. + *

+ * API name: {@code max} + */ + @Nullable + public final String max() { + return this.max; + } + /** * Maximum amount of memory, in bytes, available for use by the heap. *

@@ -105,6 +142,16 @@ public final Long maxInBytes() { return this.maxInBytes; } + /** + * Largest amount of memory historically used by the heap. + *

+ * API name: {@code peak_used} + */ + @Nullable + public final String peakUsed() { + return this.peakUsed; + } + /** * Largest amount of memory, in bytes, historically used by the heap. *

@@ -115,6 +162,16 @@ public final Long peakUsedInBytes() { return this.peakUsedInBytes; } + /** + * Largest amount of memory historically used by the heap. + *

+ * API name: {@code peak_max} + */ + @Nullable + public final String peakMax() { + return this.peakMax; + } + /** * Largest amount of memory, in bytes, historically used by the heap. *

@@ -136,20 +193,40 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.used != null) { + generator.writeKey("used"); + generator.write(this.used); + + } if (this.usedInBytes != null) { generator.writeKey("used_in_bytes"); generator.write(this.usedInBytes); + } + if (this.max != null) { + generator.writeKey("max"); + generator.write(this.max); + } if (this.maxInBytes != null) { generator.writeKey("max_in_bytes"); generator.write(this.maxInBytes); + } + if (this.peakUsed != null) { + generator.writeKey("peak_used"); + generator.write(this.peakUsed); + } if (this.peakUsedInBytes != null) { generator.writeKey("peak_used_in_bytes"); generator.write(this.peakUsedInBytes); + } + if (this.peakMax != null) { + generator.writeKey("peak_max"); + generator.write(this.peakMax); + } if (this.peakMaxInBytes != null) { generator.writeKey("peak_max_in_bytes"); @@ -171,27 +248,53 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable + private String used; + @Nullable private Long usedInBytes; + @Nullable + private String max; + @Nullable private Long maxInBytes; + @Nullable + private String peakUsed; + @Nullable private Long peakUsedInBytes; + @Nullable + private String peakMax; + @Nullable private Long peakMaxInBytes; public Builder() { } private Builder(Pool instance) { + this.used = instance.used; this.usedInBytes = instance.usedInBytes; + this.max = instance.max; this.maxInBytes = instance.maxInBytes; + this.peakUsed = instance.peakUsed; this.peakUsedInBytes = instance.peakUsedInBytes; + this.peakMax = instance.peakMax; this.peakMaxInBytes = instance.peakMaxInBytes; } + /** + * Memory used by the heap. + *

+ * API name: {@code used} + */ + public final Builder used(@Nullable String value) { + this.used = value; + return this; + } + /** * Memory, in bytes, used by the heap. *

@@ -202,6 +305,16 @@ public final Builder usedInBytes(@Nullable Long value) { return this; } + /** + * Maximum amount of memory available for use by the heap. + *

+ * API name: {@code max} + */ + public final Builder max(@Nullable String value) { + this.max = value; + return this; + } + /** * Maximum amount of memory, in bytes, available for use by the heap. *

@@ -212,6 +325,16 @@ public final Builder maxInBytes(@Nullable Long value) { return this; } + /** + * Largest amount of memory historically used by the heap. + *

+ * API name: {@code peak_used} + */ + public final Builder peakUsed(@Nullable String value) { + this.peakUsed = value; + return this; + } + /** * Largest amount of memory, in bytes, historically used by the heap. *

@@ -222,6 +345,16 @@ public final Builder peakUsedInBytes(@Nullable Long value) { return this; } + /** + * Largest amount of memory historically used by the heap. + *

+ * API name: {@code peak_max} + */ + public final Builder peakMax(@Nullable String value) { + this.peakMax = value; + return this; + } + /** * Largest amount of memory, in bytes, historically used by the heap. *

@@ -266,9 +399,13 @@ public Builder rebuild() { protected static void setupPoolDeserializer(ObjectDeserializer op) { + op.add(Builder::used, JsonpDeserializer.stringDeserializer(), "used"); op.add(Builder::usedInBytes, JsonpDeserializer.longDeserializer(), "used_in_bytes"); + op.add(Builder::max, JsonpDeserializer.stringDeserializer(), "max"); op.add(Builder::maxInBytes, JsonpDeserializer.longDeserializer(), "max_in_bytes"); + op.add(Builder::peakUsed, JsonpDeserializer.stringDeserializer(), "peak_used"); op.add(Builder::peakUsedInBytes, JsonpDeserializer.longDeserializer(), "peak_used_in_bytes"); + op.add(Builder::peakMax, JsonpDeserializer.stringDeserializer(), "peak_max"); op.add(Builder::peakMaxInBytes, JsonpDeserializer.longDeserializer(), "peak_max_in_bytes"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Processor.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Processor.java index 3ec5f1db7e..57c89828d1 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Processor.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Processor.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch.nodes; +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; @@ -67,6 +68,9 @@ public class Processor implements JsonpSerializable { @Nullable private final Long failed; + @Nullable + private final Time time; + @Nullable private final Long timeInMillis; @@ -77,6 +81,7 @@ private Processor(Builder builder) { this.count = builder.count; this.current = builder.current; this.failed = builder.failed; + this.time = builder.time; this.timeInMillis = builder.timeInMillis; } @@ -115,6 +120,16 @@ public final Long failed() { return this.failed; } + /** + * Time spent by the processor transforming documents. + *

+ * API name: {@code time} + */ + @Nullable + public final Time time() { + return this.time; + } + /** * Time, in milliseconds, spent by the processor transforming documents. *

@@ -150,6 +165,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("failed"); generator.write(this.failed); + } + if (this.time != null) { + generator.writeKey("time"); + this.time.serialize(generator, mapper); + } if (this.timeInMillis != null) { generator.writeKey("time_in_millis"); @@ -180,6 +200,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private Long failed; + @Nullable + private Time time; + @Nullable private Long timeInMillis; @@ -189,6 +212,7 @@ private Builder(Processor instance) { this.count = instance.count; this.current = instance.current; this.failed = instance.failed; + this.time = instance.time; this.timeInMillis = instance.timeInMillis; } @@ -222,6 +246,25 @@ public final Builder failed(@Nullable Long value) { return this; } + /** + * Time spent by the processor transforming documents. + *

+ * API name: {@code time} + */ + public final Builder time(@Nullable Time value) { + this.time = value; + return this; + } + + /** + * Time spent by the processor transforming documents. + *

+ * API name: {@code time} + */ + public final Builder time(Function> fn) { + return this.time(fn.apply(new Time.Builder()).build()); + } + /** * Time, in milliseconds, spent by the processor transforming documents. *

@@ -269,6 +312,7 @@ protected static void setupProcessorDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public class RepositorySnapshotStats implements JsonpSerializable { + @Nullable + private final Time totalReadThrottledTime; + + @Nullable + private final Time totalWriteThrottledTime; + + private final long totalReadThrottledTimeNanos; + + private final long totalWriteThrottledTimeNanos; + + private final long shardSnapshotsStarted; + + private final long shardSnapshotsCompleted; + + private final long shardSnapshotsInProgress; + + private final long uploadedBlobs; + + @Nullable + private final String uploadedSize; + + private final long uploadedSizeInBytes; + + @Nullable + private final Time totalUploadTime; + + private final long totalUploadTimeInMillis; + + @Nullable + private final Time totalReadTime; + + private final long totalReadTimeInMillis; + + // --------------------------------------------------------------------------------------------- + + private RepositorySnapshotStats(Builder builder) { + + this.totalReadThrottledTime = builder.totalReadThrottledTime; + this.totalWriteThrottledTime = builder.totalWriteThrottledTime; + this.totalReadThrottledTimeNanos = ApiTypeHelper.requireNonNull(builder.totalReadThrottledTimeNanos, this, + "totalReadThrottledTimeNanos", 0); + this.totalWriteThrottledTimeNanos = ApiTypeHelper.requireNonNull(builder.totalWriteThrottledTimeNanos, this, + "totalWriteThrottledTimeNanos", 0); + this.shardSnapshotsStarted = ApiTypeHelper.requireNonNull(builder.shardSnapshotsStarted, this, + "shardSnapshotsStarted", 0); + this.shardSnapshotsCompleted = ApiTypeHelper.requireNonNull(builder.shardSnapshotsCompleted, this, + "shardSnapshotsCompleted", 0); + this.shardSnapshotsInProgress = ApiTypeHelper.requireNonNull(builder.shardSnapshotsInProgress, this, + "shardSnapshotsInProgress", 0); + this.uploadedBlobs = ApiTypeHelper.requireNonNull(builder.uploadedBlobs, this, "uploadedBlobs", 0); + this.uploadedSize = builder.uploadedSize; + this.uploadedSizeInBytes = ApiTypeHelper.requireNonNull(builder.uploadedSizeInBytes, this, + "uploadedSizeInBytes", 0); + this.totalUploadTime = builder.totalUploadTime; + this.totalUploadTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalUploadTimeInMillis, this, + "totalUploadTimeInMillis", 0); + this.totalReadTime = builder.totalReadTime; + this.totalReadTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalReadTimeInMillis, this, + "totalReadTimeInMillis", 0); + + } + + public static RepositorySnapshotStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The cumulative time spent throttling read operations for this repository. + *

+ * API name: {@code total_read_throttled_time} + */ + @Nullable + public final Time totalReadThrottledTime() { + return this.totalReadThrottledTime; + } + + /** + * The cumulative time spent throttling write operations for this repository. + *

+ * API name: {@code total_write_throttled_time} + */ + @Nullable + public final Time totalWriteThrottledTime() { + return this.totalWriteThrottledTime; + } + + /** + * Required - The cumulative time, in nanoseconds, spent throttling read + * operations for this repository. + *

+ * API name: {@code total_read_throttled_time_nanos} + */ + public final long totalReadThrottledTimeNanos() { + return this.totalReadThrottledTimeNanos; + } + + /** + * Required - The cumulative time, in nanoseconds, spent throttling write + * operations for this repository. + *

+ * API name: {@code total_write_throttled_time_nanos} + */ + public final long totalWriteThrottledTimeNanos() { + return this.totalWriteThrottledTimeNanos; + } + + /** + * Required - The number of shard snapshots started for this repository. + *

+ * API name: {@code shard_snapshots_started} + */ + public final long shardSnapshotsStarted() { + return this.shardSnapshotsStarted; + } + + /** + * Required - The number of shard snapshots completed for this repository. + *

+ * API name: {@code shard_snapshots_completed} + */ + public final long shardSnapshotsCompleted() { + return this.shardSnapshotsCompleted; + } + + /** + * Required - The number of shard snapshots currently in progress for this + * repository. + *

+ * API name: {@code shard_snapshots_in_progress} + */ + public final long shardSnapshotsInProgress() { + return this.shardSnapshotsInProgress; + } + + /** + * Required - The number of blobs uploaded to this repository. + *

+ * API name: {@code uploaded_blobs} + */ + public final long uploadedBlobs() { + return this.uploadedBlobs; + } + + /** + * The cumulative size of the blobs uploaded to this repository. + *

+ * API name: {@code uploaded_size} + */ + @Nullable + public final String uploadedSize() { + return this.uploadedSize; + } + + /** + * Required - The cumulative size, in bytes, of the blobs uploaded to this + * repository. + *

+ * API name: {@code uploaded_size_in_bytes} + */ + public final long uploadedSizeInBytes() { + return this.uploadedSizeInBytes; + } + + /** + * The cumulative time spent uploading blobs to this repository. + *

+ * API name: {@code total_upload_time} + */ + @Nullable + public final Time totalUploadTime() { + return this.totalUploadTime; + } + + /** + * Required - The cumulative time, in milliseconds, spent uploading blobs to + * this repository. + *

+ * API name: {@code total_upload_time_in_millis} + */ + public final long totalUploadTimeInMillis() { + return this.totalUploadTimeInMillis; + } + + /** + * The cumulative time spent reading blobs while uploading to this repository. + *

+ * API name: {@code total_read_time} + */ + @Nullable + public final Time totalReadTime() { + return this.totalReadTime; + } + + /** + * Required - The cumulative time, in milliseconds, spent reading blobs while + * uploading to this repository. + *

+ * API name: {@code total_read_time_in_millis} + */ + public final long totalReadTimeInMillis() { + return this.totalReadTimeInMillis; + } + + /** + * 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.totalReadThrottledTime != null) { + generator.writeKey("total_read_throttled_time"); + this.totalReadThrottledTime.serialize(generator, mapper); + + } + if (this.totalWriteThrottledTime != null) { + generator.writeKey("total_write_throttled_time"); + this.totalWriteThrottledTime.serialize(generator, mapper); + + } + generator.writeKey("total_read_throttled_time_nanos"); + generator.write(this.totalReadThrottledTimeNanos); + + generator.writeKey("total_write_throttled_time_nanos"); + generator.write(this.totalWriteThrottledTimeNanos); + + generator.writeKey("shard_snapshots_started"); + generator.write(this.shardSnapshotsStarted); + + generator.writeKey("shard_snapshots_completed"); + generator.write(this.shardSnapshotsCompleted); + + generator.writeKey("shard_snapshots_in_progress"); + generator.write(this.shardSnapshotsInProgress); + + generator.writeKey("uploaded_blobs"); + generator.write(this.uploadedBlobs); + + if (this.uploadedSize != null) { + generator.writeKey("uploaded_size"); + generator.write(this.uploadedSize); + + } + generator.writeKey("uploaded_size_in_bytes"); + generator.write(this.uploadedSizeInBytes); + + if (this.totalUploadTime != null) { + generator.writeKey("total_upload_time"); + this.totalUploadTime.serialize(generator, mapper); + + } + generator.writeKey("total_upload_time_in_millis"); + generator.write(this.totalUploadTimeInMillis); + + if (this.totalReadTime != null) { + generator.writeKey("total_read_time"); + this.totalReadTime.serialize(generator, mapper); + + } + generator.writeKey("total_read_time_in_millis"); + generator.write(this.totalReadTimeInMillis); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RepositorySnapshotStats}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + @Nullable + private Time totalReadThrottledTime; + + @Nullable + private Time totalWriteThrottledTime; + + private Long totalReadThrottledTimeNanos; + + private Long totalWriteThrottledTimeNanos; + + private Long shardSnapshotsStarted; + + private Long shardSnapshotsCompleted; + + private Long shardSnapshotsInProgress; + + private Long uploadedBlobs; + + @Nullable + private String uploadedSize; + + private Long uploadedSizeInBytes; + + @Nullable + private Time totalUploadTime; + + private Long totalUploadTimeInMillis; + + @Nullable + private Time totalReadTime; + + private Long totalReadTimeInMillis; + + public Builder() { + } + private Builder(RepositorySnapshotStats instance) { + this.totalReadThrottledTime = instance.totalReadThrottledTime; + this.totalWriteThrottledTime = instance.totalWriteThrottledTime; + this.totalReadThrottledTimeNanos = instance.totalReadThrottledTimeNanos; + this.totalWriteThrottledTimeNanos = instance.totalWriteThrottledTimeNanos; + this.shardSnapshotsStarted = instance.shardSnapshotsStarted; + this.shardSnapshotsCompleted = instance.shardSnapshotsCompleted; + this.shardSnapshotsInProgress = instance.shardSnapshotsInProgress; + this.uploadedBlobs = instance.uploadedBlobs; + this.uploadedSize = instance.uploadedSize; + this.uploadedSizeInBytes = instance.uploadedSizeInBytes; + this.totalUploadTime = instance.totalUploadTime; + this.totalUploadTimeInMillis = instance.totalUploadTimeInMillis; + this.totalReadTime = instance.totalReadTime; + this.totalReadTimeInMillis = instance.totalReadTimeInMillis; + + } + /** + * The cumulative time spent throttling read operations for this repository. + *

+ * API name: {@code total_read_throttled_time} + */ + public final Builder totalReadThrottledTime(@Nullable Time value) { + this.totalReadThrottledTime = value; + return this; + } + + /** + * The cumulative time spent throttling read operations for this repository. + *

+ * API name: {@code total_read_throttled_time} + */ + public final Builder totalReadThrottledTime(Function> fn) { + return this.totalReadThrottledTime(fn.apply(new Time.Builder()).build()); + } + + /** + * The cumulative time spent throttling write operations for this repository. + *

+ * API name: {@code total_write_throttled_time} + */ + public final Builder totalWriteThrottledTime(@Nullable Time value) { + this.totalWriteThrottledTime = value; + return this; + } + + /** + * The cumulative time spent throttling write operations for this repository. + *

+ * API name: {@code total_write_throttled_time} + */ + public final Builder totalWriteThrottledTime(Function> fn) { + return this.totalWriteThrottledTime(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - The cumulative time, in nanoseconds, spent throttling read + * operations for this repository. + *

+ * API name: {@code total_read_throttled_time_nanos} + */ + public final Builder totalReadThrottledTimeNanos(long value) { + this.totalReadThrottledTimeNanos = value; + return this; + } + + /** + * Required - The cumulative time, in nanoseconds, spent throttling write + * operations for this repository. + *

+ * API name: {@code total_write_throttled_time_nanos} + */ + public final Builder totalWriteThrottledTimeNanos(long value) { + this.totalWriteThrottledTimeNanos = value; + return this; + } + + /** + * Required - The number of shard snapshots started for this repository. + *

+ * API name: {@code shard_snapshots_started} + */ + public final Builder shardSnapshotsStarted(long value) { + this.shardSnapshotsStarted = value; + return this; + } + + /** + * Required - The number of shard snapshots completed for this repository. + *

+ * API name: {@code shard_snapshots_completed} + */ + public final Builder shardSnapshotsCompleted(long value) { + this.shardSnapshotsCompleted = value; + return this; + } + + /** + * Required - The number of shard snapshots currently in progress for this + * repository. + *

+ * API name: {@code shard_snapshots_in_progress} + */ + public final Builder shardSnapshotsInProgress(long value) { + this.shardSnapshotsInProgress = value; + return this; + } + + /** + * Required - The number of blobs uploaded to this repository. + *

+ * API name: {@code uploaded_blobs} + */ + public final Builder uploadedBlobs(long value) { + this.uploadedBlobs = value; + return this; + } + + /** + * The cumulative size of the blobs uploaded to this repository. + *

+ * API name: {@code uploaded_size} + */ + public final Builder uploadedSize(@Nullable String value) { + this.uploadedSize = value; + return this; + } + + /** + * Required - The cumulative size, in bytes, of the blobs uploaded to this + * repository. + *

+ * API name: {@code uploaded_size_in_bytes} + */ + public final Builder uploadedSizeInBytes(long value) { + this.uploadedSizeInBytes = value; + return this; + } + + /** + * The cumulative time spent uploading blobs to this repository. + *

+ * API name: {@code total_upload_time} + */ + public final Builder totalUploadTime(@Nullable Time value) { + this.totalUploadTime = value; + return this; + } + + /** + * The cumulative time spent uploading blobs to this repository. + *

+ * API name: {@code total_upload_time} + */ + public final Builder totalUploadTime(Function> fn) { + return this.totalUploadTime(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - The cumulative time, in milliseconds, spent uploading blobs to + * this repository. + *

+ * API name: {@code total_upload_time_in_millis} + */ + public final Builder totalUploadTimeInMillis(long value) { + this.totalUploadTimeInMillis = value; + return this; + } + + /** + * The cumulative time spent reading blobs while uploading to this repository. + *

+ * API name: {@code total_read_time} + */ + public final Builder totalReadTime(@Nullable Time value) { + this.totalReadTime = value; + return this; + } + + /** + * The cumulative time spent reading blobs while uploading to this repository. + *

+ * API name: {@code total_read_time} + */ + public final Builder totalReadTime(Function> fn) { + return this.totalReadTime(fn.apply(new Time.Builder()).build()); + } + + /** + * Required - The cumulative time, in milliseconds, spent reading blobs while + * uploading to this repository. + *

+ * API name: {@code total_read_time_in_millis} + */ + public final Builder totalReadTimeInMillis(long value) { + this.totalReadTimeInMillis = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link RepositorySnapshotStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public RepositorySnapshotStats build() { + _checkSingleUse(); + + return new RepositorySnapshotStats(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RepositorySnapshotStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, RepositorySnapshotStats::setupRepositorySnapshotStatsDeserializer); + + protected static void setupRepositorySnapshotStatsDeserializer( + ObjectDeserializer op) { + + op.add(Builder::totalReadThrottledTime, Time._DESERIALIZER, "total_read_throttled_time"); + op.add(Builder::totalWriteThrottledTime, Time._DESERIALIZER, "total_write_throttled_time"); + op.add(Builder::totalReadThrottledTimeNanos, JsonpDeserializer.longDeserializer(), + "total_read_throttled_time_nanos"); + op.add(Builder::totalWriteThrottledTimeNanos, JsonpDeserializer.longDeserializer(), + "total_write_throttled_time_nanos"); + op.add(Builder::shardSnapshotsStarted, JsonpDeserializer.longDeserializer(), "shard_snapshots_started"); + op.add(Builder::shardSnapshotsCompleted, JsonpDeserializer.longDeserializer(), "shard_snapshots_completed"); + op.add(Builder::shardSnapshotsInProgress, JsonpDeserializer.longDeserializer(), "shard_snapshots_in_progress"); + op.add(Builder::uploadedBlobs, JsonpDeserializer.longDeserializer(), "uploaded_blobs"); + op.add(Builder::uploadedSize, JsonpDeserializer.stringDeserializer(), "uploaded_size"); + op.add(Builder::uploadedSizeInBytes, JsonpDeserializer.longDeserializer(), "uploaded_size_in_bytes"); + op.add(Builder::totalUploadTime, Time._DESERIALIZER, "total_upload_time"); + op.add(Builder::totalUploadTimeInMillis, JsonpDeserializer.longDeserializer(), "total_upload_time_in_millis"); + op.add(Builder::totalReadTime, Time._DESERIALIZER, "total_read_time"); + op.add(Builder::totalReadTimeInMillis, JsonpDeserializer.longDeserializer(), "total_read_time_in_millis"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/SizeHttpHistogram.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/SizeHttpHistogram.java index ac4d0b2121..a3795f5eea 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/SizeHttpHistogram.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/SizeHttpHistogram.java @@ -31,6 +31,7 @@ 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; @@ -61,9 +62,15 @@ public class SizeHttpHistogram implements JsonpSerializable { private final long count; + @Nullable + private final String ge; + @Nullable private final Long geBytes; + @Nullable + private final String lt; + @Nullable private final Long ltBytes; @@ -72,7 +79,9 @@ public class SizeHttpHistogram implements JsonpSerializable { private SizeHttpHistogram(Builder builder) { this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count", 0); + this.ge = builder.ge; this.geBytes = builder.geBytes; + this.lt = builder.lt; this.ltBytes = builder.ltBytes; } @@ -88,6 +97,14 @@ public final long count() { return this.count; } + /** + * API name: {@code ge} + */ + @Nullable + public final String ge() { + return this.ge; + } + /** * API name: {@code ge_bytes} */ @@ -96,6 +113,14 @@ public final Long geBytes() { return this.geBytes; } + /** + * API name: {@code lt} + */ + @Nullable + public final String lt() { + return this.lt; + } + /** * API name: {@code lt_bytes} */ @@ -118,10 +143,20 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("count"); generator.write(this.count); + if (this.ge != null) { + generator.writeKey("ge"); + generator.write(this.ge); + + } if (this.geBytes != null) { generator.writeKey("ge_bytes"); generator.write(this.geBytes); + } + if (this.lt != null) { + generator.writeKey("lt"); + generator.write(this.lt); + } if (this.ltBytes != null) { generator.writeKey("lt_bytes"); @@ -145,9 +180,15 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { private Long count; + @Nullable + private String ge; + @Nullable private Long geBytes; + @Nullable + private String lt; + @Nullable private Long ltBytes; @@ -155,7 +196,9 @@ public Builder() { } private Builder(SizeHttpHistogram instance) { this.count = instance.count; + this.ge = instance.ge; this.geBytes = instance.geBytes; + this.lt = instance.lt; this.ltBytes = instance.ltBytes; } @@ -167,6 +210,14 @@ public final Builder count(long value) { return this; } + /** + * API name: {@code ge} + */ + public final Builder ge(@Nullable String value) { + this.ge = value; + return this; + } + /** * API name: {@code ge_bytes} */ @@ -175,6 +226,14 @@ public final Builder geBytes(@Nullable Long value) { return this; } + /** + * API name: {@code lt} + */ + public final Builder lt(@Nullable String value) { + this.lt = value; + return this; + } + /** * API name: {@code lt_bytes} */ @@ -218,7 +277,9 @@ public Builder rebuild() { protected static void setupSizeHttpHistogramDeserializer(ObjectDeserializer op) { op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); + op.add(Builder::ge, JsonpDeserializer.stringDeserializer(), "ge"); op.add(Builder::geBytes, JsonpDeserializer.longDeserializer(), "ge_bytes"); + op.add(Builder::lt, JsonpDeserializer.stringDeserializer(), "lt"); op.add(Builder::ltBytes, JsonpDeserializer.longDeserializer(), "lt_bytes"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Stats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Stats.java index 59e6006b68..2f32b570a6 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Stats.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Stats.java @@ -66,6 +66,9 @@ public class Stats implements JsonpSerializable { private final Map adaptiveSelection; + @Nullable + private final Allocations allocations; + private final Map breakers; @Nullable @@ -123,11 +126,14 @@ public class Stats implements JsonpSerializable { @Nullable private final ShardStats indices; + private final Map repositories; + // --------------------------------------------------------------------------------------------- private Stats(Builder builder) { this.adaptiveSelection = ApiTypeHelper.unmodifiable(builder.adaptiveSelection); + this.allocations = builder.allocations; this.breakers = ApiTypeHelper.unmodifiable(builder.breakers); this.fs = builder.fs; this.host = builder.host; @@ -149,6 +155,7 @@ private Stats(Builder builder) { this.discovery = builder.discovery; this.indexingPressure = builder.indexingPressure; this.indices = builder.indices; + this.repositories = ApiTypeHelper.unmodifiable(builder.repositories); } @@ -165,6 +172,16 @@ public final Map adaptiveSelection() { return this.adaptiveSelection; } + /** + * Statistics about shard allocations on the node. + *

+ * API name: {@code allocations} + */ + @Nullable + public final Allocations allocations() { + return this.allocations; + } + /** * Statistics about the field data circuit breaker. *

@@ -369,6 +386,16 @@ public final ShardStats indices() { return this.indices; } + /** + * Statistics about snapshot activity for the node's registered repositories, + * keyed by repository name. + *

+ * API name: {@code repositories} + */ + public final Map repositories() { + return this.repositories; + } + /** * Serialize this object to JSON. */ @@ -390,6 +417,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + if (this.allocations != null) { + generator.writeKey("allocations"); + this.allocations.serialize(generator, mapper); + } if (ApiTypeHelper.isDefined(this.breakers)) { generator.writeKey("breakers"); @@ -536,6 +568,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.indices.serialize(generator, mapper); } + if (ApiTypeHelper.isDefined(this.repositories)) { + generator.writeKey("repositories"); + generator.writeStartObject(); + for (Map.Entry item0 : this.repositories.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } } @@ -554,6 +597,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private Map adaptiveSelection; + @Nullable + private Allocations allocations; + @Nullable private Map breakers; @@ -617,10 +663,14 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private ShardStats indices; + @Nullable + private Map repositories; + public Builder() { } private Builder(Stats instance) { this.adaptiveSelection = instance.adaptiveSelection; + this.allocations = instance.allocations; this.breakers = instance.breakers; this.fs = instance.fs; this.host = instance.host; @@ -642,6 +692,7 @@ private Builder(Stats instance) { this.discovery = instance.discovery; this.indexingPressure = instance.indexingPressure; this.indices = instance.indices; + this.repositories = instance.repositories; } /** @@ -680,6 +731,25 @@ public final Builder adaptiveSelection(String key, return adaptiveSelection(key, fn.apply(new AdaptiveSelection.Builder()).build()); } + /** + * Statistics about shard allocations on the node. + *

+ * API name: {@code allocations} + */ + public final Builder allocations(@Nullable Allocations value) { + this.allocations = value; + return this; + } + + /** + * Statistics about shard allocations on the node. + *

+ * API name: {@code allocations} + */ + public final Builder allocations(Function> fn) { + return this.allocations(fn.apply(new Allocations.Builder()).build()); + } + /** * Statistics about the field data circuit breaker. *

@@ -1097,6 +1167,45 @@ public final Builder indices(Function + * API name: {@code repositories} + *

+ * Adds all entries of map to repositories. + */ + public final Builder repositories(Map map) { + this.repositories = _mapPutAll(this.repositories, map); + return this; + } + + /** + * Statistics about snapshot activity for the node's registered repositories, + * keyed by repository name. + *

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

+ * Adds an entry to repositories. + */ + public final Builder repositories(String key, RepositorySnapshotStats value) { + this.repositories = _mapPut(this.repositories, key, value); + return this; + } + + /** + * Statistics about snapshot activity for the node's registered repositories, + * keyed by repository name. + *

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

+ * Adds an entry to repositories using a builder lambda. + */ + public final Builder repositories(String key, + Function> fn) { + return repositories(key, fn.apply(new RepositorySnapshotStats.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -1133,6 +1242,7 @@ protected static void setupStatsDeserializer(ObjectDeserializer o op.add(Builder::adaptiveSelection, JsonpDeserializer.stringMapDeserializer(AdaptiveSelection._DESERIALIZER), "adaptive_selection"); + op.add(Builder::allocations, Allocations._DESERIALIZER, "allocations"); op.add(Builder::breakers, JsonpDeserializer.stringMapDeserializer(Breaker._DESERIALIZER), "breakers"); op.add(Builder::fs, FileSystem._DESERIALIZER, "fs"); op.add(Builder::host, JsonpDeserializer.stringDeserializer(), "host"); @@ -1157,6 +1267,8 @@ protected static void setupStatsDeserializer(ObjectDeserializer o op.add(Builder::discovery, Discovery._DESERIALIZER, "discovery"); op.add(Builder::indexingPressure, IndexingPressure._DESERIALIZER, "indexing_pressure"); op.add(Builder::indices, ShardStats._DESERIALIZER, "indices"); + op.add(Builder::repositories, JsonpDeserializer.stringMapDeserializer(RepositorySnapshotStats._DESERIALIZER), + "repositories"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/TimeHttpHistogram.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/TimeHttpHistogram.java index acef22c28a..7dcd7da3fe 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/TimeHttpHistogram.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/TimeHttpHistogram.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch.nodes; +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; @@ -61,9 +62,15 @@ public class TimeHttpHistogram implements JsonpSerializable { private final long count; + @Nullable + private final Time ge; + @Nullable private final Long geMillis; + @Nullable + private final Time lt; + @Nullable private final Long ltMillis; @@ -72,7 +79,9 @@ public class TimeHttpHistogram implements JsonpSerializable { private TimeHttpHistogram(Builder builder) { this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count", 0); + this.ge = builder.ge; this.geMillis = builder.geMillis; + this.lt = builder.lt; this.ltMillis = builder.ltMillis; } @@ -88,6 +97,14 @@ public final long count() { return this.count; } + /** + * API name: {@code ge} + */ + @Nullable + public final Time ge() { + return this.ge; + } + /** * API name: {@code ge_millis} */ @@ -96,6 +113,14 @@ public final Long geMillis() { return this.geMillis; } + /** + * API name: {@code lt} + */ + @Nullable + public final Time lt() { + return this.lt; + } + /** * API name: {@code lt_millis} */ @@ -118,10 +143,20 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("count"); generator.write(this.count); + if (this.ge != null) { + generator.writeKey("ge"); + this.ge.serialize(generator, mapper); + + } if (this.geMillis != null) { generator.writeKey("ge_millis"); generator.write(this.geMillis); + } + if (this.lt != null) { + generator.writeKey("lt"); + this.lt.serialize(generator, mapper); + } if (this.ltMillis != null) { generator.writeKey("lt_millis"); @@ -145,9 +180,15 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { private Long count; + @Nullable + private Time ge; + @Nullable private Long geMillis; + @Nullable + private Time lt; + @Nullable private Long ltMillis; @@ -155,7 +196,9 @@ public Builder() { } private Builder(TimeHttpHistogram instance) { this.count = instance.count; + this.ge = instance.ge; this.geMillis = instance.geMillis; + this.lt = instance.lt; this.ltMillis = instance.ltMillis; } @@ -167,6 +210,21 @@ public final Builder count(long value) { return this; } + /** + * API name: {@code ge} + */ + public final Builder ge(@Nullable Time value) { + this.ge = value; + return this; + } + + /** + * API name: {@code ge} + */ + public final Builder ge(Function> fn) { + return this.ge(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code ge_millis} */ @@ -175,6 +233,21 @@ public final Builder geMillis(@Nullable Long value) { return this; } + /** + * API name: {@code lt} + */ + public final Builder lt(@Nullable Time value) { + this.lt = value; + return this; + } + + /** + * API name: {@code lt} + */ + public final Builder lt(Function> fn) { + return this.lt(fn.apply(new Time.Builder()).build()); + } + /** * API name: {@code lt_millis} */ @@ -218,7 +291,9 @@ public Builder rebuild() { protected static void setupTimeHttpHistogramDeserializer(ObjectDeserializer op) { op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); + op.add(Builder::ge, Time._DESERIALIZER, "ge"); op.add(Builder::geMillis, JsonpDeserializer.longDeserializer(), "ge_millis"); + op.add(Builder::lt, Time._DESERIALIZER, "lt"); op.add(Builder::ltMillis, JsonpDeserializer.longDeserializer(), "lt_millis"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Transport.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Transport.java index 324467b10b..e122607343 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Transport.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/Transport.java @@ -34,6 +34,7 @@ import java.lang.Long; import java.lang.String; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -90,6 +91,8 @@ public class Transport implements JsonpSerializable { @Nullable private final Long totalOutboundConnections; + private final Map actions; + // --------------------------------------------------------------------------------------------- private Transport(Builder builder) { @@ -104,6 +107,7 @@ private Transport(Builder builder) { this.txSize = builder.txSize; this.txSizeInBytes = builder.txSizeInBytes; this.totalOutboundConnections = builder.totalOutboundConnections; + this.actions = ApiTypeHelper.unmodifiable(builder.actions); } @@ -221,6 +225,16 @@ public final Long totalOutboundConnections() { return this.totalOutboundConnections; } + /** + * Statistics about the transport messages sent and received by the node, broken + * down by action name. + *

+ * API name: {@code actions} + */ + public final Map actions() { + return this.actions; + } + /** * Serialize this object to JSON. */ @@ -292,6 +306,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.write(this.totalOutboundConnections); } + if (ApiTypeHelper.isDefined(this.actions)) { + generator.writeKey("actions"); + generator.writeStartObject(); + for (Map.Entry item0 : this.actions.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } } @@ -337,6 +362,9 @@ public static class Builder extends WithJsonObjectBuilderBase implement @Nullable private Long totalOutboundConnections; + @Nullable + private Map actions; + public Builder() { } private Builder(Transport instance) { @@ -350,6 +378,7 @@ private Builder(Transport instance) { this.txSize = instance.txSize; this.txSizeInBytes = instance.txSizeInBytes; this.totalOutboundConnections = instance.totalOutboundConnections; + this.actions = instance.actions; } /** @@ -524,6 +553,45 @@ public final Builder totalOutboundConnections(@Nullable Long value) { return this; } + /** + * Statistics about the transport messages sent and received by the node, broken + * down by action name. + *

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

+ * Adds all entries of map to actions. + */ + public final Builder actions(Map map) { + this.actions = _mapPutAll(this.actions, map); + return this; + } + + /** + * Statistics about the transport messages sent and received by the node, broken + * down by action name. + *

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

+ * Adds an entry to actions. + */ + public final Builder actions(String key, TransportActionStats value) { + this.actions = _mapPut(this.actions, key, value); + return this; + } + + /** + * Statistics about the transport messages sent and received by the node, broken + * down by action name. + *

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

+ * Adds an entry to actions using a builder lambda. + */ + public final Builder actions(String key, + Function> fn) { + return actions(key, fn.apply(new TransportActionStats.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -572,6 +640,8 @@ protected static void setupTransportDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public class TransportActionMessageStats implements JsonpSerializable { + private final long count; + + @Nullable + private final String totalSize; + + private final long totalSizeInBytes; + + private final List histogram; + + // --------------------------------------------------------------------------------------------- + + private TransportActionMessageStats(Builder builder) { + + this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count", 0); + this.totalSize = builder.totalSize; + this.totalSizeInBytes = ApiTypeHelper.requireNonNull(builder.totalSizeInBytes, this, "totalSizeInBytes", 0); + this.histogram = ApiTypeHelper.unmodifiableRequired(builder.histogram, this, "histogram"); + + } + + public static TransportActionMessageStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The number of messages of this kind that the node has handled for + * this action. + *

+ * API name: {@code count} + */ + public final long count() { + return this.count; + } + + /** + * The cumulative size of the messages of this kind that the node has handled + * for this action. + *

+ * API name: {@code total_size} + */ + @Nullable + public final String totalSize() { + return this.totalSize; + } + + /** + * Required - The cumulative size, in bytes, of the messages of this kind that + * the node has handled for this action. + *

+ * API name: {@code total_size_in_bytes} + */ + public final long totalSizeInBytes() { + return this.totalSizeInBytes; + } + + /** + * Required - The distribution of the sizes of the messages of this kind that + * the node has handled for this action, represented as a histogram. + *

+ * API name: {@code histogram} + */ + public final List histogram() { + return this.histogram; + } + + /** + * 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("count"); + generator.write(this.count); + + if (this.totalSize != null) { + generator.writeKey("total_size"); + generator.write(this.totalSize); + + } + generator.writeKey("total_size_in_bytes"); + generator.write(this.totalSizeInBytes); + + if (ApiTypeHelper.isDefined(this.histogram)) { + generator.writeKey("histogram"); + generator.writeStartArray(); + for (TransportMessageSizeHistogramBucket item0 : this.histogram) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link TransportActionMessageStats}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private Long count; + + @Nullable + private String totalSize; + + private Long totalSizeInBytes; + + private List histogram; + + public Builder() { + } + private Builder(TransportActionMessageStats instance) { + this.count = instance.count; + this.totalSize = instance.totalSize; + this.totalSizeInBytes = instance.totalSizeInBytes; + this.histogram = instance.histogram; + + } + /** + * Required - The number of messages of this kind that the node has handled for + * this action. + *

+ * API name: {@code count} + */ + public final Builder count(long value) { + this.count = value; + return this; + } + + /** + * The cumulative size of the messages of this kind that the node has handled + * for this action. + *

+ * API name: {@code total_size} + */ + public final Builder totalSize(@Nullable String value) { + this.totalSize = value; + return this; + } + + /** + * Required - The cumulative size, in bytes, of the messages of this kind that + * the node has handled for this action. + *

+ * API name: {@code total_size_in_bytes} + */ + public final Builder totalSizeInBytes(long value) { + this.totalSizeInBytes = value; + return this; + } + + /** + * Required - The distribution of the sizes of the messages of this kind that + * the node has handled for this action, represented as a histogram. + *

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

+ * Adds all elements of list to histogram. + */ + public final Builder histogram(List list) { + this.histogram = _listAddAll(this.histogram, list); + return this; + } + + /** + * Required - The distribution of the sizes of the messages of this kind that + * the node has handled for this action, represented as a histogram. + *

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

+ * Adds one or more values to histogram. + */ + public final Builder histogram(TransportMessageSizeHistogramBucket value, + TransportMessageSizeHistogramBucket... values) { + this.histogram = _listAdd(this.histogram, value, values); + return this; + } + + /** + * Required - The distribution of the sizes of the messages of this kind that + * the node has handled for this action, represented as a histogram. + *

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

+ * Adds a value to histogram using a builder lambda. + */ + public final Builder histogram( + Function> fn) { + return histogram(fn.apply(new TransportMessageSizeHistogramBucket.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link TransportActionMessageStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public TransportActionMessageStats build() { + _checkSingleUse(); + + return new TransportActionMessageStats(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link TransportActionMessageStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, TransportActionMessageStats::setupTransportActionMessageStatsDeserializer); + + protected static void setupTransportActionMessageStatsDeserializer( + ObjectDeserializer op) { + + op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); + op.add(Builder::totalSize, JsonpDeserializer.stringDeserializer(), "total_size"); + op.add(Builder::totalSizeInBytes, JsonpDeserializer.longDeserializer(), "total_size_in_bytes"); + op.add(Builder::histogram, + JsonpDeserializer.arrayDeserializer(TransportMessageSizeHistogramBucket._DESERIALIZER), "histogram"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/TransportActionStats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/TransportActionStats.java new file mode 100644 index 0000000000..60679cdff1 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/TransportActionStats.java @@ -0,0 +1,220 @@ +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package co.elastic.clients.elasticsearch.nodes; + +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: nodes._types.TransportActionStats + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class TransportActionStats implements JsonpSerializable { + private final TransportActionMessageStats requests; + + private final TransportActionMessageStats responses; + + // --------------------------------------------------------------------------------------------- + + private TransportActionStats(Builder builder) { + + this.requests = ApiTypeHelper.requireNonNull(builder.requests, this, "requests"); + this.responses = ApiTypeHelper.requireNonNull(builder.responses, this, "responses"); + + } + + public static TransportActionStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Statistics about the requests received for this action. + *

+ * API name: {@code requests} + */ + public final TransportActionMessageStats requests() { + return this.requests; + } + + /** + * Required - Statistics about the responses sent for this action. + *

+ * API name: {@code responses} + */ + public final TransportActionMessageStats responses() { + return this.responses; + } + + /** + * 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("requests"); + this.requests.serialize(generator, mapper); + + generator.writeKey("responses"); + this.responses.serialize(generator, mapper); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link TransportActionStats}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private TransportActionMessageStats requests; + + private TransportActionMessageStats responses; + + public Builder() { + } + private Builder(TransportActionStats instance) { + this.requests = instance.requests; + this.responses = instance.responses; + + } + /** + * Required - Statistics about the requests received for this action. + *

+ * API name: {@code requests} + */ + public final Builder requests(TransportActionMessageStats value) { + this.requests = value; + return this; + } + + /** + * Required - Statistics about the requests received for this action. + *

+ * API name: {@code requests} + */ + public final Builder requests( + Function> fn) { + return this.requests(fn.apply(new TransportActionMessageStats.Builder()).build()); + } + + /** + * Required - Statistics about the responses sent for this action. + *

+ * API name: {@code responses} + */ + public final Builder responses(TransportActionMessageStats value) { + this.responses = value; + return this; + } + + /** + * Required - Statistics about the responses sent for this action. + *

+ * API name: {@code responses} + */ + public final Builder responses( + Function> fn) { + return this.responses(fn.apply(new TransportActionMessageStats.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link TransportActionStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public TransportActionStats build() { + _checkSingleUse(); + + return new TransportActionStats(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link TransportActionStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, TransportActionStats::setupTransportActionStatsDeserializer); + + protected static void setupTransportActionStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::requests, TransportActionMessageStats._DESERIALIZER, "requests"); + op.add(Builder::responses, TransportActionMessageStats._DESERIALIZER, "responses"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/TransportHistogram.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/TransportHistogram.java index d5e4dea152..afe394b030 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/TransportHistogram.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/TransportHistogram.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch.nodes; +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; @@ -61,9 +62,15 @@ public class TransportHistogram implements JsonpSerializable { @Nullable private final Long count; + @Nullable + private final Time lt; + @Nullable private final Long ltMillis; + @Nullable + private final Time ge; + @Nullable private final Long geMillis; @@ -72,7 +79,9 @@ public class TransportHistogram implements JsonpSerializable { private TransportHistogram(Builder builder) { this.count = builder.count; + this.lt = builder.lt; this.ltMillis = builder.ltMillis; + this.ge = builder.ge; this.geMillis = builder.geMillis; } @@ -92,6 +101,17 @@ public final Long count() { return this.count; } + /** + * The exclusive upper bound of the bucket. May be omitted on the last bucket if + * this bucket has no upper bound. + *

+ * API name: {@code lt} + */ + @Nullable + public final Time lt() { + return this.lt; + } + /** * The exclusive upper bound of the bucket in milliseconds. May be omitted on * the last bucket if this bucket has no upper bound. @@ -103,6 +123,17 @@ public final Long ltMillis() { return this.ltMillis; } + /** + * The inclusive lower bound of the bucket. May be omitted on the first bucket + * if this bucket has no lower bound. + *

+ * API name: {@code ge} + */ + @Nullable + public final Time ge() { + return this.ge; + } + /** * The inclusive lower bound of the bucket in milliseconds. May be omitted on * the first bucket if this bucket has no lower bound. @@ -129,11 +160,21 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("count"); generator.write(this.count); + } + if (this.lt != null) { + generator.writeKey("lt"); + this.lt.serialize(generator, mapper); + } if (this.ltMillis != null) { generator.writeKey("lt_millis"); generator.write(this.ltMillis); + } + if (this.ge != null) { + generator.writeKey("ge"); + this.ge.serialize(generator, mapper); + } if (this.geMillis != null) { generator.writeKey("ge_millis"); @@ -160,9 +201,15 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private Long count; + @Nullable + private Time lt; + @Nullable private Long ltMillis; + @Nullable + private Time ge; + @Nullable private Long geMillis; @@ -170,7 +217,9 @@ public Builder() { } private Builder(TransportHistogram instance) { this.count = instance.count; + this.lt = instance.lt; this.ltMillis = instance.ltMillis; + this.ge = instance.ge; this.geMillis = instance.geMillis; } @@ -185,6 +234,27 @@ public final Builder count(@Nullable Long value) { return this; } + /** + * The exclusive upper bound of the bucket. May be omitted on the last bucket if + * this bucket has no upper bound. + *

+ * API name: {@code lt} + */ + public final Builder lt(@Nullable Time value) { + this.lt = value; + return this; + } + + /** + * The exclusive upper bound of the bucket. May be omitted on the last bucket if + * this bucket has no upper bound. + *

+ * API name: {@code lt} + */ + public final Builder lt(Function> fn) { + return this.lt(fn.apply(new Time.Builder()).build()); + } + /** * The exclusive upper bound of the bucket in milliseconds. May be omitted on * the last bucket if this bucket has no upper bound. @@ -196,6 +266,27 @@ public final Builder ltMillis(@Nullable Long value) { return this; } + /** + * The inclusive lower bound of the bucket. May be omitted on the first bucket + * if this bucket has no lower bound. + *

+ * API name: {@code ge} + */ + public final Builder ge(@Nullable Time value) { + this.ge = value; + return this; + } + + /** + * The inclusive lower bound of the bucket. May be omitted on the first bucket + * if this bucket has no lower bound. + *

+ * API name: {@code ge} + */ + public final Builder ge(Function> fn) { + return this.ge(fn.apply(new Time.Builder()).build()); + } + /** * The inclusive lower bound of the bucket in milliseconds. May be omitted on * the first bucket if this bucket has no lower bound. @@ -242,7 +333,9 @@ public Builder rebuild() { protected static void setupTransportHistogramDeserializer(ObjectDeserializer op) { op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); + op.add(Builder::lt, Time._DESERIALIZER, "lt"); op.add(Builder::ltMillis, JsonpDeserializer.longDeserializer(), "lt_millis"); + op.add(Builder::ge, Time._DESERIALIZER, "ge"); op.add(Builder::geMillis, JsonpDeserializer.longDeserializer(), "ge_millis"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/TransportMessageSizeHistogramBucket.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/TransportMessageSizeHistogramBucket.java new file mode 100644 index 0000000000..8bb5d0ee3f --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/nodes/TransportMessageSizeHistogramBucket.java @@ -0,0 +1,323 @@ +/* + * 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.nodes; + +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.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: nodes._types.TransportMessageSizeHistogramBucket + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class TransportMessageSizeHistogramBucket implements JsonpSerializable { + private final long count; + + @Nullable + private final String ge; + + @Nullable + private final Long geBytes; + + @Nullable + private final String lt; + + @Nullable + private final Long ltBytes; + + // --------------------------------------------------------------------------------------------- + + private TransportMessageSizeHistogramBucket(Builder builder) { + + this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count", 0); + this.ge = builder.ge; + this.geBytes = builder.geBytes; + this.lt = builder.lt; + this.ltBytes = builder.ltBytes; + + } + + public static TransportMessageSizeHistogramBucket of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The number of messages with a size that falls within the bounds of + * this bucket. + *

+ * API name: {@code count} + */ + public final long count() { + return this.count; + } + + /** + * The inclusive lower bound of the bucket. May be omitted on the first bucket + * if this bucket has no lower bound. + *

+ * API name: {@code ge} + */ + @Nullable + public final String ge() { + return this.ge; + } + + /** + * The inclusive lower bound of the bucket in bytes. May be omitted on the first + * bucket if this bucket has no lower bound. + *

+ * API name: {@code ge_bytes} + */ + @Nullable + public final Long geBytes() { + return this.geBytes; + } + + /** + * The exclusive upper bound of the bucket. May be omitted on the last bucket if + * this bucket has no upper bound. + *

+ * API name: {@code lt} + */ + @Nullable + public final String lt() { + return this.lt; + } + + /** + * The exclusive upper bound of the bucket in bytes. May be omitted on the last + * bucket if this bucket has no upper bound. + *

+ * API name: {@code lt_bytes} + */ + @Nullable + public final Long ltBytes() { + return this.ltBytes; + } + + /** + * 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("count"); + generator.write(this.count); + + if (this.ge != null) { + generator.writeKey("ge"); + generator.write(this.ge); + + } + if (this.geBytes != null) { + generator.writeKey("ge_bytes"); + generator.write(this.geBytes); + + } + if (this.lt != null) { + generator.writeKey("lt"); + generator.write(this.lt); + + } + if (this.ltBytes != null) { + generator.writeKey("lt_bytes"); + generator.write(this.ltBytes); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link TransportMessageSizeHistogramBucket}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private Long count; + + @Nullable + private String ge; + + @Nullable + private Long geBytes; + + @Nullable + private String lt; + + @Nullable + private Long ltBytes; + + public Builder() { + } + private Builder(TransportMessageSizeHistogramBucket instance) { + this.count = instance.count; + this.ge = instance.ge; + this.geBytes = instance.geBytes; + this.lt = instance.lt; + this.ltBytes = instance.ltBytes; + + } + /** + * Required - The number of messages with a size that falls within the bounds of + * this bucket. + *

+ * API name: {@code count} + */ + public final Builder count(long value) { + this.count = value; + return this; + } + + /** + * The inclusive lower bound of the bucket. May be omitted on the first bucket + * if this bucket has no lower bound. + *

+ * API name: {@code ge} + */ + public final Builder ge(@Nullable String value) { + this.ge = value; + return this; + } + + /** + * The inclusive lower bound of the bucket in bytes. May be omitted on the first + * bucket if this bucket has no lower bound. + *

+ * API name: {@code ge_bytes} + */ + public final Builder geBytes(@Nullable Long value) { + this.geBytes = value; + return this; + } + + /** + * The exclusive upper bound of the bucket. May be omitted on the last bucket if + * this bucket has no upper bound. + *

+ * API name: {@code lt} + */ + public final Builder lt(@Nullable String value) { + this.lt = value; + return this; + } + + /** + * The exclusive upper bound of the bucket in bytes. May be omitted on the last + * bucket if this bucket has no upper bound. + *

+ * API name: {@code lt_bytes} + */ + public final Builder ltBytes(@Nullable Long value) { + this.ltBytes = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link TransportMessageSizeHistogramBucket}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public TransportMessageSizeHistogramBucket build() { + _checkSingleUse(); + + return new TransportMessageSizeHistogramBucket(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link TransportMessageSizeHistogramBucket} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, + TransportMessageSizeHistogramBucket::setupTransportMessageSizeHistogramBucketDeserializer); + + protected static void setupTransportMessageSizeHistogramBucketDeserializer( + ObjectDeserializer op) { + + op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); + op.add(Builder::ge, JsonpDeserializer.stringDeserializer(), "ge"); + op.add(Builder::geBytes, JsonpDeserializer.longDeserializer(), "ge_bytes"); + op.add(Builder::lt, JsonpDeserializer.stringDeserializer(), "lt"); + op.add(Builder::ltBytes, JsonpDeserializer.longDeserializer(), "lt_bytes"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/DataSourcePrivilege.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/DataSourcePrivilege.java new file mode 100644 index 0000000000..0c9307121d --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/DataSourcePrivilege.java @@ -0,0 +1,89 @@ +/* + * 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.security; + +import co.elastic.clients.json.JsonEnum; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public enum DataSourcePrivilege implements JsonEnum { + /** + * Grants privilege to create a data source with a matching name. + */ + Create("create"), + + /** + * Grants privilege to delete a data source with a matching name. + */ + Delete("delete"), + + /** + * Grants privilege to read a data source's metadata. + */ + ReadMetadata("read_metadata"), + + /** + * Grants privilege to attach a dataset to a data source with a matching name. + */ + Read("read"), + + /** + * Grants all data source privileges, including create, + * delete, read, and read_metadata. + */ + Manage("manage"), + + ; + + private final String jsonValue; + + DataSourcePrivilege(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + DataSourcePrivilege.values()); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/DataSourcePrivileges.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/DataSourcePrivileges.java new file mode 100644 index 0000000000..6c06b62e34 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/DataSourcePrivileges.java @@ -0,0 +1,267 @@ +/* + * 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.security; + +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.Arrays; +import java.util.List; +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: security._types.DataSourcePrivileges + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DataSourcePrivileges implements JsonpSerializable { + private final List names; + + private final List privileges; + + // --------------------------------------------------------------------------------------------- + + private DataSourcePrivileges(Builder builder) { + + this.names = ApiTypeHelper.unmodifiableRequired(builder.names, this, "names"); + this.privileges = ApiTypeHelper.unmodifiableRequired(builder.privileges, this, "privileges"); + + } + + public static DataSourcePrivileges of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - A list of data source names or wildcard patterns to which the + * permissions in this entry apply. + *

+ * API name: {@code names} + */ + public final List names() { + return this.names; + } + + /** + * Required - The data source privileges that owners of the role have for the + * specified data sources. + *

+ * API name: {@code privileges} + */ + public final List privileges() { + return this.privileges; + } + + /** + * 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.names)) { + generator.writeKey("names"); + generator.writeStartArray(); + for (String item0 : this.names) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.privileges)) { + generator.writeKey("privileges"); + generator.writeStartArray(); + for (String item0 : this.privileges) { + generator.write(item0); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DataSourcePrivileges}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private List names; + + private List privileges; + + public Builder() { + } + private Builder(DataSourcePrivileges instance) { + this.names = instance.names; + this.privileges = instance.privileges; + + } + /** + * Required - A list of data source names or wildcard patterns to which the + * permissions in this entry apply. + *

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

+ * Adds all elements of list to names. + */ + public final Builder names(List list) { + this.names = _listAddAll(this.names, list); + return this; + } + + /** + * Required - A list of data source names or wildcard patterns to which the + * permissions in this entry apply. + *

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

+ * Adds one or more values to names. + */ + public final Builder names(String value, String... values) { + this.names = _listAdd(this.names, value, values); + return this; + } + + /** + * Required - The data source privileges that owners of the role have for the + * specified data sources. + *

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

+ * Adds all elements of list to privileges. + */ + public final Builder privileges(List list) { + this.privileges = _listAddAll(this.privileges, list); + return this; + } + + /** + * Required - The data source privileges that owners of the role have for the + * specified data sources. + *

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

+ * Adds one or more values to privileges. + */ + public final Builder privileges(String value, String... values) { + this.privileges = _listAdd(this.privileges, value, values); + return this; + } + + /** + * Required - The data source privileges that owners of the role have for the + * specified data sources. + *

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

+ * Adds one or more enum values to privileges. + */ + public final Builder privileges(DataSourcePrivilege value, DataSourcePrivilege... values) { + this.privileges = _listAdd(this.privileges, value.jsonValue(), + Arrays.stream(values).map(DataSourcePrivilege::jsonValue).toArray(String[]::new)); + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DataSourcePrivileges}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DataSourcePrivileges build() { + _checkSingleUse(); + + return new DataSourcePrivileges(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DataSourcePrivileges} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DataSourcePrivileges::setupDataSourcePrivilegesDeserializer); + + protected static void setupDataSourcePrivilegesDeserializer(ObjectDeserializer op) { + + op.add(Builder::names, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "names"); + op.add(Builder::privileges, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "privileges"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GlobalPrivilege.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GlobalPrivilege.java index 22e7a62968..ebddc1bc5d 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GlobalPrivilege.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/GlobalPrivilege.java @@ -30,6 +30,7 @@ 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; @@ -60,11 +61,14 @@ public class GlobalPrivilege implements JsonpSerializable { private final ApplicationGlobalUserPrivileges application; + private final List dataSource; + // --------------------------------------------------------------------------------------------- private GlobalPrivilege(Builder builder) { this.application = ApiTypeHelper.requireNonNull(builder.application, this, "application"); + this.dataSource = ApiTypeHelper.unmodifiable(builder.dataSource); } @@ -79,6 +83,16 @@ public final ApplicationGlobalUserPrivileges application() { return this.application; } + /** + * A list of data source privilege entries, used to grant access to ES|QL data + * sources. + *

+ * API name: {@code data_source} + */ + public final List dataSource() { + return this.dataSource; + } + /** * Serialize this object to JSON. */ @@ -93,6 +107,17 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("application"); this.application.serialize(generator, mapper); + if (ApiTypeHelper.isDefined(this.dataSource)) { + generator.writeKey("data_source"); + generator.writeStartArray(); + for (DataSourcePrivileges item0 : this.dataSource) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + } @Override @@ -109,10 +134,14 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { private ApplicationGlobalUserPrivileges application; + @Nullable + private List dataSource; + public Builder() { } private Builder(GlobalPrivilege instance) { this.application = instance.application; + this.dataSource = instance.dataSource; } /** @@ -131,6 +160,45 @@ public final Builder application( return this.application(fn.apply(new ApplicationGlobalUserPrivileges.Builder()).build()); } + /** + * A list of data source privilege entries, used to grant access to ES|QL data + * sources. + *

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

+ * Adds all elements of list to dataSource. + */ + public final Builder dataSource(List list) { + this.dataSource = _listAddAll(this.dataSource, list); + return this; + } + + /** + * A list of data source privilege entries, used to grant access to ES|QL data + * sources. + *

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

+ * Adds one or more values to dataSource. + */ + public final Builder dataSource(DataSourcePrivileges value, DataSourcePrivileges... values) { + this.dataSource = _listAdd(this.dataSource, value, values); + return this; + } + + /** + * A list of data source privilege entries, used to grant access to ES|QL data + * sources. + *

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

+ * Adds a value to dataSource using a builder lambda. + */ + public final Builder dataSource( + Function> fn) { + return dataSource(fn.apply(new DataSourcePrivileges.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -166,6 +234,8 @@ public Builder rebuild() { protected static void setupGlobalPrivilegeDeserializer(ObjectDeserializer op) { op.add(Builder::application, ApplicationGlobalUserPrivileges._DESERIALIZER, "application"); + op.add(Builder::dataSource, JsonpDeserializer.arrayDeserializer(DataSourcePrivileges._DESERIALIZER), + "data_source"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptor.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptor.java index 742f16ecf2..37f9dec81c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptor.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptor.java @@ -149,8 +149,7 @@ public final List remoteCluster() { /** * An object defining global privileges. A global privilege is a form of cluster - * privilege that is request-aware. Support for global privileges is currently - * limited to the management of application privileges. + * privilege that is request-aware. *

* API name: {@code global} */ @@ -552,8 +551,7 @@ public final BuilderT remoteCluster( /** * An object defining global privileges. A global privilege is a form of cluster - * privilege that is request-aware. Support for global privileges is currently - * limited to the management of application privileges. + * privilege that is request-aware. *

* API name: {@code global} *

@@ -566,8 +564,7 @@ public final BuilderT global(List list) { /** * An object defining global privileges. A global privilege is a form of cluster - * privilege that is request-aware. Support for global privileges is currently - * limited to the management of application privileges. + * privilege that is request-aware. *

* API name: {@code global} *

@@ -580,8 +577,7 @@ public final BuilderT global(GlobalPrivilege value, GlobalPrivilege... values) { /** * An object defining global privileges. A global privilege is a form of cluster - * privilege that is request-aware. Support for global privileges is currently - * limited to the management of application privileges. + * privilege that is request-aware. *

* API name: {@code global} *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptorRead.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptorRead.java index bcd6f0aaba..26b04e9e9b 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptorRead.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/RoleDescriptorRead.java @@ -150,8 +150,7 @@ public final List remoteCluster() { /** * An object defining global privileges. A global privilege is a form of cluster - * privilege that is request-aware. Support for global privileges is currently - * limited to the management of application privileges. + * privilege that is request-aware. *

* API name: {@code global} */ @@ -546,8 +545,7 @@ public final Builder remoteCluster( /** * An object defining global privileges. A global privilege is a form of cluster - * privilege that is request-aware. Support for global privileges is currently - * limited to the management of application privileges. + * privilege that is request-aware. *

* API name: {@code global} *

@@ -560,8 +558,7 @@ public final Builder global(List list) { /** * An object defining global privileges. A global privilege is a form of cluster - * privilege that is request-aware. Support for global privileges is currently - * limited to the management of application privileges. + * privilege that is request-aware. *

* API name: {@code global} *

@@ -574,8 +571,7 @@ public final Builder global(GlobalPrivilege value, GlobalPrivilege... values) { /** * An object defining global privileges. A global privilege is a form of cluster - * privilege that is request-aware. Support for global privileges is currently - * limited to the management of application privileges. + * privilege that is request-aware. *

* API name: {@code global} *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/GetTransformStatsRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/GetTransformStatsRequest.java index 7c2be9d723..18ccc39d00 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/GetTransformStatsRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/transform/GetTransformStatsRequest.java @@ -73,6 +73,9 @@ public class GetTransformStatsRequest extends RequestBase { @Nullable private final Boolean allowNoMatch; + @Nullable + private final Boolean basic; + @Nullable private final Long from; @@ -89,6 +92,7 @@ public class GetTransformStatsRequest extends RequestBase { private GetTransformStatsRequest(Builder builder) { this.allowNoMatch = builder.allowNoMatch; + this.basic = builder.basic; this.from = builder.from; this.size = builder.size; this.timeout = builder.timeout; @@ -119,6 +123,22 @@ public final Boolean allowNoMatch() { return this.allowNoMatch; } + /** + * If true, the response includes id, state, + * node, stats, health, and basic + * checkpointing information (the last and next checkpoint numbers, + * and the next checkpoint's position and progress). + * Skips statistics that require heavy computations to calculate: + * operations_behind, changes_last_detected_at, + * last_search_time, and the checkpoint timestamps. + *

+ * API name: {@code basic} + */ + @Nullable + public final Boolean basic() { + return this.basic; + } + /** * Skips the specified number of transforms. *

@@ -174,6 +194,9 @@ public static class Builder extends RequestBase.AbstractBuilder @Nullable private Boolean allowNoMatch; + @Nullable + private Boolean basic; + @Nullable private Long from; @@ -189,6 +212,7 @@ public Builder() { } private Builder(GetTransformStatsRequest instance) { this.allowNoMatch = instance.allowNoMatch; + this.basic = instance.basic; this.from = instance.from; this.size = instance.size; this.timeout = instance.timeout; @@ -214,6 +238,22 @@ public final Builder allowNoMatch(@Nullable Boolean value) { return this; } + /** + * If true, the response includes id, state, + * node, stats, health, and basic + * checkpointing information (the last and next checkpoint numbers, + * and the next checkpoint's position and progress). + * Skips statistics that require heavy computations to calculate: + * operations_behind, changes_last_detected_at, + * last_search_time, and the checkpoint timestamps. + *

+ * API name: {@code basic} + */ + public final Builder basic(@Nullable Boolean value) { + this.basic = value; + return this; + } + /** * Skips the specified number of transforms. *

@@ -369,6 +409,9 @@ public Builder rebuild() { if (request.from != null) { params.put("from", String.valueOf(request.from)); } + if (request.basic != null) { + params.put("basic", String.valueOf(request.basic)); + } if (request.allowNoMatch != null) { params.put("allow_no_match", String.valueOf(request.allowNoMatch)); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ActionStatusOptions.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ActionStatusOptions.java index cb946f0200..2b6826be2a 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ActionStatusOptions.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ActionStatusOptions.java @@ -50,10 +50,16 @@ public enum ActionStatusOptions implements JsonEnum { Failure("failure"), - Simulated("simulated"), + PartialFailure("partial_failure"), + + Acknowledged("acknowledged"), Throttled("throttled"), + ConditionFailed("condition_failed"), + + Simulated("simulated"), + ; private final String jsonValue; diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResult.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResult.java index 32bab84b99..1b55524123 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResult.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResult.java @@ -63,23 +63,29 @@ public class ExecutionResult implements JsonpSerializable { private final List actions; + @Nullable private final ExecutionResultCondition condition; private final long executionDuration; private final DateTime executionTime; + @Nullable private final ExecutionResultInput input; + @Nullable + private final ExecutionResultTransform transform; + // --------------------------------------------------------------------------------------------- private ExecutionResult(Builder builder) { this.actions = ApiTypeHelper.unmodifiableRequired(builder.actions, this, "actions"); - this.condition = ApiTypeHelper.requireNonNull(builder.condition, this, "condition"); + this.condition = builder.condition; this.executionDuration = ApiTypeHelper.requireNonNull(builder.executionDuration, this, "executionDuration", 0); this.executionTime = ApiTypeHelper.requireNonNull(builder.executionTime, this, "executionTime"); - this.input = ApiTypeHelper.requireNonNull(builder.input, this, "input"); + this.input = builder.input; + this.transform = builder.transform; } @@ -95,8 +101,9 @@ public final List actions() { } /** - * Required - API name: {@code condition} + * API name: {@code condition} */ + @Nullable public final ExecutionResultCondition condition() { return this.condition; } @@ -116,12 +123,21 @@ public final DateTime executionTime() { } /** - * Required - API name: {@code input} + * API name: {@code input} */ + @Nullable public final ExecutionResultInput input() { return this.input; } + /** + * API name: {@code transform} + */ + @Nullable + public final ExecutionResultTransform transform() { + return this.transform; + } + /** * Serialize this object to JSON. */ @@ -143,16 +159,26 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - generator.writeKey("condition"); - this.condition.serialize(generator, mapper); + if (this.condition != null) { + generator.writeKey("condition"); + this.condition.serialize(generator, mapper); + } generator.writeKey("execution_duration"); generator.write(this.executionDuration); generator.writeKey("execution_time"); this.executionTime.serialize(generator, mapper); - generator.writeKey("input"); - this.input.serialize(generator, mapper); + if (this.input != null) { + generator.writeKey("input"); + this.input.serialize(generator, mapper); + + } + if (this.transform != null) { + generator.writeKey("transform"); + this.transform.serialize(generator, mapper); + + } } @@ -170,14 +196,19 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { private List actions; + @Nullable private ExecutionResultCondition condition; private Long executionDuration; private DateTime executionTime; + @Nullable private ExecutionResultInput input; + @Nullable + private ExecutionResultTransform transform; + public Builder() { } private Builder(ExecutionResult instance) { @@ -186,6 +217,7 @@ private Builder(ExecutionResult instance) { this.executionDuration = instance.executionDuration; this.executionTime = instance.executionTime; this.input = instance.input; + this.transform = instance.transform; } /** @@ -218,15 +250,15 @@ public final Builder actions(Function> fn) { @@ -250,20 +282,36 @@ public final Builder executionTime(DateTime value) { } /** - * Required - API name: {@code input} + * API name: {@code input} */ - public final Builder input(ExecutionResultInput value) { + public final Builder input(@Nullable ExecutionResultInput value) { this.input = value; return this; } /** - * Required - API name: {@code input} + * API name: {@code input} */ public final Builder input(Function> fn) { return this.input(fn.apply(new ExecutionResultInput.Builder()).build()); } + /** + * API name: {@code transform} + */ + public final Builder transform(@Nullable ExecutionResultTransform value) { + this.transform = value; + return this; + } + + /** + * API name: {@code transform} + */ + public final Builder transform( + Function> fn) { + return this.transform(fn.apply(new ExecutionResultTransform.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -303,6 +351,7 @@ protected static void setupExecutionResultDeserializer(ObjectDeserializer */ @JsonpDeserializable -public class ExecutionResultAction implements JsonpSerializable { - @Nullable - private final EmailResult email; - +public class ExecutionResultAction extends ExecutionResultForeachAction { private final String id; - @Nullable - private final IndexResult index; + private final ActionType type; - @Nullable - private final LoggingResult logging; + private final ActionStatusOptions status; @Nullable - private final PagerDutyResult pagerduty; + private final ExecutionResultCondition condition; @Nullable - private final String reason; + private final ExecutionResultTransform transform; - @Nullable - private final SlackResult slack; - - private final ActionStatusOptions status; - - private final ActionType type; + private final List foreach; @Nullable - private final WebhookResult webhook; + private final Integer maxIterations; @Nullable - private final ErrorCause error; + private final Integer numberOfActionsExecuted; // --------------------------------------------------------------------------------------------- private ExecutionResultAction(Builder builder) { + super(builder); - this.email = builder.email; this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); - this.index = builder.index; - this.logging = builder.logging; - this.pagerduty = builder.pagerduty; - this.reason = builder.reason; - this.slack = builder.slack; - this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - this.webhook = builder.webhook; - this.error = builder.error; + this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + this.condition = builder.condition; + this.transform = builder.transform; + this.foreach = ApiTypeHelper.unmodifiable(builder.foreach); + this.maxIterations = builder.maxIterations; + this.numberOfActionsExecuted = builder.numberOfActionsExecuted; } @@ -113,14 +99,6 @@ public static ExecutionResultAction of(Function foreach() { + return this.foreach; } /** - * Required - API name: {@code type} - */ - public final ActionType type() { - return this.type; - } - - /** - * API name: {@code webhook} + * API name: {@code max_iterations} */ @Nullable - public final WebhookResult webhook() { - return this.webhook; + public final Integer maxIterations() { + return this.maxIterations; } /** - * API name: {@code error} + * API name: {@code number_of_actions_executed} */ @Nullable - public final ErrorCause error() { - return this.error; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); + public final Integer numberOfActionsExecuted() { + return this.numberOfActionsExecuted; } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.email != null) { - generator.writeKey("email"); - this.email.serialize(generator, mapper); - - } + super.serializeInternal(generator, mapper); generator.writeKey("id"); generator.write(this.id); - if (this.index != null) { - generator.writeKey("index"); - this.index.serialize(generator, mapper); - - } - if (this.logging != null) { - generator.writeKey("logging"); - this.logging.serialize(generator, mapper); + generator.writeKey("type"); + this.type.serialize(generator, mapper); + generator.writeKey("status"); + this.status.serialize(generator, mapper); + if (this.condition != null) { + generator.writeKey("condition"); + this.condition.serialize(generator, mapper); } - if (this.pagerduty != null) { - generator.writeKey("pagerduty"); - this.pagerduty.serialize(generator, mapper); + if (this.transform != null) { + generator.writeKey("transform"); + this.transform.serialize(generator, mapper); } - if (this.reason != null) { - generator.writeKey("reason"); - generator.write(this.reason); + if (ApiTypeHelper.isDefined(this.foreach)) { + generator.writeKey("foreach"); + generator.writeStartArray(); + for (ExecutionResultForeachAction item0 : this.foreach) { + item0.serialize(generator, mapper); - } - if (this.slack != null) { - generator.writeKey("slack"); - this.slack.serialize(generator, mapper); + } + generator.writeEnd(); } - generator.writeKey("status"); - this.status.serialize(generator, mapper); - generator.writeKey("type"); - this.type.serialize(generator, mapper); - if (this.webhook != null) { - generator.writeKey("webhook"); - this.webhook.serialize(generator, mapper); + if (this.maxIterations != null) { + generator.writeKey("max_iterations"); + generator.write(this.maxIterations); } - if (this.error != null) { - generator.writeKey("error"); - this.error.serialize(generator, mapper); + if (this.numberOfActionsExecuted != null) { + generator.writeKey("number_of_actions_executed"); + generator.write(this.numberOfActionsExecuted); } } - @Override - public String toString() { - return JsonpUtils.toString(this); - } - // --------------------------------------------------------------------------------------------- /** * Builder for {@link ExecutionResultAction}. */ - public static class Builder extends WithJsonObjectBuilderBase + public static class Builder extends ExecutionResultForeachAction.AbstractBuilder implements ObjectBuilder { - @Nullable - private EmailResult email; - private String id; - @Nullable - private IndexResult index; + private ActionType type; - @Nullable - private LoggingResult logging; + private ActionStatusOptions status; @Nullable - private PagerDutyResult pagerduty; + private ExecutionResultCondition condition; @Nullable - private String reason; + private ExecutionResultTransform transform; @Nullable - private SlackResult slack; - - private ActionStatusOptions status; - - private ActionType type; + private List foreach; @Nullable - private WebhookResult webhook; + private Integer maxIterations; @Nullable - private ErrorCause error; + private Integer numberOfActionsExecuted; public Builder() { } private Builder(ExecutionResultAction instance) { - this.email = instance.email; this.id = instance.id; - this.index = instance.index; - this.logging = instance.logging; - this.pagerduty = instance.pagerduty; - this.reason = instance.reason; - this.slack = instance.slack; - this.status = instance.status; this.type = instance.type; - this.webhook = instance.webhook; - this.error = instance.error; - - } - /** - * API name: {@code email} - */ - public final Builder email(@Nullable EmailResult value) { - this.email = value; - return this; - } + this.status = instance.status; + this.condition = instance.condition; + this.transform = instance.transform; + this.foreach = instance.foreach; + this.maxIterations = instance.maxIterations; + this.numberOfActionsExecuted = instance.numberOfActionsExecuted; - /** - * API name: {@code email} - */ - public final Builder email(Function> fn) { - return this.email(fn.apply(new EmailResult.Builder()).build()); } - /** * Required - API name: {@code id} */ @@ -343,117 +254,97 @@ public final Builder id(String value) { } /** - * API name: {@code index} + * Required - API name: {@code type} */ - public final Builder index(@Nullable IndexResult value) { - this.index = value; + public final Builder type(ActionType value) { + this.type = value; return this; } /** - * API name: {@code index} - */ - public final Builder index(Function> fn) { - return this.index(fn.apply(new IndexResult.Builder()).build()); - } - - /** - * API name: {@code logging} + * Required - API name: {@code status} */ - public final Builder logging(@Nullable LoggingResult value) { - this.logging = value; + public final Builder status(ActionStatusOptions value) { + this.status = value; return this; } /** - * API name: {@code logging} - */ - public final Builder logging(Function> fn) { - return this.logging(fn.apply(new LoggingResult.Builder()).build()); - } - - /** - * API name: {@code pagerduty} + * API name: {@code condition} */ - public final Builder pagerduty(@Nullable PagerDutyResult value) { - this.pagerduty = value; + public final Builder condition(@Nullable ExecutionResultCondition value) { + this.condition = value; return this; } /** - * API name: {@code pagerduty} + * API name: {@code condition} */ - public final Builder pagerduty(Function> fn) { - return this.pagerduty(fn.apply(new PagerDutyResult.Builder()).build()); + public final Builder condition( + Function> fn) { + return this.condition(fn.apply(new ExecutionResultCondition.Builder()).build()); } /** - * API name: {@code reason} + * API name: {@code transform} */ - public final Builder reason(@Nullable String value) { - this.reason = value; + public final Builder transform(@Nullable ExecutionResultTransform value) { + this.transform = value; return this; } /** - * API name: {@code slack} - */ - public final Builder slack(@Nullable SlackResult value) { - this.slack = value; - return this; - } - - /** - * API name: {@code slack} - */ - public final Builder slack(Function> fn) { - return this.slack(fn.apply(new SlackResult.Builder()).build()); - } - - /** - * Required - API name: {@code status} + * API name: {@code transform} */ - public final Builder status(ActionStatusOptions value) { - this.status = value; - return this; + public final Builder transform( + Function> fn) { + return this.transform(fn.apply(new ExecutionResultTransform.Builder()).build()); } /** - * Required - API name: {@code type} + * API name: {@code foreach} + *

+ * Adds all elements of list to foreach. */ - public final Builder type(ActionType value) { - this.type = value; + public final Builder foreach(List list) { + this.foreach = _listAddAll(this.foreach, list); return this; } /** - * API name: {@code webhook} + * API name: {@code foreach} + *

+ * Adds one or more values to foreach. */ - public final Builder webhook(@Nullable WebhookResult value) { - this.webhook = value; + public final Builder foreach(ExecutionResultForeachAction value, ExecutionResultForeachAction... values) { + this.foreach = _listAdd(this.foreach, value, values); return this; } /** - * API name: {@code webhook} + * API name: {@code foreach} + *

+ * Adds a value to foreach using a builder lambda. */ - public final Builder webhook(Function> fn) { - return this.webhook(fn.apply(new WebhookResult.Builder()).build()); + public final Builder foreach( + Function> fn) { + return foreach(fn.apply(new ExecutionResultForeachAction.Builder()).build()); } /** - * API name: {@code error} + * API name: {@code max_iterations} */ - public final Builder error(@Nullable ErrorCause value) { - this.error = value; + public final Builder maxIterations(@Nullable Integer value) { + this.maxIterations = value; return this; } /** - * API name: {@code error} + * API name: {@code number_of_actions_executed} */ - public final Builder error(Function> fn) { - return this.error(fn.apply(new ErrorCause.Builder()).build()); + public final Builder numberOfActionsExecuted(@Nullable Integer value) { + this.numberOfActionsExecuted = value; + return this; } @Override @@ -489,18 +380,16 @@ public Builder rebuild() { .lazy(Builder::new, ExecutionResultAction::setupExecutionResultActionDeserializer); protected static void setupExecutionResultActionDeserializer(ObjectDeserializer op) { - - op.add(Builder::email, EmailResult._DESERIALIZER, "email"); + ExecutionResultForeachAction.setupExecutionResultForeachActionDeserializer(op); op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); - op.add(Builder::index, IndexResult._DESERIALIZER, "index"); - op.add(Builder::logging, LoggingResult._DESERIALIZER, "logging"); - op.add(Builder::pagerduty, PagerDutyResult._DESERIALIZER, "pagerduty"); - op.add(Builder::reason, JsonpDeserializer.stringDeserializer(), "reason"); - op.add(Builder::slack, SlackResult._DESERIALIZER, "slack"); - op.add(Builder::status, ActionStatusOptions._DESERIALIZER, "status"); op.add(Builder::type, ActionType._DESERIALIZER, "type"); - op.add(Builder::webhook, WebhookResult._DESERIALIZER, "webhook"); - op.add(Builder::error, ErrorCause._DESERIALIZER, "error"); + op.add(Builder::status, ActionStatusOptions._DESERIALIZER, "status"); + op.add(Builder::condition, ExecutionResultCondition._DESERIALIZER, "condition"); + op.add(Builder::transform, ExecutionResultTransform._DESERIALIZER, "transform"); + op.add(Builder::foreach, JsonpDeserializer.arrayDeserializer(ExecutionResultForeachAction._DESERIALIZER), + "foreach"); + op.add(Builder::maxIterations, JsonpDeserializer.integerDeserializer(), "max_iterations"); + op.add(Builder::numberOfActionsExecuted, JsonpDeserializer.integerDeserializer(), "number_of_actions_executed"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultCondition.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultCondition.java index 0416ca095f..ab1440b843 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultCondition.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultCondition.java @@ -62,10 +62,16 @@ public class ExecutionResultCondition implements JsonpSerializable { private final boolean met; - private final ActionStatusOptions status; + private final ExecutionResultStatus status; private final ConditionType type; + @Nullable + private final ExecutionResultConditionResolved compare; + + @Nullable + private final ExecutionResultConditionResolved arrayCompare; + // --------------------------------------------------------------------------------------------- private ExecutionResultCondition(Builder builder) { @@ -73,6 +79,8 @@ private ExecutionResultCondition(Builder builder) { this.met = ApiTypeHelper.requireNonNull(builder.met, this, "met", false); this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); + this.compare = builder.compare; + this.arrayCompare = builder.arrayCompare; } @@ -90,7 +98,7 @@ public final boolean met() { /** * Required - API name: {@code status} */ - public final ActionStatusOptions status() { + public final ExecutionResultStatus status() { return this.status; } @@ -101,6 +109,22 @@ public final ConditionType type() { return this.type; } + /** + * API name: {@code compare} + */ + @Nullable + public final ExecutionResultConditionResolved compare() { + return this.compare; + } + + /** + * API name: {@code array_compare} + */ + @Nullable + public final ExecutionResultConditionResolved arrayCompare() { + return this.arrayCompare; + } + /** * Serialize this object to JSON. */ @@ -119,6 +143,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.status.serialize(generator, mapper); generator.writeKey("type"); this.type.serialize(generator, mapper); + if (this.compare != null) { + generator.writeKey("compare"); + this.compare.serialize(generator, mapper); + + } + if (this.arrayCompare != null) { + generator.writeKey("array_compare"); + this.arrayCompare.serialize(generator, mapper); + + } } @@ -138,16 +172,24 @@ public static class Builder extends WithJsonObjectBuilderBase ObjectBuilder { private Boolean met; - private ActionStatusOptions status; + private ExecutionResultStatus status; private ConditionType type; + @Nullable + private ExecutionResultConditionResolved compare; + + @Nullable + private ExecutionResultConditionResolved arrayCompare; + public Builder() { } private Builder(ExecutionResultCondition instance) { this.met = instance.met; this.status = instance.status; this.type = instance.type; + this.compare = instance.compare; + this.arrayCompare = instance.arrayCompare; } /** @@ -161,7 +203,7 @@ public final Builder met(boolean value) { /** * Required - API name: {@code status} */ - public final Builder status(ActionStatusOptions value) { + public final Builder status(ExecutionResultStatus value) { this.status = value; return this; } @@ -174,6 +216,38 @@ public final Builder type(ConditionType value) { return this; } + /** + * API name: {@code compare} + */ + public final Builder compare(@Nullable ExecutionResultConditionResolved value) { + this.compare = value; + return this; + } + + /** + * API name: {@code compare} + */ + public final Builder compare( + Function> fn) { + return this.compare(fn.apply(new ExecutionResultConditionResolved.Builder()).build()); + } + + /** + * API name: {@code array_compare} + */ + public final Builder arrayCompare(@Nullable ExecutionResultConditionResolved value) { + this.arrayCompare = value; + return this; + } + + /** + * API name: {@code array_compare} + */ + public final Builder arrayCompare( + Function> fn) { + return this.arrayCompare(fn.apply(new ExecutionResultConditionResolved.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -210,8 +284,10 @@ protected static void setupExecutionResultConditionDeserializer( ObjectDeserializer op) { op.add(Builder::met, JsonpDeserializer.booleanDeserializer(), "met"); - op.add(Builder::status, ActionStatusOptions._DESERIALIZER, "status"); + op.add(Builder::status, ExecutionResultStatus._DESERIALIZER, "status"); op.add(Builder::type, ConditionType._DESERIALIZER, "type"); + op.add(Builder::compare, ExecutionResultConditionResolved._DESERIALIZER, "compare"); + op.add(Builder::arrayCompare, ExecutionResultConditionResolved._DESERIALIZER, "array_compare"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultConditionResolved.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultConditionResolved.java new file mode 100644 index 0000000000..a467cd4757 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultConditionResolved.java @@ -0,0 +1,195 @@ +/* + * 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.watcher; + +import co.elastic.clients.json.JsonData; +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; + +//---------------------------------------------------------------- +// 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: watcher._types.ExecutionResultConditionResolved + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class ExecutionResultConditionResolved implements JsonpSerializable { + private final Map resolvedValues; + + // --------------------------------------------------------------------------------------------- + + private ExecutionResultConditionResolved(Builder builder) { + + this.resolvedValues = ApiTypeHelper.unmodifiable(builder.resolvedValues); + + } + + public static ExecutionResultConditionResolved of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code resolved_values} + */ + public final Map resolvedValues() { + return this.resolvedValues; + } + + /** + * 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.resolvedValues)) { + generator.writeKey("resolved_values"); + generator.writeStartObject(); + for (Map.Entry item0 : this.resolvedValues.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ExecutionResultConditionResolved}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + @Nullable + private Map resolvedValues; + + public Builder() { + } + private Builder(ExecutionResultConditionResolved instance) { + this.resolvedValues = instance.resolvedValues; + + } + /** + * API name: {@code resolved_values} + *

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

+ * Adds an entry to resolvedValues. + */ + public final Builder resolvedValues(String key, JsonData value) { + this.resolvedValues = _mapPut(this.resolvedValues, key, value); + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ExecutionResultConditionResolved}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ExecutionResultConditionResolved build() { + _checkSingleUse(); + + return new ExecutionResultConditionResolved(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ExecutionResultConditionResolved} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, ExecutionResultConditionResolved::setupExecutionResultConditionResolvedDeserializer); + + protected static void setupExecutionResultConditionResolvedDeserializer( + ObjectDeserializer op) { + + op.add(Builder::resolvedValues, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), + "resolved_values"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultForeachAction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultForeachAction.java new file mode 100644 index 0000000000..9769ca3726 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultForeachAction.java @@ -0,0 +1,432 @@ +/* + * 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.watcher; + +import co.elastic.clients.elasticsearch._types.ErrorCause; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Objects; +import 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: watcher._types.ExecutionResultForeachAction + +/** + * The result of a single action execution. + * + * @see API + * specification + */ +@JsonpDeserializable +public class ExecutionResultForeachAction implements JsonpSerializable { + @Nullable + private final EmailResult email; + + @Nullable + private final IndexResult index; + + @Nullable + private final LoggingResult logging; + + @Nullable + private final PagerDutyResult pagerduty; + + @Nullable + private final SlackResult slack; + + @Nullable + private final WebhookResult webhook; + + @Nullable + private final ErrorCause error; + + @Nullable + private final String reason; + + // --------------------------------------------------------------------------------------------- + + protected ExecutionResultForeachAction(AbstractBuilder builder) { + + this.email = builder.email; + this.index = builder.index; + this.logging = builder.logging; + this.pagerduty = builder.pagerduty; + this.slack = builder.slack; + this.webhook = builder.webhook; + this.error = builder.error; + this.reason = builder.reason; + + } + + public static ExecutionResultForeachAction executionResultForeachActionOf( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code email} + */ + @Nullable + public final EmailResult email() { + return this.email; + } + + /** + * API name: {@code index} + */ + @Nullable + public final IndexResult index() { + return this.index; + } + + /** + * API name: {@code logging} + */ + @Nullable + public final LoggingResult logging() { + return this.logging; + } + + /** + * API name: {@code pagerduty} + */ + @Nullable + public final PagerDutyResult pagerduty() { + return this.pagerduty; + } + + /** + * API name: {@code slack} + */ + @Nullable + public final SlackResult slack() { + return this.slack; + } + + /** + * API name: {@code webhook} + */ + @Nullable + public final WebhookResult webhook() { + return this.webhook; + } + + /** + * API name: {@code error} + */ + @Nullable + public final ErrorCause error() { + return this.error; + } + + /** + * API name: {@code reason} + */ + @Nullable + public final String reason() { + return this.reason; + } + + /** + * 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.email != null) { + generator.writeKey("email"); + this.email.serialize(generator, mapper); + + } + if (this.index != null) { + generator.writeKey("index"); + this.index.serialize(generator, mapper); + + } + if (this.logging != null) { + generator.writeKey("logging"); + this.logging.serialize(generator, mapper); + + } + if (this.pagerduty != null) { + generator.writeKey("pagerduty"); + this.pagerduty.serialize(generator, mapper); + + } + if (this.slack != null) { + generator.writeKey("slack"); + this.slack.serialize(generator, mapper); + + } + if (this.webhook != null) { + generator.writeKey("webhook"); + this.webhook.serialize(generator, mapper); + + } + if (this.error != null) { + generator.writeKey("error"); + this.error.serialize(generator, mapper); + + } + if (this.reason != null) { + generator.writeKey("reason"); + generator.write(this.reason); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ExecutionResultForeachAction}. + */ + + public static class Builder extends ExecutionResultForeachAction.AbstractBuilder + implements + ObjectBuilder { + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ExecutionResultForeachAction}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ExecutionResultForeachAction build() { + _checkSingleUse(); + + return new ExecutionResultForeachAction(this); + } + } + + public abstract static class AbstractBuilder> + extends + WithJsonObjectBuilderBase { + @Nullable + private EmailResult email; + + @Nullable + private IndexResult index; + + @Nullable + private LoggingResult logging; + + @Nullable + private PagerDutyResult pagerduty; + + @Nullable + private SlackResult slack; + + @Nullable + private WebhookResult webhook; + + @Nullable + private ErrorCause error; + + @Nullable + private String reason; + + /** + * API name: {@code email} + */ + public final BuilderT email(@Nullable EmailResult value) { + this.email = value; + return self(); + } + + /** + * API name: {@code email} + */ + public final BuilderT email(Function> fn) { + return this.email(fn.apply(new EmailResult.Builder()).build()); + } + + /** + * API name: {@code index} + */ + public final BuilderT index(@Nullable IndexResult value) { + this.index = value; + return self(); + } + + /** + * API name: {@code index} + */ + public final BuilderT index(Function> fn) { + return this.index(fn.apply(new IndexResult.Builder()).build()); + } + + /** + * API name: {@code index} + */ + public final BuilderT index(IndexResultVariant value) { + this.index = value._toIndexResult(); + return self(); + } + + /** + * API name: {@code logging} + */ + public final BuilderT logging(@Nullable LoggingResult value) { + this.logging = value; + return self(); + } + + /** + * API name: {@code logging} + */ + public final BuilderT logging(Function> fn) { + return this.logging(fn.apply(new LoggingResult.Builder()).build()); + } + + /** + * API name: {@code pagerduty} + */ + public final BuilderT pagerduty(@Nullable PagerDutyResult value) { + this.pagerduty = value; + return self(); + } + + /** + * API name: {@code pagerduty} + */ + public final BuilderT pagerduty(Function> fn) { + return this.pagerduty(fn.apply(new PagerDutyResult.Builder()).build()); + } + + /** + * API name: {@code slack} + */ + public final BuilderT slack(@Nullable SlackResult value) { + this.slack = value; + return self(); + } + + /** + * API name: {@code slack} + */ + public final BuilderT slack(Function> fn) { + return this.slack(fn.apply(new SlackResult.Builder()).build()); + } + + /** + * API name: {@code webhook} + */ + public final BuilderT webhook(@Nullable WebhookResult value) { + this.webhook = value; + return self(); + } + + /** + * API name: {@code webhook} + */ + public final BuilderT webhook(Function> fn) { + return this.webhook(fn.apply(new WebhookResult.Builder()).build()); + } + + /** + * API name: {@code error} + */ + public final BuilderT error(@Nullable ErrorCause value) { + this.error = value; + return self(); + } + + /** + * API name: {@code error} + */ + public final BuilderT error(Function> fn) { + return this.error(fn.apply(new ErrorCause.Builder()).build()); + } + + /** + * API name: {@code reason} + */ + public final BuilderT reason(@Nullable String value) { + this.reason = value; + return self(); + } + + protected abstract BuilderT self(); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ExecutionResultForeachAction} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, ExecutionResultForeachAction::setupExecutionResultForeachActionDeserializer); + + protected static > void setupExecutionResultForeachActionDeserializer( + ObjectDeserializer op) { + + op.add(AbstractBuilder::email, EmailResult._DESERIALIZER, "email"); + op.add(AbstractBuilder::index, IndexResult._DESERIALIZER, "index"); + op.add(AbstractBuilder::logging, LoggingResult._DESERIALIZER, "logging"); + op.add(AbstractBuilder::pagerduty, PagerDutyResult._DESERIALIZER, "pagerduty"); + op.add(AbstractBuilder::slack, SlackResult._DESERIALIZER, "slack"); + op.add(AbstractBuilder::webhook, WebhookResult._DESERIALIZER, "webhook"); + op.add(AbstractBuilder::error, ErrorCause._DESERIALIZER, "error"); + op.add(AbstractBuilder::reason, JsonpDeserializer.stringDeserializer(), "reason"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultHttpInput.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultHttpInput.java new file mode 100644 index 0000000000..79e30ef242 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultHttpInput.java @@ -0,0 +1,214 @@ +/* + * 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.watcher; + +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.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: watcher._types.ExecutionResultHttpInput + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class ExecutionResultHttpInput implements JsonpSerializable { + private final HttpInputRequestResult request; + + @Nullable + private final Integer statusCode; + + // --------------------------------------------------------------------------------------------- + + private ExecutionResultHttpInput(Builder builder) { + + this.request = ApiTypeHelper.requireNonNull(builder.request, this, "request"); + this.statusCode = builder.statusCode; + + } + + public static ExecutionResultHttpInput of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code request} + */ + public final HttpInputRequestResult request() { + return this.request; + } + + /** + * The HTTP status code returned by the request. It is only present when the + * request was executed. + *

+ * API name: {@code status_code} + */ + @Nullable + public final Integer statusCode() { + return this.statusCode; + } + + /** + * 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("request"); + this.request.serialize(generator, mapper); + + if (this.statusCode != null) { + generator.writeKey("status_code"); + generator.write(this.statusCode); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ExecutionResultHttpInput}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private HttpInputRequestResult request; + + @Nullable + private Integer statusCode; + + public Builder() { + } + private Builder(ExecutionResultHttpInput instance) { + this.request = instance.request; + this.statusCode = instance.statusCode; + + } + /** + * Required - API name: {@code request} + */ + public final Builder request(HttpInputRequestResult value) { + this.request = value; + return this; + } + + /** + * Required - API name: {@code request} + */ + public final Builder request( + Function> fn) { + return this.request(fn.apply(new HttpInputRequestResult.Builder()).build()); + } + + /** + * The HTTP status code returned by the request. It is only present when the + * request was executed. + *

+ * API name: {@code status_code} + */ + public final Builder statusCode(@Nullable Integer value) { + this.statusCode = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ExecutionResultHttpInput}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ExecutionResultHttpInput build() { + _checkSingleUse(); + + return new ExecutionResultHttpInput(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ExecutionResultHttpInput} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, ExecutionResultHttpInput::setupExecutionResultHttpInputDeserializer); + + protected static void setupExecutionResultHttpInputDeserializer( + ObjectDeserializer op) { + + op.add(Builder::request, HttpInputRequestResult._DESERIALIZER, "request"); + op.add(Builder::statusCode, JsonpDeserializer.integerDeserializer(), "status_code"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultInput.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultInput.java index 8acf594107..9cd63d5003 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultInput.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultInput.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch.watcher; +import co.elastic.clients.elasticsearch._types.ErrorCause; import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; @@ -64,17 +65,32 @@ public class ExecutionResultInput implements JsonpSerializable { private final Map payload; - private final ActionStatusOptions status; + private final ExecutionResultStatus status; private final InputType type; + @Nullable + private final ExecutionResultSearchInput search; + + @Nullable + private final ExecutionResultHttpInput http; + + private final Map chain; + + @Nullable + private final ErrorCause error; + // --------------------------------------------------------------------------------------------- private ExecutionResultInput(Builder builder) { - this.payload = ApiTypeHelper.unmodifiableRequired(builder.payload, this, "payload"); + this.payload = ApiTypeHelper.unmodifiable(builder.payload); this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); + this.search = builder.search; + this.http = builder.http; + this.chain = ApiTypeHelper.unmodifiable(builder.chain); + this.error = builder.error; } @@ -83,7 +99,7 @@ public static ExecutionResultInput of(Function payload() { return this.payload; @@ -92,7 +108,7 @@ public final Map payload() { /** * Required - API name: {@code status} */ - public final ActionStatusOptions status() { + public final ExecutionResultStatus status() { return this.status; } @@ -103,6 +119,43 @@ public final InputType type() { return this.type; } + /** + * The resolved search request, present when the input is a search input. + *

+ * API name: {@code search} + */ + @Nullable + public final ExecutionResultSearchInput search() { + return this.search; + } + + /** + * The resolved HTTP request, present when the input is an HTTP input. + *

+ * API name: {@code http} + */ + @Nullable + public final ExecutionResultHttpInput http() { + return this.http; + } + + /** + * The result of each named input, present when the input is a chain input. + *

+ * API name: {@code chain} + */ + public final Map chain() { + return this.chain; + } + + /** + * API name: {@code error} + */ + @Nullable + public final ErrorCause error() { + return this.error; + } + /** * Serialize this object to JSON. */ @@ -129,6 +182,32 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { this.status.serialize(generator, mapper); generator.writeKey("type"); this.type.serialize(generator, mapper); + if (this.search != null) { + generator.writeKey("search"); + this.search.serialize(generator, mapper); + + } + if (this.http != null) { + generator.writeKey("http"); + this.http.serialize(generator, mapper); + + } + if (ApiTypeHelper.isDefined(this.chain)) { + generator.writeKey("chain"); + generator.writeStartObject(); + for (Map.Entry item0 : this.chain.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (this.error != null) { + generator.writeKey("error"); + this.error.serialize(generator, mapper); + + } } @@ -146,22 +225,39 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable private Map payload; - private ActionStatusOptions status; + private ExecutionResultStatus status; private InputType type; + @Nullable + private ExecutionResultSearchInput search; + + @Nullable + private ExecutionResultHttpInput http; + + @Nullable + private Map chain; + + @Nullable + private ErrorCause error; + public Builder() { } private Builder(ExecutionResultInput instance) { this.payload = instance.payload; this.status = instance.status; this.type = instance.type; + this.search = instance.search; + this.http = instance.http; + this.chain = instance.chain; + this.error = instance.error; } /** - * Required - API name: {@code payload} + * API name: {@code payload} *

* Adds all entries of map to payload. */ @@ -171,7 +267,7 @@ public final Builder payload(Map map) { } /** - * Required - API name: {@code payload} + * API name: {@code payload} *

* Adds an entry to payload. */ @@ -183,7 +279,7 @@ public final Builder payload(String key, JsonData value) { /** * Required - API name: {@code status} */ - public final Builder status(ActionStatusOptions value) { + public final Builder status(ExecutionResultStatus value) { this.status = value; return this; } @@ -196,6 +292,97 @@ public final Builder type(InputType value) { return this; } + /** + * The resolved search request, present when the input is a search input. + *

+ * API name: {@code search} + */ + public final Builder search(@Nullable ExecutionResultSearchInput value) { + this.search = value; + return this; + } + + /** + * The resolved search request, present when the input is a search input. + *

+ * API name: {@code search} + */ + public final Builder search( + Function> fn) { + return this.search(fn.apply(new ExecutionResultSearchInput.Builder()).build()); + } + + /** + * The resolved HTTP request, present when the input is an HTTP input. + *

+ * API name: {@code http} + */ + public final Builder http(@Nullable ExecutionResultHttpInput value) { + this.http = value; + return this; + } + + /** + * The resolved HTTP request, present when the input is an HTTP input. + *

+ * API name: {@code http} + */ + public final Builder http( + Function> fn) { + return this.http(fn.apply(new ExecutionResultHttpInput.Builder()).build()); + } + + /** + * The result of each named input, present when the input is a chain input. + *

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

+ * Adds all entries of map to chain. + */ + public final Builder chain(Map map) { + this.chain = _mapPutAll(this.chain, map); + return this; + } + + /** + * The result of each named input, present when the input is a chain input. + *

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

+ * Adds an entry to chain. + */ + public final Builder chain(String key, ExecutionResultInput value) { + this.chain = _mapPut(this.chain, key, value); + return this; + } + + /** + * The result of each named input, present when the input is a chain input. + *

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

+ * Adds an entry to chain using a builder lambda. + */ + public final Builder chain(String key, + Function> fn) { + return chain(key, fn.apply(new ExecutionResultInput.Builder()).build()); + } + + /** + * API name: {@code error} + */ + public final Builder error(@Nullable ErrorCause value) { + this.error = value; + return this; + } + + /** + * API name: {@code error} + */ + public final Builder error(Function> fn) { + return this.error(fn.apply(new ErrorCause.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -231,8 +418,12 @@ public Builder rebuild() { protected static void setupExecutionResultInputDeserializer(ObjectDeserializer op) { op.add(Builder::payload, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "payload"); - op.add(Builder::status, ActionStatusOptions._DESERIALIZER, "status"); + op.add(Builder::status, ExecutionResultStatus._DESERIALIZER, "status"); op.add(Builder::type, InputType._DESERIALIZER, "type"); + op.add(Builder::search, ExecutionResultSearchInput._DESERIALIZER, "search"); + op.add(Builder::http, ExecutionResultHttpInput._DESERIALIZER, "http"); + op.add(Builder::chain, JsonpDeserializer.stringMapDeserializer(ExecutionResultInput._DESERIALIZER), "chain"); + op.add(Builder::error, ErrorCause._DESERIALIZER, "error"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/SearchInputRequestBody.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultSearchInput.java similarity index 63% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/SearchInputRequestBody.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultSearchInput.java index 3980add105..e6d1421fcb 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/SearchInputRequestBody.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultSearchInput.java @@ -19,8 +19,6 @@ package co.elastic.clients.elasticsearch.watcher; -import co.elastic.clients.elasticsearch._types.query_dsl.Query; -import co.elastic.clients.elasticsearch._types.query_dsl.QueryVariant; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -51,35 +49,35 @@ // //---------------------------------------------------------------- -// typedef: watcher._types.SearchInputRequestBody +// typedef: watcher._types.ExecutionResultSearchInput /** * * @see API + * "../doc-files/api-spec.html#watcher._types.ExecutionResultSearchInput">API * specification */ @JsonpDeserializable -public class SearchInputRequestBody implements JsonpSerializable { - private final Query query; +public class ExecutionResultSearchInput implements JsonpSerializable { + private final SearchInputRequestDefinition request; // --------------------------------------------------------------------------------------------- - private SearchInputRequestBody(Builder builder) { + private ExecutionResultSearchInput(Builder builder) { - this.query = ApiTypeHelper.requireNonNull(builder.query, this, "query"); + this.request = ApiTypeHelper.requireNonNull(builder.request, this, "request"); } - public static SearchInputRequestBody of(Function> fn) { + public static ExecutionResultSearchInput of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code query} + * Required - API name: {@code request} */ - public final Query query() { - return this.query; + public final SearchInputRequestDefinition request() { + return this.request; } /** @@ -93,8 +91,8 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("query"); - this.query.serialize(generator, mapper); + generator.writeKey("request"); + this.request.serialize(generator, mapper); } @@ -106,41 +104,34 @@ public String toString() { // --------------------------------------------------------------------------------------------- /** - * Builder for {@link SearchInputRequestBody}. + * Builder for {@link ExecutionResultSearchInput}. */ public static class Builder extends WithJsonObjectBuilderBase implements - ObjectBuilder { - private Query query; + ObjectBuilder { + private SearchInputRequestDefinition request; public Builder() { } - private Builder(SearchInputRequestBody instance) { - this.query = instance.query; + private Builder(ExecutionResultSearchInput instance) { + this.request = instance.request; } /** - * Required - API name: {@code query} + * Required - API name: {@code request} */ - public final Builder query(Query value) { - this.query = value; + public final Builder request(SearchInputRequestDefinition value) { + this.request = value; return this; } /** - * Required - API name: {@code query} + * Required - API name: {@code request} */ - public final Builder query(Function> fn) { - return this.query(fn.apply(new Query.Builder()).build()); - } - - /** - * Required - API name: {@code query} - */ - public final Builder query(QueryVariant value) { - this.query = value._toQuery(); - return this; + public final Builder request( + Function> fn) { + return this.request(fn.apply(new SearchInputRequestDefinition.Builder()).build()); } @Override @@ -149,15 +140,15 @@ protected Builder self() { } /** - * Builds a {@link SearchInputRequestBody}. + * Builds a {@link ExecutionResultSearchInput}. * * @throws NullPointerException * if some of the required fields are null. */ - public SearchInputRequestBody build() { + public ExecutionResultSearchInput build() { _checkSingleUse(); - return new SearchInputRequestBody(this); + return new ExecutionResultSearchInput(this); } } @@ -170,15 +161,15 @@ public Builder rebuild() { // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link SearchInputRequestBody} + * Json deserializer for {@link ExecutionResultSearchInput} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, SearchInputRequestBody::setupSearchInputRequestBodyDeserializer); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, ExecutionResultSearchInput::setupExecutionResultSearchInputDeserializer); - protected static void setupSearchInputRequestBodyDeserializer( - ObjectDeserializer op) { + protected static void setupExecutionResultSearchInputDeserializer( + ObjectDeserializer op) { - op.add(Builder::query, Query._DESERIALIZER, "query"); + op.add(Builder::request, SearchInputRequestDefinition._DESERIALIZER, "request"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultStatus.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultStatus.java new file mode 100644 index 0000000000..b0c9a0c03a --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultStatus.java @@ -0,0 +1,67 @@ +/* + * 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.watcher; + +import co.elastic.clients.json.JsonEnum; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public enum ExecutionResultStatus implements JsonEnum { + Success("success"), + + Failure("failure"), + + ; + + private final String jsonValue; + + ExecutionResultStatus(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + ExecutionResultStatus.values()); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultTransform.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultTransform.java new file mode 100644 index 0000000000..7816e45b35 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultTransform.java @@ -0,0 +1,347 @@ +/* + * 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.watcher; + +import co.elastic.clients.elasticsearch._types.ErrorCause; +import co.elastic.clients.json.JsonData; +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; + +//---------------------------------------------------------------- +// 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: watcher._types.ExecutionResultTransform + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class ExecutionResultTransform implements JsonpSerializable { + private final Map payload; + + private final ExecutionResultStatus status; + + private final ExecutionResultTransformType type; + + @Nullable + private final ExecutionResultSearchInput search; + + @Nullable + private final ErrorCause error; + + @Nullable + private final String reason; + + // --------------------------------------------------------------------------------------------- + + private ExecutionResultTransform(Builder builder) { + + this.payload = ApiTypeHelper.unmodifiable(builder.payload); + this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); + this.search = builder.search; + this.error = builder.error; + this.reason = builder.reason; + + } + + public static ExecutionResultTransform of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code payload} + */ + public final Map payload() { + return this.payload; + } + + /** + * Required - API name: {@code status} + */ + public final ExecutionResultStatus status() { + return this.status; + } + + /** + * Required - API name: {@code type} + */ + public final ExecutionResultTransformType type() { + return this.type; + } + + /** + * API name: {@code search} + */ + @Nullable + public final ExecutionResultSearchInput search() { + return this.search; + } + + /** + * API name: {@code error} + */ + @Nullable + public final ErrorCause error() { + return this.error; + } + + /** + * API name: {@code reason} + */ + @Nullable + public final String reason() { + return this.reason; + } + + /** + * 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.payload)) { + generator.writeKey("payload"); + generator.writeStartObject(); + for (Map.Entry item0 : this.payload.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + generator.writeKey("status"); + this.status.serialize(generator, mapper); + generator.writeKey("type"); + this.type.serialize(generator, mapper); + if (this.search != null) { + generator.writeKey("search"); + this.search.serialize(generator, mapper); + + } + if (this.error != null) { + generator.writeKey("error"); + this.error.serialize(generator, mapper); + + } + if (this.reason != null) { + generator.writeKey("reason"); + generator.write(this.reason); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ExecutionResultTransform}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + @Nullable + private Map payload; + + private ExecutionResultStatus status; + + private ExecutionResultTransformType type; + + @Nullable + private ExecutionResultSearchInput search; + + @Nullable + private ErrorCause error; + + @Nullable + private String reason; + + public Builder() { + } + private Builder(ExecutionResultTransform instance) { + this.payload = instance.payload; + this.status = instance.status; + this.type = instance.type; + this.search = instance.search; + this.error = instance.error; + this.reason = instance.reason; + + } + /** + * API name: {@code payload} + *

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

+ * Adds an entry to payload. + */ + public final Builder payload(String key, JsonData value) { + this.payload = _mapPut(this.payload, key, value); + return this; + } + + /** + * Required - API name: {@code status} + */ + public final Builder status(ExecutionResultStatus value) { + this.status = value; + return this; + } + + /** + * Required - API name: {@code type} + */ + public final Builder type(ExecutionResultTransformType value) { + this.type = value; + return this; + } + + /** + * API name: {@code search} + */ + public final Builder search(@Nullable ExecutionResultSearchInput value) { + this.search = value; + return this; + } + + /** + * API name: {@code search} + */ + public final Builder search( + Function> fn) { + return this.search(fn.apply(new ExecutionResultSearchInput.Builder()).build()); + } + + /** + * API name: {@code error} + */ + public final Builder error(@Nullable ErrorCause value) { + this.error = value; + return this; + } + + /** + * API name: {@code error} + */ + public final Builder error(Function> fn) { + return this.error(fn.apply(new ErrorCause.Builder()).build()); + } + + /** + * API name: {@code reason} + */ + public final Builder reason(@Nullable String value) { + this.reason = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link ExecutionResultTransform}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ExecutionResultTransform build() { + _checkSingleUse(); + + return new ExecutionResultTransform(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ExecutionResultTransform} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, ExecutionResultTransform::setupExecutionResultTransformDeserializer); + + protected static void setupExecutionResultTransformDeserializer( + ObjectDeserializer op) { + + op.add(Builder::payload, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "payload"); + op.add(Builder::status, ExecutionResultStatus._DESERIALIZER, "status"); + op.add(Builder::type, ExecutionResultTransformType._DESERIALIZER, "type"); + op.add(Builder::search, ExecutionResultSearchInput._DESERIALIZER, "search"); + op.add(Builder::error, ErrorCause._DESERIALIZER, "error"); + op.add(Builder::reason, JsonpDeserializer.stringDeserializer(), "reason"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultTransformType.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultTransformType.java new file mode 100644 index 0000000000..79a6aafdc4 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/ExecutionResultTransformType.java @@ -0,0 +1,69 @@ +/* + * 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.watcher; + +import co.elastic.clients.json.JsonEnum; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; + +//---------------------------------------------------------------- +// 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. +// +//---------------------------------------------------------------- + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public enum ExecutionResultTransformType implements JsonEnum { + Script("script"), + + Search("search"), + + Chain("chain"), + + ; + + private final String jsonValue; + + ExecutionResultTransformType(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + ExecutionResultTransformType.values()); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexAction.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexAction.java index 15eb8f95a1..1bab4ecccb 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexAction.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexAction.java @@ -29,7 +29,6 @@ import co.elastic.clients.json.JsonpUtils; import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; -import co.elastic.clients.util.ApiTypeHelper; import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; @@ -62,6 +61,7 @@ */ @JsonpDeserializable public class IndexAction implements JsonpSerializable { + @Nullable private final String index; @Nullable @@ -83,7 +83,7 @@ public class IndexAction implements JsonpSerializable { private IndexAction(Builder builder) { - this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); + this.index = builder.index; this.docId = builder.docId; this.refresh = builder.refresh; this.opType = builder.opType; @@ -97,8 +97,9 @@ public static IndexAction of(Function> fn) { } /** - * Required - API name: {@code index} + * API name: {@code index} */ + @Nullable public final String index() { return this.index; } @@ -154,9 +155,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("index"); - generator.write(this.index); + if (this.index != null) { + generator.writeKey("index"); + generator.write(this.index); + } if (this.docId != null) { generator.writeKey("doc_id"); generator.write(this.docId); @@ -195,6 +198,7 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable private String index; @Nullable @@ -224,9 +228,9 @@ private Builder(IndexAction instance) { } /** - * Required - API name: {@code index} + * API name: {@code index} */ - public final Builder index(String value) { + public final Builder index(@Nullable String value) { this.index = value; return this; } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexResult.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexResult.java index 0287c066e3..faf5094e40 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexResult.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexResult.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch.watcher; +import co.elastic.clients.json.JsonEnum; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -28,8 +29,12 @@ 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.List; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -52,19 +57,66 @@ // typedef: watcher._types.IndexResult /** - * + * The result of an index action. It is a container that holds either the + * response of an executed index operation, or the + * request that would have run when the action is simulated. + * * @see API * specification */ @JsonpDeserializable -public class IndexResult implements JsonpSerializable { - private final IndexResultSummary response; +public class IndexResult implements TaggedUnion, JsonpSerializable { + + /** + * {@link IndexResult} variant kinds. + * + * @see API + * specification + */ + + public enum Kind implements JsonEnum { + Response("response"), + + Request("request"), + + ; + + 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 IndexResult(IndexResultVariant value) { + + this._kind = ApiTypeHelper.requireNonNull(value._indexResultKind(), this, ""); + this._value = ApiTypeHelper.requireNonNull(value, this, ""); + + } private IndexResult(Builder builder) { - this.response = ApiTypeHelper.requireNonNull(builder.response, this, "response"); + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); } @@ -73,25 +125,63 @@ public static IndexResult of(Function> fn) { } /** - * Required - API name: {@code response} + * Is this variant instance of kind {@code response}? + */ + public boolean isResponse() { + return _kind == Kind.Response; + } + + /** + * Get the {@code response} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code response} kind. + */ + public List response() { + return TaggedUnionUtils.get(this, Kind.Response); + } + + /** + * Is this variant instance of kind {@code request}? */ - public final IndexResultSummary response() { - return this.response; + public boolean isRequest() { + return _kind == Kind.Request; } /** - * Serialize this object to JSON. + * Get the {@code request} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code request} kind. */ + public IndexResultRequestSummary request() { + return TaggedUnionUtils.get(this, Kind.Request); + } + + @Override + @SuppressWarnings("unchecked") public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey(_kind.jsonValue()); + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } else { + switch (_kind) { + case Response : + generator.writeStartArray(); + for (IndexResultSummary item0 : ((List) this._value)) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + break; + } + } - generator.writeKey("response"); - this.response.serialize(generator, mapper); + generator.writeEnd(); } @@ -100,72 +190,45 @@ public String toString() { return JsonpUtils.toString(this); } - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexResult}. - */ - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private IndexResultSummary response; - - public Builder() { - } - private Builder(IndexResult instance) { - this.response = instance.response; + private Kind _kind; + private Object _value; + @Override + protected Builder self() { + return this; } - /** - * Required - API name: {@code response} - */ - public final Builder response(IndexResultSummary value) { - this.response = value; + public ObjectBuilder response(List v) { + this._kind = Kind.Response; + this._value = v; return this; } - /** - * Required - API name: {@code response} - */ - public final Builder response(Function> fn) { - return this.response(fn.apply(new IndexResultSummary.Builder()).build()); + public ObjectBuilder request(IndexResultRequestSummary v) { + this._kind = Kind.Request; + this._value = v; + return this; } - @Override - protected Builder self() { - return this; + public ObjectBuilder request( + Function> fn) { + return this.request(fn.apply(new IndexResultRequestSummary.Builder()).build()); } - /** - * Builds a {@link IndexResult}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ public IndexResult build() { _checkSingleUse(); - return new IndexResult(this); } - } - /** - * @return New {@link Builder} initialized with field values of this instance - */ - public Builder rebuild() { - return new Builder(this); } - // --------------------------------------------------------------------------------------------- - /** - * Json deserializer for {@link IndexResult} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - IndexResult::setupIndexResultDeserializer); - - protected static void setupIndexResultDeserializer(ObjectDeserializer op) { + protected static void setupIndexResultDeserializer(ObjectDeserializer op) { - op.add(Builder::response, IndexResultSummary._DESERIALIZER, "response"); + op.add(Builder::response, JsonpDeserializer.arrayDeserializer(IndexResultSummary._DESERIALIZER), "response"); + op.add(Builder::request, IndexResultRequestSummary._DESERIALIZER, "request"); } + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + IndexResult::setupIndexResultDeserializer, Builder::build); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexResultBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexResultBuilders.java new file mode 100644 index 0000000000..c2770f8140 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexResultBuilders.java @@ -0,0 +1,70 @@ +/* + * 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.watcher; + +import co.elastic.clients.util.ObjectBuilder; +import java.util.function.Function; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +/** + * Builders for {@link IndexResult} variants. + *

+ * Variants response are not available here as they don't have a + * dedicated class. Use {@link IndexResult}'s builder for these. + * + */ +public class IndexResultBuilders { + private IndexResultBuilders() { + } + + /** + * Creates a builder for the {@link IndexResultRequestSummary request} + * {@code IndexResult} variant. + */ + public static IndexResultRequestSummary.Builder request() { + return new IndexResultRequestSummary.Builder(); + } + + /** + * Creates a IndexResult of the {@link IndexResultRequestSummary request} + * {@code IndexResult} variant. + */ + public static IndexResult request( + Function> fn) { + IndexResult.Builder builder = new IndexResult.Builder(); + builder.request(fn.apply(new IndexResultRequestSummary.Builder()).build()); + return builder.build(); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexResultRequestSummary.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexResultRequestSummary.java new file mode 100644 index 0000000000..f7509dfe64 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexResultRequestSummary.java @@ -0,0 +1,263 @@ +/* + * 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.watcher; + +import co.elastic.clients.elasticsearch._types.Refresh; +import co.elastic.clients.json.JsonData; +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.JsonpSerializable; +import co.elastic.clients.json.JsonpUtils; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import co.elastic.clients.util.WithJsonObjectBuilderBase; +import jakarta.json.stream.JsonGenerator; +import java.lang.String; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: watcher._types.IndexResultRequestSummary + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class IndexResultRequestSummary implements IndexResultVariant, JsonpSerializable { + @Nullable + private final String docId; + + private final String index; + + @Nullable + private final Refresh refresh; + + private final JsonData source; + + // --------------------------------------------------------------------------------------------- + + private IndexResultRequestSummary(Builder builder) { + + this.docId = builder.docId; + this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); + this.refresh = builder.refresh; + this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source"); + + } + + public static IndexResultRequestSummary of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * IndexResult variant kind. + */ + @Override + public IndexResult.Kind _indexResultKind() { + return IndexResult.Kind.Request; + } + + /** + * API name: {@code doc_id} + */ + @Nullable + public final String docId() { + return this.docId; + } + + /** + * Required - API name: {@code index} + */ + public final String index() { + return this.index; + } + + /** + * API name: {@code refresh} + */ + @Nullable + public final Refresh refresh() { + return this.refresh; + } + + /** + * Required - API name: {@code source} + */ + public final JsonData source() { + return this.source; + } + + /** + * 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.docId != null) { + generator.writeKey("doc_id"); + generator.write(this.docId); + + } + generator.writeKey("index"); + generator.write(this.index); + + if (this.refresh != null) { + generator.writeKey("refresh"); + this.refresh.serialize(generator, mapper); + } + generator.writeKey("source"); + this.source.serialize(generator, mapper); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link IndexResultRequestSummary}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + @Nullable + private String docId; + + private String index; + + @Nullable + private Refresh refresh; + + private JsonData source; + + public Builder() { + } + private Builder(IndexResultRequestSummary instance) { + this.docId = instance.docId; + this.index = instance.index; + this.refresh = instance.refresh; + this.source = instance.source; + + } + /** + * API name: {@code doc_id} + */ + public final Builder docId(@Nullable String value) { + this.docId = value; + return this; + } + + /** + * Required - API name: {@code index} + */ + public final Builder index(String value) { + this.index = value; + return this; + } + + /** + * API name: {@code refresh} + */ + public final Builder refresh(@Nullable Refresh value) { + this.refresh = value; + return this; + } + + /** + * Required - API name: {@code source} + */ + public final Builder source(JsonData value) { + this.source = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link IndexResultRequestSummary}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public IndexResultRequestSummary build() { + _checkSingleUse(); + + return new IndexResultRequestSummary(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link IndexResultRequestSummary} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, IndexResultRequestSummary::setupIndexResultRequestSummaryDeserializer); + + protected static void setupIndexResultRequestSummaryDeserializer( + ObjectDeserializer op) { + + op.add(Builder::docId, JsonpDeserializer.stringDeserializer(), "doc_id"); + op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); + op.add(Builder::refresh, Refresh._DESERIALIZER, "refresh"); + op.add(Builder::source, JsonData._DESERIALIZER, "source"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexResultSummary.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexResultSummary.java index c35b740982..7962049f48 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexResultSummary.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexResultSummary.java @@ -56,32 +56,47 @@ // typedef: watcher._types.IndexResultSummary /** - * + * A single item of an index action result. Successful items and failed items + * expose different fields; only id and index are + * present in both. Failed items appear when a bulk index action ends in + * failure or partial_failure. + * * @see API * specification */ @JsonpDeserializable public class IndexResultSummary implements JsonpSerializable { - private final boolean created; - private final String id; private final String index; + @Nullable + private final Boolean created; + + @Nullable private final Result result; - private final long version; + @Nullable + private final Long version; + + @Nullable + private final Boolean failed; + + @Nullable + private final String message; // --------------------------------------------------------------------------------------------- private IndexResultSummary(Builder builder) { - this.created = ApiTypeHelper.requireNonNull(builder.created, this, "created", false); this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - this.result = ApiTypeHelper.requireNonNull(builder.result, this, "result"); - this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version", 0); + this.created = builder.created; + this.result = builder.result; + this.version = builder.version; + this.failed = builder.failed; + this.message = builder.message; } @@ -89,13 +104,6 @@ public static IndexResultSummary of(Function + * API name: {@code failed} + */ + @Nullable + public final Boolean failed() { + return this.failed; + } + + /** + * Only present for failed items + *

+ * API name: {@code message} + */ + @Nullable + public final String message() { + return this.message; + } + /** * Serialize this object to JSON. */ @@ -135,19 +173,36 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("created"); - generator.write(this.created); - generator.writeKey("id"); generator.write(this.id); generator.writeKey("index"); generator.write(this.index); - generator.writeKey("result"); - this.result.serialize(generator, mapper); - generator.writeKey("version"); - generator.write(this.version); + if (this.created != null) { + generator.writeKey("created"); + generator.write(this.created); + + } + if (this.result != null) { + generator.writeKey("result"); + this.result.serialize(generator, mapper); + } + if (this.version != null) { + generator.writeKey("version"); + generator.write(this.version); + + } + if (this.failed != null) { + generator.writeKey("failed"); + generator.write(this.failed); + + } + if (this.message != null) { + generator.writeKey("message"); + generator.write(this.message); + + } } @@ -165,34 +220,37 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private Boolean created; - private String id; private String index; + @Nullable + private Boolean created; + + @Nullable private Result result; + @Nullable private Long version; + @Nullable + private Boolean failed; + + @Nullable + private String message; + public Builder() { } private Builder(IndexResultSummary instance) { - this.created = instance.created; this.id = instance.id; this.index = instance.index; + this.created = instance.created; this.result = instance.result; this.version = instance.version; + this.failed = instance.failed; + this.message = instance.message; } - /** - * Required - API name: {@code created} - */ - public final Builder created(boolean value) { - this.created = value; - return this; - } - /** * Required - API name: {@code id} */ @@ -210,21 +268,49 @@ public final Builder index(String value) { } /** - * Required - API name: {@code result} + * API name: {@code created} + */ + public final Builder created(@Nullable Boolean value) { + this.created = value; + return this; + } + + /** + * API name: {@code result} */ - public final Builder result(Result value) { + public final Builder result(@Nullable Result value) { this.result = value; return this; } /** - * Required - API name: {@code version} + * API name: {@code version} */ - public final Builder version(long value) { + public final Builder version(@Nullable Long value) { this.version = value; return this; } + /** + * Only present for failed items + *

+ * API name: {@code failed} + */ + public final Builder failed(@Nullable Boolean value) { + this.failed = value; + return this; + } + + /** + * Only present for failed items + *

+ * API name: {@code message} + */ + public final Builder message(@Nullable String value) { + this.message = value; + return this; + } + @Override protected Builder self() { return this; @@ -259,11 +345,13 @@ public Builder rebuild() { protected static void setupIndexResultSummaryDeserializer(ObjectDeserializer op) { - op.add(Builder::created, JsonpDeserializer.booleanDeserializer(), "created"); op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); + op.add(Builder::created, JsonpDeserializer.booleanDeserializer(), "created"); op.add(Builder::result, Result._DESERIALIZER, "result"); op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); + op.add(Builder::failed, JsonpDeserializer.booleanDeserializer(), "failed"); + op.add(Builder::message, JsonpDeserializer.stringDeserializer(), "message"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexResultVariant.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexResultVariant.java new file mode 100644 index 0000000000..f1af8f8523 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/IndexResultVariant.java @@ -0,0 +1,48 @@ +/* + * 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.watcher; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +/** + * Base interface for {@link IndexResult} variants. + */ +public interface IndexResultVariant { + + IndexResult.Kind _indexResultKind(); + + default IndexResult _toIndexResult() { + return new IndexResult(this); + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Input.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Input.java index a3165e53e5..290a57527e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Input.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Input.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch.watcher; +import co.elastic.clients.elasticsearch._types.Transform; import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonEnum; import co.elastic.clients.json.JsonpDeserializable; @@ -82,6 +83,8 @@ public enum Kind implements JsonEnum { Simple("simple"), + Transform("transform"), + ; private final String jsonValue; @@ -195,6 +198,23 @@ public Map simple() { return TaggedUnionUtils.get(this, Kind.Simple); } + /** + * Is this variant instance of kind {@code transform}? + */ + public boolean isTransform() { + return _kind == Kind.Transform; + } + + /** + * Get the {@code transform} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code transform} kind. + */ + public Transform transform() { + return TaggedUnionUtils.get(this, Kind.Transform); + } + @Override @SuppressWarnings("unchecked") public void serialize(JsonGenerator generator, JsonpMapper mapper) { @@ -272,6 +292,16 @@ public ObjectBuilder simple(Map v) { return this; } + public ObjectBuilder transform(Transform v) { + this._kind = Kind.Transform; + this._value = v; + return this; + } + + public ObjectBuilder transform(Function> fn) { + return this.transform(fn.apply(new Transform.Builder()).build()); + } + public Input build() { _checkSingleUse(); return new Input(this); @@ -285,6 +315,7 @@ protected static void setupInputDeserializer(ObjectDeserializer op) { op.add(Builder::http, HttpInput._DESERIALIZER, "http"); op.add(Builder::search, SearchInput._DESERIALIZER, "search"); op.add(Builder::simple, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "simple"); + op.add(Builder::transform, Transform._DESERIALIZER, "transform"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/InputBuilders.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/InputBuilders.java index 17861cf0aa..fd36c62dfe 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/InputBuilders.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/InputBuilders.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch.watcher; +import co.elastic.clients.elasticsearch._types.Transform; import co.elastic.clients.util.ObjectBuilder; import java.lang.String; import java.util.function.Function; @@ -97,4 +98,20 @@ public static Input search(Function> fn) { + Input.Builder builder = new Input.Builder(); + builder.transform(fn.apply(new Transform.Builder()).build()); + return builder.build(); + } + } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/InputType.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/InputType.java index 68c55c9c60..5b81cfedfa 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/InputType.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/InputType.java @@ -45,12 +45,18 @@ */ @JsonpDeserializable public enum InputType implements JsonEnum { + Chain("chain"), + Http("http"), + None("none"), + Search("search"), Simple("simple"), + Transform("transform"), + ; private final String jsonValue; diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/SearchInputRequestDefinition.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/SearchInputRequestDefinition.java index f52ce27429..c0f0ec1e69 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/SearchInputRequestDefinition.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/SearchInputRequestDefinition.java @@ -21,6 +21,8 @@ import co.elastic.clients.elasticsearch._types.IndicesOptions; import co.elastic.clients.elasticsearch._types.SearchType; +import co.elastic.clients.elasticsearch.core.SearchRequest; +import co.elastic.clients.elasticsearch.core.search.SearchRequestBody; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -65,7 +67,7 @@ @JsonpDeserializable public class SearchInputRequestDefinition implements JsonpSerializable { @Nullable - private final SearchInputRequestBody body; + private final SearchRequestBody body; private final List indices; @@ -102,7 +104,7 @@ public static SearchInputRequestDefinition of(Function implements ObjectBuilder { @Nullable - private SearchInputRequestBody body; + private SearchRequestBody body; @Nullable private List indices; @@ -239,7 +241,7 @@ private Builder(SearchInputRequestDefinition instance) { /** * API name: {@code body} */ - public final Builder body(@Nullable SearchInputRequestBody value) { + public final Builder body(@Nullable SearchRequestBody value) { this.body = value; return this; } @@ -247,8 +249,25 @@ public final Builder body(@Nullable SearchInputRequestBody value) { /** * API name: {@code body} */ - public final Builder body(Function> fn) { - return this.body(fn.apply(new SearchInputRequestBody.Builder()).build()); + public final Builder body(Function> fn) { + return this.body(fn.apply(new SearchRequestBody.Builder()).build()); + } + + public final Builder body(@Nullable SearchRequest value) { + SearchRequestBody body = SearchRequestBody.of(srb -> srb.aggregations(value.aggregations()) + .collapse(value.collapse()).explain(value.explain()).ext(value.ext()).from(value.from()) + .highlight(value.highlight()).trackTotalHits(value.trackTotalHits()) + .indicesBoost(value.indicesBoost()).docvalueFields(value.docvalueFields()).knn(value.knn()) + .rank(value.rank()).minScore(value.minScore()).postFilter(value.postFilter()) + .profile(value.profile()).query(value.query()).rescore(value.rescore()).retriever(value.retriever()) + .scriptFields(value.scriptFields()).searchAfter(value.searchAfter()).size(value.size()) + .slice(value.slice()).sort(value.sort()).source(value.source()).fields(value.fields()) + .suggest(value.suggest()).terminateAfter(value.terminateAfter()).timeout(value.timeout()) + .trackScores(value.trackScores()).version(value.version()) + .seqNoPrimaryTerm(value.seqNoPrimaryTerm()).storedFields(value.storedFields()).pit(value.pit()) + .runtimeMappings(value.runtimeMappings()).stats(value.stats())); + this.body = body; + return this; } /** @@ -353,7 +372,7 @@ public Builder rebuild() { protected static void setupSearchInputRequestDefinitionDeserializer( ObjectDeserializer op) { - op.add(Builder::body, SearchInputRequestBody._DESERIALIZER, "body"); + op.add(Builder::body, SearchRequestBody._DESERIALIZER, "body"); op.add(Builder::indices, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "indices"); op.add(Builder::indicesOptions, IndicesOptions._DESERIALIZER, "indices_options"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/SearchTemplateRequestBody.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/SearchTemplateRequestBody.java index 81994f90eb..e8447cbbd5 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/SearchTemplateRequestBody.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/SearchTemplateRequestBody.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch.watcher; +import co.elastic.clients.elasticsearch._types.ScriptLanguage; import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; @@ -69,6 +70,9 @@ public class SearchTemplateRequestBody implements JsonpSerializable { @Nullable private final String id; + @Nullable + private final String lang; + private final Map params; @Nullable @@ -83,6 +87,7 @@ private SearchTemplateRequestBody(Builder builder) { this.explain = builder.explain; this.id = builder.id; + this.lang = builder.lang; this.params = ApiTypeHelper.unmodifiable(builder.params); this.profile = builder.profile; this.source = builder.source; @@ -112,6 +117,17 @@ public final String id() { return this.id; } + /** + * The language the template is written in. It is reported in the resolved + * search input of a watch record. + *

+ * API name: {@code lang} + */ + @Nullable + public final String lang() { + return this.lang; + } + /** * API name: {@code params} */ @@ -159,6 +175,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("id"); generator.write(this.id); + } + if (this.lang != null) { + generator.writeKey("lang"); + generator.write(this.lang); + } if (ApiTypeHelper.isDefined(this.params)) { generator.writeKey("params"); @@ -204,6 +225,9 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private String id; + @Nullable + private String lang; + @Nullable private Map params; @@ -218,6 +242,7 @@ public Builder() { private Builder(SearchTemplateRequestBody instance) { this.explain = instance.explain; this.id = instance.id; + this.lang = instance.lang; this.params = instance.params; this.profile = instance.profile; this.source = instance.source; @@ -242,6 +267,28 @@ public final Builder id(@Nullable String value) { return this; } + /** + * The language the template is written in. It is reported in the resolved + * search input of a watch record. + *

+ * API name: {@code lang} + */ + public final Builder lang(@Nullable String value) { + this.lang = value; + return this; + } + + /** + * The language the template is written in. It is reported in the resolved + * search input of a watch record. + *

+ * API name: {@code lang} + */ + public final Builder lang(@Nullable ScriptLanguage value) { + this.lang = value == null ? null : value.jsonValue(); + return this; + } + /** * API name: {@code params} *

@@ -319,6 +366,7 @@ protected static void setupSearchTemplateRequestBodyDeserializer( op.add(Builder::explain, JsonpDeserializer.booleanDeserializer(), "explain"); op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); + op.add(Builder::lang, JsonpDeserializer.stringDeserializer(), "lang"); op.add(Builder::params, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "params"); op.add(Builder::profile, JsonpDeserializer.booleanDeserializer(), "profile"); op.add(Builder::source, JsonpDeserializer.stringDeserializer(), "source"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Watch.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Watch.java index 9e31a84035..9d850d02f3 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Watch.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/Watch.java @@ -67,6 +67,7 @@ public class Watch implements JsonpSerializable { private final Map actions; + @Nullable private final Condition condition; private final Input input; @@ -92,7 +93,7 @@ public class Watch implements JsonpSerializable { private Watch(Builder builder) { this.actions = ApiTypeHelper.unmodifiableRequired(builder.actions, this, "actions"); - this.condition = ApiTypeHelper.requireNonNull(builder.condition, this, "condition"); + this.condition = builder.condition; this.input = ApiTypeHelper.requireNonNull(builder.input, this, "input"); this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); this.status = builder.status; @@ -115,8 +116,9 @@ public final Map actions() { } /** - * Required - API name: {@code condition} + * API name: {@code condition} */ + @Nullable public final Condition condition() { return this.condition; } @@ -196,9 +198,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - generator.writeKey("condition"); - this.condition.serialize(generator, mapper); + if (this.condition != null) { + generator.writeKey("condition"); + this.condition.serialize(generator, mapper); + } generator.writeKey("input"); this.input.serialize(generator, mapper); @@ -252,6 +256,7 @@ public String toString() { public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { private Map actions; + @Nullable private Condition condition; private Input input; @@ -317,22 +322,22 @@ public final Builder actions(String key, Function> fn) { return this.condition(fn.apply(new Condition.Builder()).build()); } /** - * Required - API name: {@code condition} + * API name: {@code condition} */ public final Builder condition(ConditionVariant value) { this.condition = value._toCondition(); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/execute_watch/WatchRecord.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/execute_watch/WatchRecord.java index 5f12e3fe06..5e9fab392c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/execute_watch/WatchRecord.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/watcher/execute_watch/WatchRecord.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch.watcher.execute_watch; +import co.elastic.clients.elasticsearch._types.ErrorCause; import co.elastic.clients.elasticsearch.watcher.Condition; import co.elastic.clients.elasticsearch.watcher.ConditionVariant; import co.elastic.clients.elasticsearch.watcher.ExecutionResult; @@ -36,6 +37,7 @@ import co.elastic.clients.json.ObjectBuilderDeserializer; import co.elastic.clients.json.ObjectDeserializer; import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.DateTime; import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; @@ -71,44 +73,58 @@ */ @JsonpDeserializable public class WatchRecord implements JsonpSerializable { + private final DateTime timestamp; + + private final String node; + + private final ExecutionStatus state; + + private final TriggerEventResult triggerEvent; + + private final String watchId; + + @Nullable private final Condition condition; + @Nullable private final Input input; - private final List messages; - private final Map metadata; - private final String node; - + @Nullable private final ExecutionResult result; - private final ExecutionStatus state; + @Nullable + private final String user; - private final TriggerEventResult triggerEvent; + @Nullable + private final WatchStatus status; - private final String user; + private final List messages; - private final String watchId; + private final Map vars; @Nullable - private final WatchStatus status; + private final ErrorCause exception; // --------------------------------------------------------------------------------------------- private WatchRecord(Builder builder) { - this.condition = ApiTypeHelper.requireNonNull(builder.condition, this, "condition"); - this.input = ApiTypeHelper.requireNonNull(builder.input, this, "input"); - this.messages = ApiTypeHelper.unmodifiableRequired(builder.messages, this, "messages"); - this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); + this.timestamp = ApiTypeHelper.requireNonNull(builder.timestamp, this, "timestamp"); this.node = ApiTypeHelper.requireNonNull(builder.node, this, "node"); - this.result = ApiTypeHelper.requireNonNull(builder.result, this, "result"); this.state = ApiTypeHelper.requireNonNull(builder.state, this, "state"); this.triggerEvent = ApiTypeHelper.requireNonNull(builder.triggerEvent, this, "triggerEvent"); - this.user = ApiTypeHelper.requireNonNull(builder.user, this, "user"); this.watchId = ApiTypeHelper.requireNonNull(builder.watchId, this, "watchId"); + this.condition = builder.condition; + this.input = builder.input; + this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); + this.result = builder.result; + this.user = builder.user; this.status = builder.status; + this.messages = ApiTypeHelper.unmodifiable(builder.messages); + this.vars = ApiTypeHelper.unmodifiable(builder.vars); + this.exception = builder.exception; } @@ -117,73 +133,77 @@ public static WatchRecord of(Function> fn) { } /** - * Required - API name: {@code condition} + * Required - API name: {@code @timestamp} */ - public final Condition condition() { - return this.condition; + public final DateTime timestamp() { + return this.timestamp; } /** - * Required - API name: {@code input} + * Required - API name: {@code node} */ - public final Input input() { - return this.input; + public final String node() { + return this.node; } /** - * Required - API name: {@code messages} + * Required - API name: {@code state} */ - public final List messages() { - return this.messages; + public final ExecutionStatus state() { + return this.state; } /** - * API name: {@code metadata} + * Required - API name: {@code trigger_event} */ - public final Map metadata() { - return this.metadata; + public final TriggerEventResult triggerEvent() { + return this.triggerEvent; } /** - * Required - API name: {@code node} + * Required - API name: {@code watch_id} */ - public final String node() { - return this.node; + public final String watchId() { + return this.watchId; } /** - * Required - API name: {@code result} + * API name: {@code condition} */ - public final ExecutionResult result() { - return this.result; + @Nullable + public final Condition condition() { + return this.condition; } /** - * Required - API name: {@code state} + * API name: {@code input} */ - public final ExecutionStatus state() { - return this.state; + @Nullable + public final Input input() { + return this.input; } /** - * Required - API name: {@code trigger_event} + * API name: {@code metadata} */ - public final TriggerEventResult triggerEvent() { - return this.triggerEvent; + public final Map metadata() { + return this.metadata; } /** - * Required - API name: {@code user} + * API name: {@code result} */ - public final String user() { - return this.user; + @Nullable + public final ExecutionResult result() { + return this.result; } /** - * Required - API name: {@code watch_id} + * API name: {@code user} */ - public final String watchId() { - return this.watchId; + @Nullable + public final String user() { + return this.user; } /** @@ -194,6 +214,28 @@ public final WatchStatus status() { return this.status; } + /** + * API name: {@code messages} + */ + public final List messages() { + return this.messages; + } + + /** + * API name: {@code vars} + */ + public final Map vars() { + return this.vars; + } + + /** + * API name: {@code exception} + */ + @Nullable + public final ErrorCause exception() { + return this.exception; + } + /** * Serialize this object to JSON. */ @@ -205,20 +247,27 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("condition"); - this.condition.serialize(generator, mapper); + generator.writeKey("@timestamp"); + this.timestamp.serialize(generator, mapper); + generator.writeKey("node"); + generator.write(this.node); - generator.writeKey("input"); - this.input.serialize(generator, mapper); + generator.writeKey("state"); + this.state.serialize(generator, mapper); + generator.writeKey("trigger_event"); + this.triggerEvent.serialize(generator, mapper); - if (ApiTypeHelper.isDefined(this.messages)) { - generator.writeKey("messages"); - generator.writeStartArray(); - for (String item0 : this.messages) { - generator.write(item0); + generator.writeKey("watch_id"); + generator.write(this.watchId); - } - generator.writeEnd(); + if (this.condition != null) { + generator.writeKey("condition"); + this.condition.serialize(generator, mapper); + + } + if (this.input != null) { + generator.writeKey("input"); + this.input.serialize(generator, mapper); } if (ApiTypeHelper.isDefined(this.metadata)) { @@ -232,28 +281,47 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - generator.writeKey("node"); - generator.write(this.node); - - generator.writeKey("result"); - this.result.serialize(generator, mapper); + if (this.result != null) { + generator.writeKey("result"); + this.result.serialize(generator, mapper); - generator.writeKey("state"); - this.state.serialize(generator, mapper); - generator.writeKey("trigger_event"); - this.triggerEvent.serialize(generator, mapper); - - generator.writeKey("user"); - generator.write(this.user); - - generator.writeKey("watch_id"); - generator.write(this.watchId); + } + if (this.user != null) { + generator.writeKey("user"); + generator.write(this.user); + } if (this.status != null) { generator.writeKey("status"); this.status.serialize(generator, mapper); } + if (ApiTypeHelper.isDefined(this.messages)) { + generator.writeKey("messages"); + generator.writeStartArray(); + for (String item0 : this.messages) { + generator.write(item0); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.vars)) { + generator.writeKey("vars"); + generator.writeStartObject(); + for (Map.Entry item0 : this.vars.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (this.exception != null) { + generator.writeKey("exception"); + this.exception.serialize(generator, mapper); + + } } @@ -269,109 +337,152 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private DateTime timestamp; + + private String node; + + private ExecutionStatus state; + + private TriggerEventResult triggerEvent; + + private String watchId; + + @Nullable private Condition condition; + @Nullable private Input input; - private List messages; - @Nullable private Map metadata; - private String node; - + @Nullable private ExecutionResult result; - private ExecutionStatus state; + @Nullable + private String user; - private TriggerEventResult triggerEvent; + @Nullable + private WatchStatus status; - private String user; + @Nullable + private List messages; - private String watchId; + @Nullable + private Map vars; @Nullable - private WatchStatus status; + private ErrorCause exception; public Builder() { } private Builder(WatchRecord instance) { + this.timestamp = instance.timestamp; + this.node = instance.node; + this.state = instance.state; + this.triggerEvent = instance.triggerEvent; + this.watchId = instance.watchId; this.condition = instance.condition; this.input = instance.input; - this.messages = instance.messages; this.metadata = instance.metadata; - this.node = instance.node; this.result = instance.result; - this.state = instance.state; - this.triggerEvent = instance.triggerEvent; this.user = instance.user; - this.watchId = instance.watchId; this.status = instance.status; + this.messages = instance.messages; + this.vars = instance.vars; + this.exception = instance.exception; } /** - * Required - API name: {@code condition} + * Required - API name: {@code @timestamp} */ - public final Builder condition(Condition value) { - this.condition = value; + public final Builder timestamp(DateTime value) { + this.timestamp = value; return this; } /** - * Required - API name: {@code condition} + * Required - API name: {@code node} */ - public final Builder condition(Function> fn) { - return this.condition(fn.apply(new Condition.Builder()).build()); + public final Builder node(String value) { + this.node = value; + return this; } /** - * Required - API name: {@code condition} + * Required - API name: {@code state} */ - public final Builder condition(ConditionVariant value) { - this.condition = value._toCondition(); + public final Builder state(ExecutionStatus value) { + this.state = value; return this; } /** - * Required - API name: {@code input} + * Required - API name: {@code trigger_event} */ - public final Builder input(Input value) { - this.input = value; + public final Builder triggerEvent(TriggerEventResult value) { + this.triggerEvent = value; return this; } /** - * Required - API name: {@code input} + * Required - API name: {@code trigger_event} */ - public final Builder input(Function> fn) { - return this.input(fn.apply(new Input.Builder()).build()); + public final Builder triggerEvent(Function> fn) { + return this.triggerEvent(fn.apply(new TriggerEventResult.Builder()).build()); } /** - * Required - API name: {@code input} + * Required - API name: {@code watch_id} */ - public final Builder input(InputVariant value) { - this.input = value._toInput(); + public final Builder watchId(String value) { + this.watchId = value; return this; } /** - * Required - API name: {@code messages} - *

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

- * Adds one or more values to messages. + * API name: {@code condition} */ - public final Builder messages(String value, String... values) { - this.messages = _listAdd(this.messages, value, values); + public final Builder condition(Function> fn) { + return this.condition(fn.apply(new Condition.Builder()).build()); + } + + /** + * API name: {@code condition} + */ + public final Builder condition(ConditionVariant value) { + this.condition = value._toCondition(); + return this; + } + + /** + * API name: {@code input} + */ + public final Builder input(@Nullable Input value) { + this.input = value; + return this; + } + + /** + * API name: {@code input} + */ + public final Builder input(Function> fn) { + return this.input(fn.apply(new Input.Builder()).build()); + } + + /** + * API name: {@code input} + */ + public final Builder input(InputVariant value) { + this.input = value._toInput(); return this; } @@ -396,80 +507,96 @@ public final Builder metadata(String key, JsonData value) { } /** - * Required - API name: {@code node} + * API name: {@code result} */ - public final Builder node(String value) { - this.node = value; + public final Builder result(@Nullable ExecutionResult value) { + this.result = value; return this; } /** - * Required - API name: {@code result} + * API name: {@code result} */ - public final Builder result(ExecutionResult value) { - this.result = value; - return this; + public final Builder result(Function> fn) { + return this.result(fn.apply(new ExecutionResult.Builder()).build()); } /** - * Required - API name: {@code result} + * API name: {@code user} */ - public final Builder result(Function> fn) { - return this.result(fn.apply(new ExecutionResult.Builder()).build()); + public final Builder user(@Nullable String value) { + this.user = value; + return this; } /** - * Required - API name: {@code state} + * API name: {@code status} */ - public final Builder state(ExecutionStatus value) { - this.state = value; + public final Builder status(@Nullable WatchStatus value) { + this.status = value; return this; } /** - * Required - API name: {@code trigger_event} + * API name: {@code status} */ - public final Builder triggerEvent(TriggerEventResult value) { - this.triggerEvent = value; + public final Builder status(Function> fn) { + return this.status(fn.apply(new WatchStatus.Builder()).build()); + } + + /** + * API name: {@code messages} + *

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

+ * Adds one or more values to messages. */ - public final Builder triggerEvent(Function> fn) { - return this.triggerEvent(fn.apply(new TriggerEventResult.Builder()).build()); + public final Builder messages(String value, String... values) { + this.messages = _listAdd(this.messages, value, values); + return this; } /** - * Required - API name: {@code user} + * API name: {@code vars} + *

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

+ * Adds an entry to vars. */ - public final Builder watchId(String value) { - this.watchId = value; + public final Builder vars(String key, JsonData value) { + this.vars = _mapPut(this.vars, key, value); return this; } /** - * API name: {@code status} + * API name: {@code exception} */ - public final Builder status(@Nullable WatchStatus value) { - this.status = value; + public final Builder exception(@Nullable ErrorCause value) { + this.exception = value; return this; } /** - * API name: {@code status} + * API name: {@code exception} */ - public final Builder status(Function> fn) { - return this.status(fn.apply(new WatchStatus.Builder()).build()); + public final Builder exception(Function> fn) { + return this.exception(fn.apply(new ErrorCause.Builder()).build()); } @Override @@ -506,18 +633,21 @@ public Builder rebuild() { protected static void setupWatchRecordDeserializer(ObjectDeserializer op) { + op.add(Builder::timestamp, DateTime._DESERIALIZER, "@timestamp"); + op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node"); + op.add(Builder::state, ExecutionStatus._DESERIALIZER, "state"); + op.add(Builder::triggerEvent, TriggerEventResult._DESERIALIZER, "trigger_event"); + op.add(Builder::watchId, JsonpDeserializer.stringDeserializer(), "watch_id"); op.add(Builder::condition, Condition._DESERIALIZER, "condition"); op.add(Builder::input, Input._DESERIALIZER, "input"); - op.add(Builder::messages, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "messages"); op.add(Builder::metadata, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "metadata"); - op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node"); op.add(Builder::result, ExecutionResult._DESERIALIZER, "result"); - op.add(Builder::state, ExecutionStatus._DESERIALIZER, "state"); - op.add(Builder::triggerEvent, TriggerEventResult._DESERIALIZER, "trigger_event"); op.add(Builder::user, JsonpDeserializer.stringDeserializer(), "user"); - op.add(Builder::watchId, JsonpDeserializer.stringDeserializer(), "watch_id"); op.add(Builder::status, WatchStatus._DESERIALIZER, "status"); + op.add(Builder::messages, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), + "messages"); + op.add(Builder::vars, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "vars"); + op.add(Builder::exception, ErrorCause._DESERIALIZER, "exception"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/XpackUsageResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/XpackUsageResponse.java index 706da3aa76..8d7e3e5a86 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/XpackUsageResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/XpackUsageResponse.java @@ -23,6 +23,7 @@ import co.elastic.clients.elasticsearch.xpack.usage.Archive; import co.elastic.clients.elasticsearch.xpack.usage.Base; import co.elastic.clients.elasticsearch.xpack.usage.Ccr; +import co.elastic.clients.elasticsearch.xpack.usage.DataStreamLifecycleUsage; import co.elastic.clients.elasticsearch.xpack.usage.DataStreams; import co.elastic.clients.elasticsearch.xpack.usage.DataTiers; import co.elastic.clients.elasticsearch.xpack.usage.Eql; @@ -30,6 +31,7 @@ import co.elastic.clients.elasticsearch.xpack.usage.GpuVectorIndexing; import co.elastic.clients.elasticsearch.xpack.usage.HealthStatistics; import co.elastic.clients.elasticsearch.xpack.usage.Ilm; +import co.elastic.clients.elasticsearch.xpack.usage.Logging; import co.elastic.clients.elasticsearch.xpack.usage.MachineLearning; import co.elastic.clients.elasticsearch.xpack.usage.Monitoring; import co.elastic.clients.elasticsearch.xpack.usage.RuntimeFieldTypes; @@ -38,6 +40,7 @@ import co.elastic.clients.elasticsearch.xpack.usage.Slm; import co.elastic.clients.elasticsearch.xpack.usage.Sql; import co.elastic.clients.elasticsearch.xpack.usage.Vector; +import co.elastic.clients.elasticsearch.xpack.usage.VectorDbDocument; import co.elastic.clients.elasticsearch.xpack.usage.Watcher; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; @@ -94,6 +97,9 @@ public class XpackUsageResponse implements JsonpSerializable { @Nullable private final Base dataScience; + @Nullable + private final DataStreamLifecycleUsage dataLifecycle; + @Nullable private final DataStreams dataStreams; @@ -117,6 +123,9 @@ public class XpackUsageResponse implements JsonpSerializable { private final Ilm ilm; + @Nullable + private final Logging logging; + private final Base logstash; private final MachineLearning ml; @@ -143,6 +152,9 @@ public class XpackUsageResponse implements JsonpSerializable { @Nullable private final Vector vectors; + @Nullable + private final VectorDbDocument vectordbDocument; + private final Base votingOnly; // --------------------------------------------------------------------------------------------- @@ -156,6 +168,7 @@ private XpackUsageResponse(Builder builder) { this.ccr = ApiTypeHelper.requireNonNull(builder.ccr, this, "ccr"); this.dataFrame = builder.dataFrame; this.dataScience = builder.dataScience; + this.dataLifecycle = builder.dataLifecycle; this.dataStreams = builder.dataStreams; this.dataTiers = ApiTypeHelper.requireNonNull(builder.dataTiers, this, "dataTiers"); this.enrich = builder.enrich; @@ -165,6 +178,7 @@ private XpackUsageResponse(Builder builder) { this.gpuVectorIndexing = builder.gpuVectorIndexing; this.healthApi = builder.healthApi; this.ilm = ApiTypeHelper.requireNonNull(builder.ilm, this, "ilm"); + this.logging = builder.logging; this.logstash = ApiTypeHelper.requireNonNull(builder.logstash, this, "logstash"); this.ml = ApiTypeHelper.requireNonNull(builder.ml, this, "ml"); this.monitoring = ApiTypeHelper.requireNonNull(builder.monitoring, this, "monitoring"); @@ -178,6 +192,7 @@ private XpackUsageResponse(Builder builder) { this.sql = ApiTypeHelper.requireNonNull(builder.sql, this, "sql"); this.transform = ApiTypeHelper.requireNonNull(builder.transform, this, "transform"); this.vectors = builder.vectors; + this.vectordbDocument = builder.vectordbDocument; this.votingOnly = ApiTypeHelper.requireNonNull(builder.votingOnly, this, "votingOnly"); } @@ -237,6 +252,14 @@ public final Base dataScience() { return this.dataScience; } + /** + * API name: {@code data_lifecycle} + */ + @Nullable + public final DataStreamLifecycleUsage dataLifecycle() { + return this.dataLifecycle; + } + /** * API name: {@code data_streams} */ @@ -305,6 +328,14 @@ public final Ilm ilm() { return this.ilm; } + /** + * API name: {@code logging} + */ + @Nullable + public final Logging logging() { + return this.logging; + } + /** * Required - API name: {@code logstash} */ @@ -391,6 +422,14 @@ public final Vector vectors() { return this.vectors; } + /** + * API name: {@code vectordb_document} + */ + @Nullable + public final VectorDbDocument vectordbDocument() { + return this.vectordbDocument; + } + /** * Required - API name: {@code voting_only} */ @@ -433,6 +472,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("data_science"); this.dataScience.serialize(generator, mapper); + } + if (this.dataLifecycle != null) { + generator.writeKey("data_lifecycle"); + this.dataLifecycle.serialize(generator, mapper); + } if (this.dataStreams != null) { generator.writeKey("data_streams"); @@ -471,6 +515,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("ilm"); this.ilm.serialize(generator, mapper); + if (this.logging != null) { + generator.writeKey("logging"); + this.logging.serialize(generator, mapper); + + } generator.writeKey("logstash"); this.logstash.serialize(generator, mapper); @@ -510,6 +559,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("vectors"); this.vectors.serialize(generator, mapper); + } + if (this.vectordbDocument != null) { + generator.writeKey("vectordb_document"); + this.vectordbDocument.serialize(generator, mapper); + } generator.writeKey("voting_only"); this.votingOnly.serialize(generator, mapper); @@ -546,6 +600,9 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private Base dataScience; + @Nullable + private DataStreamLifecycleUsage dataLifecycle; + @Nullable private DataStreams dataStreams; @@ -569,6 +626,9 @@ public static class Builder extends WithJsonObjectBuilderBase private Ilm ilm; + @Nullable + private Logging logging; + private Base logstash; private MachineLearning ml; @@ -595,6 +655,9 @@ public static class Builder extends WithJsonObjectBuilderBase @Nullable private Vector vectors; + @Nullable + private VectorDbDocument vectordbDocument; + private Base votingOnly; /** @@ -702,6 +765,22 @@ public final Builder dataScience(Function> fn) return this.dataScience(fn.apply(new Base.Builder()).build()); } + /** + * API name: {@code data_lifecycle} + */ + public final Builder dataLifecycle(@Nullable DataStreamLifecycleUsage value) { + this.dataLifecycle = value; + return this; + } + + /** + * API name: {@code data_lifecycle} + */ + public final Builder dataLifecycle( + Function> fn) { + return this.dataLifecycle(fn.apply(new DataStreamLifecycleUsage.Builder()).build()); + } + /** * API name: {@code data_streams} */ @@ -838,6 +917,21 @@ public final Builder ilm(Function> fn) { return this.ilm(fn.apply(new Ilm.Builder()).build()); } + /** + * API name: {@code logging} + */ + public final Builder logging(@Nullable Logging value) { + this.logging = value; + return this; + } + + /** + * API name: {@code logging} + */ + public final Builder logging(Function> fn) { + return this.logging(fn.apply(new Logging.Builder()).build()); + } + /** * Required - API name: {@code logstash} */ @@ -1019,6 +1113,21 @@ public final Builder vectors(Function> fn) return this.vectors(fn.apply(new Vector.Builder()).build()); } + /** + * API name: {@code vectordb_document} + */ + public final Builder vectordbDocument(@Nullable VectorDbDocument value) { + this.vectordbDocument = value; + return this; + } + + /** + * API name: {@code vectordb_document} + */ + public final Builder vectordbDocument(Function> fn) { + return this.vectordbDocument(fn.apply(new VectorDbDocument.Builder()).build()); + } + /** * Required - API name: {@code voting_only} */ @@ -1069,6 +1178,7 @@ protected static void setupXpackUsageResponseDeserializer(ObjectDeserializerAPI + * specification + */ +@JsonpDeserializable +public class DataStreamLifecycleEffectiveRetentionStats extends DataStreamLifecycleThresholdStats { + private final long retainedDataStreams; + + // --------------------------------------------------------------------------------------------- + + private DataStreamLifecycleEffectiveRetentionStats(Builder builder) { + super(builder); + + this.retainedDataStreams = ApiTypeHelper.requireNonNull(builder.retainedDataStreams, this, + "retainedDataStreams", 0); + + } + + public static DataStreamLifecycleEffectiveRetentionStats of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The number of data streams for which an effective retention + * applies. + *

+ * API name: {@code retained_data_streams} + */ + public final long retainedDataStreams() { + return this.retainedDataStreams; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + generator.writeKey("retained_data_streams"); + generator.write(this.retainedDataStreams); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DataStreamLifecycleEffectiveRetentionStats}. + */ + + public static class Builder extends DataStreamLifecycleThresholdStats.AbstractBuilder + implements + ObjectBuilder { + private Long retainedDataStreams; + + public Builder() { + } + private Builder(DataStreamLifecycleEffectiveRetentionStats instance) { + this.retainedDataStreams = instance.retainedDataStreams; + + } + /** + * Required - The number of data streams for which an effective retention + * applies. + *

+ * API name: {@code retained_data_streams} + */ + public final Builder retainedDataStreams(long value) { + this.retainedDataStreams = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DataStreamLifecycleEffectiveRetentionStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DataStreamLifecycleEffectiveRetentionStats build() { + _checkSingleUse(); + + return new DataStreamLifecycleEffectiveRetentionStats(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DataStreamLifecycleEffectiveRetentionStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, + DataStreamLifecycleEffectiveRetentionStats::setupDataStreamLifecycleEffectiveRetentionStatsDeserializer); + + protected static void setupDataStreamLifecycleEffectiveRetentionStatsDeserializer( + ObjectDeserializer op) { + DataStreamLifecycleThresholdStats.setupDataStreamLifecycleThresholdStatsDeserializer(op); + op.add(Builder::retainedDataStreams, JsonpDeserializer.longDeserializer(), "retained_data_streams"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/DataStreamLifecycleGlobalRetention.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/DataStreamLifecycleGlobalRetention.java new file mode 100644 index 0000000000..1b54ba6893 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/DataStreamLifecycleGlobalRetention.java @@ -0,0 +1,223 @@ +/* + * 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.xpack.usage; + +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: xpack.usage.DataStreamLifecycleGlobalRetention + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DataStreamLifecycleGlobalRetention implements JsonpSerializable { + private final DataStreamLifecycleGlobalRetentionStats default_; + + private final DataStreamLifecycleGlobalRetentionStats max; + + // --------------------------------------------------------------------------------------------- + + private DataStreamLifecycleGlobalRetention(Builder builder) { + + this.default_ = ApiTypeHelper.requireNonNull(builder.default_, this, "default_"); + this.max = ApiTypeHelper.requireNonNull(builder.max, this, "max"); + + } + + public static DataStreamLifecycleGlobalRetention of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Statistics about the cluster's default global retention. + *

+ * API name: {@code default} + */ + public final DataStreamLifecycleGlobalRetentionStats default_() { + return this.default_; + } + + /** + * Required - Statistics about the cluster's maximum global retention. + *

+ * API name: {@code max} + */ + public final DataStreamLifecycleGlobalRetentionStats max() { + return this.max; + } + + /** + * 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("default"); + this.default_.serialize(generator, mapper); + + generator.writeKey("max"); + this.max.serialize(generator, mapper); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DataStreamLifecycleGlobalRetention}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private DataStreamLifecycleGlobalRetentionStats default_; + + private DataStreamLifecycleGlobalRetentionStats max; + + public Builder() { + } + private Builder(DataStreamLifecycleGlobalRetention instance) { + this.default_ = instance.default_; + this.max = instance.max; + + } + /** + * Required - Statistics about the cluster's default global retention. + *

+ * API name: {@code default} + */ + public final Builder default_(DataStreamLifecycleGlobalRetentionStats value) { + this.default_ = value; + return this; + } + + /** + * Required - Statistics about the cluster's default global retention. + *

+ * API name: {@code default} + */ + public final Builder default_( + Function> fn) { + return this.default_(fn.apply(new DataStreamLifecycleGlobalRetentionStats.Builder()).build()); + } + + /** + * Required - Statistics about the cluster's maximum global retention. + *

+ * API name: {@code max} + */ + public final Builder max(DataStreamLifecycleGlobalRetentionStats value) { + this.max = value; + return this; + } + + /** + * Required - Statistics about the cluster's maximum global retention. + *

+ * API name: {@code max} + */ + public final Builder max( + Function> fn) { + return this.max(fn.apply(new DataStreamLifecycleGlobalRetentionStats.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DataStreamLifecycleGlobalRetention}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DataStreamLifecycleGlobalRetention build() { + _checkSingleUse(); + + return new DataStreamLifecycleGlobalRetention(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DataStreamLifecycleGlobalRetention} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, + DataStreamLifecycleGlobalRetention::setupDataStreamLifecycleGlobalRetentionDeserializer); + + protected static void setupDataStreamLifecycleGlobalRetentionDeserializer( + ObjectDeserializer op) { + + op.add(Builder::default_, DataStreamLifecycleGlobalRetentionStats._DESERIALIZER, "default"); + op.add(Builder::max, DataStreamLifecycleGlobalRetentionStats._DESERIALIZER, "max"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/DataStreamLifecycleGlobalRetentionStats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/DataStreamLifecycleGlobalRetentionStats.java new file mode 100644 index 0000000000..950d8feb8a --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/DataStreamLifecycleGlobalRetentionStats.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. + */ + +package co.elastic.clients.elasticsearch.xpack.usage; + +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.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: xpack.usage.DataStreamLifecycleGlobalRetentionStats + +/** + * The affected_data_streams and retention_millis + * fields are only present when this global retention is defined. + * + * @see API + * specification + */ +@JsonpDeserializable +public class DataStreamLifecycleGlobalRetentionStats implements JsonpSerializable { + private final boolean defined; + + @Nullable + private final Long affectedDataStreams; + + @Nullable + private final Long retentionMillis; + + // --------------------------------------------------------------------------------------------- + + private DataStreamLifecycleGlobalRetentionStats(Builder builder) { + + this.defined = ApiTypeHelper.requireNonNull(builder.defined, this, "defined", false); + this.affectedDataStreams = builder.affectedDataStreams; + this.retentionMillis = builder.retentionMillis; + + } + + public static DataStreamLifecycleGlobalRetentionStats of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Whether this global retention is defined for the cluster. + *

+ * API name: {@code defined} + */ + public final boolean defined() { + return this.defined; + } + + /** + * The number of data streams affected by this global retention. + *

+ * API name: {@code affected_data_streams} + */ + @Nullable + public final Long affectedDataStreams() { + return this.affectedDataStreams; + } + + /** + * The global retention period in milliseconds. + *

+ * API name: {@code retention_millis} + */ + @Nullable + public final Long retentionMillis() { + return this.retentionMillis; + } + + /** + * 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("defined"); + generator.write(this.defined); + + if (this.affectedDataStreams != null) { + generator.writeKey("affected_data_streams"); + generator.write(this.affectedDataStreams); + + } + if (this.retentionMillis != null) { + generator.writeKey("retention_millis"); + generator.write(this.retentionMillis); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DataStreamLifecycleGlobalRetentionStats}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private Boolean defined; + + @Nullable + private Long affectedDataStreams; + + @Nullable + private Long retentionMillis; + + public Builder() { + } + private Builder(DataStreamLifecycleGlobalRetentionStats instance) { + this.defined = instance.defined; + this.affectedDataStreams = instance.affectedDataStreams; + this.retentionMillis = instance.retentionMillis; + + } + /** + * Required - Whether this global retention is defined for the cluster. + *

+ * API name: {@code defined} + */ + public final Builder defined(boolean value) { + this.defined = value; + return this; + } + + /** + * The number of data streams affected by this global retention. + *

+ * API name: {@code affected_data_streams} + */ + public final Builder affectedDataStreams(@Nullable Long value) { + this.affectedDataStreams = value; + return this; + } + + /** + * The global retention period in milliseconds. + *

+ * API name: {@code retention_millis} + */ + public final Builder retentionMillis(@Nullable Long value) { + this.retentionMillis = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DataStreamLifecycleGlobalRetentionStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DataStreamLifecycleGlobalRetentionStats build() { + _checkSingleUse(); + + return new DataStreamLifecycleGlobalRetentionStats(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DataStreamLifecycleGlobalRetentionStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, + DataStreamLifecycleGlobalRetentionStats::setupDataStreamLifecycleGlobalRetentionStatsDeserializer); + + protected static void setupDataStreamLifecycleGlobalRetentionStatsDeserializer( + ObjectDeserializer op) { + + op.add(Builder::defined, JsonpDeserializer.booleanDeserializer(), "defined"); + op.add(Builder::affectedDataStreams, JsonpDeserializer.longDeserializer(), "affected_data_streams"); + op.add(Builder::retentionMillis, JsonpDeserializer.longDeserializer(), "retention_millis"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/DataStreamLifecycleRetentionStats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/DataStreamLifecycleRetentionStats.java new file mode 100644 index 0000000000..2ae02ce85c --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/DataStreamLifecycleRetentionStats.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.xpack.usage; + +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.Long; +import java.util.Objects; +import java.util.function.Function; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: xpack.usage.DataStreamLifecycleRetentionStats + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class DataStreamLifecycleRetentionStats extends DataStreamLifecycleThresholdStats { + private final long configuredDataStreams; + + // --------------------------------------------------------------------------------------------- + + private DataStreamLifecycleRetentionStats(Builder builder) { + super(builder); + + this.configuredDataStreams = ApiTypeHelper.requireNonNull(builder.configuredDataStreams, this, + "configuredDataStreams", 0); + + } + + public static DataStreamLifecycleRetentionStats of( + Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The number of data streams for which this value is configured. + *

+ * API name: {@code configured_data_streams} + */ + public final long configuredDataStreams() { + return this.configuredDataStreams; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + generator.writeKey("configured_data_streams"); + generator.write(this.configuredDataStreams); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DataStreamLifecycleRetentionStats}. + */ + + public static class Builder extends DataStreamLifecycleThresholdStats.AbstractBuilder + implements + ObjectBuilder { + private Long configuredDataStreams; + + public Builder() { + } + private Builder(DataStreamLifecycleRetentionStats instance) { + this.configuredDataStreams = instance.configuredDataStreams; + + } + /** + * Required - The number of data streams for which this value is configured. + *

+ * API name: {@code configured_data_streams} + */ + public final Builder configuredDataStreams(long value) { + this.configuredDataStreams = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DataStreamLifecycleRetentionStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DataStreamLifecycleRetentionStats build() { + _checkSingleUse(); + + return new DataStreamLifecycleRetentionStats(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DataStreamLifecycleRetentionStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DataStreamLifecycleRetentionStats::setupDataStreamLifecycleRetentionStatsDeserializer); + + protected static void setupDataStreamLifecycleRetentionStatsDeserializer( + ObjectDeserializer op) { + DataStreamLifecycleThresholdStats.setupDataStreamLifecycleThresholdStatsDeserializer(op); + op.add(Builder::configuredDataStreams, JsonpDeserializer.longDeserializer(), "configured_data_streams"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/DataStreamLifecycleThresholdStats.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/DataStreamLifecycleThresholdStats.java new file mode 100644 index 0000000000..06e0602985 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/DataStreamLifecycleThresholdStats.java @@ -0,0 +1,204 @@ +/* + * 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.xpack.usage; + +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.Double; +import java.lang.Long; +import java.util.Objects; +import javax.annotation.Nullable; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: xpack.usage.DataStreamLifecycleThresholdStats + +/** + * The minimum_millis, maximum_millis, and + * average_millis fields are only present when at least one data + * stream contributes to these statistics. + * + * @see API + * specification + */ + +public abstract class DataStreamLifecycleThresholdStats implements JsonpSerializable { + @Nullable + private final Long minimumMillis; + + @Nullable + private final Long maximumMillis; + + @Nullable + private final Double averageMillis; + + // --------------------------------------------------------------------------------------------- + + protected DataStreamLifecycleThresholdStats(AbstractBuilder builder) { + + this.minimumMillis = builder.minimumMillis; + this.maximumMillis = builder.maximumMillis; + this.averageMillis = builder.averageMillis; + + } + + /** + * The smallest configured value in milliseconds. + *

+ * API name: {@code minimum_millis} + */ + @Nullable + public final Long minimumMillis() { + return this.minimumMillis; + } + + /** + * The largest configured value in milliseconds. + *

+ * API name: {@code maximum_millis} + */ + @Nullable + public final Long maximumMillis() { + return this.maximumMillis; + } + + /** + * The average configured value in milliseconds. + *

+ * API name: {@code average_millis} + */ + @Nullable + public final Double averageMillis() { + return this.averageMillis; + } + + /** + * 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.minimumMillis != null) { + generator.writeKey("minimum_millis"); + generator.write(this.minimumMillis); + + } + if (this.maximumMillis != null) { + generator.writeKey("maximum_millis"); + generator.write(this.maximumMillis); + + } + if (this.averageMillis != null) { + generator.writeKey("average_millis"); + generator.write(this.averageMillis); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + public abstract static class AbstractBuilder> + extends + WithJsonObjectBuilderBase { + @Nullable + private Long minimumMillis; + + @Nullable + private Long maximumMillis; + + @Nullable + private Double averageMillis; + + /** + * The smallest configured value in milliseconds. + *

+ * API name: {@code minimum_millis} + */ + public final BuilderT minimumMillis(@Nullable Long value) { + this.minimumMillis = value; + return self(); + } + + /** + * The largest configured value in milliseconds. + *

+ * API name: {@code maximum_millis} + */ + public final BuilderT maximumMillis(@Nullable Long value) { + this.maximumMillis = value; + return self(); + } + + /** + * The average configured value in milliseconds. + *

+ * API name: {@code average_millis} + */ + public final BuilderT averageMillis(@Nullable Double value) { + this.averageMillis = value; + return self(); + } + + protected abstract BuilderT self(); + + } + + // --------------------------------------------------------------------------------------------- + protected static > void setupDataStreamLifecycleThresholdStatsDeserializer( + ObjectDeserializer op) { + + op.add(AbstractBuilder::minimumMillis, JsonpDeserializer.longDeserializer(), "minimum_millis"); + op.add(AbstractBuilder::maximumMillis, JsonpDeserializer.longDeserializer(), "maximum_millis"); + op.add(AbstractBuilder::averageMillis, JsonpDeserializer.doubleDeserializer(), "average_millis"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/DataStreamLifecycleUsage.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/DataStreamLifecycleUsage.java new file mode 100644 index 0000000000..1b131844fd --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/DataStreamLifecycleUsage.java @@ -0,0 +1,390 @@ +/* + * 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.xpack.usage; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; +import java.lang.Long; +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: xpack.usage.DataStreamLifecycleUsage + +/** + * Usage statistics for data stream lifecycle (DLM), reported by + * _xpack/usage under data_lifecycle. Besides + * available and enabled, all the following statistics + * are only present when the feature is enabled. + * + * @see API + * specification + */ +@JsonpDeserializable +public class DataStreamLifecycleUsage extends Base { + @Nullable + private final Long count; + + @Nullable + private final Boolean defaultRolloverUsed; + + @Nullable + private final DataStreamLifecycleRetentionStats dataRetention; + + @Nullable + private final DataStreamLifecycleEffectiveRetentionStats effectiveRetention; + + @Nullable + private final DataStreamLifecycleRetentionStats frozenAfter; + + @Nullable + private final DataStreamLifecycleGlobalRetention globalRetention; + + // --------------------------------------------------------------------------------------------- + + private DataStreamLifecycleUsage(Builder builder) { + super(builder); + + this.count = builder.count; + this.defaultRolloverUsed = builder.defaultRolloverUsed; + this.dataRetention = builder.dataRetention; + this.effectiveRetention = builder.effectiveRetention; + this.frozenAfter = builder.frozenAfter; + this.globalRetention = builder.globalRetention; + + } + + public static DataStreamLifecycleUsage of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * The number of data streams that have a lifecycle configured. + *

+ * API name: {@code count} + */ + @Nullable + public final Long count() { + return this.count; + } + + /** + * Whether the default rollover configuration is used by at least one data + * stream. + *

+ * API name: {@code default_rollover_used} + */ + @Nullable + public final Boolean defaultRolloverUsed() { + return this.defaultRolloverUsed; + } + + /** + * Statistics about the explicitly configured data retention across data + * streams. + *

+ * API name: {@code data_retention} + */ + @Nullable + public final DataStreamLifecycleRetentionStats dataRetention() { + return this.dataRetention; + } + + /** + * Statistics about the effective retention (configured or derived from global + * retention) across data streams. + *

+ * API name: {@code effective_retention} + */ + @Nullable + public final DataStreamLifecycleEffectiveRetentionStats effectiveRetention() { + return this.effectiveRetention; + } + + /** + * Statistics about the configured frozen_after (searchable + * snapshot) tier threshold across data streams. + *

+ * API name: {@code frozen_after} + */ + @Nullable + public final DataStreamLifecycleRetentionStats frozenAfter() { + return this.frozenAfter; + } + + /** + * Statistics about the cluster's global default and maximum retention settings. + *

+ * API name: {@code global_retention} + */ + @Nullable + public final DataStreamLifecycleGlobalRetention globalRetention() { + return this.globalRetention; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + if (this.count != null) { + generator.writeKey("count"); + generator.write(this.count); + + } + if (this.defaultRolloverUsed != null) { + generator.writeKey("default_rollover_used"); + generator.write(this.defaultRolloverUsed); + + } + if (this.dataRetention != null) { + generator.writeKey("data_retention"); + this.dataRetention.serialize(generator, mapper); + + } + if (this.effectiveRetention != null) { + generator.writeKey("effective_retention"); + this.effectiveRetention.serialize(generator, mapper); + + } + if (this.frozenAfter != null) { + generator.writeKey("frozen_after"); + this.frozenAfter.serialize(generator, mapper); + + } + if (this.globalRetention != null) { + generator.writeKey("global_retention"); + this.globalRetention.serialize(generator, mapper); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link DataStreamLifecycleUsage}. + */ + + public static class Builder extends Base.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private Long count; + + @Nullable + private Boolean defaultRolloverUsed; + + @Nullable + private DataStreamLifecycleRetentionStats dataRetention; + + @Nullable + private DataStreamLifecycleEffectiveRetentionStats effectiveRetention; + + @Nullable + private DataStreamLifecycleRetentionStats frozenAfter; + + @Nullable + private DataStreamLifecycleGlobalRetention globalRetention; + + public Builder() { + } + private Builder(DataStreamLifecycleUsage instance) { + this.count = instance.count; + this.defaultRolloverUsed = instance.defaultRolloverUsed; + this.dataRetention = instance.dataRetention; + this.effectiveRetention = instance.effectiveRetention; + this.frozenAfter = instance.frozenAfter; + this.globalRetention = instance.globalRetention; + + } + /** + * The number of data streams that have a lifecycle configured. + *

+ * API name: {@code count} + */ + public final Builder count(@Nullable Long value) { + this.count = value; + return this; + } + + /** + * Whether the default rollover configuration is used by at least one data + * stream. + *

+ * API name: {@code default_rollover_used} + */ + public final Builder defaultRolloverUsed(@Nullable Boolean value) { + this.defaultRolloverUsed = value; + return this; + } + + /** + * Statistics about the explicitly configured data retention across data + * streams. + *

+ * API name: {@code data_retention} + */ + public final Builder dataRetention(@Nullable DataStreamLifecycleRetentionStats value) { + this.dataRetention = value; + return this; + } + + /** + * Statistics about the explicitly configured data retention across data + * streams. + *

+ * API name: {@code data_retention} + */ + public final Builder dataRetention( + Function> fn) { + return this.dataRetention(fn.apply(new DataStreamLifecycleRetentionStats.Builder()).build()); + } + + /** + * Statistics about the effective retention (configured or derived from global + * retention) across data streams. + *

+ * API name: {@code effective_retention} + */ + public final Builder effectiveRetention(@Nullable DataStreamLifecycleEffectiveRetentionStats value) { + this.effectiveRetention = value; + return this; + } + + /** + * Statistics about the effective retention (configured or derived from global + * retention) across data streams. + *

+ * API name: {@code effective_retention} + */ + public final Builder effectiveRetention( + Function> fn) { + return this.effectiveRetention(fn.apply(new DataStreamLifecycleEffectiveRetentionStats.Builder()).build()); + } + + /** + * Statistics about the configured frozen_after (searchable + * snapshot) tier threshold across data streams. + *

+ * API name: {@code frozen_after} + */ + public final Builder frozenAfter(@Nullable DataStreamLifecycleRetentionStats value) { + this.frozenAfter = value; + return this; + } + + /** + * Statistics about the configured frozen_after (searchable + * snapshot) tier threshold across data streams. + *

+ * API name: {@code frozen_after} + */ + public final Builder frozenAfter( + Function> fn) { + return this.frozenAfter(fn.apply(new DataStreamLifecycleRetentionStats.Builder()).build()); + } + + /** + * Statistics about the cluster's global default and maximum retention settings. + *

+ * API name: {@code global_retention} + */ + public final Builder globalRetention(@Nullable DataStreamLifecycleGlobalRetention value) { + this.globalRetention = value; + return this; + } + + /** + * Statistics about the cluster's global default and maximum retention settings. + *

+ * API name: {@code global_retention} + */ + public final Builder globalRetention( + Function> fn) { + return this.globalRetention(fn.apply(new DataStreamLifecycleGlobalRetention.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link DataStreamLifecycleUsage}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DataStreamLifecycleUsage build() { + _checkSingleUse(); + + return new DataStreamLifecycleUsage(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link DataStreamLifecycleUsage} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DataStreamLifecycleUsage::setupDataStreamLifecycleUsageDeserializer); + + protected static void setupDataStreamLifecycleUsageDeserializer( + ObjectDeserializer op) { + Base.setupBaseDeserializer(op); + op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); + op.add(Builder::defaultRolloverUsed, JsonpDeserializer.booleanDeserializer(), "default_rollover_used"); + op.add(Builder::dataRetention, DataStreamLifecycleRetentionStats._DESERIALIZER, "data_retention"); + op.add(Builder::effectiveRetention, DataStreamLifecycleEffectiveRetentionStats._DESERIALIZER, + "effective_retention"); + op.add(Builder::frozenAfter, DataStreamLifecycleRetentionStats._DESERIALIZER, "frozen_after"); + op.add(Builder::globalRetention, DataStreamLifecycleGlobalRetention._DESERIALIZER, "global_retention"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/EsqlLoggingConfig.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/EsqlLoggingConfig.java new file mode 100644 index 0000000000..6563f5656d --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/EsqlLoggingConfig.java @@ -0,0 +1,266 @@ +/* + * 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.xpack.usage; + +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.lang.Boolean; +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: xpack.usage.EsqlLoggingConfig + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class EsqlLoggingConfig implements JsonpSerializable { + private final boolean enabled; + + private final boolean user; + + private final Map thresholds; + + // --------------------------------------------------------------------------------------------- + + private EsqlLoggingConfig(Builder builder) { + + this.enabled = ApiTypeHelper.requireNonNull(builder.enabled, this, "enabled", false); + this.user = ApiTypeHelper.requireNonNull(builder.user, this, "user", false); + this.thresholds = ApiTypeHelper.unmodifiable(builder.thresholds); + + } + + public static EsqlLoggingConfig of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Whether ES|QL query logging is enabled. + *

+ * API name: {@code enabled} + */ + public final boolean enabled() { + return this.enabled; + } + + /** + * Required - Whether user information is included in the ES|QL query log. + *

+ * API name: {@code user} + */ + public final boolean user() { + return this.user; + } + + /** + * The configured logging thresholds, keyed by threshold name, if any. + *

+ * API name: {@code thresholds} + */ + public final Map thresholds() { + return this.thresholds; + } + + /** + * 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("enabled"); + generator.write(this.enabled); + + generator.writeKey("user"); + generator.write(this.user); + + if (ApiTypeHelper.isDefined(this.thresholds)) { + generator.writeKey("thresholds"); + generator.writeStartObject(); + for (Map.Entry item0 : this.thresholds.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link EsqlLoggingConfig}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private Boolean enabled; + + private Boolean user; + + @Nullable + private Map thresholds; + + public Builder() { + } + private Builder(EsqlLoggingConfig instance) { + this.enabled = instance.enabled; + this.user = instance.user; + this.thresholds = instance.thresholds; + + } + /** + * Required - Whether ES|QL query logging is enabled. + *

+ * API name: {@code enabled} + */ + public final Builder enabled(boolean value) { + this.enabled = value; + return this; + } + + /** + * Required - Whether user information is included in the ES|QL query log. + *

+ * API name: {@code user} + */ + public final Builder user(boolean value) { + this.user = value; + return this; + } + + /** + * The configured logging thresholds, keyed by threshold name, if any. + *

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

+ * Adds all entries of map to thresholds. + */ + public final Builder thresholds(Map map) { + this.thresholds = _mapPutAll(this.thresholds, map); + return this; + } + + /** + * The configured logging thresholds, keyed by threshold name, if any. + *

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

+ * Adds an entry to thresholds. + */ + public final Builder thresholds(String key, Time value) { + this.thresholds = _mapPut(this.thresholds, key, value); + return this; + } + + /** + * The configured logging thresholds, keyed by threshold name, if any. + *

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

+ * Adds an entry to thresholds using a builder lambda. + */ + public final Builder thresholds(String key, Function> fn) { + return thresholds(key, fn.apply(new Time.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link EsqlLoggingConfig}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public EsqlLoggingConfig build() { + _checkSingleUse(); + + return new EsqlLoggingConfig(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link EsqlLoggingConfig} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, EsqlLoggingConfig::setupEsqlLoggingConfigDeserializer); + + protected static void setupEsqlLoggingConfigDeserializer(ObjectDeserializer op) { + + op.add(Builder::enabled, JsonpDeserializer.booleanDeserializer(), "enabled"); + op.add(Builder::user, JsonpDeserializer.booleanDeserializer(), "user"); + op.add(Builder::thresholds, JsonpDeserializer.stringMapDeserializer(Time._DESERIALIZER), "thresholds"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/Logging.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/Logging.java new file mode 100644 index 0000000000..051b39c4f1 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/Logging.java @@ -0,0 +1,217 @@ +/* + * 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.xpack.usage; + +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: xpack.usage.Logging + +/** + * Usage statistics about logging configuration reported by + * _xpack/usage. + * + * @see API + * specification + */ +@JsonpDeserializable +public class Logging implements JsonpSerializable { + private final QueryLoggingConfig querylog; + + private final EsqlLoggingConfig esql; + + // --------------------------------------------------------------------------------------------- + + private Logging(Builder builder) { + + this.querylog = ApiTypeHelper.requireNonNull(builder.querylog, this, "querylog"); + this.esql = ApiTypeHelper.requireNonNull(builder.esql, this, "esql"); + + } + + public static Logging of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Search query log configuration. + *

+ * API name: {@code querylog} + */ + public final QueryLoggingConfig querylog() { + return this.querylog; + } + + /** + * Required - ES|QL query log configuration. + *

+ * API name: {@code esql} + */ + public final EsqlLoggingConfig esql() { + return this.esql; + } + + /** + * 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("querylog"); + this.querylog.serialize(generator, mapper); + + generator.writeKey("esql"); + this.esql.serialize(generator, mapper); + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link Logging}. + */ + + public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + private QueryLoggingConfig querylog; + + private EsqlLoggingConfig esql; + + public Builder() { + } + private Builder(Logging instance) { + this.querylog = instance.querylog; + this.esql = instance.esql; + + } + /** + * Required - Search query log configuration. + *

+ * API name: {@code querylog} + */ + public final Builder querylog(QueryLoggingConfig value) { + this.querylog = value; + return this; + } + + /** + * Required - Search query log configuration. + *

+ * API name: {@code querylog} + */ + public final Builder querylog(Function> fn) { + return this.querylog(fn.apply(new QueryLoggingConfig.Builder()).build()); + } + + /** + * Required - ES|QL query log configuration. + *

+ * API name: {@code esql} + */ + public final Builder esql(EsqlLoggingConfig value) { + this.esql = value; + return this; + } + + /** + * Required - ES|QL query log configuration. + *

+ * API name: {@code esql} + */ + public final Builder esql(Function> fn) { + return this.esql(fn.apply(new EsqlLoggingConfig.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link Logging}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public Logging build() { + _checkSingleUse(); + + return new Logging(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link Logging} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + Logging::setupLoggingDeserializer); + + protected static void setupLoggingDeserializer(ObjectDeserializer op) { + + op.add(Builder::querylog, QueryLoggingConfig._DESERIALIZER, "querylog"); + op.add(Builder::esql, EsqlLoggingConfig._DESERIALIZER, "esql"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/QueryLoggingConfig.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/QueryLoggingConfig.java new file mode 100644 index 0000000000..b4e2541c5c --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/QueryLoggingConfig.java @@ -0,0 +1,275 @@ +/* + * 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.xpack.usage; + +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.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: xpack.usage.QueryLoggingConfig + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class QueryLoggingConfig implements JsonpSerializable { + private final boolean enabled; + + private final boolean user; + + private final boolean system; + + @Nullable + private final Time threshold; + + // --------------------------------------------------------------------------------------------- + + private QueryLoggingConfig(Builder builder) { + + this.enabled = ApiTypeHelper.requireNonNull(builder.enabled, this, "enabled", false); + this.user = ApiTypeHelper.requireNonNull(builder.user, this, "user", false); + this.system = ApiTypeHelper.requireNonNull(builder.system, this, "system", false); + this.threshold = builder.threshold; + + } + + public static QueryLoggingConfig of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Whether query logging is enabled. + *

+ * API name: {@code enabled} + */ + public final boolean enabled() { + return this.enabled; + } + + /** + * Required - Whether user information is included in the query log. + *

+ * API name: {@code user} + */ + public final boolean user() { + return this.user; + } + + /** + * Required - Whether system queries are included in the query log. + *

+ * API name: {@code system} + */ + public final boolean system() { + return this.system; + } + + /** + * The configured logging threshold, if any. + *

+ * API name: {@code threshold} + */ + @Nullable + public final Time threshold() { + return this.threshold; + } + + /** + * 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("enabled"); + generator.write(this.enabled); + + generator.writeKey("user"); + generator.write(this.user); + + generator.writeKey("system"); + generator.write(this.system); + + if (this.threshold != null) { + generator.writeKey("threshold"); + this.threshold.serialize(generator, mapper); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link QueryLoggingConfig}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private Boolean enabled; + + private Boolean user; + + private Boolean system; + + @Nullable + private Time threshold; + + public Builder() { + } + private Builder(QueryLoggingConfig instance) { + this.enabled = instance.enabled; + this.user = instance.user; + this.system = instance.system; + this.threshold = instance.threshold; + + } + /** + * Required - Whether query logging is enabled. + *

+ * API name: {@code enabled} + */ + public final Builder enabled(boolean value) { + this.enabled = value; + return this; + } + + /** + * Required - Whether user information is included in the query log. + *

+ * API name: {@code user} + */ + public final Builder user(boolean value) { + this.user = value; + return this; + } + + /** + * Required - Whether system queries are included in the query log. + *

+ * API name: {@code system} + */ + public final Builder system(boolean value) { + this.system = value; + return this; + } + + /** + * The configured logging threshold, if any. + *

+ * API name: {@code threshold} + */ + public final Builder threshold(@Nullable Time value) { + this.threshold = value; + return this; + } + + /** + * The configured logging threshold, if any. + *

+ * API name: {@code threshold} + */ + public final Builder threshold(Function> fn) { + return this.threshold(fn.apply(new Time.Builder()).build()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link QueryLoggingConfig}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public QueryLoggingConfig build() { + _checkSingleUse(); + + return new QueryLoggingConfig(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link QueryLoggingConfig} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, QueryLoggingConfig::setupQueryLoggingConfigDeserializer); + + protected static void setupQueryLoggingConfigDeserializer(ObjectDeserializer op) { + + op.add(Builder::enabled, JsonpDeserializer.booleanDeserializer(), "enabled"); + op.add(Builder::user, JsonpDeserializer.booleanDeserializer(), "user"); + op.add(Builder::system, JsonpDeserializer.booleanDeserializer(), "system"); + op.add(Builder::threshold, Time._DESERIALIZER, "threshold"); + + } + +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/VectorDbDocument.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/VectorDbDocument.java new file mode 100644 index 0000000000..c8045f2600 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/xpack/usage/VectorDbDocument.java @@ -0,0 +1,189 @@ +/* + * 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.xpack.usage; + +import co.elastic.clients.json.JsonpDeserializable; +import co.elastic.clients.json.JsonpDeserializer; +import co.elastic.clients.json.JsonpMapper; +import co.elastic.clients.json.ObjectBuilderDeserializer; +import co.elastic.clients.json.ObjectDeserializer; +import co.elastic.clients.util.ApiTypeHelper; +import co.elastic.clients.util.ObjectBuilder; +import jakarta.json.stream.JsonGenerator; +import java.lang.Integer; +import java.lang.Long; +import java.util.Objects; +import java.util.function.Function; + +//---------------------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------------------- +// +// This code is generated from the Elasticsearch API specification +// at https://github.com/elastic/elasticsearch-specification +// +// Manual updates to this file will be lost when the code is +// re-generated. +// +// If you find a property that is missing or wrongly typed, please +// open an issue or a PR on the API specification repository. +// +//---------------------------------------------------------------- + +// typedef: xpack.usage.VectorDbDocument + +/** + * Usage statistics for indices using the vectordb_document index + * mode. + * + * @see API + * specification + */ +@JsonpDeserializable +public class VectorDbDocument extends Base { + private final int indicesCount; + + private final long numDocs; + + // --------------------------------------------------------------------------------------------- + + private VectorDbDocument(Builder builder) { + super(builder); + + this.indicesCount = ApiTypeHelper.requireNonNull(builder.indicesCount, this, "indicesCount", 0); + this.numDocs = ApiTypeHelper.requireNonNull(builder.numDocs, this, "numDocs", 0); + + } + + public static VectorDbDocument of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The number of indices using the vectordb_document + * index mode. + *

+ * API name: {@code indices_count} + */ + public final int indicesCount() { + return this.indicesCount; + } + + /** + * Required - The total number of documents held across all + * vectordb_document indices. + *

+ * API name: {@code num_docs} + */ + public final long numDocs() { + return this.numDocs; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + generator.writeKey("indices_count"); + generator.write(this.indicesCount); + + generator.writeKey("num_docs"); + generator.write(this.numDocs); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link VectorDbDocument}. + */ + + public static class Builder extends Base.AbstractBuilder implements ObjectBuilder { + private Integer indicesCount; + + private Long numDocs; + + public Builder() { + } + private Builder(VectorDbDocument instance) { + this.indicesCount = instance.indicesCount; + this.numDocs = instance.numDocs; + + } + /** + * Required - The number of indices using the vectordb_document + * index mode. + *

+ * API name: {@code indices_count} + */ + public final Builder indicesCount(int value) { + this.indicesCount = value; + return this; + } + + /** + * Required - The total number of documents held across all + * vectordb_document indices. + *

+ * API name: {@code num_docs} + */ + public final Builder numDocs(long value) { + this.numDocs = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link VectorDbDocument}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public VectorDbDocument build() { + _checkSingleUse(); + + return new VectorDbDocument(this); + } + } + + /** + * @return New {@link Builder} initialized with field values of this instance + */ + public Builder rebuild() { + return new Builder(this); + } + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link VectorDbDocument} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + VectorDbDocument::setupVectorDbDocumentDeserializer); + + protected static void setupVectorDbDocumentDeserializer(ObjectDeserializer op) { + Base.setupBaseDeserializer(op); + op.add(Builder::indicesCount, JsonpDeserializer.integerDeserializer(), "indices_count"); + op.add(Builder::numDocs, JsonpDeserializer.longDeserializer(), "num_docs"); + + } + +}