Skip to content

Commit

Permalink
[codegen-serverless] update to latest api spec
Browse files Browse the repository at this point in the history
  • Loading branch information
l-trotta committed Sep 10, 2024
1 parent 1567252 commit 7d3ecf5
Show file tree
Hide file tree
Showing 48 changed files with 4,385 additions and 839 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ public enum Kind implements JsonEnum {

TTest("t_test"),

TimeSeries("time_series"),

TopHits("top_hits"),

TopMetrics("top_metrics"),
Expand Down Expand Up @@ -1307,6 +1309,23 @@ public TTestAggregate tTest() {
return TaggedUnionUtils.get(this, Kind.TTest);
}

/**
* Is this variant instance of kind {@code time_series}?
*/
public boolean isTimeSeries() {
return _kind == Kind.TimeSeries;
}

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

/**
* Is this variant instance of kind {@code top_hits}?
*/
Expand Down Expand Up @@ -2156,6 +2175,17 @@ public ObjectBuilder<Aggregate> tTest(Function<TTestAggregate.Builder, ObjectBui
return this.tTest(fn.apply(new TTestAggregate.Builder()).build());
}

public ObjectBuilder<Aggregate> timeSeries(TimeSeriesAggregate v) {
this._kind = Kind.TimeSeries;
this._value = v;
return this;
}

public ObjectBuilder<Aggregate> timeSeries(
Function<TimeSeriesAggregate.Builder, ObjectBuilder<TimeSeriesAggregate>> fn) {
return this.timeSeries(fn.apply(new TimeSeriesAggregate.Builder()).build());
}

public ObjectBuilder<Aggregate> topHits(TopHitsAggregate v) {
this._kind = Kind.TopHits;
this._value = v;
Expand Down Expand Up @@ -2342,6 +2372,7 @@ public Aggregate build() {
deserializers.put("tdigest_percentile_ranks", TDigestPercentileRanksAggregate._DESERIALIZER);
deserializers.put("tdigest_percentiles", TDigestPercentilesAggregate._DESERIALIZER);
deserializers.put("t_test", TTestAggregate._DESERIALIZER);
deserializers.put("time_series", TimeSeriesAggregate._DESERIALIZER);
deserializers.put("top_hits", TopHitsAggregate._DESERIALIZER);
deserializers.put("top_metrics", TopMetricsAggregate._DESERIALIZER);
deserializers.put("umrareterms", UnmappedRareTermsAggregate._DESERIALIZER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,24 @@ public static Aggregate tTest(Function<TTestAggregate.Builder, ObjectBuilder<TTe
return builder.build();
}

/**
* Creates a builder for the {@link TimeSeriesAggregate time_series}
* {@code Aggregate} variant.
*/
public static TimeSeriesAggregate.Builder timeSeries() {
return new TimeSeriesAggregate.Builder();
}

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

/**
* Creates a builder for the {@link TopHitsAggregate top_hits} {@code Aggregate}
* variant.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ public enum Kind implements JsonEnum {

Terms("terms"),

TimeSeries("time_series"),

TopHits("top_hits"),

TTest("t_test"),
Expand Down Expand Up @@ -1493,6 +1495,23 @@ public TermsAggregation terms() {
return TaggedUnionUtils.get(this, Kind.Terms);
}

/**
* Is this variant instance of kind {@code time_series}?
*/
public boolean isTimeSeries() {
return _kind == Kind.TimeSeries;
}

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

/**
* Is this variant instance of kind {@code top_hits}?
*/
Expand Down Expand Up @@ -2477,6 +2496,17 @@ public ContainerBuilder terms(Function<TermsAggregation.Builder, ObjectBuilder<T
return this.terms(fn.apply(new TermsAggregation.Builder()).build());
}

public ContainerBuilder timeSeries(TimeSeriesAggregation v) {
this._kind = Kind.TimeSeries;
this._value = v;
return new ContainerBuilder();
}

public ContainerBuilder timeSeries(
Function<TimeSeriesAggregation.Builder, ObjectBuilder<TimeSeriesAggregation>> fn) {
return this.timeSeries(fn.apply(new TimeSeriesAggregation.Builder()).build());
}

public ContainerBuilder topHits(TopHitsAggregation v) {
this._kind = Kind.TopHits;
this._value = v;
Expand Down Expand Up @@ -2702,6 +2732,7 @@ protected static void setupAggregationDeserializer(ObjectDeserializer<Builder> o
op.add(Builder::sum, SumAggregation._DESERIALIZER, "sum");
op.add(Builder::sumBucket, SumBucketAggregation._DESERIALIZER, "sum_bucket");
op.add(Builder::terms, TermsAggregation._DESERIALIZER, "terms");
op.add(Builder::timeSeries, TimeSeriesAggregation._DESERIALIZER, "time_series");
op.add(Builder::topHits, TopHitsAggregation._DESERIALIZER, "top_hits");
op.add(Builder::tTest, TTestAggregation._DESERIALIZER, "t_test");
op.add(Builder::topMetrics, TopMetricsAggregation._DESERIALIZER, "top_metrics");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,25 @@ public static Aggregation terms(Function<TermsAggregation.Builder, ObjectBuilder
return builder.build();
}

/**
* Creates a builder for the {@link TimeSeriesAggregation time_series}
* {@code Aggregation} variant.
*/
public static TimeSeriesAggregation.Builder timeSeries() {
return new TimeSeriesAggregation.Builder();
}

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

/**
* Creates a builder for the {@link TopHitsAggregation top_hits}
* {@code Aggregation} variant.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ public static AggregationRange of(Function<Builder, ObjectBuilder<AggregationRan
* Start of the range (inclusive).
* <p>
* API name: {@code from}
* <p>
* Defaults to {@code 0} if parsed from a JSON {@code null} value.
*/
@Nullable
public final Double from() {
Expand All @@ -107,6 +109,8 @@ public final String key() {
* End of the range (exclusive).
* <p>
* API name: {@code to}
* <p>
* Defaults to {@code 0} if parsed from a JSON {@code null} value.
*/
@Nullable
public final Double to() {
Expand All @@ -126,8 +130,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {

if (this.from != null) {
generator.writeKey("from");
generator.write(this.from);

JsonpUtils.serializeDoubleOrNull(generator, this.from, 0);
}
if (this.key != null) {
generator.writeKey("key");
Expand All @@ -136,8 +139,7 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
}
if (this.to != null) {
generator.writeKey("to");
generator.write(this.to);

JsonpUtils.serializeDoubleOrNull(generator, this.to, 0);
}

}
Expand Down Expand Up @@ -167,6 +169,8 @@ public static class Builder extends WithJsonObjectBuilderBase<Builder> implement
* Start of the range (inclusive).
* <p>
* API name: {@code from}
* <p>
* Defaults to {@code 0} if parsed from a JSON {@code null} value.
*/
public final Builder from(@Nullable Double value) {
this.from = value;
Expand All @@ -187,6 +191,8 @@ public final Builder key(@Nullable String value) {
* End of the range (exclusive).
* <p>
* API name: {@code to}
* <p>
* Defaults to {@code 0} if parsed from a JSON {@code null} value.
*/
public final Builder to(@Nullable Double value) {
this.to = value;
Expand Down Expand Up @@ -221,9 +227,9 @@ public AggregationRange build() {

protected static void setupAggregationRangeDeserializer(ObjectDeserializer<AggregationRange.Builder> op) {

op.add(Builder::from, JsonpDeserializer.doubleDeserializer(), "from");
op.add(Builder::from, JsonpDeserializer.doubleOrNullDeserializer(0), "from");
op.add(Builder::key, JsonpDeserializer.stringDeserializer(), "key");
op.add(Builder::to, JsonpDeserializer.doubleDeserializer(), "to");
op.add(Builder::to, JsonpDeserializer.doubleOrNullDeserializer(0), "to");

}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/*
* 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._types.aggregations;

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: _types.aggregations.TimeSeriesAggregate

/**
*
* @see <a href=
* "../../doc-files/api-spec.html#_types.aggregations.TimeSeriesAggregate">API
* specification</a>
*/
@JsonpDeserializable
public class TimeSeriesAggregate extends MultiBucketAggregateBase<TimeSeriesBucket> implements AggregateVariant {
// ---------------------------------------------------------------------------------------------

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

}

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

/**
* Aggregate variant kind.
*/
@Override
public Aggregate.Kind _aggregateKind() {
return Aggregate.Kind.TimeSeries;
}

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

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

public static class Builder extends MultiBucketAggregateBase.AbstractBuilder<TimeSeriesBucket, Builder>
implements
ObjectBuilder<TimeSeriesAggregate> {
@Override
protected Builder self() {
return this;
}

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

return new TimeSeriesAggregate(this);
}
}

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

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

protected static void setupTimeSeriesAggregateDeserializer(ObjectDeserializer<TimeSeriesAggregate.Builder> op) {
MultiBucketAggregateBase.setupMultiBucketAggregateBaseDeserializer(op, TimeSeriesBucket._DESERIALIZER);

}

}
Loading

0 comments on commit 7d3ecf5

Please sign in to comment.