Skip to content

Commit

Permalink
[codegen] update to latest spec
Browse files Browse the repository at this point in the history
  • Loading branch information
l-trotta committed Dec 5, 2024
1 parent 3c6ba9f commit dae1f43
Show file tree
Hide file tree
Showing 16 changed files with 1,212 additions and 214 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;

}

Expand All @@ -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.
* <p>
* API name: {@code keep_alive}
*/
@Nullable
public final Time keepAlive() {
return this.keepAlive;
}

// ---------------------------------------------------------------------------------------------

/**
Expand All @@ -102,6 +117,9 @@ public static class Builder extends RequestBase.AbstractBuilder<Builder>
ObjectBuilder<AsyncSearchStatusRequest> {
private String id;

@Nullable
private Time keepAlive;

/**
* Required - A unique identifier for the async search.
* <p>
Expand All @@ -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.
* <p>
* 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.
* <p>
* API name: {@code keep_alive}
*/
public final Builder keepAlive(Function<Time.Builder, ObjectBuilder<Time>> fn) {
return this.keepAlive(fn.apply(new Time.Builder()).build());
}

@Override
protected Builder self() {
return this;
Expand Down Expand Up @@ -181,7 +220,11 @@ public AsyncSearchStatusRequest build() {

// Request parameters
request -> {
return Collections.emptyMap();
Map<String, String> params = new HashMap<>();
if (request.keepAlive != null) {
params.put("keep_alive", request.keepAlive._toJsonString());
}
return params;

}, SimpleEndpoint.emptyMap(), false, AsyncSearchStatusResponse._DESERIALIZER);
}
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,6 @@ public class SubmitRequest extends RequestBase implements JsonpSerializable {

private final Map<String, ScriptField> scriptFields;

@Nullable
private final Time scroll;

private final List<FieldValue> searchAfter;

@Nullable
Expand Down Expand Up @@ -306,7 +303,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;
Expand Down Expand Up @@ -744,14 +740,6 @@ public final Map<String, ScriptField> scriptFields() {
return this.scriptFields;
}

/**
* API name: {@code scroll}
*/
@Nullable
public final Time scroll() {
return this.scroll;
}

/**
* API name: {@code search_after}
*/
Expand Down Expand Up @@ -1296,9 +1284,6 @@ public static class Builder extends RequestBase.AbstractBuilder<Builder> impleme
@Nullable
private Map<String, ScriptField> scriptFields;

@Nullable
private Time scroll;

@Nullable
private List<FieldValue> searchAfter;

Expand Down Expand Up @@ -2062,21 +2047,6 @@ public final Builder scriptFields(String key, Function<ScriptField.Builder, Obje
return scriptFields(key, fn.apply(new ScriptField.Builder()).build());
}

/**
* API name: {@code scroll}
*/
public final Builder scroll(@Nullable Time value) {
this.scroll = value;
return this;
}

/**
* API name: {@code scroll}
*/
public final Builder scroll(Function<Time.Builder, ObjectBuilder<Time>> fn) {
return this.scroll(fn.apply(new Time.Builder()).build());
}

/**
* API name: {@code search_after}
* <p>
Expand Down Expand Up @@ -2587,9 +2557,6 @@ protected static void setupSubmitRequestDeserializer(ObjectDeserializer<SubmitRe
if (request.analyzeWildcard != null) {
params.put("analyze_wildcard", String.valueOf(request.analyzeWildcard));
}
if (request.scroll != null) {
params.put("scroll", request.scroll._toJsonString());
}
if (request.waitForCompletionTimeout != null) {
params.put("wait_for_completion_timeout", request.waitForCompletionTimeout._toJsonString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -68,13 +68,21 @@
*/

public class DeleteAutoscalingPolicyRequest extends RequestBase {
@Nullable
private final Time masterTimeout;

private final String name;

@Nullable
private final Time timeout;

// ---------------------------------------------------------------------------------------------

private DeleteAutoscalingPolicyRequest(Builder builder) {

this.masterTimeout = builder.masterTimeout;
this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name");
this.timeout = builder.timeout;

}

Expand All @@ -83,6 +91,17 @@ public static DeleteAutoscalingPolicyRequest of(
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.
* <p>
* API name: {@code master_timeout}
*/
@Nullable
public final Time masterTimeout() {
return this.masterTimeout;
}

/**
* Required - the name of the autoscaling policy
* <p>
Expand All @@ -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.
* <p>
* API name: {@code timeout}
*/
@Nullable
public final Time timeout() {
return this.timeout;
}

// ---------------------------------------------------------------------------------------------

/**
Expand All @@ -101,8 +131,35 @@ public final String name() {
public static class Builder extends RequestBase.AbstractBuilder<Builder>
implements
ObjectBuilder<DeleteAutoscalingPolicyRequest> {
@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.
* <p>
* 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.
* <p>
* API name: {@code master_timeout}
*/
public final Builder masterTimeout(Function<Time.Builder, ObjectBuilder<Time>> fn) {
return this.masterTimeout(fn.apply(new Time.Builder()).build());
}

/**
* Required - the name of the autoscaling policy
* <p>
Expand All @@ -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.
* <p>
* 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.
* <p>
* API name: {@code timeout}
*/
public final Builder timeout(Function<Time.Builder, ObjectBuilder<Time>> fn) {
return this.timeout(fn.apply(new Time.Builder()).build());
}

@Override
protected Builder self() {
return this;
Expand Down Expand Up @@ -182,7 +260,14 @@ public DeleteAutoscalingPolicyRequest build() {

// Request parameters
request -> {
return Collections.emptyMap();
Map<String, String> 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);
}
Loading

0 comments on commit dae1f43

Please sign in to comment.