diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/AsyncSearchStatusRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/AsyncSearchStatusRequest.java index eca1c109a..f0151830e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/AsyncSearchStatusRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/AsyncSearchStatusRequest.java @@ -21,6 +21,7 @@ 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; @@ -31,7 +32,6 @@ import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; import java.lang.String; -import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -70,11 +70,15 @@ public class AsyncSearchStatusRequest extends RequestBase { private final String id; + @Nullable + private final Time keepAlive; + // --------------------------------------------------------------------------------------------- private AsyncSearchStatusRequest(Builder builder) { this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); + this.keepAlive = builder.keepAlive; } @@ -91,6 +95,17 @@ public final String id() { return this.id; } + /** + * Specifies how long the async search needs to be available. Ongoing async + * searches and any saved search results are deleted after this period. + *

+ * API name: {@code keep_alive} + */ + @Nullable + public final Time keepAlive() { + return this.keepAlive; + } + // --------------------------------------------------------------------------------------------- /** @@ -102,6 +117,9 @@ public static class Builder extends RequestBase.AbstractBuilder ObjectBuilder { private String id; + @Nullable + private Time keepAlive; + /** * Required - A unique identifier for the async search. *

@@ -112,6 +130,27 @@ public final Builder id(String value) { return this; } + /** + * Specifies how long the async search needs to be available. Ongoing async + * searches and any saved search results are deleted after this period. + *

+ * API name: {@code keep_alive} + */ + public final Builder keepAlive(@Nullable Time value) { + this.keepAlive = value; + return this; + } + + /** + * Specifies how long the async search needs to be available. Ongoing async + * searches and any saved search results are deleted after this period. + *

+ * API name: {@code keep_alive} + */ + public final Builder keepAlive(Function> fn) { + return this.keepAlive(fn.apply(new Time.Builder()).build()); + } + @Override protected Builder self() { return this; @@ -181,7 +220,11 @@ public AsyncSearchStatusRequest build() { // Request parameters request -> { - return Collections.emptyMap(); + Map params = new HashMap<>(); + if (request.keepAlive != null) { + params.put("keep_alive", request.keepAlive._toJsonString()); + } + return params; }, SimpleEndpoint.emptyMap(), false, AsyncSearchStatusResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/SubmitRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/SubmitRequest.java index e69c4bc97..f6d697999 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/SubmitRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/async_search/SubmitRequest.java @@ -164,9 +164,6 @@ public class SubmitRequest extends RequestBase implements JsonpSerializable { private final List> indicesBoost; - @Nullable - private final Time keepAlive; - @Nullable private final Boolean keepOnCompletion; @@ -190,9 +187,6 @@ public class SubmitRequest extends RequestBase implements JsonpSerializable { @Nullable private final Query postFilter; - @Nullable - private final Long preFilterShardSize; - @Nullable private final String preference; @@ -217,9 +211,6 @@ public class SubmitRequest extends RequestBase implements JsonpSerializable { private final Map scriptFields; - @Nullable - private final Time scroll; - private final List searchAfter; @Nullable @@ -287,7 +278,6 @@ private SubmitRequest(Builder builder) { this.ignoreUnavailable = builder.ignoreUnavailable; this.index = ApiTypeHelper.unmodifiable(builder.index); this.indicesBoost = ApiTypeHelper.unmodifiable(builder.indicesBoost); - this.keepAlive = builder.keepAlive; this.keepOnCompletion = builder.keepOnCompletion; this.knn = ApiTypeHelper.unmodifiable(builder.knn); this.lenient = builder.lenient; @@ -296,7 +286,6 @@ private SubmitRequest(Builder builder) { this.minScore = builder.minScore; this.pit = builder.pit; this.postFilter = builder.postFilter; - this.preFilterShardSize = builder.preFilterShardSize; this.preference = builder.preference; this.profile = builder.profile; this.q = builder.q; @@ -306,7 +295,6 @@ private SubmitRequest(Builder builder) { this.routing = builder.routing; this.runtimeMappings = ApiTypeHelper.unmodifiable(builder.runtimeMappings); this.scriptFields = ApiTypeHelper.unmodifiable(builder.scriptFields); - this.scroll = builder.scroll; this.searchAfter = ApiTypeHelper.unmodifiable(builder.searchAfter); this.searchType = builder.searchType; this.seqNoPrimaryTerm = builder.seqNoPrimaryTerm; @@ -554,17 +542,6 @@ public final List> indicesBoost() { return this.indicesBoost; } - /** - * Specifies how long the async search needs to be available. Ongoing async - * searches and any saved search results are deleted after this period. - *

- * API name: {@code keep_alive} - */ - @Nullable - public final Time keepAlive() { - return this.keepAlive; - } - /** * If true, results are stored for later retrieval when the search * completes within the wait_for_completion_timeout. @@ -646,18 +623,6 @@ public final Query postFilter() { return this.postFilter; } - /** - * The default value cannot be changed, which enforces the execution of a - * pre-filter roundtrip to retrieve statistics from each shard so that the ones - * that surely don’t hold any document matching the query get skipped. - *

- * API name: {@code pre_filter_shard_size} - */ - @Nullable - public final Long preFilterShardSize() { - return this.preFilterShardSize; - } - /** * Specify the node or shard the operation should be performed on (default: * random) @@ -744,14 +709,6 @@ public final Map scriptFields() { return this.scriptFields; } - /** - * API name: {@code scroll} - */ - @Nullable - public final Time scroll() { - return this.scroll; - } - /** * API name: {@code search_after} */ @@ -1239,9 +1196,6 @@ public static class Builder extends RequestBase.AbstractBuilder impleme @Nullable private List> indicesBoost; - @Nullable - private Time keepAlive; - @Nullable private Boolean keepOnCompletion; @@ -1266,9 +1220,6 @@ public static class Builder extends RequestBase.AbstractBuilder impleme @Nullable private Query postFilter; - @Nullable - private Long preFilterShardSize; - @Nullable private String preference; @@ -1296,9 +1247,6 @@ public static class Builder extends RequestBase.AbstractBuilder impleme @Nullable private Map scriptFields; - @Nullable - private Time scroll; - @Nullable private List searchAfter; @@ -1733,27 +1681,6 @@ public final Builder indicesBoost(Map value, Map return this; } - /** - * Specifies how long the async search needs to be available. Ongoing async - * searches and any saved search results are deleted after this period. - *

- * API name: {@code keep_alive} - */ - public final Builder keepAlive(@Nullable Time value) { - this.keepAlive = value; - return this; - } - - /** - * Specifies how long the async search needs to be available. Ongoing async - * searches and any saved search results are deleted after this period. - *

- * API name: {@code keep_alive} - */ - public final Builder keepAlive(Function> fn) { - return this.keepAlive(fn.apply(new Time.Builder()).build()); - } - /** * If true, results are stored for later retrieval when the search * completes within the wait_for_completion_timeout. @@ -1878,18 +1805,6 @@ public final Builder postFilter(Function> fn return this.postFilter(fn.apply(new Query.Builder()).build()); } - /** - * The default value cannot be changed, which enforces the execution of a - * pre-filter roundtrip to retrieve statistics from each shard so that the ones - * that surely don’t hold any document matching the query get skipped. - *

- * API name: {@code pre_filter_shard_size} - */ - public final Builder preFilterShardSize(@Nullable Long value) { - this.preFilterShardSize = value; - return this; - } - /** * Specify the node or shard the operation should be performed on (default: * random) @@ -2062,21 +1977,6 @@ public final Builder scriptFields(String key, Function> fn) { - return this.scroll(fn.apply(new Time.Builder()).build()); - } - /** * API name: {@code search_after} *

@@ -2544,9 +2444,6 @@ protected static void setupSubmitRequestDeserializer(ObjectDeserializer + * API name: {@code master_timeout} + */ + @Nullable + public final Time masterTimeout() { + return this.masterTimeout; + } + /** * Required - the name of the autoscaling policy *

@@ -92,6 +111,17 @@ public final String name() { return this.name; } + /** + * 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; + } + // --------------------------------------------------------------------------------------------- /** @@ -101,8 +131,35 @@ public final String name() { public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { + @Nullable + private Time masterTimeout; + private String name; + @Nullable + private Time timeout; + + /** + * 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; + } + + /** + * 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()); + } + /** * Required - the name of the autoscaling policy *

@@ -113,6 +170,27 @@ public final Builder name(String value) { return this; } + /** + * 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; + } + + /** + * 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; @@ -182,7 +260,14 @@ public DeleteAutoscalingPolicyRequest build() { // Request parameters request -> { - return Collections.emptyMap(); + 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, DeleteAutoscalingPolicyResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/ElasticsearchAutoscalingAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/ElasticsearchAutoscalingAsyncClient.java index bbf384e4c..6455ee9d7 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/ElasticsearchAutoscalingAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/ElasticsearchAutoscalingAsyncClient.java @@ -139,8 +139,83 @@ public final CompletableFuture deleteAutoscalin * "https://www.elastic.co/guide/en/elasticsearch/reference/8.17/autoscaling-get-autoscaling-capacity.html">Documentation * on elastic.co */ + + public CompletableFuture getAutoscalingCapacity( + GetAutoscalingCapacityRequest request) { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) GetAutoscalingCapacityRequest._ENDPOINT; + + return this.transport.performRequestAsync(request, endpoint, this.transportOptions); + } + + /** + * Get the autoscaling capacity. + *

+ * NOTE: This feature is designed for indirect use by Elasticsearch Service, + * Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not + * supported. + *

+ * This API gets the current autoscaling capacity based on the configured + * autoscaling policy. It will return information to size the cluster + * appropriately to the current workload. + *

+ * The required_capacity is calculated as the maximum of the + * required_capacity result of all individual deciders that are + * enabled for the policy. + *

+ * The operator should verify that the current_nodes match the + * operator’s knowledge of the cluster to avoid making autoscaling decisions + * based on stale or incomplete information. + *

+ * The response contains decider-specific information you can use to diagnose + * how and why autoscaling determined a certain capacity was required. This + * information is provided for diagnosis only. Do not use this information to + * make autoscaling decisions. + * + * @param fn + * a function that initializes a builder to create the + * {@link GetAutoscalingCapacityRequest} + * @see Documentation + * on elastic.co + */ + + public final CompletableFuture getAutoscalingCapacity( + Function> fn) { + return getAutoscalingCapacity(fn.apply(new GetAutoscalingCapacityRequest.Builder()).build()); + } + + /** + * Get the autoscaling capacity. + *

+ * NOTE: This feature is designed for indirect use by Elasticsearch Service, + * Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not + * supported. + *

+ * This API gets the current autoscaling capacity based on the configured + * autoscaling policy. It will return information to size the cluster + * appropriately to the current workload. + *

+ * The required_capacity is calculated as the maximum of the + * required_capacity result of all individual deciders that are + * enabled for the policy. + *

+ * The operator should verify that the current_nodes match the + * operator’s knowledge of the cluster to avoid making autoscaling decisions + * based on stale or incomplete information. + *

+ * The response contains decider-specific information you can use to diagnose + * how and why autoscaling determined a certain capacity was required. This + * information is provided for diagnosis only. Do not use this information to + * make autoscaling decisions. + * + * @see Documentation + * on elastic.co + */ + public CompletableFuture getAutoscalingCapacity() { - return this.transport.performRequestAsync(GetAutoscalingCapacityRequest._INSTANCE, + return this.transport.performRequestAsync(new GetAutoscalingCapacityRequest.Builder().build(), GetAutoscalingCapacityRequest._ENDPOINT, this.transportOptions); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/ElasticsearchAutoscalingClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/ElasticsearchAutoscalingClient.java index c51dfcf81..755806571 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/ElasticsearchAutoscalingClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/ElasticsearchAutoscalingClient.java @@ -139,8 +139,84 @@ public final DeleteAutoscalingPolicyResponse deleteAutoscalingPolicy( * "https://www.elastic.co/guide/en/elasticsearch/reference/8.17/autoscaling-get-autoscaling-capacity.html">Documentation * on elastic.co */ + + public GetAutoscalingCapacityResponse getAutoscalingCapacity(GetAutoscalingCapacityRequest request) + throws IOException, ElasticsearchException { + @SuppressWarnings("unchecked") + JsonEndpoint endpoint = (JsonEndpoint) GetAutoscalingCapacityRequest._ENDPOINT; + + return this.transport.performRequest(request, endpoint, this.transportOptions); + } + + /** + * Get the autoscaling capacity. + *

+ * NOTE: This feature is designed for indirect use by Elasticsearch Service, + * Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not + * supported. + *

+ * This API gets the current autoscaling capacity based on the configured + * autoscaling policy. It will return information to size the cluster + * appropriately to the current workload. + *

+ * The required_capacity is calculated as the maximum of the + * required_capacity result of all individual deciders that are + * enabled for the policy. + *

+ * The operator should verify that the current_nodes match the + * operator’s knowledge of the cluster to avoid making autoscaling decisions + * based on stale or incomplete information. + *

+ * The response contains decider-specific information you can use to diagnose + * how and why autoscaling determined a certain capacity was required. This + * information is provided for diagnosis only. Do not use this information to + * make autoscaling decisions. + * + * @param fn + * a function that initializes a builder to create the + * {@link GetAutoscalingCapacityRequest} + * @see Documentation + * on elastic.co + */ + + public final GetAutoscalingCapacityResponse getAutoscalingCapacity( + Function> fn) + throws IOException, ElasticsearchException { + return getAutoscalingCapacity(fn.apply(new GetAutoscalingCapacityRequest.Builder()).build()); + } + + /** + * Get the autoscaling capacity. + *

+ * NOTE: This feature is designed for indirect use by Elasticsearch Service, + * Elastic Cloud Enterprise, and Elastic Cloud on Kubernetes. Direct use is not + * supported. + *

+ * This API gets the current autoscaling capacity based on the configured + * autoscaling policy. It will return information to size the cluster + * appropriately to the current workload. + *

+ * The required_capacity is calculated as the maximum of the + * required_capacity result of all individual deciders that are + * enabled for the policy. + *

+ * The operator should verify that the current_nodes match the + * operator’s knowledge of the cluster to avoid making autoscaling decisions + * based on stale or incomplete information. + *

+ * The response contains decider-specific information you can use to diagnose + * how and why autoscaling determined a certain capacity was required. This + * information is provided for diagnosis only. Do not use this information to + * make autoscaling decisions. + * + * @see Documentation + * on elastic.co + */ + public GetAutoscalingCapacityResponse getAutoscalingCapacity() throws IOException, ElasticsearchException { - return this.transport.performRequest(GetAutoscalingCapacityRequest._INSTANCE, + return this.transport.performRequest(new GetAutoscalingCapacityRequest.Builder().build(), GetAutoscalingCapacityRequest._ENDPOINT, this.transportOptions); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/GetAutoscalingCapacityRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/GetAutoscalingCapacityRequest.java index 40d0c71a6..96f46db2f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/GetAutoscalingCapacityRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/GetAutoscalingCapacityRequest.java @@ -21,6 +21,7 @@ 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; @@ -30,7 +31,11 @@ import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; 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. @@ -79,13 +84,82 @@ */ public class GetAutoscalingCapacityRequest extends RequestBase { - public GetAutoscalingCapacityRequest() { + @Nullable + private final Time masterTimeout; + + // --------------------------------------------------------------------------------------------- + + private GetAutoscalingCapacityRequest(Builder builder) { + + this.masterTimeout = builder.masterTimeout; + + } + + public static GetAutoscalingCapacityRequest of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * 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; } + // --------------------------------------------------------------------------------------------- + /** - * Singleton instance for {@link GetAutoscalingCapacityRequest}. + * Builder for {@link GetAutoscalingCapacityRequest}. */ - public static final GetAutoscalingCapacityRequest _INSTANCE = new GetAutoscalingCapacityRequest(); + + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { + @Nullable + private Time masterTimeout; + + /** + * 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; + } + + /** + * 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()); + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link GetAutoscalingCapacityRequest}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetAutoscalingCapacityRequest build() { + _checkSingleUse(); + + return new GetAutoscalingCapacityRequest(this); + } + } // --------------------------------------------------------------------------------------------- @@ -114,7 +188,11 @@ public GetAutoscalingCapacityRequest() { // Request parameters request -> { - return Collections.emptyMap(); + Map params = new HashMap<>(); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } + return params; }, SimpleEndpoint.emptyMap(), false, GetAutoscalingCapacityResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/GetAutoscalingPolicyRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/GetAutoscalingPolicyRequest.java index ad1047dfc..4faccea7f 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/GetAutoscalingPolicyRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/GetAutoscalingPolicyRequest.java @@ -21,6 +21,7 @@ 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; @@ -31,7 +32,6 @@ import co.elastic.clients.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; import java.lang.String; -import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -68,12 +68,16 @@ */ public class GetAutoscalingPolicyRequest extends RequestBase { + @Nullable + private final Time masterTimeout; + private final String name; // --------------------------------------------------------------------------------------------- private GetAutoscalingPolicyRequest(Builder builder) { + this.masterTimeout = builder.masterTimeout; this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); } @@ -82,6 +86,17 @@ public static GetAutoscalingPolicyRequest of(Function + * API name: {@code master_timeout} + */ + @Nullable + public final Time masterTimeout() { + return this.masterTimeout; + } + /** * Required - the name of the autoscaling policy *

@@ -100,8 +115,32 @@ public final String name() { public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { + @Nullable + private Time masterTimeout; + private String name; + /** + * 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; + } + + /** + * 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()); + } + /** * Required - the name of the autoscaling policy *

@@ -181,7 +220,11 @@ public GetAutoscalingPolicyRequest build() { // Request parameters request -> { - return Collections.emptyMap(); + Map params = new HashMap<>(); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } + return params; }, SimpleEndpoint.emptyMap(), false, GetAutoscalingPolicyResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/PutAutoscalingPolicyRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/PutAutoscalingPolicyRequest.java index e639e46c6..66e553363 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/PutAutoscalingPolicyRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/autoscaling/PutAutoscalingPolicyRequest.java @@ -21,6 +21,7 @@ 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.JsonpMapper; @@ -34,7 +35,6 @@ import jakarta.json.stream.JsonGenerator; import jakarta.json.stream.JsonParser; import java.lang.String; -import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Objects; @@ -71,15 +71,23 @@ */ @JsonpDeserializable public class PutAutoscalingPolicyRequest extends RequestBase implements JsonpSerializable { + @Nullable + private final Time masterTimeout; + private final String name; + @Nullable + private final Time timeout; + private final AutoscalingPolicy policy; // --------------------------------------------------------------------------------------------- private PutAutoscalingPolicyRequest(Builder builder) { + this.masterTimeout = builder.masterTimeout; this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.timeout = builder.timeout; this.policy = ApiTypeHelper.requireNonNull(builder.policy, this, "policy"); } @@ -88,6 +96,17 @@ public static PutAutoscalingPolicyRequest of(Function + * API name: {@code master_timeout} + */ + @Nullable + public final Time masterTimeout() { + return this.masterTimeout; + } + /** * Required - the name of the autoscaling policy *

@@ -97,6 +116,17 @@ public final String name() { return this.name; } + /** + * 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; + } + /** * Required - Request body. */ @@ -121,10 +151,37 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { + @Nullable + private Time masterTimeout; + private String name; + @Nullable + private Time timeout; + private AutoscalingPolicy policy; + /** + * 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; + } + + /** + * 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()); + } + /** * Required - the name of the autoscaling policy *

@@ -135,6 +192,27 @@ public final Builder name(String value) { return this; } + /** + * 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; + } + + /** + * 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()); + } + /** * Required - Request body. */ @@ -236,7 +314,14 @@ protected static JsonpDeserializer createPutAutosca // Request parameters request -> { - return Collections.emptyMap(); + 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, PutAutoscalingPolicyResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html b/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html index 29393578e..4c6d6e6a3 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html @@ -991,24 +991,24 @@ 'async_search.delete.Response': 'async_search/delete/AsyncSearchDeleteResponse.ts#L22-L24', 'async_search.get.Request': 'async_search/get/AsyncSearchGetRequest.ts#L24-L57', 'async_search.get.Response': 'async_search/get/AsyncSearchGetResponse.ts#L22-L24', -'async_search.status.Request': 'async_search/status/AsyncSearchStatusRequest.ts#L23-L39', +'async_search.status.Request': 'async_search/status/AsyncSearchStatusRequest.ts#L24-L48', 'async_search.status.Response': 'async_search/status/AsyncSearchStatusResponse.ts#L39-L41', 'async_search.status.StatusResponseBase': 'async_search/status/AsyncSearchStatusResponse.ts#L24-L38', -'async_search.submit.Request': 'async_search/submit/AsyncSearchSubmitRequest.ts#L55-L290', +'async_search.submit.Request': 'async_search/submit/AsyncSearchSubmitRequest.ts#L55-L280', 'async_search.submit.Response': 'async_search/submit/AsyncSearchSubmitResponse.ts#L22-L24', 'autoscaling._types.AutoscalingPolicy': 'autoscaling/_types/AutoscalingPolicy.ts#L23-L30', -'autoscaling.delete_autoscaling_policy.Request': 'autoscaling/delete_autoscaling_policy/DeleteAutoscalingPolicyRequest.ts#L23-L36', +'autoscaling.delete_autoscaling_policy.Request': 'autoscaling/delete_autoscaling_policy/DeleteAutoscalingPolicyRequest.ts#L24-L48', 'autoscaling.delete_autoscaling_policy.Response': 'autoscaling/delete_autoscaling_policy/DeleteAutoscalingPolicyResponse.ts#L22-L24', 'autoscaling.get_autoscaling_capacity.AutoscalingCapacity': 'autoscaling/get_autoscaling_capacity/GetAutoscalingCapacityResponse.ts#L38-L41', 'autoscaling.get_autoscaling_capacity.AutoscalingDecider': 'autoscaling/get_autoscaling_capacity/GetAutoscalingCapacityResponse.ts#L52-L56', 'autoscaling.get_autoscaling_capacity.AutoscalingDeciders': 'autoscaling/get_autoscaling_capacity/GetAutoscalingCapacityResponse.ts#L31-L36', 'autoscaling.get_autoscaling_capacity.AutoscalingNode': 'autoscaling/get_autoscaling_capacity/GetAutoscalingCapacityResponse.ts#L48-L50', 'autoscaling.get_autoscaling_capacity.AutoscalingResources': 'autoscaling/get_autoscaling_capacity/GetAutoscalingCapacityResponse.ts#L43-L46', -'autoscaling.get_autoscaling_capacity.Request': 'autoscaling/get_autoscaling_capacity/GetAutoscalingCapacityRequest.ts#L22-L42', +'autoscaling.get_autoscaling_capacity.Request': 'autoscaling/get_autoscaling_capacity/GetAutoscalingCapacityRequest.ts#L23-L51', 'autoscaling.get_autoscaling_capacity.Response': 'autoscaling/get_autoscaling_capacity/GetAutoscalingCapacityResponse.ts#L25-L29', -'autoscaling.get_autoscaling_policy.Request': 'autoscaling/get_autoscaling_policy/GetAutoscalingPolicyRequest.ts#L23-L36', +'autoscaling.get_autoscaling_policy.Request': 'autoscaling/get_autoscaling_policy/GetAutoscalingPolicyRequest.ts#L24-L44', 'autoscaling.get_autoscaling_policy.Response': 'autoscaling/get_autoscaling_policy/GetAutoscalingPolicyResponse.ts#L22-L24', -'autoscaling.put_autoscaling_policy.Request': 'autoscaling/put_autoscaling_policy/PutAutoscalingPolicyRequest.ts#L24-L39', +'autoscaling.put_autoscaling_policy.Request': 'autoscaling/put_autoscaling_policy/PutAutoscalingPolicyRequest.ts#L25-L51', 'autoscaling.put_autoscaling_policy.Response': 'autoscaling/put_autoscaling_policy/PutAutoscalingPolicyResponse.ts#L22-L24', 'cat._types.CatAnomalyDetectorColumn': 'cat/_types/CatBase.ts#L32-L401', 'cat._types.CatDatafeedColumn': 'cat/_types/CatBase.ts#L405-L471', @@ -1809,8 +1809,8 @@ 'logstash.get_pipeline.Request': 'logstash/get_pipeline/LogstashGetPipelineRequest.ts#L23-L37', 'logstash.get_pipeline.Response': 'logstash/get_pipeline/LogstashGetPipelineResponse.ts#L24-L27', 'logstash.put_pipeline.Request': 'logstash/put_pipeline/LogstashPutPipelineRequest.ts#L24-L39', -'migration.deprecations.Deprecation': 'migration/deprecations/types.ts#L29-L35', -'migration.deprecations.DeprecationLevel': 'migration/deprecations/types.ts#L20-L27', +'migration.deprecations.Deprecation': 'migration/deprecations/types.ts#L32-L40', +'migration.deprecations.DeprecationLevel': 'migration/deprecations/types.ts#L23-L30', 'migration.deprecations.Request': 'migration/deprecations/DeprecationInfoRequest.ts#L23-L32', 'migration.deprecations.Response': 'migration/deprecations/DeprecationInfoResponse.ts#L23-L31', 'migration.get_feature_upgrade_status.MigrationFeature': 'migration/get_feature_upgrade_status/GetFeatureUpgradeStatusResponse.ts#L37-L42', @@ -2389,7 +2389,8 @@ 'searchable_snapshots.stats.Request': 'searchable_snapshots/stats/SearchableSnapshotsStatsRequest.ts#L24-L35', 'searchable_snapshots.stats.Response': 'searchable_snapshots/stats/SearchableSnapshotsStatsResponse.ts#L22-L27', 'security._types.Access': 'security/_types/Access.ts#L22-L31', -'security._types.ApiKey': 'security/_types/ApiKey.ts#L26-L88', +'security._types.ApiKey': 'security/_types/ApiKey.ts#L27-L113', +'security._types.ApiKeyType': 'security/_types/ApiKey.ts#L115-L118', 'security._types.ApplicationGlobalUserPrivileges': 'security/_types/Privileges.ts#L410-L412', 'security._types.ApplicationPrivileges': 'security/_types/Privileges.ts#L27-L40', 'security._types.BulkError': 'security/_types/Bulk.ts#L24-L33', @@ -2429,8 +2430,9 @@ 'security._types.UserProfileWithMetadata': 'security/_types/UserProfile.ts#L49-L52', 'security.activate_user_profile.Request': 'security/activate_user_profile/Request.ts#L23-L39', 'security.activate_user_profile.Response': 'security/activate_user_profile/Response.ts#L22-L24', +'security.authenticate.AuthenticateApiKey': 'security/authenticate/SecurityAuthenticateResponse.ts#L44-L47', 'security.authenticate.Request': 'security/authenticate/SecurityAuthenticateRequest.ts#L22-L33', -'security.authenticate.Response': 'security/authenticate/SecurityAuthenticateResponse.ts#L25-L43', +'security.authenticate.Response': 'security/authenticate/SecurityAuthenticateResponse.ts#L24-L42', 'security.authenticate.Token': 'security/authenticate/types.ts#L22-L29', 'security.bulk_delete_role.Request': 'security/bulk_delete_role/SecurityBulkDeleteRoleRequest.ts#L23-L43', 'security.bulk_delete_role.Response': 'security/bulk_delete_role/SecurityBulkDeleteRoleResponse.ts#L22-L37', @@ -2954,10 +2956,10 @@ if (hash.length > 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/b7c7c41eabca623640a4fc51492d1cd7063ca8b7/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/15f335ff5b98b93e0be79a2cad2d07c5bc2373e1/specification/" + (paths[hash] || ""); - Please see the Elasticsearch API specification. + Please see the Elasticsearch API specification. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/migration/deprecations/Deprecation.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/migration/deprecations/Deprecation.java index 5e7cb2144..7a4caa705 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/migration/deprecations/Deprecation.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/migration/deprecations/Deprecation.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch.migration.deprecations; +import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; import co.elastic.clients.json.JsonpDeserializer; import co.elastic.clients.json.JsonpMapper; @@ -30,7 +31,9 @@ import co.elastic.clients.util.ObjectBuilder; import co.elastic.clients.util.WithJsonObjectBuilderBase; import jakarta.json.stream.JsonGenerator; +import java.lang.Boolean; import java.lang.String; +import java.util.Map; import java.util.Objects; import java.util.function.Function; import javax.annotation.Nullable; @@ -60,6 +63,7 @@ */ @JsonpDeserializable public class Deprecation implements JsonpSerializable { + @Nullable private final String details; private final DeprecationLevel level; @@ -68,14 +72,21 @@ public class Deprecation implements JsonpSerializable { private final String url; + private final boolean resolveDuringRollingUpgrade; + + private final Map meta; + // --------------------------------------------------------------------------------------------- private Deprecation(Builder builder) { - this.details = ApiTypeHelper.requireNonNull(builder.details, this, "details"); + this.details = builder.details; this.level = ApiTypeHelper.requireNonNull(builder.level, this, "level"); this.message = ApiTypeHelper.requireNonNull(builder.message, this, "message"); this.url = ApiTypeHelper.requireNonNull(builder.url, this, "url"); + this.resolveDuringRollingUpgrade = ApiTypeHelper.requireNonNull(builder.resolveDuringRollingUpgrade, this, + "resolveDuringRollingUpgrade"); + this.meta = ApiTypeHelper.unmodifiable(builder.meta); } @@ -84,8 +95,9 @@ public static Deprecation of(Function> fn) { } /** - * Required - API name: {@code details} + * API name: {@code details} */ + @Nullable public final String details() { return this.details; } @@ -113,6 +125,20 @@ public final String url() { return this.url; } + /** + * Required - API name: {@code resolve_during_rolling_upgrade} + */ + public final boolean resolveDuringRollingUpgrade() { + return this.resolveDuringRollingUpgrade; + } + + /** + * API name: {@code _meta} + */ + public final Map meta() { + return this.meta; + } + /** * Serialize this object to JSON. */ @@ -124,9 +150,11 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("details"); - generator.write(this.details); + if (this.details != null) { + generator.writeKey("details"); + generator.write(this.details); + } generator.writeKey("level"); this.level.serialize(generator, mapper); generator.writeKey("message"); @@ -135,6 +163,21 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("url"); generator.write(this.url); + generator.writeKey("resolve_during_rolling_upgrade"); + generator.write(this.resolveDuringRollingUpgrade); + + if (ApiTypeHelper.isDefined(this.meta)) { + generator.writeKey("_meta"); + generator.writeStartObject(); + for (Map.Entry item0 : this.meta.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + } @Override @@ -149,6 +192,7 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { + @Nullable private String details; private DeprecationLevel level; @@ -157,10 +201,15 @@ public static class Builder extends WithJsonObjectBuilderBase implement private String url; + private Boolean resolveDuringRollingUpgrade; + + @Nullable + private Map meta; + /** - * Required - API name: {@code details} + * API name: {@code details} */ - public final Builder details(String value) { + public final Builder details(@Nullable String value) { this.details = value; return this; } @@ -191,6 +240,34 @@ public final Builder url(String value) { return this; } + /** + * Required - API name: {@code resolve_during_rolling_upgrade} + */ + public final Builder resolveDuringRollingUpgrade(boolean value) { + this.resolveDuringRollingUpgrade = value; + return this; + } + + /** + * API name: {@code _meta} + *

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

+ * Adds an entry to meta. + */ + public final Builder meta(String key, JsonData value) { + this.meta = _mapPut(this.meta, key, value); + return this; + } + @Override protected Builder self() { return this; @@ -223,6 +300,9 @@ protected static void setupDeprecationDeserializer(ObjectDeserializer metadata; private final Map roleDescriptors; private final List> limitedBy; + @Nullable + private final Access access; + + @Nullable + private final String profileUid; + private final List sort; // --------------------------------------------------------------------------------------------- private ApiKey(Builder builder) { - this.creation = builder.creation; - this.expiration = builder.expiration; this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); - this.invalidated = builder.invalidated; this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.realm = builder.realm; + this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); + this.creation = ApiTypeHelper.requireNonNull(builder.creation, this, "creation"); + this.expiration = builder.expiration; + this.invalidated = ApiTypeHelper.requireNonNull(builder.invalidated, this, "invalidated"); + this.invalidation = builder.invalidation; + this.username = ApiTypeHelper.requireNonNull(builder.username, this, "username"); + this.realm = ApiTypeHelper.requireNonNull(builder.realm, this, "realm"); this.realmType = builder.realmType; - this.username = builder.username; - this.profileUid = builder.profileUid; - this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); + this.metadata = ApiTypeHelper.unmodifiableRequired(builder.metadata, this, "metadata"); this.roleDescriptors = ApiTypeHelper.unmodifiable(builder.roleDescriptors); this.limitedBy = ApiTypeHelper.unmodifiable(builder.limitedBy); + this.access = builder.access; + this.profileUid = builder.profileUid; this.sort = ApiTypeHelper.unmodifiable(builder.sort); } @@ -124,12 +131,39 @@ public static ApiKey of(Function> fn) { } /** - * Creation time for the API key in milliseconds. + * Required - Id for the API key + *

+ * API name: {@code id} + */ + public final String id() { + return this.id; + } + + /** + * Required - Name of the API key. + *

+ * API name: {@code name} + */ + public final String name() { + return this.name; + } + + /** + * Required - The type of the API key (e.g. rest or + * cross_cluster). + *

+ * API name: {@code type} + */ + public final ApiKeyType type() { + return this.type; + } + + /** + * Required - Creation time for the API key in milliseconds. *

* API name: {@code creation} */ - @Nullable - public final Long creation() { + public final long creation() { return this.creation; } @@ -144,40 +178,40 @@ public final Long expiration() { } /** - * Required - Id for the API key + * Required - Invalidation status for the API key. If the key has been + * invalidated, it has a value of true. Otherwise, it is + * false. *

- * API name: {@code id} + * API name: {@code invalidated} */ - public final String id() { - return this.id; + public final boolean invalidated() { + return this.invalidated; } /** - * Invalidation status for the API key. If the key has been invalidated, it has - * a value of true. Otherwise, it is false. + * If the key has been invalidated, invalidation time in milliseconds. *

- * API name: {@code invalidated} + * API name: {@code invalidation} */ @Nullable - public final Boolean invalidated() { - return this.invalidated; + public final Long invalidation() { + return this.invalidation; } /** - * Required - Name of the API key. + * Required - Principal for which this API key was created *

- * API name: {@code name} + * API name: {@code username} */ - public final String name() { - return this.name; + public final String username() { + return this.username; } /** - * Realm name of the principal for which this API key was created. + * Required - Realm name of the principal for which this API key was created. *

* API name: {@code realm} */ - @Nullable public final String realm() { return this.realm; } @@ -193,28 +227,7 @@ public final String realmType() { } /** - * Principal for which this API key was created - *

- * API name: {@code username} - */ - @Nullable - public final String username() { - return this.username; - } - - /** - * The profile uid for the API key owner principal, if requested and if it - * exists - *

- * API name: {@code profile_uid} - */ - @Nullable - public final String profileUid() { - return this.profileUid; - } - - /** - * Metadata of the API key + * Required - Metadata of the API key *

* API name: {@code metadata} */ @@ -246,6 +259,33 @@ public final List> limitedBy() { } /** + * The access granted to cross-cluster API keys. The access is composed of + * permissions for cross cluster search and cross cluster replication. At least + * one of them must be specified. When specified, the new access assignment + * fully replaces the previously assigned access. + *

+ * API name: {@code access} + */ + @Nullable + public final Access access() { + return this.access; + } + + /** + * The profile uid for the API key owner principal, if requested and if it + * exists + *

+ * API name: {@code profile_uid} + */ + @Nullable + public final String profileUid() { + return this.profileUid; + } + + /** + * Sorting values when using the sort parameter with the + * security.query_api_keys API. + *

* API name: {@code _sort} */ public final List sort() { @@ -263,46 +303,40 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.creation != null) { - generator.writeKey("creation"); - generator.write(this.creation); + generator.writeKey("id"); + generator.write(this.id); + + generator.writeKey("name"); + generator.write(this.name); + + generator.writeKey("type"); + this.type.serialize(generator, mapper); + generator.writeKey("creation"); + generator.write(this.creation); - } if (this.expiration != null) { generator.writeKey("expiration"); generator.write(this.expiration); } - generator.writeKey("id"); - generator.write(this.id); + generator.writeKey("invalidated"); + generator.write(this.invalidated); - if (this.invalidated != null) { - generator.writeKey("invalidated"); - generator.write(this.invalidated); + if (this.invalidation != null) { + generator.writeKey("invalidation"); + generator.write(this.invalidation); } - generator.writeKey("name"); - generator.write(this.name); + generator.writeKey("username"); + generator.write(this.username); - if (this.realm != null) { - generator.writeKey("realm"); - generator.write(this.realm); + generator.writeKey("realm"); + generator.write(this.realm); - } if (this.realmType != null) { generator.writeKey("realm_type"); generator.write(this.realmType); - } - if (this.username != null) { - generator.writeKey("username"); - generator.write(this.username); - - } - if (this.profileUid != null) { - generator.writeKey("profile_uid"); - generator.write(this.profileUid); - } if (ApiTypeHelper.isDefined(this.metadata)) { generator.writeKey("metadata"); @@ -343,6 +377,16 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } generator.writeEnd(); + } + if (this.access != null) { + generator.writeKey("access"); + this.access.serialize(generator, mapper); + + } + if (this.profileUid != null) { + generator.writeKey("profile_uid"); + generator.write(this.profileUid); + } if (ApiTypeHelper.isDefined(this.sort)) { generator.writeKey("_sort"); @@ -369,137 +413,151 @@ public String toString() { */ public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - @Nullable + private String id; + + private String name; + + private ApiKeyType type; + private Long creation; @Nullable private Long expiration; - private String id; + private Boolean invalidated; @Nullable - private Boolean invalidated; + private Long invalidation; - private String name; + private String username; - @Nullable private String realm; @Nullable private String realmType; - @Nullable - private String username; + private Map metadata; @Nullable - private String profileUid; + private Map roleDescriptors; @Nullable - private Map metadata; + private List> limitedBy; @Nullable - private Map roleDescriptors; + private Access access; @Nullable - private List> limitedBy; + private String profileUid; @Nullable private List sort; /** - * Creation time for the API key in milliseconds. + * Required - Id for the API key *

- * API name: {@code creation} + * API name: {@code id} */ - public final Builder creation(@Nullable Long value) { - this.creation = value; + public final Builder id(String value) { + this.id = value; return this; } /** - * Expiration time for the API key in milliseconds. + * Required - Name of the API key. *

- * API name: {@code expiration} + * API name: {@code name} */ - public final Builder expiration(@Nullable Long value) { - this.expiration = value; + public final Builder name(String value) { + this.name = value; return this; } /** - * Required - Id for the API key + * Required - The type of the API key (e.g. rest or + * cross_cluster). *

- * API name: {@code id} + * API name: {@code type} */ - public final Builder id(String value) { - this.id = value; + public final Builder type(ApiKeyType value) { + this.type = value; return this; } /** - * Invalidation status for the API key. If the key has been invalidated, it has - * a value of true. Otherwise, it is false. + * Required - Creation time for the API key in milliseconds. *

- * API name: {@code invalidated} + * API name: {@code creation} */ - public final Builder invalidated(@Nullable Boolean value) { - this.invalidated = value; + public final Builder creation(long value) { + this.creation = value; return this; } /** - * Required - Name of the API key. + * Expiration time for the API key in milliseconds. *

- * API name: {@code name} + * API name: {@code expiration} */ - public final Builder name(String value) { - this.name = value; + public final Builder expiration(@Nullable Long value) { + this.expiration = value; return this; } /** - * Realm name of the principal for which this API key was created. + * Required - Invalidation status for the API key. If the key has been + * invalidated, it has a value of true. Otherwise, it is + * false. *

- * API name: {@code realm} + * API name: {@code invalidated} */ - public final Builder realm(@Nullable String value) { - this.realm = value; + public final Builder invalidated(boolean value) { + this.invalidated = value; return this; } /** - * Realm type of the principal for which this API key was created + * If the key has been invalidated, invalidation time in milliseconds. *

- * API name: {@code realm_type} + * API name: {@code invalidation} */ - public final Builder realmType(@Nullable String value) { - this.realmType = value; + public final Builder invalidation(@Nullable Long value) { + this.invalidation = value; return this; } /** - * Principal for which this API key was created + * Required - Principal for which this API key was created *

* API name: {@code username} */ - public final Builder username(@Nullable String value) { + public final Builder username(String value) { this.username = value; return this; } /** - * The profile uid for the API key owner principal, if requested and if it - * exists + * Required - Realm name of the principal for which this API key was created. *

- * API name: {@code profile_uid} + * API name: {@code realm} */ - public final Builder profileUid(@Nullable String value) { - this.profileUid = value; + public final Builder realm(String value) { + this.realm = value; + return this; + } + + /** + * Realm type of the principal for which this API key was created + *

+ * API name: {@code realm_type} + */ + public final Builder realmType(@Nullable String value) { + this.realmType = value; return this; } /** - * Metadata of the API key + * Required - Metadata of the API key *

* API name: {@code metadata} *

@@ -511,7 +569,7 @@ public final Builder metadata(Map map) { } /** - * Metadata of the API key + * Required - Metadata of the API key *

* API name: {@code metadata} *

@@ -595,6 +653,45 @@ public final Builder limitedBy(Map value, Map + * API name: {@code access} + */ + public final Builder access(@Nullable Access value) { + this.access = value; + return this; + } + + /** + * The access granted to cross-cluster API keys. The access is composed of + * permissions for cross cluster search and cross cluster replication. At least + * one of them must be specified. When specified, the new access assignment + * fully replaces the previously assigned access. + *

+ * API name: {@code access} + */ + public final Builder access(Function> fn) { + return this.access(fn.apply(new Access.Builder()).build()); + } + + /** + * The profile uid for the API key owner principal, if requested and if it + * exists + *

+ * API name: {@code profile_uid} + */ + public final Builder profileUid(@Nullable String value) { + this.profileUid = value; + return this; + } + + /** + * Sorting values when using the sort parameter with the + * security.query_api_keys API. + *

* API name: {@code _sort} *

* Adds all elements of list to sort. @@ -605,6 +702,9 @@ public final Builder sort(List list) { } /** + * Sorting values when using the sort parameter with the + * security.query_api_keys API. + *

* API name: {@code _sort} *

* Adds one or more values to sort. @@ -615,6 +715,9 @@ public final Builder sort(FieldValue value, FieldValue... values) { } /** + * Sorting values when using the sort parameter with the + * security.query_api_keys API. + *

* API name: {@code _sort} *

* Adds all passed values to sort. @@ -630,6 +733,9 @@ public final Builder sort(String value, String... values) { } /** + * Sorting values when using the sort parameter with the + * security.query_api_keys API. + *

* API name: {@code _sort} *

* Adds all passed values to sort. @@ -645,6 +751,9 @@ public final Builder sort(long value, long... values) { } /** + * Sorting values when using the sort parameter with the + * security.query_api_keys API. + *

* API name: {@code _sort} *

* Adds all passed values to sort. @@ -660,6 +769,9 @@ public final Builder sort(double value, double... values) { } /** + * Sorting values when using the sort parameter with the + * security.query_api_keys API. + *

* API name: {@code _sort} *

* Adds all passed values to sort. @@ -675,6 +787,9 @@ public final Builder sort(boolean value, boolean... values) { } /** + * Sorting values when using the sort parameter with the + * security.query_api_keys API. + *

* API name: {@code _sort} *

* Adds a value to sort using a builder lambda. @@ -711,20 +826,23 @@ public ApiKey build() { protected static void setupApiKeyDeserializer(ObjectDeserializer op) { + op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::type, ApiKeyType._DESERIALIZER, "type"); op.add(Builder::creation, JsonpDeserializer.longDeserializer(), "creation"); op.add(Builder::expiration, JsonpDeserializer.longDeserializer(), "expiration"); - op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); op.add(Builder::invalidated, JsonpDeserializer.booleanDeserializer(), "invalidated"); - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::invalidation, JsonpDeserializer.longDeserializer(), "invalidation"); + op.add(Builder::username, JsonpDeserializer.stringDeserializer(), "username"); op.add(Builder::realm, JsonpDeserializer.stringDeserializer(), "realm"); op.add(Builder::realmType, JsonpDeserializer.stringDeserializer(), "realm_type"); - op.add(Builder::username, JsonpDeserializer.stringDeserializer(), "username"); - op.add(Builder::profileUid, JsonpDeserializer.stringDeserializer(), "profile_uid"); op.add(Builder::metadata, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "metadata"); op.add(Builder::roleDescriptors, JsonpDeserializer.stringMapDeserializer(RoleDescriptor._DESERIALIZER), "role_descriptors"); op.add(Builder::limitedBy, JsonpDeserializer.arrayDeserializer( JsonpDeserializer.stringMapDeserializer(RoleDescriptor._DESERIALIZER)), "limited_by"); + op.add(Builder::access, Access._DESERIALIZER, "access"); + op.add(Builder::profileUid, JsonpDeserializer.stringDeserializer(), "profile_uid"); op.add(Builder::sort, JsonpDeserializer.arrayDeserializer(FieldValue._DESERIALIZER), "_sort"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ApiKeyType.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ApiKeyType.java new file mode 100644 index 000000000..ab3080ea8 --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/ApiKeyType.java @@ -0,0 +1,66 @@ +/* + * 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 ApiKeyType implements JsonEnum { + Rest("rest"), + + CrossCluster("cross_cluster"), + + ; + + private final String jsonValue; + + ApiKeyType(String jsonValue) { + this.jsonValue = jsonValue; + } + + public String jsonValue() { + return this.jsonValue; + } + + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + ApiKeyType.values()); +} diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/AuthenticateResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/AuthenticateResponse.java index fb08644ee..57b26a47c 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/AuthenticateResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/AuthenticateResponse.java @@ -19,6 +19,7 @@ package co.elastic.clients.elasticsearch.security; +import co.elastic.clients.elasticsearch.security.authenticate.AuthenticateApiKey; import co.elastic.clients.elasticsearch.security.authenticate.ServiceToken; import co.elastic.clients.json.JsonData; import co.elastic.clients.json.JsonpDeserializable; @@ -65,7 +66,7 @@ @JsonpDeserializable public class AuthenticateResponse implements JsonpSerializable { @Nullable - private final ApiKey apiKey; + private final AuthenticateApiKey apiKey; private final RealmInfo authenticationRealm; @@ -117,7 +118,7 @@ public static AuthenticateResponse of(Function implements ObjectBuilder { @Nullable - private ApiKey apiKey; + private AuthenticateApiKey apiKey; private RealmInfo authenticationRealm; @@ -307,7 +308,7 @@ public static class Builder extends WithJsonObjectBuilderBase /** * API name: {@code api_key} */ - public final Builder apiKey(@Nullable ApiKey value) { + public final Builder apiKey(@Nullable AuthenticateApiKey value) { this.apiKey = value; return this; } @@ -315,8 +316,8 @@ public final Builder apiKey(@Nullable ApiKey value) { /** * API name: {@code api_key} */ - public final Builder apiKey(Function> fn) { - return this.apiKey(fn.apply(new ApiKey.Builder()).build()); + public final Builder apiKey(Function> fn) { + return this.apiKey(fn.apply(new AuthenticateApiKey.Builder()).build()); } /** @@ -472,7 +473,7 @@ public AuthenticateResponse build() { protected static void setupAuthenticateResponseDeserializer(ObjectDeserializer op) { - op.add(Builder::apiKey, ApiKey._DESERIALIZER, "api_key"); + op.add(Builder::apiKey, AuthenticateApiKey._DESERIALIZER, "api_key"); op.add(Builder::authenticationRealm, RealmInfo._DESERIALIZER, "authentication_realm"); op.add(Builder::email, JsonpDeserializer.stringDeserializer(), "email"); op.add(Builder::fullName, JsonpDeserializer.stringDeserializer(), "full_name"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/security/authenticate/AuthenticateApiKey.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/authenticate/AuthenticateApiKey.java new file mode 100644 index 000000000..bb1987e9a --- /dev/null +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/security/authenticate/AuthenticateApiKey.java @@ -0,0 +1,186 @@ +/* + * 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.authenticate; + +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: security.authenticate.AuthenticateApiKey + +/** + * + * @see API + * specification + */ +@JsonpDeserializable +public class AuthenticateApiKey implements JsonpSerializable { + private final String id; + + @Nullable + private final String name; + + // --------------------------------------------------------------------------------------------- + + private AuthenticateApiKey(Builder builder) { + + this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); + this.name = builder.name; + + } + + public static AuthenticateApiKey of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code id} + */ + public final String id() { + return this.id; + } + + /** + * API name: {@code name} + */ + @Nullable + public final String name() { + return this.name; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("id"); + generator.write(this.id); + + if (this.name != null) { + generator.writeKey("name"); + generator.write(this.name); + + } + + } + + @Override + public String toString() { + return JsonpUtils.toString(this); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link AuthenticateApiKey}. + */ + + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private String id; + + @Nullable + private String name; + + /** + * Required - API name: {@code id} + */ + public final Builder id(String value) { + this.id = value; + return this; + } + + /** + * API name: {@code name} + */ + public final Builder name(@Nullable String value) { + this.name = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link AuthenticateApiKey}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public AuthenticateApiKey build() { + _checkSingleUse(); + + return new AuthenticateApiKey(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link AuthenticateApiKey} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, AuthenticateApiKey::setupAuthenticateApiKeyDeserializer); + + protected static void setupAuthenticateApiKeyDeserializer(ObjectDeserializer op) { + + op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + + } + +}