Skip to content

Commit 7444423

Browse files
committed
[codegen] Update to latest API specification
1 parent f7f03a8 commit 7444423

File tree

155 files changed

+12266
-8645
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+12266
-8645
lines changed
Lines changed: 53 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@
2121
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
2222
//----------------------------------------------------
2323

24-
package co.elastic.clients.elasticsearch.indices.rollover;
24+
package co.elastic.clients.elasticsearch._types;
2525

26-
import co.elastic.clients.elasticsearch._types.mapping.TypeMapping;
2726
import co.elastic.clients.json.JsonpDeserializable;
2827
import co.elastic.clients.json.JsonpDeserializer;
2928
import co.elastic.clients.json.JsonpMapper;
@@ -36,26 +35,25 @@
3635
import co.elastic.clients.util.TaggedUnion;
3736
import co.elastic.clients.util.TaggedUnionUtils;
3837
import jakarta.json.stream.JsonGenerator;
38+
import java.lang.Long;
3939
import java.lang.Object;
4040
import java.lang.String;
41-
import java.util.Map;
4241
import java.util.Objects;
4342
import java.util.function.Function;
4443
import javax.annotation.Nullable;
4544

46-
// typedef: indices.rollover.IndexRolloverMapping
45+
// typedef: _types.DateOrEpochMillis
4746

