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 19, 2024
1 parent bb6ac88 commit 2ea172f
Show file tree
Hide file tree
Showing 73 changed files with 4,663 additions and 506 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.ExpandWildcard;
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 Down Expand Up @@ -71,13 +72,17 @@
public class AliasesRequest extends CatRequestBase {
private final List<ExpandWildcard> expandWildcards;

@Nullable
private final Time masterTimeout;

private final List<String> name;

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

private AliasesRequest(Builder builder) {

this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards);
this.masterTimeout = builder.masterTimeout;
this.name = ApiTypeHelper.unmodifiable(builder.name);

}
Expand All @@ -96,6 +101,16 @@ public final List<ExpandWildcard> expandWildcards() {
return this.expandWildcards;
}

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

/**
* A comma-separated list of aliases to retrieve. Supports wildcards
* (<code>*</code>). To retrieve all aliases, omit this parameter or use
Expand All @@ -119,6 +134,9 @@ public static class Builder extends CatRequestBase.AbstractBuilder<Builder>
@Nullable
private List<ExpandWildcard> expandWildcards;

@Nullable
private Time masterTimeout;

@Nullable
private List<String> name;

Expand Down Expand Up @@ -148,6 +166,25 @@ public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... val
return this;
}

/**
* Period to wait for a connection to the master node.
* <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.
* <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());
}

/**
* A comma-separated list of aliases to retrieve. Supports wildcards
* (<code>*</code>). To retrieve all aliases, omit this parameter or use
Expand Down Expand Up @@ -257,6 +294,9 @@ public AliasesRequest build() {
request -> {
Map<String, String> params = new HashMap<>();
params.put("format", "json");
if (request.masterTimeout != null) {
params.put("master_timeout", request.masterTimeout._toJsonString());
}
if (ApiTypeHelper.isDefined(request.expandWildcards)) {
params.put("expand_wildcards",
request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(",")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import co.elastic.clients.elasticsearch._types.Bytes;
import co.elastic.clients.elasticsearch._types.ErrorResponse;
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 Down Expand Up @@ -74,6 +75,9 @@ public class AllocationRequest extends CatRequestBase {
@Nullable
private final Boolean local;

@Nullable
private final Time masterTimeout;

private final List<String> nodeId;

// ---------------------------------------------------------------------------------------------
Expand All @@ -82,6 +86,7 @@ private AllocationRequest(Builder builder) {

this.bytes = builder.bytes;
this.local = builder.local;
this.masterTimeout = builder.masterTimeout;
this.nodeId = ApiTypeHelper.unmodifiable(builder.nodeId);

}
Expand Down Expand Up @@ -114,6 +119,16 @@ public final Boolean local() {
return this.local;
}

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

/**
* Comma-separated list of node identifiers or names used to limit the returned
* information.
Expand All @@ -139,6 +154,9 @@ public static class Builder extends CatRequestBase.AbstractBuilder<Builder>
@Nullable
private Boolean local;

@Nullable
private Time masterTimeout;

@Nullable
private List<String> nodeId;

Expand Down Expand Up @@ -166,6 +184,25 @@ public final Builder local(@Nullable Boolean value) {
return this;
}

/**
* Period to wait for a connection to the master node.
* <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.
* <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());
}

/**
* Comma-separated list of node identifiers or names used to limit the returned
* information.
Expand Down Expand Up @@ -274,6 +311,9 @@ public AllocationRequest build() {
request -> {
Map<String, String> params = new HashMap<>();
params.put("format", "json");
if (request.masterTimeout != null) {
params.put("master_timeout", request.masterTimeout._toJsonString());
}
if (request.bytes != null) {
params.put("bytes", request.bytes.jsonValue());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package co.elastic.clients.elasticsearch.cat;

import co.elastic.clients.elasticsearch._types.ErrorResponse;
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 Down Expand Up @@ -70,6 +71,9 @@ public class ComponentTemplatesRequest extends CatRequestBase {
@Nullable
private final Boolean local;

@Nullable
private final Time masterTimeout;

@Nullable
private final String name;

Expand All @@ -78,6 +82,7 @@ public class ComponentTemplatesRequest extends CatRequestBase {
private ComponentTemplatesRequest(Builder builder) {

this.local = builder.local;
this.masterTimeout = builder.masterTimeout;
this.name = builder.name;

}
Expand All @@ -100,6 +105,16 @@ public final Boolean local() {
return this.local;
}

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

/**
* The name of the component template. Accepts wildcard expressions. If omitted,
* all component templates are returned.
Expand All @@ -123,6 +138,9 @@ public static class Builder extends CatRequestBase.AbstractBuilder<Builder>
@Nullable
private Boolean local;

@Nullable
private Time masterTimeout;

@Nullable
private String name;

Expand All @@ -140,6 +158,25 @@ public final Builder local(@Nullable Boolean value) {
return this;
}

/**
* Period to wait for a connection to the master node.
* <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.
* <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());
}

/**
* The name of the component template. Accepts wildcard expressions. If omitted,
* all component templates are returned.
Expand Down Expand Up @@ -232,6 +269,9 @@ public ComponentTemplatesRequest build() {
request -> {
Map<String, String> params = new HashMap<>();
params.put("format", "json");
if (request.masterTimeout != null) {
params.put("master_timeout", request.masterTimeout._toJsonString());
}
if (request.local != null) {
params.put("local", String.valueOf(request.local));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1193,9 +1193,49 @@ public CompletableFuture<RecoveryResponse> recovery() {
* "https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cat-repositories.html">Documentation
* on elastic.co</a>
*/

