Skip to content

Commit 230a92c

Browse files
Re-generate client code using latest OpenSearch API specification (2024-09-23) (#1113)
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 432919c commit 230a92c

18 files changed

+3980
-62
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,289 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* The OpenSearch Contributors require contributions made to
5+
* this file be licensed under the Apache-2.0 license or a
6+
* compatible open source license.
7+
*/
8+
9+
//----------------------------------------------------
10+
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST.
11+
//----------------------------------------------------
12+
13+
package org.opensearch.client.opensearch.ml;
14+
15+
import jakarta.json.stream.JsonGenerator;
16+
import java.util.function.Function;
17+
import javax.annotation.Generated;
18+
import javax.annotation.Nullable;
19+
import org.opensearch.client.json.JsonpDeserializable;
20+
import org.opensearch.client.json.JsonpDeserializer;
21+
import org.opensearch.client.json.JsonpMapper;
22+
import org.opensearch.client.json.ObjectBuilderDeserializer;
23+
import org.opensearch.client.json.ObjectDeserializer;
24+
import org.opensearch.client.json.PlainJsonSerializable;
25+
import org.opensearch.client.util.ObjectBuilder;
26+
import org.opensearch.client.util.ObjectBuilderBase;
27+
28+
// typedef: ml.Action
29+
30+
@JsonpDeserializable
31+
@Generated("org.opensearch.client.codegen.CodeGenerator")
32+
public class Action implements PlainJsonSerializable {
33+
34+
@Nullable
35+
private final String actionType;
36+
37+
@Nullable
38+
private final Headers headers;
39+
40+
@Nullable
41+
private final String method;
42+
43+
@Nullable
44+
private final String postProcessFunction;
45+
46+
@Nullable
47+
private final String preProcessFunction;
48+
49+
@Nullable
50+
private final String requestBody;
51+
52+
@Nullable
53+
private final String url;
54+
55+
// ---------------------------------------------------------------------------------------------
56+
57+
private Action(Builder builder) {
58+
this.actionType = builder.actionType;
59+
this.headers = builder.headers;
60+
this.method = builder.method;
61+
this.postProcessFunction = builder.postProcessFunction;
62+
this.preProcessFunction = builder.preProcessFunction;
63+
this.requestBody = builder.requestBody;
64+
this.url = builder.url;
65+
}
66+
67+
public static Action of(Function<Action.Builder, ObjectBuilder<Action>> fn) {
68+
return fn.apply(new Builder()).build();
69+
}
70+
71+
/**
72+
* API name: {@code action_type}
73+
*/
74+
@Nullable
75+
public final String actionType() {
76+
return this.actionType;
77+
}
78+
79+
/**
80+
* API name: {@code headers}
81+
*/
82+
@Nullable
83+
public final Headers headers() {
84+
return this.headers;
85+
}
86+
87+
/**
88+
* API name: {@code method}
89+
*/
90+
@Nullable
91+
public final String method() {
92+
return this.method;
93+
}
94+
95+
/**
96+
* API name: {@code post_process_function}
97+
*/
98+
@Nullable
99+
public final String postProcessFunction() {
100+
return this.postProcessFunction;
101+
}
102+
103+
/**
104+
* API name: {@code pre_process_function}
105+
*/
106+
@Nullable
107+
public final String preProcessFunction() {
108+
return this.preProcessFunction;
109+
}
110+
111+
/**
112+
* API name: {@code request_body}
113+
*/
114+
@Nullable
115+
public final String requestBody() {
116+
return this.requestBody;
117+
}
118+
119+
/**
120+
* API name: {@code url}
121+
*/
122+
@Nullable
123+
public final String url() {
124+
return this.url;
125+
}
126+
127+
/**
128+
* Serialize this object to JSON.
129+
*/
130+
@Override
131+
public void serialize(JsonGenerator generator, JsonpMapper mapper) {
132+
generator.writeStartObject();
133+
serializeInternal(generator, mapper);
134+
generator.writeEnd();
135+
}
136+
137+
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
138+
if (this.actionType != null) {
139+
generator.writeKey("action_type");
140+
generator.write(this.actionType);
141+
}
142+
143+
if (this.headers != null) {
144+
generator.writeKey("headers");
145+
this.headers.serialize(generator, mapper);
146+
}
147+
148+
if (this.method != null) {
149+
generator.writeKey("method");
150+
generator.write(this.method);
151+
}
152+
153+
if (this.postProcessFunction != null) {
154+
generator.writeKey("post_process_function");
155+
generator.write(this.postProcessFunction);
156+
}
157+
158+
if (this.preProcessFunction != null) {
159+
generator.writeKey("pre_process_function");
160+
generator.write(this.preProcessFunction);
161+
}
162+
163+
if (this.requestBody != null) {
164+
generator.writeKey("request_body");
165+
generator.write(this.requestBody);
166+
}
167+
168+
if (this.url != null) {
169+
generator.writeKey("url");
170+
generator.write(this.url);
171+
}
172+
}
173+
174+
// ---------------------------------------------------------------------------------------------
175+
176+
/**
177+
* Builder for {@link Action}.
178+
*/
179+
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<Action> {
180+
@Nullable
181+
private String actionType;
182+
@Nullable
183+
private Headers headers;
184+
@Nullable
185+
private String method;
186+
@Nullable
187+
private String postProcessFunction;
188+
@Nullable
189+
private String preProcessFunction;
190+
@Nullable
191+
private String requestBody;
192+
@Nullable
193+
private String url;
194+
195+
/**
196+
* API name: {@code action_type}
197+
*/
198+
public final Builder actionType(@Nullable String value) {
199+
this.actionType = value;
200+
return this;
201+
}
202+
203+
/**
204+
* API name: {@code headers}
205+
*/
206+
public final Builder headers(@Nullable Headers value) {
207+
this.headers = value;
208+
return this;
209+
}
210+
211+
/**
212+
* API name: {@code headers}
213+
*/
214+
public final Builder headers(Function<Headers.Builder, ObjectBuilder<Headers>> fn) {
215+
return headers(fn.apply(new Headers.Builder()).build());
216+
}
217+
218+
/**
219+
* API name: {@code method}
220+
*/
221+
public final Builder method(@Nullable String value) {
222+
this.method = value;
223+
return this;
224+
}
225+
226+
/**
227+
* API name: {@code post_process_function}
228+
*/
229+
public final Builder postProcessFunction(@Nullable String value) {
230+
this.postProcessFunction = value;
231+
return this;
232+
}
233+
234+
/**
235+
* API name: {@code pre_process_function}
236+
*/
237+
public final Builder preProcessFunction(@Nullable String value) {
238+
this.preProcessFunction = value;
239+
return this;
240+
}
241+
242+
/**
243+
* API name: {@code request_body}
244+
*/
245+
public final Builder requestBody(@Nullable String value) {
246+
this.requestBody = value;
247+
return this;
248+
}
249+
250+
/**
251+
* API name: {@code url}
252+
*/
253+
public final Builder url(@Nullable String value) {
254+
this.url = value;
255+
return this;
256+
}
257+
258+
/**
259+
* Builds a {@link Action}.
260+
*
261+
* @throws NullPointerException if some of the required fields are null.
262+
*/
263+
public Action build() {
264+
_checkSingleUse();
265+
266+
return new Action(this);
267+
}
268+
}
269+
270+
// ---------------------------------------------------------------------------------------------
271+
272+
/**
273+
* Json deserializer for {@link Action}
274+
*/
275+
public static final JsonpDeserializer<Action> _DESERIALIZER = ObjectBuilderDeserializer.lazy(
276+
Builder::new,
277+
Action::setupActionDeserializer
278+
);
279+
280+
protected static void setupActionDeserializer(ObjectDeserializer<Action.Builder> op) {
281+
op.add(Builder::actionType, JsonpDeserializer.stringDeserializer(), "action_type");
282+
op.add(Builder::headers, Headers._DESERIALIZER, "headers");
283+
op.add(Builder::method, JsonpDeserializer.stringDeserializer(), "method");
284+
op.add(Builder::postProcessFunction, JsonpDeserializer.stringDeserializer(), "post_process_function");
285+
op.add(Builder::preProcessFunction, JsonpDeserializer.stringDeserializer(), "pre_process_function");
286+
op.add(Builder::requestBody, JsonpDeserializer.stringDeserializer(), "request_body");
287+
op.add(Builder::url, JsonpDeserializer.stringDeserializer(), "url");
288+
}
289+
}

0 commit comments

Comments
 (0)