4847
/**
4948
*
50-
* @see <a href=
51-
* "../../doc-files/api-spec.html#indices.rollover.IndexRolloverMapping">API
49+
* @see <a href="../doc-files/api-spec.html#_types.DateOrEpochMillis">API
5250
* specification</a>
5351
*/
5452
@JsonpDeserializable
55-
public class IndexRolloverMapping implements TaggedUnion<IndexRolloverMapping.Kind, Object>, JsonpSerializable {
53+
public class DateOrEpochMillis implements TaggedUnion<DateOrEpochMillis.Kind, Object>, JsonpSerializable {
5654

5755
public enum Kind {
58-
ByType, Single
56+
Date, Millis
5957

6058
}
6159

@@ -72,54 +70,66 @@ public final Object _get() {
7270
return _value;
7371
}
7472

75-
private IndexRolloverMapping(Kind kind, Object value) {
73+
private DateOrEpochMillis(Kind kind, Object value) {
7674
this._kind = kind;
7775
this._value = value;
7876
}
7977

80-
private IndexRolloverMapping(Builder builder) {
78+
public String _toJsonString() {
79+
switch (_kind) {
80+
case Date :
81+
return this.date();
82+
case Millis :
83+
return String.valueOf(this.millis());
84+
85+
default :
86+
throw new IllegalStateException("Unknown kind " + _kind);
87+
}
88+
}
89+
90+
private DateOrEpochMillis(Builder builder) {
8191

8292
this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, "<variant kind>");
8393
this._value = ApiTypeHelper.requireNonNull(builder._value, builder, "<variant value>");
8494

8595
}
8696

87-
public static IndexRolloverMapping of(Function<Builder, ObjectBuilder<IndexRolloverMapping>> fn) {
97+
public static DateOrEpochMillis of(Function<Builder, ObjectBuilder<DateOrEpochMillis>> fn) {
8898
return fn.apply(new Builder()).build();
8999
}
90100

91101
/**
92-
* Is this variant instance of kind {@code by_type}?
102+
* Is this variant instance of kind {@code date}?
93103
*/
94-
public boolean isByType() {
95-
return _kind == Kind.ByType;
104+
public boolean isDate() {
105+
return _kind == Kind.Date;
96106
}
97107

98108
/**
99-
* Get the {@code by_type} variant value.
109+
* Get the {@code date} variant value.
100110
*
101111
* @throws IllegalStateException
102-
* if the current variant is not of the {@code by_type} kind.
112+
* if the current variant is not of the {@code date} kind.
103113
*/
104-
public Map<String, TypeMapping> byType() {
105-
return TaggedUnionUtils.get(this, Kind.ByType);
114+
public String date() {
115+
return TaggedUnionUtils.get(this, Kind.Date);
106116
}
107117

108118
/**
109-
* Is this variant instance of kind {@code single}?
119+
* Is this variant instance of kind {@code millis}?
110120
*/
111-
public boolean isSingle() {
112-
return _kind == Kind.Single;
121+
public boolean isMillis() {
122+
return _kind == Kind.Millis;
113123
}
114124

115125
/**
116-
* Get the {@code single} variant value.
126+
* Get the {@code millis} variant value.
117127
*
118128
* @throws IllegalStateException
119-
* if the current variant is not of the {@code single} kind.
129+
* if the current variant is not of the {@code millis} kind.
120130
*/
121-
public TypeMapping single() {
122-
return TaggedUnionUtils.get(this, Kind.Single);
131+
public Long millis() {
132+
return TaggedUnionUtils.get(this, Kind.Millis);
123133
}
124134

125135
@Override
@@ -128,55 +138,48 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) {
128138
((JsonpSerializable) _value).serialize(generator, mapper);
129139
} else {
130140
switch (_kind) {
131-
case ByType :
132-
generator.writeStartObject();
133-
for (Map.Entry<String, TypeMapping> item0 : ((Map<String, TypeMapping>) this._value).entrySet()) {
134-
generator.writeKey(item0.getKey());
135-
item0.getValue().serialize(generator, mapper);
141+
case Date :
142+
generator.write(((String) this._value));
136143

137-
}
138-
generator.writeEnd();
144+
break;
145+
case Millis :
146+
generator.write(((Long) this._value));
139147

140148
break;
141149
}
142150
}
143151

144152
}
145153

146-
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<IndexRolloverMapping> {
154+
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<DateOrEpochMillis> {
147155
private Kind _kind;
148156
private Object _value;
149157

150-
public ObjectBuilder<IndexRolloverMapping> byType(Map<String, TypeMapping> v) {
151-
this._kind = Kind.ByType;
158+
public ObjectBuilder<DateOrEpochMillis> date(String v) {
159+
this._kind = Kind.Date;
152160
this._value = v;
153161
return this;
154162
}
155163

156-
public ObjectBuilder<IndexRolloverMapping> single(TypeMapping v) {
157-
this._kind = Kind.Single;
164+
public ObjectBuilder<DateOrEpochMillis> millis(Long v) {
165+
this._kind = Kind.Millis;
158166
this._value = v;
159167
return this;
160168
}
161169

162-
public ObjectBuilder<IndexRolloverMapping> single(
163-
Function<TypeMapping.Builder, ObjectBuilder<TypeMapping>> fn) {
164-
return this.single(fn.apply(new TypeMapping.Builder()).build());
165-
}
166-
167-
public IndexRolloverMapping build() {
170+
public DateOrEpochMillis build() {
168171
_checkSingleUse();
169-
return new IndexRolloverMapping(this);
172+
return new DateOrEpochMillis(this);
170173
}
171174

172175
}
173176

174-
private static JsonpDeserializer<IndexRolloverMapping> buildIndexRolloverMappingDeserializer() {
175-
return new UnionDeserializer.Builder<IndexRolloverMapping, Kind, Object>(IndexRolloverMapping::new, false)
176-
.addMember(Kind.ByType, JsonpDeserializer.stringMapDeserializer(TypeMapping._DESERIALIZER))
177-
.addMember(Kind.Single, TypeMapping._DESERIALIZER).build();
177+
private static JsonpDeserializer<DateOrEpochMillis> buildDateOrEpochMillisDeserializer() {
178+
return new UnionDeserializer.Builder<DateOrEpochMillis, Kind, Object>(DateOrEpochMillis::new, false)
179+
.addMember(Kind.Date, JsonpDeserializer.stringDeserializer())
180+
.addMember(Kind.Millis, JsonpDeserializer.longDeserializer()).build();
178181
}
179182

180-
public static final JsonpDeserializer<IndexRolloverMapping> _DESERIALIZER = JsonpDeserializer
181-
.lazy(IndexRolloverMapping::buildIndexRolloverMappingDeserializer);
183+
public static final JsonpDeserializer<DateOrEpochMillis> _DESERIALIZER = JsonpDeserializer
184+
.lazy(DateOrEpochMillis::buildDateOrEpochMillisDeserializer);
182185
}
Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,28 +21,18 @@
2121
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
2222
//----------------------------------------------------
2323

24-
package co.elastic.clients.elasticsearch.indices.rollover;
25-
26-
import co.elastic.clients.elasticsearch._types.mapping.TypeMapping;
27-
import java.lang.String;
24+
package co.elastic.clients.elasticsearch._types;
2825

2926
/**
30-
* Builders for {@link IndexRolloverMapping} variants.
27+
* Builders for {@link DateOrEpochMillis} variants.
3128
* <p>
32-
* Variants <code>by_type</code> are not available here as they don't have a
33-
* dedicated class. Use {@link IndexRolloverMapping}'s builder for these.
29+
* Variants <code>date</code>, <code>millis</code> are not available here as
30+
* they don't have a dedicated class. Use {@link DateOrEpochMillis}'s builder
31+
* for these.
3432
*
3533
*/
36-
public class IndexRolloverMappingBuilders {
37-
private IndexRolloverMappingBuilders() {
38-
}
39-
40-
/**
41-
* Creates a builder for the {@link TypeMapping single}
42-
* {@code IndexRolloverMapping} variant.
43-
*/
44-
public static TypeMapping.Builder single() {
45-
return new TypeMapping.Builder();
34+
public class DateOrEpochMillisBuilders {
35+
private DateOrEpochMillisBuilders() {
4636
}
4737

4838
}

java-client/src/main/java/co/elastic/clients/elasticsearch/_types/EmptyTransform.java

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)