Skip to content

Commit 0c3b5f7

Browse files
committed
[codegen] update to latest spec
1 parent e734d0a commit 0c3b5f7

18 files changed

+2573
-76
lines changed

java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,7 +1702,8 @@
17021702
'ingest._types.ConvertProcessor': 'ingest/_types/Processors.ts#L672-L692',
17031703
'ingest._types.ConvertType': 'ingest/_types/Processors.ts#L661-L670',
17041704
'ingest._types.CsvProcessor': 'ingest/_types/Processors.ts#L694-L727',
1705-
'ingest._types.DatabaseConfiguration': 'ingest/_types/Database.ts#L22-L29',
1705+
'ingest._types.DatabaseConfiguration': 'ingest/_types/Database.ts#L22-L37',
1706+
'ingest._types.DatabaseConfigurationFull': 'ingest/_types/Database.ts#L39-L42',
17061707
'ingest._types.DateIndexNameProcessor': 'ingest/_types/Processors.ts#L729-L767',
17071708
'ingest._types.DateProcessor': 'ingest/_types/Processors.ts#L769-L802',
17081709
'ingest._types.DissectProcessor': 'ingest/_types/Processors.ts#L804-L823',
@@ -1725,12 +1726,14 @@
17251726
'ingest._types.InferenceConfigRegression': 'ingest/_types/Processors.ts#L1062-L1073',
17261727
'ingest._types.InferenceProcessor': 'ingest/_types/Processors.ts#L1027-L1046',
17271728
'ingest._types.IpLocationProcessor': 'ingest/_types/Processors.ts#L478-L512',
1729+
'ingest._types.Ipinfo': 'ingest/_types/Database.ts#L48-L48',
17281730
'ingest._types.JoinProcessor': 'ingest/_types/Processors.ts#L1103-L1118',
17291731
'ingest._types.JsonProcessor': 'ingest/_types/Processors.ts#L1120-L1149',
17301732
'ingest._types.JsonProcessorConflictStrategy': 'ingest/_types/Processors.ts#L1151-L1156',
17311733
'ingest._types.KeyValueProcessor': 'ingest/_types/Processors.ts#L1158-L1210',
1734+
'ingest._types.Local': 'ingest/_types/Database.ts#L52-L54',
17321735
'ingest._types.LowercaseProcessor': 'ingest/_types/Processors.ts#L1212-L1228',
1733-
'ingest._types.Maxmind': 'ingest/_types/Database.ts#L31-L33',
1736+
'ingest._types.Maxmind': 'ingest/_types/Database.ts#L44-L46',
17341737
'ingest._types.NetworkDirectionProcessor': 'ingest/_types/Processors.ts#L1230-L1264',
17351738
'ingest._types.Pipeline': 'ingest/_types/Pipeline.ts#L23-L51',
17361739
'ingest._types.PipelineProcessor': 'ingest/_types/Processors.ts#L1266-L1277',
@@ -1754,8 +1757,11 @@
17541757
'ingest._types.UrlDecodeProcessor': 'ingest/_types/Processors.ts#L1561-L1577',
17551758
'ingest._types.UserAgentProcessor': 'ingest/_types/Processors.ts#L514-L545',
17561759
'ingest._types.UserAgentProperty': 'ingest/_types/Processors.ts#L547-L553',
1760+
'ingest._types.Web': 'ingest/_types/Database.ts#L50-L50',
17571761
'ingest.delete_geoip_database.Request': 'ingest/delete_geoip_database/DeleteGeoipDatabaseRequest.ts#L24-L49',
17581762
'ingest.delete_geoip_database.Response': 'ingest/delete_geoip_database/DeleteGeoipDatabaseResponse.ts#L22-L24',
1763+
'ingest.delete_ip_location_database.Request': 'ingest/delete_ip_location_database/DeleteIpLocationDatabaseRequest.ts#L24-L48',
1764+
'ingest.delete_ip_location_database.Response': 'ingest/delete_ip_location_database/DeleteIpLocationDatabaseResponse.ts#L22-L24',
17591765
'ingest.delete_pipeline.Request': 'ingest/delete_pipeline/DeletePipelineRequest.ts#L24-L54',
17601766
'ingest.delete_pipeline.Response': 'ingest/delete_pipeline/DeletePipelineResponse.ts#L22-L24',
17611767
'ingest.geo_ip_stats.GeoIpDownloadStatistics': 'ingest/geo_ip_stats/types.ts#L24-L37',
@@ -1766,12 +1772,17 @@
17661772
'ingest.get_geoip_database.DatabaseConfigurationMetadata': 'ingest/get_geoip_database/GetGeoipDatabaseResponse.ts#L29-L34',
17671773
'ingest.get_geoip_database.Request': 'ingest/get_geoip_database/GetGeoipDatabaseRequest.ts#L24-L47',
17681774
'ingest.get_geoip_database.Response': 'ingest/get_geoip_database/GetGeoipDatabaseResponse.ts#L25-L27',
1775+
'ingest.get_ip_location_database.DatabaseConfigurationMetadata': 'ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts#L28-L34',
1776+
'ingest.get_ip_location_database.Request': 'ingest/get_ip_location_database/GetIpLocationDatabaseRequest.ts#L24-L46',
1777+
'ingest.get_ip_location_database.Response': 'ingest/get_ip_location_database/GetIpLocationDatabaseResponse.ts#L24-L26',
17691778
'ingest.get_pipeline.Request': 'ingest/get_pipeline/GetPipelineRequest.ts#L24-L52',
17701779
'ingest.get_pipeline.Response': 'ingest/get_pipeline/GetPipelineResponse.ts#L23-L26',
17711780
'ingest.processor_grok.Request': 'ingest/processor_grok/GrokProcessorPatternsRequest.ts#L22-L33',
17721781
'ingest.processor_grok.Response': 'ingest/processor_grok/GrokProcessorPatternsResponse.ts#L22-L24',
17731782
'ingest.put_geoip_database.Request': 'ingest/put_geoip_database/PutGeoipDatabaseRequest.ts#L25-L58',
17741783
'ingest.put_geoip_database.Response': 'ingest/put_geoip_database/PutGeoipDatabaseResponse.ts#L22-L24',
1784+
'ingest.put_ip_location_database.Request': 'ingest/put_ip_location_database/PutIpLocationDatabaseRequest.ts#L25-L51',
1785+
'ingest.put_ip_location_database.Response': 'ingest/put_ip_location_database/PutIpLocationDatabaseResponse.ts#L22-L24',
17751786
'ingest.put_pipeline.Request': 'ingest/put_pipeline/PutPipelineRequest.ts#L25-L84',
17761787
'ingest.put_pipeline.Response': 'ingest/put_pipeline/PutPipelineResponse.ts#L22-L24',
17771788
'ingest.simulate.Document': 'ingest/simulate/types.ts#L62-L76',
@@ -2957,10 +2968,10 @@
29572968
if (hash.length > 1) {
29582969
hash = hash.substring(1);
29592970
}
2960-
window.location = "https://github.com/elastic/elasticsearch-specification/tree/bf306944eb96c57ae42ccb1a2f54816fed51267d/specification/" + (paths[hash] || "");
2971+
window.location = "https://github.com/elastic/elasticsearch-specification/tree/885bfe1ed73a32cccda79cdfee55783a87ed7ab7/specification/" + (paths[hash] || "");
29612972
</script>
29622973
</head>
29632974
<body>
2964-
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/bf306944eb96c57ae42ccb1a2f54816fed51267d/specification/">Elasticsearch API specification</a>.
2975+
Please see the <a href="https://github.com/elastic/elasticsearch-specification/tree/885bfe1ed73a32cccda79cdfee55783a87ed7ab7/specification/">Elasticsearch API specification</a>.
29652976
</body>
29662977
</html>

