Skip to content

Commit 3046b4b

Browse files
committed
[codegen] Update to latest 8.3 API specification
1 parent 295affb commit 3046b4b

13 files changed

+1014
-160
lines changed

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

Lines changed: 61 additions & 57 deletions
Large diffs are not rendered by default.

java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlAsyncClient.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,6 +1244,42 @@ public CompletableFuture<GetMemoryStatsResponse> getMemoryStats() {
12441244
GetMemoryStatsRequest._ENDPOINT, this.transportOptions);
12451245
}
12461246

1247+
// ----- Endpoint: ml.get_model_snapshot_upgrade_stats
1248+
1249+
/**
1250+
* Gets stats for anomaly detection job model snapshot upgrades that are in
1251+
* progress.
1252+
*
1253+
* @see <a href=
1254+
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-model-snapshot-upgrade-stats.html">Documentation
1255+
* on elastic.co</a>
1256+
*/
1257+
1258+
public CompletableFuture<GetModelSnapshotUpgradeStatsResponse> getModelSnapshotUpgradeStats(
1259+
GetModelSnapshotUpgradeStatsRequest request) {
1260+
@SuppressWarnings("unchecked")
1261+
JsonEndpoint<GetModelSnapshotUpgradeStatsRequest, GetModelSnapshotUpgradeStatsResponse, ErrorResponse> endpoint = (JsonEndpoint<GetModelSnapshotUpgradeStatsRequest, GetModelSnapshotUpgradeStatsResponse, ErrorResponse>) GetModelSnapshotUpgradeStatsRequest._ENDPOINT;
1262+
1263+
return this.transport.performRequestAsync(request, endpoint, this.transportOptions);
1264+
}
1265+
1266+
/**
1267+
* Gets stats for anomaly detection job model snapshot upgrades that are in
1268+
* progress.
1269+
*
1270+
* @param fn
1271+
* a function that initializes a builder to create the
1272+
* {@link GetModelSnapshotUpgradeStatsRequest}
1273+
* @see <a href=
1274+
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-model-snapshot-upgrade-stats.html">Documentation
1275+
* on elastic.co</a>
1276+
*/
1277+
1278+
public final CompletableFuture<GetModelSnapshotUpgradeStatsResponse> getModelSnapshotUpgradeStats(
1279+
Function<GetModelSnapshotUpgradeStatsRequest.Builder, ObjectBuilder<GetModelSnapshotUpgradeStatsRequest>> fn) {
1280+
return getModelSnapshotUpgradeStats(fn.apply(new GetModelSnapshotUpgradeStatsRequest.Builder()).build());
1281+
}
1282+
12471283
// ----- Endpoint: ml.get_model_snapshots
12481284

12491285
/**

java-client/src/main/java/co/elastic/clients/elasticsearch/ml/ElasticsearchMlClient.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,6 +1284,43 @@ public GetMemoryStatsResponse getMemoryStats() throws IOException, Elasticsearch
12841284
GetMemoryStatsRequest._ENDPOINT, this.transportOptions);
12851285
}
12861286

1287+
// ----- Endpoint: ml.get_model_snapshot_upgrade_stats
1288+
1289+
/**
1290+
* Gets stats for anomaly detection job model snapshot upgrades that are in
1291+
* progress.
1292+
*
1293+
* @see <a href=
1294+
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-model-snapshot-upgrade-stats.html">Documentation
1295+
* on elastic.co</a>
1296+
*/
1297+
1298+
public GetModelSnapshotUpgradeStatsResponse getModelSnapshotUpgradeStats(
1299+
GetModelSnapshotUpgradeStatsRequest request) throws IOException, ElasticsearchException {
1300+
@SuppressWarnings("unchecked")
1301+
JsonEndpoint<GetModelSnapshotUpgradeStatsRequest, GetModelSnapshotUpgradeStatsResponse, ErrorResponse> endpoint = (JsonEndpoint<GetModelSnapshotUpgradeStatsRequest, GetModelSnapshotUpgradeStatsResponse, ErrorResponse>) GetModelSnapshotUpgradeStatsRequest._ENDPOINT;
1302+
1303+
return this.transport.performRequest(request, endpoint, this.transportOptions);
1304+
}
1305+
1306+
/**
1307+
* Gets stats for anomaly detection job model snapshot upgrades that are in
1308+
* progress.
1309+
*
1310+
* @param fn
1311+
* a function that initializes a builder to create the
1312+
* {@link GetModelSnapshotUpgradeStatsRequest}
1313+
* @see <a href=
1314+
* "https://www.elastic.co/guide/en/elasticsearch/reference/current/ml-get-job-model-snapshot-upgrade-stats.html">Documentation
1315+
* on elastic.co</a>
1316+
*/
1317+
1318+
public final GetModelSnapshotUpgradeStatsResponse getModelSnapshotUpgradeStats(
1319+
Function<GetModelSnapshotUpgradeStatsRequest.Builder, ObjectBuilder<GetModelSnapshotUpgradeStatsRequest>> fn)
1320+
throws IOException, ElasticsearchException {
1321+
return getModelSnapshotUpgradeStats(fn.apply(new GetModelSnapshotUpgradeStatsRequest.Builder()).build());
1322+
}
1323+
12871324
// ----- Endpoint: ml.get_model_snapshots
12881325

