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 Oct 14, 2024
1 parent a89e9e3 commit 31b7496
Show file tree
Hide file tree
Showing 10 changed files with 655 additions and 244 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

public class ClusterStatsRequest extends RequestBase {
@Nullable
private final Boolean flatSettings;
private final Boolean includeRemotes;

private final List<String> nodeId;

Expand All @@ -81,7 +81,7 @@ public class ClusterStatsRequest extends RequestBase {

private ClusterStatsRequest(Builder builder) {

this.flatSettings = builder.flatSettings;
this.includeRemotes = builder.includeRemotes;
this.nodeId = ApiTypeHelper.unmodifiable(builder.nodeId);
this.timeout = builder.timeout;

Expand All @@ -92,13 +92,13 @@ public static ClusterStatsRequest of(Function<Builder, ObjectBuilder<ClusterStat
}

/**
* If <code>true</code>, returns settings in flat format.
* Include remote cluster data into the response
* <p>
* API name: {@code flat_settings}
* API name: {@code include_remotes}
*/
@Nullable
public final Boolean flatSettings() {
return this.flatSettings;
public final Boolean includeRemotes() {
return this.includeRemotes;
}

/**
Expand Down Expand Up @@ -134,7 +134,7 @@ public static class Builder extends RequestBase.AbstractBuilder<Builder>
implements
ObjectBuilder<ClusterStatsRequest> {
@Nullable
private Boolean flatSettings;
private Boolean includeRemotes;

@Nullable
private List<String> nodeId;
Expand All @@ -143,12 +143,12 @@ public static class Builder extends RequestBase.AbstractBuilder<Builder>
private Time timeout;

/**
* If <code>true</code>, returns settings in flat format.
* Include remote cluster data into the response
* <p>
* API name: {@code flat_settings}
* API name: {@code include_remotes}
*/
public final Builder flatSettings(@Nullable Boolean value) {
this.flatSettings = value;
public final Builder includeRemotes(@Nullable Boolean value) {
this.includeRemotes = value;
return this;
}

Expand Down Expand Up @@ -285,8 +285,8 @@ public ClusterStatsRequest build() {
// Request parameters
request -> {
Map<String, String> params = new HashMap<>();
if (request.flatSettings != null) {
params.put("flat_settings", String.valueOf(request.flatSettings));
if (request.includeRemotes != null) {
params.put("include_remotes", String.valueOf(request.includeRemotes));
}
if (request.timeout != null) {
params.put("timeout", request.timeout._toJsonString());
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ public enum Kind implements JsonEnum {

Split("split"),

Terminate("terminate"),

Trim("trim"),

Uppercase("uppercase"),
Expand Down Expand Up @@ -782,6 +784,23 @@ public SplitProcessor split() {
return TaggedUnionUtils.get(this, Kind.Split);
}

/**
* Is this variant instance of kind {@code terminate}?
*/
public boolean isTerminate() {
return _kind == Kind.Terminate;
}

/**
* Get the {@code terminate} variant value.
*
* @throws IllegalStateException
* if the current variant is not of the {@code terminate} kind.
*/
public TerminateProcessor terminate() {
return TaggedUnionUtils.get(this, Kind.Terminate);
}

/**
* Is this variant instance of kind {@code trim}?
*/
Expand Down Expand Up @@ -1278,6 +1297,17 @@ public ObjectBuilder<Processor> split(Function<SplitProcessor.Builder, ObjectBui
return this.split(fn.apply(new SplitProcessor.Builder()).build());
}

public ObjectBuilder<Processor> terminate(TerminateProcessor v) {
this._kind = Kind.Terminate;
this._value = v;
return this;
}

public ObjectBuilder<Processor> terminate(
Function<TerminateProcessor.Builder, ObjectBuilder<TerminateProcessor>> fn) {
return this.terminate(fn.apply(new TerminateProcessor.Builder()).build());
}

public ObjectBuilder<Processor> trim(TrimProcessor v) {
this._kind = Kind.Trim;
this._value = v;
Expand Down Expand Up @@ -1391,6 +1421,7 @@ protected static void setupProcessorDeserializer(ObjectDeserializer<Builder> op)
op.add(Builder::setSecurityUser, SetSecurityUserProcessor._DESERIALIZER, "set_security_user");
op.add(Builder::sort, SortProcessor._DESERIALIZER, "sort");
op.add(Builder::split, SplitProcessor._DESERIALIZER, "split");
op.add(Builder::terminate, TerminateProcessor._DESERIALIZER, "terminate");
op.add(Builder::trim, TrimProcessor._DESERIALIZER, "trim");
op.add(Builder::uppercase, UppercaseProcessor._DESERIALIZER, "uppercase");
op.add(Builder::urldecode, UrlDecodeProcessor._DESERIALIZER, "urldecode");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,24 @@ public static Processor split(Function<SplitProcessor.Builder, ObjectBuilder<Spl
return builder.build();
}

/**
* Creates a builder for the {@link TerminateProcessor terminate}
* {@code Processor} variant.
*/
public static TerminateProcessor.Builder terminate() {
return new TerminateProcessor.Builder();
}

/**
* Creates a Processor of the {@link TerminateProcessor terminate}
* {@code Processor} variant.
*/
public static Processor terminate(Function<TerminateProcessor.Builder, ObjectBuilder<TerminateProcessor>> fn) {
Processor.Builder builder = new Processor.Builder();
builder.terminate(fn.apply(new TerminateProcessor.Builder()).build());
return builder.build();
}

/**
* Creates a builder for the {@link TrimProcessor trim} {@code Processor}
* variant.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/*
* 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.ingest;

import co.elastic.clients.json.JsonpDeserializable;
import co.elastic.clients.json.JsonpDeserializer;
import co.elastic.clients.json.ObjectBuilderDeserializer;
import co.elastic.clients.json.ObjectDeserializer;
import co.elastic.clients.util.ObjectBuilder;
import jakarta.json.stream.JsonGenerator;
import java.util.Objects;
import java.util.function.Function;

//----------------------------------------------------------------
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
//----------------------------------------------------------------
//
// This code is generated from the Elasticsearch API specification
// at https://github.com/elastic/elasticsearch-specification
//
// Manual updates to this file will be lost when the code is
// re-generated.
//
// If you find a property that is missing or wrongly typed, please
// open an issue or a PR on the API specification repository.
//
//----------------------------------------------------------------

// typedef: ingest._types.TerminateProcessor

/**
*
* @see <a href=
* "../doc-files/api-spec.html#ingest._types.TerminateProcessor">API
* specification</a>
*/
@JsonpDeserializable
public class TerminateProcessor extends ProcessorBase implements ProcessorVariant {
// ---------------------------------------------------------------------------------------------

private TerminateProcessor(Builder builder) {
super(builder);

}

public static TerminateProcessor of(Function<Builder, ObjectBuilder<TerminateProcessor>> fn) {
return fn.apply(new Builder()).build();
}

/**
* Processor variant kind.
*/
@Override
public Processor.Kind _processorKind() {
return Processor.Kind.Terminate;
}

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

/**
* Builder for {@link TerminateProcessor}.
*/

public static class Builder extends ProcessorBase.AbstractBuilder<Builder>
implements
ObjectBuilder<TerminateProcessor> {
@Override
protected Builder self() {
return this;
}

/**
* Builds a {@link TerminateProcessor}.
*
* @throws NullPointerException
* if some of the required fields are null.
*/
public TerminateProcessor build() {
_checkSingleUse();

return new TerminateProcessor(this);
}
}

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

/**
* Json deserializer for {@link TerminateProcessor}
*/
public static final JsonpDeserializer<TerminateProcessor> _DESERIALIZER = ObjectBuilderDeserializer
.lazy(Builder::new, TerminateProcessor::setupTerminateProcessorDeserializer);

protected static void setupTerminateProcessorDeserializer(ObjectDeserializer<TerminateProcessor.Builder> op) {
ProcessorBase.setupProcessorBaseDeserializer(op);

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,17 @@ public class NodeInfoXpack implements JsonpSerializable {

private final Map<String, JsonData> notification;

@Nullable
private final NodeInfoXpackMl ml;

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

private NodeInfoXpack(Builder builder) {

this.license = builder.license;
this.security = ApiTypeHelper.requireNonNull(builder.security, this, "security");
this.notification = ApiTypeHelper.unmodifiable(builder.notification);
this.ml = builder.ml;

}

Expand Down Expand Up @@ -104,6 +108,14 @@ public final Map<String, JsonData> notification() {
return this.notification;
}

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

/**
* Serialize this object to JSON.
*/
Expand Down Expand Up @@ -134,6 +146,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
generator.writeEnd();

}
if (this.ml != null) {
generator.writeKey("ml");
this.ml.serialize(generator, mapper);

}

}

Expand All @@ -157,6 +174,9 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder> implement
@Nullable
private Map<String, JsonData> notification;

@Nullable
private NodeInfoXpackMl ml;

/**
* API name: {@code license}
*/
Expand Down Expand Up @@ -208,6 +228,21 @@ public final Builder notification(String key, JsonData value) {
return this;
}

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

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

@Override
protected Builder self() {
return this;
Expand Down Expand Up @@ -239,6 +274,7 @@ protected static void setupNodeInfoXpackDeserializer(ObjectDeserializer<NodeInfo
op.add(Builder::license, NodeInfoXpackLicense._DESERIALIZER, "license");
op.add(Builder::security, NodeInfoXpackSecurity._DESERIALIZER, "security");
op.add(Builder::notification, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "notification");
op.add(Builder::ml, NodeInfoXpackMl._DESERIALIZER, "ml");

}

Expand Down
Loading

0 comments on commit 31b7496

Please sign in to comment.