java-client/src/main/java/co/elastic/clients/elasticsearch/ingest/DatabaseConfiguration.java

Lines changed: 134 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
package co.elastic.clients.elasticsearch.ingest;
2121

22+
import co.elastic.clients.json.JsonEnum;
2223
import co.elastic.clients.json.JsonpDeserializable;
2324
import co.elastic.clients.json.JsonpDeserializer;
2425
import co.elastic.clients.json.JsonpMapper;
@@ -28,8 +29,11 @@
2829
import co.elastic.clients.json.ObjectDeserializer;
2930
import co.elastic.clients.util.ApiTypeHelper;
3031
import co.elastic.clients.util.ObjectBuilder;
32+
import co.elastic.clients.util.TaggedUnion;
33+
import co.elastic.clients.util.TaggedUnionUtils;
3134
import co.elastic.clients.util.WithJsonObjectBuilderBase;
3235
import jakarta.json.stream.JsonGenerator;
36+
import java.lang.Object;
3337
import java.lang.String;
3438
import java.util.Objects;
3539
import java.util.function.Function;
@@ -53,23 +57,69 @@
5357
// typedef: ingest._types.DatabaseConfiguration
5458

5559
/**
56-
*
60+
* The configuration necessary to identify which IP geolocation provider to use
61+
* to download a database, as well as any provider-specific configuration
62+
* necessary for such downloading. At present, the only supported providers are
63+
* maxmind and ipinfo, and the maxmind provider requires that an account_id
64+
* (string) is configured. A provider (either maxmind or ipinfo) must be
65+
* specified. The web and local providers can be returned as read only
66+
* configurations.
67+
*
5768
* @see <a href=
5869
* "../doc-files/api-spec.html#ingest._types.DatabaseConfiguration">API
5970
* specification</a>
6071
*/
6172
@JsonpDeserializable
62-
public class DatabaseConfiguration implements JsonpSerializable {
63-
private final String name;
73+
public class DatabaseConfiguration implements TaggedUnion<DatabaseConfiguration.Kind, Object>, JsonpSerializable {
74+
75+
/**
76+
* {@link DatabaseConfiguration} variant kinds.
77+
*
78+
* @see <a href=
79+
* "../doc-files/api-spec.html#ingest._types.DatabaseConfiguration">API
80+
* specification</a>
81+
*/
6482

65-
private final Maxmind maxmind;
83+
public enum Kind implements JsonEnum {
84+
Maxmind("maxmind"),
6685

67-
// ---------------------------------------------------------------------------------------------
86+
Ipinfo("ipinfo"),
87+
88+
;
89+
90+
private final String jsonValue;
91+
92+
Kind(String jsonValue) {
93+
this.jsonValue = jsonValue;
94+
}
95+
96+
public String jsonValue() {
97+
return this.jsonValue;
98+
}
99+
100+
}
101+
102+
private final Kind _kind;
103+
private final Object _value;
104+
105+
@Override
106+
public final Kind _kind() {
107+
return _kind;
108+
}
109+
110+
@Override
111+
public final Object _get() {
112+
return _value;
113+
}
114+
115+
private final String name;
68116

69117
private DatabaseConfiguration(Builder builder) {
70118

119+
this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, "<variant kind>");
120+
this._value = ApiTypeHelper.requireNonNull(builder._value, builder, "<variant value>");
121+
71122
this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name");
72-
this.maxmind = ApiTypeHelper.requireNonNull(builder.maxmind, this, "maxmind");
73123

74124
}
75125

@@ -88,34 +138,54 @@ public final String name() {
88138
}
89139

90140
/**
91-
* Required - The configuration necessary to identify which IP geolocation
92-
* provider to use to download the database, as well as any provider-specific
93-
* configuration necessary for such downloading. At present, the only supported
94-
* provider is maxmind, and the maxmind provider requires that an account_id
95-
* (string) is configured.
96-
* <p>
97-
* API name: {@code maxmind}
141+
* Is this variant instance of kind {@code maxmind}?
98142
*/
99-
public final Maxmind maxmind() {
100-
return this.maxmind;
143+
public boolean isMaxmind() {
144+
return _kind == Kind.Maxmind;
101145
}
102146

103147
/**
104-
* Serialize this object to JSON.
148+
* Get the {@code maxmind} variant value.
149+
*
150+
* @throws IllegalStateException
151+
* if the current variant is not of the {@code maxmind} kind.
105152
*/
106-
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
107-
generator.writeStartObject();
108-
serializeInternal(generator, mapper);
109-
generator.writeEnd();
153+
public Maxmind maxmind() {
154+
return TaggedUnionUtils.get(this, Kind.Maxmind);
155+
}
156+
157+
/**
158+
* Is this variant instance of kind {@code ipinfo}?
159+
*/
160+
public boolean isIpinfo() {
161+
return _kind == Kind.Ipinfo;
110162
}
111163

112-
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
164+
/**
165+
* Get the {@code ipinfo} variant value.
166+
*
167+
* @throws IllegalStateException
168+
* if the current variant is not of the {@code ipinfo} kind.
169+
*/
170+
public Ipinfo ipinfo() {
171+
return TaggedUnionUtils.get(this, Kind.Ipinfo);
172+
}
173+
174+
@Override
175+
@SuppressWarnings("unchecked")
176+
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
177+
178+
generator.writeStartObject();
113179

114180
generator.writeKey("name");
115181
generator.write(this.name);
116182

117-
generator.writeKey("maxmind");
118-
this.maxmind.serialize(generator, mapper);
183+
generator.writeKey(_kind.jsonValue());
184+
if (_value instanceof JsonpSerializable) {
185+
((JsonpSerializable) _value).serialize(generator, mapper);
186+
}
187+
188+
generator.writeEnd();
119189

120190
}
121191

@@ -124,18 +194,13 @@ public String toString() {
124194
return JsonpUtils.toString(this);
125195
}
126196

127-
// ---------------------------------------------------------------------------------------------
128-
129-
/**
130-
* Builder for {@link DatabaseConfiguration}.
131-
*/
132-
133197
public static class Builder extends WithJsonObjectBuilderBase<Builder>
134198
implements
135199
ObjectBuilder<DatabaseConfiguration> {
136-
private String name;
200+
private Kind _kind;
201+
private Object _value;
137202

138-
private Maxmind maxmind;
203+
private String name;
139204

140205
/**
141206
* Required - The provider-assigned name of the IP geolocation database to
@@ -148,64 +213,62 @@ public final Builder name(String value) {
148213
return this;
149214
}
150215

151-
/**
152-
* Required - The configuration necessary to identify which IP geolocation
153-
* provider to use to download the database, as well as any provider-specific
154-
* configuration necessary for such downloading. At present, the only supported
155-
* provider is maxmind, and the maxmind provider requires that an account_id
156-
* (string) is configured.
157-
* <p>
158-
* API name: {@code maxmind}
159-
*/
160-
public final Builder maxmind(Maxmind value) {
161-
this.maxmind = value;
216+
@Override
217+
protected Builder self() {
162218
return this;
163219
}
220+
public ContainerBuilder maxmind(Maxmind v) {
221+
this._kind = Kind.Maxmind;
222+
this._value = v;
223+
return new ContainerBuilder();
224+
}
164225

165-
/**
166-
* Required - The configuration necessary to identify which IP geolocation
167-
* provider to use to download the database, as well as any provider-specific
168-
* configuration necessary for such downloading. At present, the only supported
169-
* provider is maxmind, and the maxmind provider requires that an account_id
170-
* (string) is configured.
171-
* <p>
172-
* API name: {@code maxmind}
173-
*/
174-
public final Builder maxmind(Function<Maxmind.Builder, ObjectBuilder<Maxmind>> fn) {
226+
public ContainerBuilder maxmind(Function<Maxmind.Builder, ObjectBuilder<Maxmind>> fn) {
175227
return this.maxmind(fn.apply(new Maxmind.Builder()).build());
176228
}
177229

178-
@Override
179-
protected Builder self() {
180-
return this;
230+
public ContainerBuilder ipinfo(Ipinfo v) {
231+
this._kind = Kind.Ipinfo;
232+
this._value = v;
233+
return new ContainerBuilder();
234+
}
235+
236+
public ContainerBuilder ipinfo(Function<Ipinfo.Builder, ObjectBuilder<Ipinfo>> fn) {
237+
return this.ipinfo(fn.apply(new Ipinfo.Builder()).build());
181238
}
182239

183-
/**
184-
* Builds a {@link DatabaseConfiguration}.
185-
*
186-
* @throws NullPointerException
187-
* if some of the required fields are null.
188-
*/
189240
public DatabaseConfiguration build() {
190241
_checkSingleUse();
191-
192242
return new DatabaseConfiguration(this);
193243
}
194-
}
195-
196-
// ---------------------------------------------------------------------------------------------
197244

198-
/**
199-
* Json deserializer for {@link DatabaseConfiguration}
200-
*/
201-
public static final JsonpDeserializer<DatabaseConfiguration> _DESERIALIZER = ObjectBuilderDeserializer
202-
.lazy(Builder::new, DatabaseConfiguration::setupDatabaseConfigurationDeserializer);
245+
public class ContainerBuilder implements ObjectBuilder<DatabaseConfiguration> {
246+
247+
/**
248+
* Required - The provider-assigned name of the IP geolocation database to
249+
* download.
250+
* <p>
251+
* API name: {@code name}
252+
*/
253+
public final ContainerBuilder name(String value) {
254+
Builder.this.name = value;
255+
return this;
256+
}
257+
258+
public DatabaseConfiguration build() {
259+
return Builder.this.build();
260+
}
261+
}
262+
}
203263

204-
protected static void setupDatabaseConfigurationDeserializer(ObjectDeserializer<DatabaseConfiguration.Builder> op) {
264+
protected static void setupDatabaseConfigurationDeserializer(ObjectDeserializer<Builder> op) {
205265

206266
op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name");
207267
op.add(Builder::maxmind, Maxmind._DESERIALIZER, "maxmind");
268+
op.add(Builder::ipinfo, Ipinfo._DESERIALIZER, "ipinfo");
208269

209270
}
210271

272+
public static final JsonpDeserializer<DatabaseConfiguration> _DESERIALIZER = ObjectBuilderDeserializer
273+
.lazy(Builder::new, DatabaseConfiguration::setupDatabaseConfigurationDeserializer, Builder::build);
211274
}

0 commit comments

Comments
 (0)