public CompletableFuture<RepositoriesResponse> repositories(RepositoriesRequest request) {
@SuppressWarnings("unchecked")
JsonEndpoint<RepositoriesRequest, RepositoriesResponse, ErrorResponse> endpoint = (JsonEndpoint<RepositoriesRequest, RepositoriesResponse, ErrorResponse>) RepositoriesRequest._ENDPOINT;

return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
}

/**
* Get snapshot repository information. Get a list of snapshot repositories for
* a cluster. IMPORTANT: cat APIs are only intended for human consumption using
* the command line or Kibana console. They are not intended for use by
* applications. For application consumption, use the get snapshot repository
* API.
*
* @param fn
* a function that initializes a builder to create the
* {@link RepositoriesRequest}
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cat-repositories.html">Documentation
* on elastic.co</a>
*/

public final CompletableFuture<RepositoriesResponse> repositories(
Function<RepositoriesRequest.Builder, ObjectBuilder<RepositoriesRequest>> fn) {
return repositories(fn.apply(new RepositoriesRequest.Builder()).build());
}

/**
* Get snapshot repository information. Get a list of snapshot repositories for
* a cluster. IMPORTANT: cat APIs are only intended for human consumption using
* the command line or Kibana console. They are not intended for use by
* applications. For application consumption, use the get snapshot repository
* API.
*
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cat-repositories.html">Documentation
* on elastic.co</a>
*/

public CompletableFuture<RepositoriesResponse> repositories() {
return this.transport.performRequestAsync(RepositoriesRequest._INSTANCE, RepositoriesRequest._ENDPOINT,
this.transportOptions);
return this.transport.performRequestAsync(new RepositoriesRequest.Builder().build(),
RepositoriesRequest._ENDPOINT, this.transportOptions);
}

// ----- Endpoint: cat.segments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1202,8 +1202,49 @@ public RecoveryResponse recovery() throws IOException, ElasticsearchException {
* "https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cat-repositories.html">Documentation
* on elastic.co</a>
*/

public RepositoriesResponse repositories(RepositoriesRequest request) throws IOException, ElasticsearchException {
@SuppressWarnings("unchecked")
JsonEndpoint<RepositoriesRequest, RepositoriesResponse, ErrorResponse> endpoint = (JsonEndpoint<RepositoriesRequest, RepositoriesResponse, ErrorResponse>) RepositoriesRequest._ENDPOINT;

return this.transport.performRequest(request, endpoint, this.transportOptions);
}

/**
* Get snapshot repository information. Get a list of snapshot repositories for
* a cluster. IMPORTANT: cat APIs are only intended for human consumption using
* the command line or Kibana console. They are not intended for use by
* applications. For application consumption, use the get snapshot repository
* API.
*
* @param fn
* a function that initializes a builder to create the
* {@link RepositoriesRequest}
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cat-repositories.html">Documentation
* on elastic.co</a>
*/

public final RepositoriesResponse repositories(
Function<RepositoriesRequest.Builder, ObjectBuilder<RepositoriesRequest>> fn)
throws IOException, ElasticsearchException {
return repositories(fn.apply(new RepositoriesRequest.Builder()).build());
}

/**
* Get snapshot repository information. Get a list of snapshot repositories for
* a cluster. IMPORTANT: cat APIs are only intended for human consumption using
* the command line or Kibana console. They are not intended for use by
* applications. For application consumption, use the get snapshot repository
* API.
*
* @see <a href=
* "https://www.elastic.co/guide/en/elasticsearch/reference/9.0/cat-repositories.html">Documentation
* on elastic.co</a>
*/

public RepositoriesResponse repositories() throws IOException, ElasticsearchException {
return this.transport.performRequest(RepositoriesRequest._INSTANCE, RepositoriesRequest._ENDPOINT,
return this.transport.performRequest(new RepositoriesRequest.Builder().build(), RepositoriesRequest._ENDPOINT,
this.transportOptions);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
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;

//----------------------------------------------------------------
Expand All @@ -57,7 +55,7 @@
* specification</a>
*/

public class HelpRequest extends CatRequestBase {
public class HelpRequest {
public HelpRequest() {
}

Expand Down Expand Up @@ -93,9 +91,7 @@ public HelpRequest() {

// Request parameters
request -> {
Map<String, String> params = new HashMap<>();
params.put("format", "json");
return params;
return Collections.emptyMap();

}, SimpleEndpoint.emptyMap(), false, HelpResponse._DESERIALIZER);
}
Loading

0 comments on commit 2ea172f

Please sign in to comment.