12891326
/**
Lines changed: 249 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,249 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
//----------------------------------------------------
21+
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
22+
//----------------------------------------------------
23+
24+
package co.elastic.clients.elasticsearch.ml;
25+
26+
import co.elastic.clients.elasticsearch._types.ErrorResponse;
27+
import co.elastic.clients.elasticsearch._types.RequestBase;
28+
import co.elastic.clients.json.JsonpDeserializable;
29+
import co.elastic.clients.json.JsonpDeserializer;
30+
import co.elastic.clients.json.ObjectBuilderDeserializer;
31+
import co.elastic.clients.json.ObjectDeserializer;
32+
import co.elastic.clients.transport.Endpoint;
33+
import co.elastic.clients.transport.endpoints.SimpleEndpoint;
34+
import co.elastic.clients.util.ApiTypeHelper;
35+
import co.elastic.clients.util.ObjectBuilder;
36+
import co.elastic.clients.util.ObjectBuilderBase;
37+
import jakarta.json.stream.JsonGenerator;
38+
import java.lang.Boolean;
39+
import java.lang.String;
40+
import java.util.HashMap;
41+
import java.util.Map;
42+
import java.util.Objects;
43+
import java.util.function.Function;
44+
import javax.annotation.Nullable;
45+
46+
// typedef: ml.get_model_snapshot_upgrade_stats.Request
47+
48+
/**
49+
* Retrieves usage information for anomaly detection job model snapshot
50+
* upgrades.
51+
*
52+
* @see <a href=
53+
* "../doc-files/api-spec.html#ml.get_model_snapshot_upgrade_stats.Request">API
54+
* specification</a>
55+
*/
56+
57+
public class GetModelSnapshotUpgradeStatsRequest extends RequestBase {
58+
@Nullable
59+
private final Boolean allowNoMatch;
60+
61+
private final String jobId;
62+
63+
@Nullable
64+
private final String snapshotId;
65+
66+
// ---------------------------------------------------------------------------------------------
67+
68+
private GetModelSnapshotUpgradeStatsRequest(Builder builder) {
69+
70+
this.allowNoMatch = builder.allowNoMatch;
71+
this.jobId = ApiTypeHelper.requireNonNull(builder.jobId, this, "jobId");
72+
this.snapshotId = builder.snapshotId;
73+
74+
}
75+
76+
public static GetModelSnapshotUpgradeStatsRequest of(
77+
Function<Builder, ObjectBuilder<GetModelSnapshotUpgradeStatsRequest>> fn) {
78+
return fn.apply(new Builder()).build();
79+
}
80+
81+
/**
82+
* Specifies what to do when the request:
83+
* <ul>
84+
* <li>Contains wildcard expressions and there are no jobs that match.</li>
85+
* <li>Contains the _all string or no identifiers and there are no matches.</li>
86+
* <li>Contains wildcard expressions and there are only partial matches.</li>
87+
* </ul>
88+
* <p>
89+
* The default value is true, which returns an empty jobs array when there are
90+
* no matches and the subset of results when there are partial matches. If this
91+
* parameter is false, the request returns a 404 status code when there are no
92+
* matches or only partial matches.
93+
* <p>
94+
* API name: {@code allow_no_match}
95+
*/
96+
@Nullable
97+
public final Boolean allowNoMatch() {
98+
return this.allowNoMatch;
99+
}
100+
101+
/**
102+
* Required - Identifier for the anomaly detection job.
103+
* <p>
104+
* API name: {@code job_id}
105+
*/
106+
public final String jobId() {
107+
return this.jobId;
108+
}
109+
110+
/**
111+
* A numerical character string that uniquely identifies the model snapshot. You
112+
* can get information for multiple snapshots by using a comma-separated list or
113+
* a wildcard expression. You can get all snapshots by using <code>_all</code>,
114+
* by specifying <code>*</code> as the snapshot ID, or by omitting the snapshot
115+
* ID.
116+
* <p>
117+
* API name: {@code snapshot_id}
118+
*/
119+
@Nullable
120+
public final String snapshotId() {
121+
return this.snapshotId;
122+
}
123+
124+
// ---------------------------------------------------------------------------------------------
125+
126+
/**
127+
* Builder for {@link GetModelSnapshotUpgradeStatsRequest}.
128+
*/
129+
130+
public static class Builder extends ObjectBuilderBase
131+
implements
132+
ObjectBuilder<GetModelSnapshotUpgradeStatsRequest> {
133+
@Nullable
134+
private Boolean allowNoMatch;
135+
136+
private String jobId;
137+
138+
@Nullable
139+
private String snapshotId;
140+
141+
/**
142+
* Specifies what to do when the request:
143+
* <ul>
144+
* <li>Contains wildcard expressions and there are no jobs that match.</li>
145+
* <li>Contains the _all string or no identifiers and there are no matches.</li>
146+
* <li>Contains wildcard expressions and there are only partial matches.</li>
147+
* </ul>
148+
* <p>
149+
* The default value is true, which returns an empty jobs array when there are
150+
* no matches and the subset of results when there are partial matches. If this
151+
* parameter is false, the request returns a 404 status code when there are no
152+
* matches or only partial matches.
153+
* <p>
154+
* API name: {@code allow_no_match}
155+
*/
156+
public final Builder allowNoMatch(@Nullable Boolean value) {
157+
this.allowNoMatch = value;
158+
return this;
159+
}
160+
161+
/**
162+
* Required - Identifier for the anomaly detection job.
163+
* <p>
164+
* API name: {@code job_id}
165+
*/
166+
public final Builder jobId(String value) {
167+
this.jobId = value;
168+
return this;
169+
}
170+
171+
/**
172+
* A numerical character string that uniquely identifies the model snapshot. You
173+
* can get information for multiple snapshots by using a comma-separated list or
174+
* a wildcard expression. You can get all snapshots by using <code>_all</code>,
175+
* by specifying <code>*</code> as the snapshot ID, or by omitting the snapshot
176+
* ID.
177+
* <p>
178+
* API name: {@code snapshot_id}
179+
*/
180+
public final Builder snapshotId(@Nullable String value) {
181+
this.snapshotId = value;
182+
return this;
183+
}
184+
185+
/**
186+
* Builds a {@link GetModelSnapshotUpgradeStatsRequest}.
187+
*
188+
* @throws NullPointerException
189+
* if some of the required fields are null.
190+
*/
191+
public GetModelSnapshotUpgradeStatsRequest build() {
192+
_checkSingleUse();
193+
194+
return new GetModelSnapshotUpgradeStatsRequest(this);
195+
}
196+
}
197+
198+
// ---------------------------------------------------------------------------------------------
199+
200+
/**
201+
* Endpoint "{@code ml.get_model_snapshot_upgrade_stats}".
202+
*/
203+
public static final Endpoint<GetModelSnapshotUpgradeStatsRequest, GetModelSnapshotUpgradeStatsResponse, ErrorResponse> _ENDPOINT = new SimpleEndpoint<>(
204+
"es/ml.get_model_snapshot_upgrade_stats",
205+
206+
// Request method
207+
request -> {
208+
return "GET";
209+
210+
},
211+
212+
// Request path
213+
request -> {
214+
final int _snapshotId = 1 << 0;
215+
final int _jobId = 1 << 1;
216+
217+
int propsSet = 0;
218+
219+
if (request.snapshotId() != null)
220+
propsSet |= _snapshotId;
221+
propsSet |= _jobId;
222+
223+
if (propsSet == (_jobId | _snapshotId)) {
224+
StringBuilder buf = new StringBuilder();
225+
buf.append("/_ml");
226+
buf.append("/anomaly_detectors");
227+
buf.append("/");
228+
SimpleEndpoint.pathEncode(request.jobId, buf);
229+
buf.append("/model_snapshots");
230+
buf.append("/");
231+
SimpleEndpoint.pathEncode(request.snapshotId, buf);
232+
buf.append("/_upgrade");
233+
buf.append("/_stats");
234+
return buf.toString();
235+
}
236+
throw SimpleEndpoint.noPathTemplateFound("path");
237+
238+
},
239+
240+
// Request parameters
241+
request -> {
242+
Map<String, String> params = new HashMap<>();
243+
if (request.allowNoMatch != null) {
244+
params.put("allow_no_match", String.valueOf(request.allowNoMatch));
245+
}
246+
return params;
247+
248+
}, SimpleEndpoint.emptyMap(), false, GetModelSnapshotUpgradeStatsResponse._DESERIALIZER);
249+
}

0 commit comments

Comments
 (0)