-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Backport 2.x] Re-generate client code using latest OpenSearch API sp…
…ecification (2024-09-23) (#1113) (#1205) * 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> (cherry picked from commit 230a92c) * Regenerate tasks namespace (#1187) * Fix codegen integer handling Signed-off-by: Thomas Farr <[email protected]> * Add failing tests Signed-off-by: Thomas Farr <[email protected]> * Begin re-generating `tasks.ListRequest` and `TaskExecutingNode` renaming `State` to `TaskInfo` Signed-off-by: Thomas Farr <[email protected]> * Simplify client request methods Signed-off-by: Thomas Farr <[email protected]> * Re-generate _types.Retries Signed-off-by: Thomas Farr <[email protected]> * Handle types that are used in both abstract and concrete contexts Signed-off-by: Thomas Farr <[email protected]> * Re-generate tasks.ListResponse Signed-off-by: Thomas Farr <[email protected]> * Regenerate tasks.cancel Signed-off-by: Thomas Farr <[email protected]> * Regenerate tasks.get Signed-off-by: Thomas Farr <[email protected]> * spotless Signed-off-by: Thomas Farr <[email protected]> * Fixes Signed-off-by: Thomas Farr <[email protected]> --------- Signed-off-by: Thomas Farr <[email protected]> (cherry picked from commit cb89246) * Support new mechanism of defining deprecated enum variants in OpenAPI (#1198) * Support new mechanism of defining deprecated enum variants in OpenAPI Signed-off-by: Thomas Farr <[email protected]> * Spotless Signed-off-by: Thomas Farr <[email protected]> --------- Signed-off-by: Thomas Farr <[email protected]> (cherry picked from commit 432919c) * Ensure codegen uptodate Signed-off-by: Thomas Farr <[email protected]> --------- Signed-off-by: Thomas Farr <[email protected]> Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
9f2fbab
commit f83cd4d
Showing
54 changed files
with
8,501 additions
and
1,378 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
289 changes: 289 additions & 0 deletions
289
java-client/src/generated/java/org/opensearch/client/opensearch/ml/Action.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,289 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
//---------------------------------------------------- | ||
// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. | ||
//---------------------------------------------------- | ||
|
||
package org.opensearch.client.opensearch.ml; | ||
|
||
import jakarta.json.stream.JsonGenerator; | ||
import java.util.function.Function; | ||
import javax.annotation.Generated; | ||
import javax.annotation.Nullable; | ||
import org.opensearch.client.json.JsonpDeserializable; | ||
import org.opensearch.client.json.JsonpDeserializer; | ||
import org.opensearch.client.json.JsonpMapper; | ||
import org.opensearch.client.json.ObjectBuilderDeserializer; | ||
import org.opensearch.client.json.ObjectDeserializer; | ||
import org.opensearch.client.json.PlainJsonSerializable; | ||
import org.opensearch.client.util.ObjectBuilder; | ||
import org.opensearch.client.util.ObjectBuilderBase; | ||
|
||
// typedef: ml.Action | ||
|
||
@JsonpDeserializable | ||
@Generated("org.opensearch.client.codegen.CodeGenerator") | ||
public class Action implements PlainJsonSerializable { | ||
|
||
@Nullable | ||
private final String actionType; | ||
|
||
@Nullable | ||
private final Headers headers; | ||
|
||
@Nullable | ||
private final String method; | ||
|
||
@Nullable | ||
private final String postProcessFunction; | ||
|
||
@Nullable | ||
private final String preProcessFunction; | ||
|
||
@Nullable | ||
private final String requestBody; | ||
|
||
@Nullable | ||
private final String url; | ||
|
||
// --------------------------------------------------------------------------------------------- | ||
|
||
private Action(Builder builder) { | ||
this.actionType = builder.actionType; | ||
this.headers = builder.headers; | ||
this.method = builder.method; | ||
this.postProcessFunction = builder.postProcessFunction; | ||
this.preProcessFunction = builder.preProcessFunction; | ||
this.requestBody = builder.requestBody; | ||
this.url = builder.url; | ||
} | ||
|
||
public static Action of(Function<Action.Builder, ObjectBuilder<Action>> fn) { | ||
return fn.apply(new Builder()).build(); | ||
} | ||
|
||
/** | ||
* API name: {@code action_type} | ||
*/ | ||
@Nullable | ||
public final String actionType() { | ||
return this.actionType; | ||
} | ||
|
||
/** | ||
* API name: {@code headers} | ||
*/ | ||
@Nullable | ||
public final Headers headers() { | ||
return this.headers; | ||
} | ||
|
||
/** | ||
* API name: {@code method} | ||
*/ | ||
@Nullable | ||
public final String method() { | ||
return this.method; | ||
} | ||
|
||
/** | ||
* API name: {@code post_process_function} | ||
*/ | ||
@Nullable | ||
public final String postProcessFunction() { | ||
return this.postProcessFunction; | ||
} | ||
|
||
/** | ||
* API name: {@code pre_process_function} | ||
*/ | ||
@Nullable | ||
public final String preProcessFunction() { | ||
return this.preProcessFunction; | ||
} | ||
|
||
/** | ||
* API name: {@code request_body} | ||
*/ | ||
@Nullable | ||
public final String requestBody() { | ||
return this.requestBody; | ||
} | ||
|
||
/** | ||
* API name: {@code url} | ||
*/ | ||
@Nullable | ||
public final String url() { | ||
return this.url; | ||
} | ||
|
||
/** | ||
* Serialize this object to JSON. | ||
*/ | ||
@Override | ||
public void serialize(JsonGenerator generator, JsonpMapper mapper) { | ||
generator.writeStartObject(); | ||
serializeInternal(generator, mapper); | ||
generator.writeEnd(); | ||
} | ||
|
||
protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { | ||
if (this.actionType != null) { | ||
generator.writeKey("action_type"); | ||
generator.write(this.actionType); | ||
} | ||
|
||
if (this.headers != null) { | ||
generator.writeKey("headers"); | ||
this.headers.serialize(generator, mapper); | ||
} | ||
|
||
if (this.method != null) { | ||
generator.writeKey("method"); | ||
generator.write(this.method); | ||
} | ||
|
||
if (this.postProcessFunction != null) { | ||
generator.writeKey("post_process_function"); | ||
generator.write(this.postProcessFunction); | ||
} | ||
|
||
if (this.preProcessFunction != null) { | ||
generator.writeKey("pre_process_function"); | ||
generator.write(this.preProcessFunction); | ||
} | ||
|
||
if (this.requestBody != null) { | ||
generator.writeKey("request_body"); | ||
generator.write(this.requestBody); | ||
} | ||
|
||
if (this.url != null) { | ||
generator.writeKey("url"); | ||
generator.write(this.url); | ||
} | ||
} | ||
|
||
// --------------------------------------------------------------------------------------------- | ||
|
||
/** | ||
* Builder for {@link Action}. | ||
*/ | ||
public static class Builder extends ObjectBuilderBase implements ObjectBuilder<Action> { | ||
@Nullable | ||
private String actionType; | ||
@Nullable | ||
private Headers headers; | ||
@Nullable | ||
private String method; | ||
@Nullable | ||
private String postProcessFunction; | ||
@Nullable | ||
private String preProcessFunction; | ||
@Nullable | ||
private String requestBody; | ||
@Nullable | ||
private String url; | ||
|
||
/** | ||
* API name: {@code action_type} | ||
*/ | ||
public final Builder actionType(@Nullable String value) { | ||
this.actionType = value; | ||
return this; | ||
} | ||
|
||
/** | ||
* API name: {@code headers} | ||
*/ | ||
public final Builder headers(@Nullable Headers value) { | ||
this.headers = value; | ||
return this; | ||
} | ||
|
||
/** | ||
* API name: {@code headers} | ||
*/ | ||
public final Builder headers(Function<Headers.Builder, ObjectBuilder<Headers>> fn) { | ||
return headers(fn.apply(new Headers.Builder()).build()); | ||
} | ||
|
||
/** | ||
* API name: {@code method} | ||
*/ | ||
public final Builder method(@Nullable String value) { | ||
this.method = value; | ||
return this; | ||
} | ||
|
||
/** | ||
* API name: {@code post_process_function} | ||
*/ | ||
public final Builder postProcessFunction(@Nullable String value) { | ||
this.postProcessFunction = value; | ||
return this; | ||
} | ||
|
||
/** | ||
* API name: {@code pre_process_function} | ||
*/ | ||
public final Builder preProcessFunction(@Nullable String value) { | ||
this.preProcessFunction = value; | ||
return this; | ||
} | ||
|
||
/** | ||
* API name: {@code request_body} | ||
*/ | ||
public final Builder requestBody(@Nullable String value) { | ||
this.requestBody = value; | ||
return this; | ||
} | ||
|
||
/** | ||
* API name: {@code url} | ||
*/ | ||
public final Builder url(@Nullable String value) { | ||
this.url = value; | ||
return this; | ||
} | ||
|
||
/** | ||
* Builds a {@link Action}. | ||
* | ||
* @throws NullPointerException if some of the required fields are null. | ||
*/ | ||
public Action build() { | ||
_checkSingleUse(); | ||
|
||
return new Action(this); | ||
} | ||
} | ||
|
||
// --------------------------------------------------------------------------------------------- | ||
|
||
/** | ||
* Json deserializer for {@link Action} | ||
*/ | ||
public static final JsonpDeserializer<Action> _DESERIALIZER = ObjectBuilderDeserializer.lazy( | ||
Builder::new, | ||
Action::setupActionDeserializer | ||
); | ||
|
||
protected static void setupActionDeserializer(ObjectDeserializer<Action.Builder> op) { | ||
op.add(Builder::actionType, JsonpDeserializer.stringDeserializer(), "action_type"); | ||
op.add(Builder::headers, Headers._DESERIALIZER, "headers"); | ||
op.add(Builder::method, JsonpDeserializer.stringDeserializer(), "method"); | ||
op.add(Builder::postProcessFunction, JsonpDeserializer.stringDeserializer(), "post_process_function"); | ||
op.add(Builder::preProcessFunction, JsonpDeserializer.stringDeserializer(), "pre_process_function"); | ||
op.add(Builder::requestBody, JsonpDeserializer.stringDeserializer(), "request_body"); | ||
op.add(Builder::url, JsonpDeserializer.stringDeserializer(), "url"); | ||
} | ||
} |
Oops, something went wrong.