diff --git a/CHANGELOG.md b/CHANGELOG.md index afb5321fde..123b879598 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ This section is for maintaining a changelog for all breaking changes for the cli ### Changed - Migrate client transports to Apache HttpClient / Core 5.x ([#246](https://github.com/opensearch-project/opensearch-java/pull/246)) - Changed SearchAfter of SearchRequest type to FieldValue instead of String ([#769](https://github.com/opensearch-project/opensearch-java/pull/769)) +- Changed type of `DanglingIndex`'s `creationDateMillis` field from `String` to `long` ([#1124](https://github.com/opensearch-project/opensearch-java/pull/1124)) ### Deprecated - Deprecate RestClientTransport ([#536](https://github.com/opensearch-project/opensearch-java/pull/536)) diff --git a/UPGRADING.md b/UPGRADING.md index 1b1a91c7c6..4764e323bf 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -21,3 +21,6 @@ After: .searchAfter(FieldValue.of("string1"), FieldValue.of("string2")) .searchAfter(List.of(FieldValue.of("String"))) ``` + +### DanglingIndex creationDateMillis type +- The type of `DanglingIndex`'s `creationDateMillis` field has been corrected from a `String` to a `long`. \ No newline at end of file diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java index 77f05da118..3c2dbdd206 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchAsyncClient.java @@ -43,9 +43,13 @@ import org.opensearch.client.opensearch._types.OpenSearchException; import org.opensearch.client.opensearch.core.InfoRequest; import org.opensearch.client.opensearch.core.InfoResponse; +import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesAsyncClient; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; +/** + * Client for the namespace. + */ @Generated("org.opensearch.client.codegen.CodeGenerator") public class OpenSearchAsyncClient extends OpenSearchAsyncClientBase { public OpenSearchAsyncClient(OpenSearchTransport transport) { @@ -61,6 +65,12 @@ public OpenSearchAsyncClient withTransportOptions(@Nullable TransportOptions tra return new OpenSearchAsyncClient(this.transport, transportOptions); } + // ----- Child clients + + public OpenSearchDanglingIndicesAsyncClient danglingIndices() { + return new OpenSearchDanglingIndicesAsyncClient(this.transport, this.transportOptions); + } + // ----- Endpoint: info /** diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClient.java index 87e3cdc45a..d797bf2b54 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/OpenSearchClient.java @@ -42,9 +42,13 @@ import org.opensearch.client.opensearch._types.OpenSearchException; import org.opensearch.client.opensearch.core.InfoRequest; import org.opensearch.client.opensearch.core.InfoResponse; +import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesClient; import org.opensearch.client.transport.OpenSearchTransport; import org.opensearch.client.transport.TransportOptions; +/** + * Client for the namespace. + */ @Generated("org.opensearch.client.codegen.CodeGenerator") public class OpenSearchClient extends OpenSearchClientBase { public OpenSearchClient(OpenSearchTransport transport) { @@ -60,6 +64,12 @@ public OpenSearchClient withTransportOptions(@Nullable TransportOptions transpor return new OpenSearchClient(this.transport, transportOptions); } + // ----- Child clients + + public OpenSearchDanglingIndicesClient danglingIndices() { + return new OpenSearchDanglingIndicesClient(this.transport, this.transportOptions); + } + // ----- Endpoint: info /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java similarity index 87% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java index 17037c3447..c7ab7d8510 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java @@ -30,9 +30,14 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.ObjectDeserializer; @@ -42,22 +47,22 @@ // typedef: _types.AcknowledgedResponseBase +@Generated("org.opensearch.client.codegen.CodeGenerator") public abstract class AcknowledgedResponseBase implements PlainJsonSerializable { + private final boolean acknowledged; // --------------------------------------------------------------------------------------------- protected AcknowledgedResponseBase(AbstractBuilder builder) { - this.acknowledged = ApiTypeHelper.requireNonNull(builder.acknowledged, this, "acknowledged"); - } /** - * Required - For a successful response, this value is always true. On failure, - * an exception is returned instead. + * Required - For a successful response, this value is always true. On failure, an exception is returned instead. *

* API name: {@code acknowledged} + *

*/ public final boolean acknowledged() { return this.acknowledged; @@ -66,6 +71,7 @@ public final boolean acknowledged() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -73,20 +79,21 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("acknowledged"); generator.write(this.acknowledged); } + // --------------------------------------------------------------------------------------------- + protected abstract static class AbstractBuilder> extends ObjectBuilderBase { private Boolean acknowledged; /** - * Required - For a successful response, this value is always true. On failure, - * an exception is returned instead. + * Required - For a successful response, this value is always true. On failure, an exception is returned instead. *

* API name: {@code acknowledged} + *

*/ public final BuilderT acknowledged(boolean value) { this.acknowledged = value; @@ -94,16 +101,12 @@ public final BuilderT acknowledged(boolean value) { } protected abstract BuilderT self(); - } - // --------------------------------------------------------------------------------------------- + protected static > void setupAcknowledgedResponseBaseDeserializer( ObjectDeserializer op ) { - op.add(AbstractBuilder::acknowledged, JsonpDeserializer.booleanDeserializer(), "acknowledged"); - } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorCause.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java similarity index 88% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorCause.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java index 131f7046e5..2941b7ea30 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorCause.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/ErrorCause.java @@ -30,6 +30,10 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; @@ -37,6 +41,7 @@ import java.util.List; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -51,78 +56,74 @@ // typedef: _types.ErrorCause -/** - * Cause and details about a request failure. This class defines the properties - * common to all error types. Additional details are also provided, that depend - * on the error type. - */ @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class ErrorCause implements PlainJsonSerializable { - private final Map metadata; - private final String type; + @Nullable + private final ErrorCause causedBy; + @Nullable private final String reason; + private final List rootCause; + @Nullable private final String stackTrace; - @Nullable - private final ErrorCause causedBy; + private final List suppressed; - private final List rootCause; + private final String type; - private final List suppressed; + private final Map metadata; // --------------------------------------------------------------------------------------------- private ErrorCause(Builder builder) { - - this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); - - this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - this.reason = ApiTypeHelper.requireNonNull(builder.reason, this, "reason"); - this.stackTrace = builder.stackTrace; this.causedBy = builder.causedBy; + this.reason = builder.reason; this.rootCause = ApiTypeHelper.unmodifiable(builder.rootCause); + this.stackTrace = builder.stackTrace; this.suppressed = ApiTypeHelper.unmodifiable(builder.suppressed); - + this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); + this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); } - public static ErrorCause of(Function> fn) { + public static ErrorCause of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Additional details about the error + * API name: {@code caused_by} */ - public final Map metadata() { - return this.metadata; + @Nullable + public final ErrorCause causedBy() { + return this.causedBy; } /** - * Required - The type of error + * A human-readable explanation of the error, in english *

- * API name: {@code type} + * API name: {@code reason} + *

*/ - public final String type() { - return this.type; + @Nullable + public final String reason() { + return this.reason; } /** - * Required - A human-readable explanation of the error, in english - *

- * API name: {@code reason} + * API name: {@code root_cause} */ - public final String reason() { - return this.reason; + public final List rootCause() { + return this.rootCause; } /** - * The server stack trace. Present only if the error_trace=true - * parameter was sent with the request. + * The server stack trace. Present only if the `error_trace=true` parameter was sent with the request. *

* API name: {@code stack_trace} + *

*/ @Nullable public final String stackTrace() { @@ -130,30 +131,33 @@ public final String stackTrace() { } /** - * API name: {@code caused_by} + * API name: {@code suppressed} */ - @Nullable - public final ErrorCause causedBy() { - return this.causedBy; + public final List suppressed() { + return this.suppressed; } /** - * API name: {@code root_cause} + * Required - The type of error + *

+ * API name: {@code type} + *

*/ - public final List rootCause() { - return this.rootCause; + public final String type() { + return this.type; } /** - * API name: {@code suppressed} + * Additional details about the error */ - public final List suppressed() { - return this.suppressed; + public final Map metadata() { + return this.metadata; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -161,29 +165,24 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - for (Map.Entry item0 : this.metadata.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); } - generator.writeKey("type"); - generator.write(this.type); - - generator.writeKey("reason"); - generator.write(this.reason); - - if (this.stackTrace != null) { - generator.writeKey("stack_trace"); - generator.write(this.stackTrace); - - } if (this.causedBy != null) { generator.writeKey("caused_by"); this.causedBy.serialize(generator, mapper); } + + if (this.reason != null) { + generator.writeKey("reason"); + generator.write(this.reason); + + } + if (ApiTypeHelper.isDefined(this.rootCause)) { generator.writeKey("root_cause"); generator.writeStartArray(); @@ -194,6 +193,13 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } + + if (this.stackTrace != null) { + generator.writeKey("stack_trace"); + generator.write(this.stackTrace); + + } + if (ApiTypeHelper.isDefined(this.suppressed)) { generator.writeKey("suppressed"); generator.writeStartArray(); @@ -205,6 +211,9 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { } + generator.writeKey("type"); + generator.write(this.type); + } // --------------------------------------------------------------------------------------------- @@ -212,97 +221,53 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link ErrorCause}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private Map metadata = new HashMap<>(); - - /** - * Additional details about the error - *

- * Adds all entries of map to metadata. - */ - public final Builder metadata(Map map) { - this.metadata = _mapPutAll(this.metadata, map); - return this; - } - - /** - * Additional details about the error - *

- * Adds an entry to metadata. - */ - public final Builder metadata(String key, JsonData value) { - this.metadata = _mapPut(this.metadata, key, value); - return this; - } - - private String type; - - private String reason; - - @Nullable - private String stackTrace; - @Nullable private ErrorCause causedBy; - + @Nullable + private String reason; @Nullable private List rootCause; - + @Nullable + private String stackTrace; @Nullable private List suppressed; + private String type; + @Nullable + private Map metadata; /** - * Required - The type of error - *

- * API name: {@code type} + * API name: {@code caused_by} */ - public final Builder type(String value) { - this.type = value; + public final Builder causedBy(@Nullable ErrorCause value) { + this.causedBy = value; return this; } /** - * Required - A human-readable explanation of the error, in english - *

- * API name: {@code reason} + * API name: {@code caused_by} */ - public final Builder reason(String value) { - this.reason = value; - return this; + public final Builder causedBy(Function> fn) { + return causedBy(fn.apply(new ErrorCause.Builder()).build()); } /** - * The server stack trace. Present only if the error_trace=true - * parameter was sent with the request. + * A human-readable explanation of the error, in english *

- * API name: {@code stack_trace} - */ - public final Builder stackTrace(@Nullable String value) { - this.stackTrace = value; - return this; - } - - /** - * API name: {@code caused_by} + * API name: {@code reason} + *

*/ - public final Builder causedBy(@Nullable ErrorCause value) { - this.causedBy = value; + public final Builder reason(@Nullable String value) { + this.reason = value; return this; } - /** - * API name: {@code caused_by} - */ - public final Builder causedBy(Function> fn) { - return this.causedBy(fn.apply(new ErrorCause.Builder()).build()); - } - /** * API name: {@code root_cause} + * *

* Adds all elements of list to rootCause. + *

*/ public final Builder rootCause(List list) { this.rootCause = _listAddAll(this.rootCause, list); @@ -311,8 +276,10 @@ public final Builder rootCause(List list) { /** * API name: {@code root_cause} + * *

* Adds one or more values to rootCause. + *

*/ public final Builder rootCause(ErrorCause value, ErrorCause... values) { this.rootCause = _listAdd(this.rootCause, value, values); @@ -321,17 +288,32 @@ public final Builder rootCause(ErrorCause value, ErrorCause... values) { /** * API name: {@code root_cause} + * *

* Adds a value to rootCause using a builder lambda. + *

*/ public final Builder rootCause(Function> fn) { return rootCause(fn.apply(new ErrorCause.Builder()).build()); } + /** + * The server stack trace. Present only if the `error_trace=true` parameter was sent with the request. + *

+ * API name: {@code stack_trace} + *

+ */ + public final Builder stackTrace(@Nullable String value) { + this.stackTrace = value; + return this; + } + /** * API name: {@code suppressed} + * *

* Adds all elements of list to suppressed. + *

*/ public final Builder suppressed(List list) { this.suppressed = _listAddAll(this.suppressed, list); @@ -340,8 +322,10 @@ public final Builder suppressed(List list) { /** * API name: {@code suppressed} + * *

* Adds one or more values to suppressed. + *

*/ public final Builder suppressed(ErrorCause value, ErrorCause... values) { this.suppressed = _listAdd(this.suppressed, value, values); @@ -350,18 +334,46 @@ public final Builder suppressed(ErrorCause value, ErrorCause... values) { /** * API name: {@code suppressed} + * *

* Adds a value to suppressed using a builder lambda. + *

*/ public final Builder suppressed(Function> fn) { return suppressed(fn.apply(new ErrorCause.Builder()).build()); } + /** + * Required - The type of error + *

+ * API name: {@code type} + *

+ */ + public final Builder type(String value) { + this.type = value; + return this; + } + + /** + * Additional details about the error + */ + public final Builder metadata(Map map) { + this.metadata = _mapPutAll(this.metadata, map); + return this; + } + + /** + * Additional details about the error + */ + public final Builder metadata(String key, JsonData value) { + this.metadata = _mapPut(this.metadata, key, value); + return this; + } + /** * Builds a {@link ErrorCause}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public ErrorCause build() { _checkSingleUse(); @@ -369,7 +381,6 @@ public ErrorCause build() { return new ErrorCause(this); } } - // --------------------------------------------------------------------------------------------- /** @@ -381,21 +392,17 @@ public ErrorCause build() { ); protected static void setupErrorCauseDeserializer(ObjectDeserializer op) { - - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); - op.add(Builder::reason, JsonpDeserializer.stringDeserializer(), "reason"); - op.add(Builder::stackTrace, JsonpDeserializer.stringDeserializer(), "stack_trace"); op.add(Builder::causedBy, ErrorCause._DESERIALIZER, "caused_by"); + op.add(Builder::reason, JsonpDeserializer.stringDeserializer(), "reason"); op.add(Builder::rootCause, JsonpDeserializer.arrayDeserializer(ErrorCause._DESERIALIZER), "root_cause"); + op.add(Builder::stackTrace, JsonpDeserializer.stringDeserializer(), "stack_trace"); op.add(Builder::suppressed, JsonpDeserializer.arrayDeserializer(ErrorCause._DESERIALIZER), "suppressed"); - + op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); op.setUnknownFieldHandler((builder, name, parser, mapper) -> { if (builder.metadata == null) { builder.metadata = new HashMap<>(); } builder.metadata.put(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); }); - } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeStatistics.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java similarity index 89% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeStatistics.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java index 94f7e0ae83..12b40c0fe4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeStatistics.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/NodeStatistics.java @@ -30,11 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; import java.util.List; 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; @@ -49,69 +54,72 @@ // typedef: _types.NodeStatistics @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class NodeStatistics implements PlainJsonSerializable { - private final List failures; - private final int total; + private final int failed; + + private final List failures; private final int successful; - private final int failed; + private final int total; // --------------------------------------------------------------------------------------------- private NodeStatistics(Builder builder) { - + this.failed = ApiTypeHelper.requireNonNull(builder.failed, this, "failed"); this.failures = ApiTypeHelper.unmodifiable(builder.failures); - this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); this.successful = ApiTypeHelper.requireNonNull(builder.successful, this, "successful"); - this.failed = ApiTypeHelper.requireNonNull(builder.failed, this, "failed"); - + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); } - public static NodeStatistics of(Function> fn) { + public static NodeStatistics of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * API name: {@code failures} + * Required - Number of nodes that rejected the request or failed to respond. If this value is not 0, a reason for the rejection or + * failure is included in the response. + *

+ * API name: {@code failed} + *

*/ - public final List failures() { - return this.failures; + public final int failed() { + return this.failed; } /** - * Required - Total number of nodes selected by the request. - *

- * API name: {@code total} + * API name: {@code failures} */ - public final int total() { - return this.total; + public final List failures() { + return this.failures; } /** * Required - Number of nodes that responded successfully to the request. *

* API name: {@code successful} + *

*/ public final int successful() { return this.successful; } /** - * Required - Number of nodes that rejected the request or failed to respond. If - * this value is not 0, a reason for the rejection or failure is included in the - * response. + * Required - Total number of nodes selected by the request. *

- * API name: {@code failed} + * API name: {@code total} + *

*/ - public final int failed() { - return this.failed; + public final int total() { + return this.total; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -119,6 +127,8 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("failed"); + generator.write(this.failed); if (ApiTypeHelper.isDefined(this.failures)) { generator.writeKey("failures"); @@ -130,14 +140,12 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeEnd(); } - generator.writeKey("total"); - generator.write(this.total); generator.writeKey("successful"); generator.write(this.successful); - generator.writeKey("failed"); - generator.write(this.failed); + generator.writeKey("total"); + generator.write(this.total); } @@ -146,21 +154,31 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link NodeStatistics}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Integer failed; @Nullable private List failures; - - private Integer total; - private Integer successful; + private Integer total; - private Integer failed; + /** + * Required - Number of nodes that rejected the request or failed to respond. If this value is not 0, a reason for the rejection or + * failure is included in the response. + *

+ * API name: {@code failed} + *

+ */ + public final Builder failed(int value) { + this.failed = value; + return this; + } /** * API name: {@code failures} + * *

* Adds all elements of list to failures. + *

*/ public final Builder failures(List list) { this.failures = _listAddAll(this.failures, list); @@ -169,8 +187,10 @@ public final Builder failures(List list) { /** * API name: {@code failures} + * *

* Adds one or more values to failures. + *

*/ public final Builder failures(ErrorCause value, ErrorCause... values) { this.failures = _listAdd(this.failures, value, values); @@ -179,27 +199,20 @@ public final Builder failures(ErrorCause value, ErrorCause... values) { /** * API name: {@code failures} + * *

* Adds a value to failures using a builder lambda. + *

*/ public final Builder failures(Function> fn) { return failures(fn.apply(new ErrorCause.Builder()).build()); } - /** - * Required - Total number of nodes selected by the request. - *

- * API name: {@code total} - */ - public final Builder total(int value) { - this.total = value; - return this; - } - /** * Required - Number of nodes that responded successfully to the request. *

* API name: {@code successful} + *

*/ public final Builder successful(int value) { this.successful = value; @@ -207,22 +220,20 @@ public final Builder successful(int value) { } /** - * Required - Number of nodes that rejected the request or failed to respond. If - * this value is not 0, a reason for the rejection or failure is included in the - * response. + * Required - Total number of nodes selected by the request. *

- * API name: {@code failed} + * API name: {@code total} + *

*/ - public final Builder failed(int value) { - this.failed = value; + public final Builder total(int value) { + this.total = value; return this; } /** * Builds a {@link NodeStatistics}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public NodeStatistics build() { _checkSingleUse(); @@ -230,7 +241,6 @@ public NodeStatistics build() { return new NodeStatistics(this); } } - // --------------------------------------------------------------------------------------------- /** @@ -242,12 +252,9 @@ public NodeStatistics build() { ); protected static void setupNodeStatisticsDeserializer(ObjectDeserializer op) { - + op.add(Builder::failed, JsonpDeserializer.integerDeserializer(), "failed"); op.add(Builder::failures, JsonpDeserializer.arrayDeserializer(ErrorCause._DESERIALIZER), "failures"); - op.add(Builder::total, JsonpDeserializer.integerDeserializer(), "total"); op.add(Builder::successful, JsonpDeserializer.integerDeserializer(), "successful"); - op.add(Builder::failed, JsonpDeserializer.integerDeserializer(), "failed"); - + op.add(Builder::total, JsonpDeserializer.integerDeserializer(), "total"); } - } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java index 2de1706223..fe6603175b 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java @@ -43,9 +43,9 @@ import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.JsonpSerializable; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; @@ -54,7 +54,7 @@ @JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") -public class OpenSearchVersionInfo implements JsonpSerializable { +public class OpenSearchVersionInfo implements PlainJsonSerializable { private final String buildDate; diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java index a8afc4e71d..08293ca62a 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/core/InfoResponse.java @@ -42,9 +42,9 @@ import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.JsonpSerializable; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.OpenSearchVersionInfo; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; @@ -54,7 +54,7 @@ @JsonpDeserializable @Generated("org.opensearch.client.codegen.CodeGenerator") -public class InfoResponse implements JsonpSerializable { +public class InfoResponse implements PlainJsonSerializable { private final String clusterName; @@ -199,7 +199,7 @@ public final Builder version(OpenSearchVersionInfo value) { * Required - API name: {@code version} */ public final Builder version(Function> fn) { - return this.version(fn.apply(new OpenSearchVersionInfo.Builder()).build()); + return version(fn.apply(new OpenSearchVersionInfo.Builder()).build()); } /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexRequest.java similarity index 84% rename from java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexRequest.java index 6a17b033b8..4f6ea2ac3c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexRequest.java @@ -30,11 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.dangling_indices; import java.util.HashMap; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; @@ -48,38 +53,38 @@ // typedef: dangling_indices.delete_dangling_index.Request /** - * Deletes the specified dangling index - * + * Deletes the specified dangling index. */ - +@Generated("org.opensearch.client.codegen.CodeGenerator") public class DeleteDanglingIndexRequest extends RequestBase { + private final boolean acceptDataLoss; + @Nullable + private final Time clusterManagerTimeout; + private final String indexUuid; @Deprecated @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - @Nullable private final Time timeout; // --------------------------------------------------------------------------------------------- private DeleteDanglingIndexRequest(Builder builder) { - this.acceptDataLoss = ApiTypeHelper.requireNonNull(builder.acceptDataLoss, this, "acceptDataLoss"); + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.indexUuid = ApiTypeHelper.requireNonNull(builder.indexUuid, this, "indexUuid"); this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.timeout = builder.timeout; - } - public static DeleteDanglingIndexRequest of(Function> fn) { + public static DeleteDanglingIndexRequest of( + Function> fn + ) { return fn.apply(new Builder()).build(); } @@ -87,15 +92,28 @@ public static DeleteDanglingIndexRequest of(Function * API name: {@code accept_data_loss} + *

*/ public final boolean acceptDataLoss() { return this.acceptDataLoss; } + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + /** * Required - The UUID of the dangling index *

* API name: {@code index_uuid} + *

*/ public final String indexUuid() { return this.indexUuid; @@ -105,26 +123,19 @@ public final String indexUuid() { * Specify timeout for connection to master *

* API name: {@code master_timeout} + *

*/ + @Deprecated @Nullable public final Time masterTimeout() { return this.masterTimeout; } - /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } - /** * Explicit operation timeout *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -136,19 +147,13 @@ public final Time timeout() { /** * Builder for {@link DeleteDanglingIndexRequest}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Boolean acceptDataLoss; - + @Nullable + private Time clusterManagerTimeout; private String indexUuid; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - @Nullable private Time timeout; @@ -156,16 +161,39 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder * API name: {@code accept_data_loss} + *

*/ public final Builder acceptDataLoss(boolean value) { this.acceptDataLoss = value; return this; } + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; + return this; + } + + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + /** * Required - The UUID of the dangling index *

* API name: {@code index_uuid} + *

*/ public final Builder indexUuid(String value) { this.indexUuid = value; @@ -176,6 +204,7 @@ public final Builder indexUuid(String value) { * Specify timeout for connection to master *

* API name: {@code master_timeout} + *

*/ @Deprecated public final Builder masterTimeout(@Nullable Time value) { @@ -187,35 +216,18 @@ public final Builder masterTimeout(@Nullable Time value) { * Specify timeout for connection to master *

* API name: {@code master_timeout} + *

*/ @Deprecated public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; - return this; - } - - /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** * Explicit operation timeout *

* API name: {@code timeout} + *

*/ public final Builder timeout(@Nullable Time value) { this.timeout = value; @@ -226,16 +238,16 @@ public final Builder timeout(@Nullable Time value) { * Explicit operation timeout *

* API name: {@code timeout} + *

*/ public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** * Builds a {@link DeleteDanglingIndexRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public DeleteDanglingIndexRequest build() { _checkSingleUse(); @@ -250,47 +262,29 @@ public DeleteDanglingIndexRequest build() { * Endpoint "{@code dangling_indices.delete_dangling_index}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "DELETE"; - - }, - + request -> "DELETE", // Request path request -> { - final int _indexUuid = 1 << 0; - - int propsSet = 0; - - propsSet |= _indexUuid; - - if (propsSet == (_indexUuid)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_dangling"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.indexUuid, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/_dangling/"); + SimpleEndpoint.pathEncode(request.indexUuid, buf); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } + params.put("accept_data_loss", String.valueOf(request.acceptDataLoss)); if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } - params.put("accept_data_loss", String.valueOf(request.acceptDataLoss)); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } if (request.timeout != null) { params.put("timeout", request.timeout._toJsonString()); } return params; - }, SimpleEndpoint.emptyMap(), false, diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexResponse.java similarity index 86% rename from java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexResponse.java index f2e55aa97b..72f04f6cb1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexResponse.java @@ -30,9 +30,14 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.dangling_indices; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; @@ -43,15 +48,18 @@ // typedef: dangling_indices.delete_dangling_index.Response @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class DeleteDanglingIndexResponse extends AcknowledgedResponseBase { + // --------------------------------------------------------------------------------------------- private DeleteDanglingIndexResponse(Builder builder) { super(builder); - } - public static DeleteDanglingIndexResponse of(Function> fn) { + public static DeleteDanglingIndexResponse of( + Function> fn + ) { return fn.apply(new Builder()).build(); } @@ -60,7 +68,6 @@ public static DeleteDanglingIndexResponse of(Function implements ObjectBuilder { @@ -72,8 +79,7 @@ protected Builder self() { /** * Builds a {@link DeleteDanglingIndexResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public DeleteDanglingIndexResponse build() { _checkSingleUse(); @@ -81,7 +87,6 @@ public DeleteDanglingIndexResponse build() { return new DeleteDanglingIndexResponse(this); } } - // --------------------------------------------------------------------------------------------- /** @@ -94,7 +99,5 @@ public DeleteDanglingIndexResponse build() { protected static void setupDeleteDanglingIndexResponseDeserializer(ObjectDeserializer op) { AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java similarity index 84% rename from java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java index e0635576b9..4b1440b7eb 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java @@ -30,11 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.dangling_indices; import java.util.HashMap; import java.util.Map; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; @@ -48,38 +53,38 @@ // typedef: dangling_indices.import_dangling_index.Request /** - * Imports the specified dangling index - * + * Imports the specified dangling index. */ - +@Generated("org.opensearch.client.codegen.CodeGenerator") public class ImportDanglingIndexRequest extends RequestBase { + private final boolean acceptDataLoss; + @Nullable + private final Time clusterManagerTimeout; + private final String indexUuid; @Deprecated @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - @Nullable private final Time timeout; // --------------------------------------------------------------------------------------------- private ImportDanglingIndexRequest(Builder builder) { - this.acceptDataLoss = ApiTypeHelper.requireNonNull(builder.acceptDataLoss, this, "acceptDataLoss"); + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.indexUuid = ApiTypeHelper.requireNonNull(builder.indexUuid, this, "indexUuid"); this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.timeout = builder.timeout; - } - public static ImportDanglingIndexRequest of(Function> fn) { + public static ImportDanglingIndexRequest of( + Function> fn + ) { return fn.apply(new Builder()).build(); } @@ -87,15 +92,28 @@ public static ImportDanglingIndexRequest of(Function * API name: {@code accept_data_loss} + *

*/ public final boolean acceptDataLoss() { return this.acceptDataLoss; } + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + /** * Required - The UUID of the dangling index *

* API name: {@code index_uuid} + *

*/ public final String indexUuid() { return this.indexUuid; @@ -105,6 +123,7 @@ public final String indexUuid() { * Specify timeout for connection to master *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -112,20 +131,11 @@ public final Time masterTimeout() { return this.masterTimeout; } - /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } - /** * Explicit operation timeout *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -137,19 +147,13 @@ public final Time timeout() { /** * Builder for {@link ImportDanglingIndexRequest}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { private Boolean acceptDataLoss; - + @Nullable + private Time clusterManagerTimeout; private String indexUuid; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - @Nullable private Time timeout; @@ -157,16 +161,39 @@ public static class Builder extends ObjectBuilderBase implements ObjectBuilder * API name: {@code accept_data_loss} + *

*/ public final Builder acceptDataLoss(boolean value) { this.acceptDataLoss = value; return this; } + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; + return this; + } + + /** + * Operation timeout for connection to cluster-manager node. + *

+ * API name: {@code cluster_manager_timeout} + *

+ */ + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + /** * Required - The UUID of the dangling index *

* API name: {@code index_uuid} + *

*/ public final Builder indexUuid(String value) { this.indexUuid = value; @@ -177,6 +204,7 @@ public final Builder indexUuid(String value) { * Specify timeout for connection to master *

* API name: {@code master_timeout} + *

*/ @Deprecated public final Builder masterTimeout(@Nullable Time value) { @@ -188,35 +216,18 @@ public final Builder masterTimeout(@Nullable Time value) { * Specify timeout for connection to master *

* API name: {@code master_timeout} + *

*/ @Deprecated public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; - return this; - } - - /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** * Explicit operation timeout *

* API name: {@code timeout} + *

*/ public final Builder timeout(@Nullable Time value) { this.timeout = value; @@ -227,16 +238,16 @@ public final Builder timeout(@Nullable Time value) { * Explicit operation timeout *

* API name: {@code timeout} + *

*/ public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** * Builds a {@link ImportDanglingIndexRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public ImportDanglingIndexRequest build() { _checkSingleUse(); @@ -251,47 +262,29 @@ public ImportDanglingIndexRequest build() { * Endpoint "{@code dangling_indices.import_dangling_index}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "POST"; - - }, - + request -> "POST", // Request path request -> { - final int _indexUuid = 1 << 0; - - int propsSet = 0; - - propsSet |= _indexUuid; - - if (propsSet == (_indexUuid)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_dangling"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.indexUuid, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/_dangling/"); + SimpleEndpoint.pathEncode(request.indexUuid, buf); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } + params.put("accept_data_loss", String.valueOf(request.acceptDataLoss)); if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } - params.put("accept_data_loss", String.valueOf(request.acceptDataLoss)); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } if (request.timeout != null) { params.put("timeout", request.timeout._toJsonString()); } return params; - }, SimpleEndpoint.emptyMap(), false, diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java similarity index 86% rename from java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java index 413913a404..90b180798e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexResponse.java @@ -30,9 +30,14 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.dangling_indices; import java.util.function.Function; +import javax.annotation.Generated; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; @@ -43,15 +48,18 @@ // typedef: dangling_indices.import_dangling_index.Response @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class ImportDanglingIndexResponse extends AcknowledgedResponseBase { + // --------------------------------------------------------------------------------------------- private ImportDanglingIndexResponse(Builder builder) { super(builder); - } - public static ImportDanglingIndexResponse of(Function> fn) { + public static ImportDanglingIndexResponse of( + Function> fn + ) { return fn.apply(new Builder()).build(); } @@ -60,7 +68,6 @@ public static ImportDanglingIndexResponse of(Function implements ObjectBuilder { @@ -72,8 +79,7 @@ protected Builder self() { /** * Builds a {@link ImportDanglingIndexResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public ImportDanglingIndexResponse build() { _checkSingleUse(); @@ -81,7 +87,6 @@ public ImportDanglingIndexResponse build() { return new ImportDanglingIndexResponse(this); } } - // --------------------------------------------------------------------------------------------- /** @@ -94,7 +99,5 @@ public ImportDanglingIndexResponse build() { protected static void setupImportDanglingIndexResponseDeserializer(ObjectDeserializer op) { AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); - } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesRequest.java similarity index 86% rename from java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesRequest.java index 5e7f0b48c2..641bb9b012 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesRequest.java @@ -30,9 +30,13 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.dangling_indices; -import java.util.Collections; +import javax.annotation.Generated; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.transport.Endpoint; @@ -42,9 +46,8 @@ /** * Returns all dangling indices. - * */ - +@Generated("org.opensearch.client.codegen.CodeGenerator") public class ListDanglingIndicesRequest extends RequestBase { public ListDanglingIndicesRequest() {} @@ -59,24 +62,12 @@ public ListDanglingIndicesRequest() {} * Endpoint "{@code dangling_indices.list_dangling_indices}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "GET"; - - }, - + request -> "GET", // Request path - request -> { - return "/_dangling"; - - }, - + request -> "/_dangling", // Request parameters - request -> { - return Collections.emptyMap(); - - }, + SimpleEndpoint.emptyMap(), SimpleEndpoint.emptyMap(), false, ListDanglingIndicesResponse._DESERIALIZER diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java similarity index 67% rename from java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java index 31d1171432..1c26867fa5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesResponse.java @@ -30,17 +30,24 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.dangling_indices; import jakarta.json.stream.JsonGenerator; import java.util.List; 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.opensearch._types.NodeStatistics; import org.opensearch.client.opensearch.dangling_indices.list_dangling_indices.DanglingIndex; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; @@ -49,21 +56,39 @@ // typedef: dangling_indices.list_dangling_indices.Response @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class ListDanglingIndicesResponse implements PlainJsonSerializable { + + @Nullable + private final String clusterName; + private final List danglingIndices; + @Nullable + private final NodeStatistics nodes; + // --------------------------------------------------------------------------------------------- private ListDanglingIndicesResponse(Builder builder) { - + this.clusterName = builder.clusterName; this.danglingIndices = ApiTypeHelper.unmodifiableRequired(builder.danglingIndices, this, "danglingIndices"); - + this.nodes = builder.nodes; } - public static ListDanglingIndicesResponse of(Function> fn) { + public static ListDanglingIndicesResponse of( + Function> fn + ) { return fn.apply(new Builder()).build(); } + /** + * API name: {@code cluster_name} + */ + @Nullable + public final String clusterName() { + return this.clusterName; + } + /** * Required - API name: {@code dangling_indices} */ @@ -71,9 +96,18 @@ public final List danglingIndices() { return this.danglingIndices; } + /** + * API name: {@code _nodes} + */ + @Nullable + public final NodeStatistics nodes() { + return this.nodes; + } + /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -81,15 +115,23 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.clusterName != null) { + generator.writeKey("cluster_name"); + generator.write(this.clusterName); + + } - if (ApiTypeHelper.isDefined(this.danglingIndices)) { - generator.writeKey("dangling_indices"); - generator.writeStartArray(); - for (DanglingIndex item0 : this.danglingIndices) { - item0.serialize(generator, mapper); + generator.writeKey("dangling_indices"); + generator.writeStartArray(); + for (DanglingIndex item0 : this.danglingIndices) { + item0.serialize(generator, mapper); - } - generator.writeEnd(); + } + generator.writeEnd(); + + if (this.nodes != null) { + generator.writeKey("_nodes"); + this.nodes.serialize(generator, mapper); } @@ -100,14 +142,27 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link ListDanglingIndicesResponse}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String clusterName; private List danglingIndices; + @Nullable + private NodeStatistics nodes; + + /** + * API name: {@code cluster_name} + */ + public final Builder clusterName(@Nullable String value) { + this.clusterName = value; + return this; + } /** * Required - API name: {@code dangling_indices} + * *

* Adds all elements of list to danglingIndices. + *

*/ public final Builder danglingIndices(List list) { this.danglingIndices = _listAddAll(this.danglingIndices, list); @@ -116,8 +171,10 @@ public final Builder danglingIndices(List list) { /** * Required - API name: {@code dangling_indices} + * *

* Adds one or more values to danglingIndices. + *

*/ public final Builder danglingIndices(DanglingIndex value, DanglingIndex... values) { this.danglingIndices = _listAdd(this.danglingIndices, value, values); @@ -126,18 +183,34 @@ public final Builder danglingIndices(DanglingIndex value, DanglingIndex... value /** * Required - API name: {@code dangling_indices} + * *

* Adds a value to danglingIndices using a builder lambda. + *

*/ public final Builder danglingIndices(Function> fn) { return danglingIndices(fn.apply(new DanglingIndex.Builder()).build()); } + /** + * API name: {@code _nodes} + */ + public final Builder nodes(@Nullable NodeStatistics value) { + this.nodes = value; + return this; + } + + /** + * API name: {@code _nodes} + */ + public final Builder nodes(Function> fn) { + return nodes(fn.apply(new NodeStatistics.Builder()).build()); + } + /** * Builds a {@link ListDanglingIndicesResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public ListDanglingIndicesResponse build() { _checkSingleUse(); @@ -145,7 +218,6 @@ public ListDanglingIndicesResponse build() { return new ListDanglingIndicesResponse(this); } } - // --------------------------------------------------------------------------------------------- /** @@ -157,9 +229,8 @@ public ListDanglingIndicesResponse build() { ); protected static void setupListDanglingIndicesResponseDeserializer(ObjectDeserializer op) { - + op.add(Builder::clusterName, JsonpDeserializer.stringDeserializer(), "cluster_name"); op.add(Builder::danglingIndices, JsonpDeserializer.arrayDeserializer(DanglingIndex._DESERIALIZER), "dangling_indices"); - + op.add(Builder::nodes, NodeStatistics._DESERIALIZER, "_nodes"); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/OpenSearchDanglingIndicesAsyncClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/OpenSearchDanglingIndicesAsyncClient.java similarity index 88% rename from java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/OpenSearchDanglingIndicesAsyncClient.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/OpenSearchDanglingIndicesAsyncClient.java index 402839470c..dc7158198f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/OpenSearchDanglingIndicesAsyncClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/OpenSearchDanglingIndicesAsyncClient.java @@ -30,11 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.dangling_indices; import java.io.IOException; import java.util.concurrent.CompletableFuture; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.ApiClient; import org.opensearch.client.opensearch._types.ErrorResponse; @@ -47,8 +52,8 @@ /** * Client for the dangling_indices namespace. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") public class OpenSearchDanglingIndicesAsyncClient extends ApiClient { - public OpenSearchDanglingIndicesAsyncClient(OpenSearchTransport transport) { super(transport, null); } @@ -65,10 +70,8 @@ public OpenSearchDanglingIndicesAsyncClient withTransportOptions(@Nullable Trans // ----- Endpoint: dangling_indices.delete_dangling_index /** - * Deletes the specified dangling index - * + * Deletes the specified dangling index. */ - public CompletableFuture deleteDanglingIndex(DeleteDanglingIndexRequest request) throws IOException, OpenSearchException { @SuppressWarnings("unchecked") @@ -81,14 +84,10 @@ public CompletableFuture deleteDanglingIndex(Delete } /** - * Deletes the specified dangling index - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteDanglingIndexRequest} + * Deletes the specified dangling index. * + * @param fn a function that initializes a builder to create the {@link DeleteDanglingIndexRequest} */ - public final CompletableFuture deleteDanglingIndex( Function> fn ) throws IOException, OpenSearchException { @@ -98,11 +97,8 @@ public final CompletableFuture deleteDanglingIndex( // ----- Endpoint: dangling_indices.import_dangling_index /** - * Imports the specified dangling index - * - * + * Imports the specified dangling index. */ - public CompletableFuture importDanglingIndex(ImportDanglingIndexRequest request) throws IOException, OpenSearchException { @SuppressWarnings("unchecked") @@ -115,14 +111,10 @@ public CompletableFuture importDanglingIndex(Import } /** - * Imports the specified dangling index - * - * @param fn - * a function that initializes a builder to create the - * {@link ImportDanglingIndexRequest} + * Imports the specified dangling index. * + * @param fn a function that initializes a builder to create the {@link ImportDanglingIndexRequest} */ - public final CompletableFuture importDanglingIndex( Function> fn ) throws IOException, OpenSearchException { @@ -133,8 +125,6 @@ public final CompletableFuture importDanglingIndex( /** * Returns all dangling indices. - * - * */ public CompletableFuture listDanglingIndices() throws IOException, OpenSearchException { return this.transport.performRequestAsync( @@ -143,5 +133,4 @@ public CompletableFuture listDanglingIndices() thro this.transportOptions ); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/OpenSearchDanglingIndicesClient.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/OpenSearchDanglingIndicesClient.java similarity index 87% rename from java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/OpenSearchDanglingIndicesClient.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/OpenSearchDanglingIndicesClient.java index 5c9e4985db..c4ebd9da0e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/OpenSearchDanglingIndicesClient.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/OpenSearchDanglingIndicesClient.java @@ -30,10 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.dangling_indices; import java.io.IOException; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.ApiClient; import org.opensearch.client.opensearch._types.ErrorResponse; @@ -46,8 +51,8 @@ /** * Client for the dangling_indices namespace. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") public class OpenSearchDanglingIndicesClient extends ApiClient { - public OpenSearchDanglingIndicesClient(OpenSearchTransport transport) { super(transport, null); } @@ -64,11 +69,8 @@ public OpenSearchDanglingIndicesClient withTransportOptions(@Nullable TransportO // ----- Endpoint: dangling_indices.delete_dangling_index /** - * Deletes the specified dangling index - * - * + * Deletes the specified dangling index. */ - public DeleteDanglingIndexResponse deleteDanglingIndex(DeleteDanglingIndexRequest request) throws IOException, OpenSearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint< @@ -80,14 +82,10 @@ public DeleteDanglingIndexResponse deleteDanglingIndex(DeleteDanglingIndexReques } /** - * Deletes the specified dangling index - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteDanglingIndexRequest} + * Deletes the specified dangling index. * + * @param fn a function that initializes a builder to create the {@link DeleteDanglingIndexRequest} */ - public final DeleteDanglingIndexResponse deleteDanglingIndex( Function> fn ) throws IOException, OpenSearchException { @@ -97,11 +95,8 @@ public final DeleteDanglingIndexResponse deleteDanglingIndex( // ----- Endpoint: dangling_indices.import_dangling_index /** - * Imports the specified dangling index - * - * + * Imports the specified dangling index. */ - public ImportDanglingIndexResponse importDanglingIndex(ImportDanglingIndexRequest request) throws IOException, OpenSearchException { @SuppressWarnings("unchecked") JsonEndpoint endpoint = (JsonEndpoint< @@ -113,14 +108,10 @@ public ImportDanglingIndexResponse importDanglingIndex(ImportDanglingIndexReques } /** - * Imports the specified dangling index - * - * @param fn - * a function that initializes a builder to create the - * {@link ImportDanglingIndexRequest} + * Imports the specified dangling index. * + * @param fn a function that initializes a builder to create the {@link ImportDanglingIndexRequest} */ - public final ImportDanglingIndexResponse importDanglingIndex( Function> fn ) throws IOException, OpenSearchException { @@ -131,8 +122,6 @@ public final ImportDanglingIndexResponse importDanglingIndex( /** * Returns all dangling indices. - * - * */ public ListDanglingIndicesResponse listDanglingIndices() throws IOException, OpenSearchException { return this.transport.performRequest( @@ -141,5 +130,4 @@ public ListDanglingIndicesResponse listDanglingIndices() throws IOException, Ope this.transportOptions ); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java similarity index 78% rename from java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java index b893eb9946..822758ab0f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/dangling_indices/list_dangling_indices/DanglingIndex.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.dangling_indices.list_dangling_indices; import jakarta.json.stream.JsonGenerator; import java.util.List; 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; @@ -48,30 +54,49 @@ // typedef: dangling_indices.list_dangling_indices.DanglingIndex @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class DanglingIndex implements PlainJsonSerializable { + + @Nullable + private final String creationDate; + + private final long creationDateMillis; + private final String indexName; private final String indexUuid; - private final String creationDateMillis; - private final List nodeIds; // --------------------------------------------------------------------------------------------- private DanglingIndex(Builder builder) { - + this.creationDate = builder.creationDate; + this.creationDateMillis = ApiTypeHelper.requireNonNull(builder.creationDateMillis, this, "creationDateMillis"); this.indexName = ApiTypeHelper.requireNonNull(builder.indexName, this, "indexName"); this.indexUuid = ApiTypeHelper.requireNonNull(builder.indexUuid, this, "indexUuid"); - this.creationDateMillis = ApiTypeHelper.requireNonNull(builder.creationDateMillis, this, "creationDateMillis"); this.nodeIds = ApiTypeHelper.unmodifiableRequired(builder.nodeIds, this, "nodeIds"); - } - public static DanglingIndex of(Function> fn) { + public static DanglingIndex of(Function> fn) { return fn.apply(new Builder()).build(); } + /** + * API name: {@code creation_date} + */ + @Nullable + public final String creationDate() { + return this.creationDate; + } + + /** + * Required - API name: {@code creation_date_millis} + */ + public final long creationDateMillis() { + return this.creationDateMillis; + } + /** * Required - API name: {@code index_name} */ @@ -86,13 +111,6 @@ public final String indexUuid() { return this.indexUuid; } - /** - * Required - API name: {@code creation_date_millis} - */ - public final String creationDateMillis() { - return this.creationDateMillis; - } - /** * Required - API name: {@code node_ids} */ @@ -103,6 +121,7 @@ public final List nodeIds() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -110,6 +129,14 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (this.creationDate != null) { + generator.writeKey("creation_date"); + generator.write(this.creationDate); + + } + + generator.writeKey("creation_date_millis"); + generator.write(this.creationDateMillis); generator.writeKey("index_name"); generator.write(this.indexName); @@ -117,19 +144,13 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { generator.writeKey("index_uuid"); generator.write(this.indexUuid); - generator.writeKey("creation_date_millis"); - generator.write(this.creationDateMillis); - - if (ApiTypeHelper.isDefined(this.nodeIds)) { - generator.writeKey("node_ids"); - generator.writeStartArray(); - for (String item0 : this.nodeIds) { - generator.write(item0); - - } - generator.writeEnd(); + generator.writeKey("node_ids"); + generator.writeStartArray(); + for (String item0 : this.nodeIds) { + generator.write(item0); } + generator.writeEnd(); } @@ -138,15 +159,29 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { /** * Builder for {@link DanglingIndex}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String creationDate; + private Long creationDateMillis; private String indexName; - private String indexUuid; + private List nodeIds; - private String creationDateMillis; + /** + * API name: {@code creation_date} + */ + public final Builder creationDate(@Nullable String value) { + this.creationDate = value; + return this; + } - private List nodeIds; + /** + * Required - API name: {@code creation_date_millis} + */ + public final Builder creationDateMillis(long value) { + this.creationDateMillis = value; + return this; + } /** * Required - API name: {@code index_name} @@ -164,18 +199,12 @@ public final Builder indexUuid(String value) { return this; } - /** - * Required - API name: {@code creation_date_millis} - */ - public final Builder creationDateMillis(String value) { - this.creationDateMillis = value; - return this; - } - /** * Required - API name: {@code node_ids} + * *

* Adds all elements of list to nodeIds. + *

*/ public final Builder nodeIds(List list) { this.nodeIds = _listAddAll(this.nodeIds, list); @@ -184,8 +213,10 @@ public final Builder nodeIds(List list) { /** * Required - API name: {@code node_ids} + * *

* Adds one or more values to nodeIds. + *

*/ public final Builder nodeIds(String value, String... values) { this.nodeIds = _listAdd(this.nodeIds, value, values); @@ -195,8 +226,7 @@ public final Builder nodeIds(String value, String... values) { /** * Builds a {@link DanglingIndex}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public DanglingIndex build() { _checkSingleUse(); @@ -204,7 +234,6 @@ public DanglingIndex build() { return new DanglingIndex(this); } } - // --------------------------------------------------------------------------------------------- /** @@ -216,12 +245,10 @@ public DanglingIndex build() { ); protected static void setupDanglingIndexDeserializer(ObjectDeserializer op) { - + op.add(Builder::creationDate, JsonpDeserializer.stringDeserializer(), "creation_date"); + op.add(Builder::creationDateMillis, JsonpDeserializer.longDeserializer(), "creation_date_millis"); op.add(Builder::indexName, JsonpDeserializer.stringDeserializer(), "index_name"); op.add(Builder::indexUuid, JsonpDeserializer.stringDeserializer(), "index_uuid"); - op.add(Builder::creationDateMillis, JsonpDeserializer.stringDeserializer(), "creation_date_millis"); op.add(Builder::nodeIds, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "node_ids"); - } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java index 8250942fd3..3326baa189 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchAsyncClientBase.java @@ -120,7 +120,6 @@ import org.opensearch.client.opensearch.core.pit.DeletePitResponse; import org.opensearch.client.opensearch.core.pit.ListAllPitRequest; import org.opensearch.client.opensearch.core.pit.ListAllPitResponse; -import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesAsyncClient; import org.opensearch.client.opensearch.features.OpenSearchFeaturesAsyncClient; import org.opensearch.client.opensearch.indices.OpenSearchIndicesAsyncClient; import org.opensearch.client.opensearch.ingest.OpenSearchIngestAsyncClient; @@ -154,10 +153,6 @@ public OpenSearchClusterAsyncClient cluster() { return new OpenSearchClusterAsyncClient(this.transport, this.transportOptions); } - public OpenSearchDanglingIndicesAsyncClient danglingIndices() { - return new OpenSearchDanglingIndicesAsyncClient(this.transport, this.transportOptions); - } - public OpenSearchFeaturesAsyncClient features() { return new OpenSearchFeaturesAsyncClient(this.transport, this.transportOptions); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClientBase.java b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClientBase.java index d4b2d661cd..3c361c66fc 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClientBase.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/OpenSearchClientBase.java @@ -119,7 +119,6 @@ import org.opensearch.client.opensearch.core.pit.DeletePitResponse; import org.opensearch.client.opensearch.core.pit.ListAllPitRequest; import org.opensearch.client.opensearch.core.pit.ListAllPitResponse; -import org.opensearch.client.opensearch.dangling_indices.OpenSearchDanglingIndicesClient; import org.opensearch.client.opensearch.features.OpenSearchFeaturesClient; import org.opensearch.client.opensearch.generic.OpenSearchGenericClient; import org.opensearch.client.opensearch.indices.OpenSearchIndicesClient; @@ -157,10 +156,6 @@ public OpenSearchClusterClient cluster() { return new OpenSearchClusterClient(this.transport, this.transportOptions); } - public OpenSearchDanglingIndicesClient danglingIndices() { - return new OpenSearchDanglingIndicesClient(this.transport, this.transportOptions); - } - public OpenSearchFeaturesClient features() { return new OpenSearchFeaturesClient(this.transport, this.transportOptions); } diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/json/PlainJsonSerializableTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/json/PlainJsonSerializableTest.java index 2f504c48fc..c0af29e51b 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/json/PlainJsonSerializableTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/json/PlainJsonSerializableTest.java @@ -23,7 +23,7 @@ public class PlainJsonSerializableTest extends Assert { public void testIndexResponse() { String expectedStringValue = - "{\"_id\":\"id\",\"_index\":\"index\",\"_primary_term\":1,\"result\":\"created\",\"_seq_no\":2,\"_shards\":{\"failed\":1.0,\"successful\":1.0,\"total\":3.0,\"failures\":[{\"index\":\"index\",\"node\":\"node\",\"reason\":{\"type\":\"query_shard_exception\",\"reason\":\"Failed to create query.\"},\"shard\":1,\"status\":\"Failed\"}],\"skipped\":1.0},\"_version\":3}"; + "{\"_id\":\"id\",\"_index\":\"index\",\"_primary_term\":1,\"result\":\"created\",\"_seq_no\":2,\"_shards\":{\"failed\":1.0,\"successful\":1.0,\"total\":3.0,\"failures\":[{\"index\":\"index\",\"node\":\"node\",\"reason\":{\"reason\":\"Failed to create query.\",\"type\":\"query_shard_exception\"},\"shard\":1,\"status\":\"Failed\"}],\"skipped\":1.0},\"_version\":3}"; IndexResponse indexResponse = IndexResponse.of( response -> response.result(Result.Created) .index("index") diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/model/BehaviorsTest.java b/java-client/src/test/java/org/opensearch/client/opensearch/model/BehaviorsTest.java index cd10c73915..d79f2156af 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/model/BehaviorsTest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/model/BehaviorsTest.java @@ -147,7 +147,7 @@ public void testAdditionalProperties() { .metadata(MapBuilder.of("index", JsonData.of("test"), "retries", JsonData.of(1))) .build(); - err = checkJsonRoundtrip(err, "{\"index\":\"test\",\"retries\":1,\"type\":\"Some type\",\"reason\":\"Some failure\"}"); + err = checkJsonRoundtrip(err, "{\"index\":\"test\",\"retries\":1,\"reason\":\"Some failure\",\"type\":\"Some type\"}"); assertEquals("Some failure", err.reason()); assertEquals(1, err.metadata().get("retries").to(int.class).intValue()); diff --git a/java-codegen/opensearch-openapi.yaml b/java-codegen/opensearch-openapi.yaml index 43c7dd003c..fb5695388c 100644 --- a/java-codegen/opensearch-openapi.yaml +++ b/java-codegen/opensearch-openapi.yaml @@ -64,7 +64,7 @@ paths: x-version-added: '1.0' description: Creates or updates an alias. externalDocs: - url: https://opensearch.org/docs/latest/im-plugin/index-alias/#create-aliases + url: https://opensearch.org/docs/latest/api-reference/index-apis/update-alias/ parameters: - $ref: '#/components/parameters/indices.put_alias::query.cluster_manager_timeout' - $ref: '#/components/parameters/indices.put_alias::query.master_timeout' @@ -128,7 +128,7 @@ paths: x-version-added: '1.0' description: Creates or updates an alias. externalDocs: - url: https://opensearch.org/docs/latest/im-plugin/index-alias/#create-aliases + url: https://opensearch.org/docs/latest/api-reference/index-apis/update-alias/ parameters: - $ref: '#/components/parameters/indices.put_alias::path.name' - $ref: '#/components/parameters/indices.put_alias::query.cluster_manager_timeout' @@ -150,7 +150,7 @@ paths: x-version-added: '1.0' description: Creates or updates an alias. externalDocs: - url: https://opensearch.org/docs/latest/im-plugin/index-alias/#create-aliases + url: https://opensearch.org/docs/latest/api-reference/index-apis/update-alias/ parameters: - $ref: '#/components/parameters/indices.put_alias::path.name' - $ref: '#/components/parameters/indices.put_alias::query.cluster_manager_timeout' @@ -173,7 +173,7 @@ paths: x-version-added: '1.0' description: Updates index aliases. externalDocs: - url: https://opensearch.org/docs/latest/api-reference/alias/ + url: https://opensearch.org/docs/latest/api-reference/index-apis/alias/ parameters: - $ref: '#/components/parameters/indices.update_aliases::query.cluster_manager_timeout' - $ref: '#/components/parameters/indices.update_aliases::query.master_timeout' @@ -195,7 +195,7 @@ paths: x-version-added: '1.0' description: Creates or updates an alias. externalDocs: - url: https://opensearch.org/docs/latest/im-plugin/index-alias/#create-aliases + url: https://opensearch.org/docs/latest/api-reference/index-apis/update-alias/ parameters: - $ref: '#/components/parameters/indices.put_alias::path.name' - $ref: '#/components/parameters/indices.put_alias::query.cluster_manager_timeout' @@ -217,7 +217,7 @@ paths: x-version-added: '1.0' description: Creates or updates an alias. externalDocs: - url: https://opensearch.org/docs/latest/im-plugin/index-alias/#create-aliases + url: https://opensearch.org/docs/latest/api-reference/index-apis/update-alias/ parameters: - $ref: '#/components/parameters/indices.put_alias::path.name' - $ref: '#/components/parameters/indices.put_alias::query.cluster_manager_timeout' @@ -5626,6 +5626,108 @@ paths: - $ref: '#/components/parameters/_global::query.error_trace' - $ref: '#/components/parameters/_global::query.source' - $ref: '#/components/parameters/_global::query.filter_path' + /_plugins/_sql: + post: + operationId: sql.query.0 + x-operation-group: sql.query + x-version-added: '1.0' + description: Send a SQL/PPL query to the SQL plugin. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/sql-ppl-api/ + parameters: + - $ref: '#/components/parameters/sql.query::query.format' + - $ref: '#/components/parameters/sql.query::query.sanitize' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/sql.query' + responses: + '200': + $ref: '#/components/responses/sql.query@200' + /_plugins/_sql/_explain: + post: + operationId: sql.explain.0 + x-operation-group: sql.explain + x-version-added: '1.0' + description: Shows how a query is executed against OpenSearch. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/sql-ppl-api/ + parameters: + - $ref: '#/components/parameters/sql.explain::query.format' + - $ref: '#/components/parameters/sql.explain::query.sanitize' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/sql.explain' + responses: + '200': + $ref: '#/components/responses/sql.explain@200' + /_plugins/_sql/close: + post: + operationId: sql.close.0 + x-operation-group: sql.close + x-version-added: '1.0' + description: Clear the cursor context. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/sql-ppl-api/ + parameters: + - $ref: '#/components/parameters/sql.close::query.format' + - $ref: '#/components/parameters/sql.close::query.sanitize' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/sql.close' + responses: + '200': + $ref: '#/components/responses/sql.close@200' + /_plugins/_sql/stats: + get: + operationId: sql.get_stats.0 + x-operation-group: sql.get_stats + x-version-added: '1.0' + description: Collect metrics for the plugin within the interval. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/monitoring/ + parameters: + - $ref: '#/components/parameters/sql.get_stats::query.format' + - $ref: '#/components/parameters/sql.get_stats::query.sanitize' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/sql.get_stats@200' + post: + operationId: sql.post_stats.1 + x-operation-group: sql.post_stats + x-version-added: '1.0' + description: By a stats endpoint, you are able to collect metrics for the plugin within the interval. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/monitoring/ + parameters: + - $ref: '#/components/parameters/sql.post_stats::query.format' + - $ref: '#/components/parameters/sql.post_stats::query.sanitize' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/sql.post_stats' + responses: + '200': + $ref: '#/components/responses/sql.post_stats@200' /_plugins/_transform: get: operationId: transforms.search.0 @@ -7796,7 +7898,7 @@ paths: x-version-added: '1.0' description: Creates or updates an alias. externalDocs: - url: https://opensearch.org/docs/latest/im-plugin/index-alias/#create-aliases + url: https://opensearch.org/docs/latest/api-reference/index-apis/update-alias/ parameters: - $ref: '#/components/parameters/indices.put_alias::path.index' - $ref: '#/components/parameters/indices.put_alias::query.cluster_manager_timeout' @@ -7884,7 +7986,7 @@ paths: x-version-added: '1.0' description: Creates or updates an alias. externalDocs: - url: https://opensearch.org/docs/latest/im-plugin/index-alias/#create-aliases + url: https://opensearch.org/docs/latest/api-reference/index-apis/update-alias/ parameters: - $ref: '#/components/parameters/indices.put_alias::path.index' - $ref: '#/components/parameters/indices.put_alias::path.name' @@ -7907,7 +8009,7 @@ paths: x-version-added: '1.0' description: Creates or updates an alias. externalDocs: - url: https://opensearch.org/docs/latest/im-plugin/index-alias/#create-aliases + url: https://opensearch.org/docs/latest/api-reference/index-apis/update-alias/ parameters: - $ref: '#/components/parameters/indices.put_alias::path.index' - $ref: '#/components/parameters/indices.put_alias::path.name' @@ -7931,7 +8033,7 @@ paths: x-version-added: '1.0' description: Creates or updates an alias. externalDocs: - url: https://opensearch.org/docs/latest/im-plugin/index-alias/#create-aliases + url: https://opensearch.org/docs/latest/api-reference/index-apis/update-alias/ parameters: - $ref: '#/components/parameters/indices.put_alias::path.index' - $ref: '#/components/parameters/indices.put_alias::query.cluster_manager_timeout' @@ -7975,7 +8077,7 @@ paths: x-version-added: '1.0' description: Creates or updates an alias. externalDocs: - url: https://opensearch.org/docs/latest/im-plugin/index-alias/#create-aliases + url: https://opensearch.org/docs/latest/api-reference/index-apis/update-alias/ parameters: - $ref: '#/components/parameters/indices.put_alias::path.index' - $ref: '#/components/parameters/indices.put_alias::path.name' @@ -7998,7 +8100,7 @@ paths: x-version-added: '1.0' description: Creates or updates an alias. externalDocs: - url: https://opensearch.org/docs/latest/im-plugin/index-alias/#create-aliases + url: https://opensearch.org/docs/latest/api-reference/index-apis/update-alias/ parameters: - $ref: '#/components/parameters/indices.put_alias::path.index' - $ref: '#/components/parameters/indices.put_alias::path.name' @@ -11603,6 +11705,118 @@ paths: - $ref: '#/components/parameters/_global::query.filter_path' deprecated: true x-ignorable: true + /_opendistro/_sql: + post: + operationId: sql.query.0_superseded + x-operation-group: sql.query + x-version-added: '1.0' + description: Send a SQL/PPL query to the SQL plugin. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/sql-ppl-api/ + parameters: + - $ref: '#/components/parameters/sql.query::query.format' + - $ref: '#/components/parameters/sql.query::query.sanitize' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/sql.query' + responses: + '200': + $ref: '#/components/responses/sql.query@200' + deprecated: true + x-ignorable: true + /_opendistro/_sql/_explain: + post: + operationId: sql.explain.0_superseded + x-operation-group: sql.explain + x-version-added: '1.0' + description: Shows how a query is executed against OpenSearch. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/sql-ppl-api/ + parameters: + - $ref: '#/components/parameters/sql.explain::query.format' + - $ref: '#/components/parameters/sql.explain::query.sanitize' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/sql.explain' + responses: + '200': + $ref: '#/components/responses/sql.explain@200' + deprecated: true + x-ignorable: true + /_opendistro/_sql/close: + post: + operationId: sql.close.0_superseded + x-operation-group: sql.close + x-version-added: '1.0' + description: Clear the cursor context. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/sql-ppl-api/ + parameters: + - $ref: '#/components/parameters/sql.close::query.format' + - $ref: '#/components/parameters/sql.close::query.sanitize' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/sql.close' + responses: + '200': + $ref: '#/components/responses/sql.close@200' + deprecated: true + x-ignorable: true + /_opendistro/_sql/stats: + get: + operationId: sql.get_stats.0_superseded + x-operation-group: sql.get_stats + x-version-added: '1.0' + description: Collect metrics for the plugin within the interval. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/monitoring/ + parameters: + - $ref: '#/components/parameters/sql.get_stats::query.format' + - $ref: '#/components/parameters/sql.get_stats::query.sanitize' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + responses: + '200': + $ref: '#/components/responses/sql.get_stats@200' + deprecated: true + x-ignorable: true + post: + operationId: sql.post_stats.1_superseded + x-operation-group: sql.post_stats + x-version-added: '1.0' + description: By a stats endpoint, you are able to collect metrics for the plugin within the interval. + externalDocs: + url: https://opensearch.org/docs/latest/search-plugins/sql/monitoring/ + parameters: + - $ref: '#/components/parameters/sql.post_stats::query.format' + - $ref: '#/components/parameters/sql.post_stats::query.sanitize' + - $ref: '#/components/parameters/_global::query.pretty' + - $ref: '#/components/parameters/_global::query.human' + - $ref: '#/components/parameters/_global::query.error_trace' + - $ref: '#/components/parameters/_global::query.source' + - $ref: '#/components/parameters/_global::query.filter_path' + requestBody: + $ref: '#/components/requestBodies/sql.post_stats' + responses: + '200': + $ref: '#/components/responses/sql.post_stats@200' + deprecated: true + x-ignorable: true components: parameters: _global::query.pretty: @@ -21070,6 +21284,81 @@ components: schema: $ref: '#/components/schemas/_common:Duration' style: form + sql.close::query.format: + name: format + in: query + description: A short version of the Accept header, e.g. json, yaml. + schema: + type: string + description: A short version of the Accept header, e.g. json, yaml. + sql.close::query.sanitize: + name: sanitize + in: query + description: Specifies whether to escape special characters in the results + schema: + type: boolean + default: true + description: Specifies whether to escape special characters in the results + sql.explain::query.format: + name: format + in: query + description: A short version of the Accept header, e.g. json, yaml. + schema: + type: string + description: A short version of the Accept header, e.g. json, yaml. + sql.explain::query.sanitize: + name: sanitize + in: query + description: Specifies whether to escape special characters in the results + schema: + type: boolean + default: true + description: Specifies whether to escape special characters in the results + sql.get_stats::query.format: + name: format + in: query + description: A short version of the Accept header, e.g. json, yaml. + schema: + type: string + description: A short version of the Accept header, e.g. json, yaml. + sql.get_stats::query.sanitize: + name: sanitize + in: query + description: Specifies whether to escape special characters in the results + schema: + type: boolean + default: true + description: Specifies whether to escape special characters in the results + sql.post_stats::query.format: + name: format + in: query + description: A short version of the Accept header, e.g. json, yaml. + schema: + type: string + description: A short version of the Accept header, e.g. json, yaml. + sql.post_stats::query.sanitize: + name: sanitize + in: query + description: Specifies whether to escape special characters in the results + schema: + type: boolean + default: true + description: Specifies whether to escape special characters in the results + sql.query::query.format: + name: format + in: query + description: A short version of the Accept header, e.g. json, yaml. + schema: + type: string + description: A short version of the Accept header, e.g. json, yaml. + sql.query::query.sanitize: + name: sanitize + in: query + description: Specifies whether to escape special characters in the results + schema: + type: boolean + default: true + description: Specifies whether to escape special characters in the results tasks.cancel::path.task_id: in: path name: task_id @@ -22521,18 +22810,7 @@ components: ml.search_models: content: application/json: - schema: - type: object - properties: - query: - type: object - description: The query. - size: - type: integer - description: The number of models to return. - required: - - query - - size + $ref: '#/components/schemas/ml._common:SearchModelsQuery' msearch: content: application/x-ndjson: @@ -23212,6 +23490,30 @@ components: rename_replacement: type: string description: Details of what to restore + sql.close: + content: + application/json: + schema: + $ref: '#/components/schemas/sql._common:SqlClose' + required: true + sql.explain: + content: + application/json: + schema: + $ref: '#/components/schemas/sql._common:SqlExplain' + required: true + sql.post_stats: + content: + application/json: + schema: + $ref: '#/components/schemas/sql._common:SqlStats' + required: true + sql.query: + content: + application/json: + schema: + $ref: '#/components/schemas/sql._common:SqlQuery' + required: true termvectors: content: application/json: @@ -24699,106 +25001,31 @@ components: ml.delete_model_group@200: content: application/json: - schema: - type: object + $ref: '#/components/schemas/ml._common:ModelGroup' ml.delete_model@200: content: application/json: - schema: - type: object + $ref: '#/components/schemas/ml._common:ModelGroup' ml.get_model_group@200: content: application/json: - schema: - type: object - properties: - name: - type: string - description: The model group name. - latest_version: - type: number - description: The latest version. - description: - type: string - description: The model group description. - access: - type: string - description: The model group access. - created_time: - type: integer - format: int64 - last_updated_time: - type: integer - format: int64 - required: - - access - - description - - latest_version - - name + $ref: '#/components/schemas/ml._common:ModelGroup' ml.get_task@200: content: application/json: - schema: - type: object - properties: - model_id: - type: string - description: The model ID. - state: - type: string - description: The state. - enum: - - CANCELLED - - COMPLETED - - COMPLETED_WITH_ERROR - - CREATED - - FAILED - - RUNNING - required: - - state + $ref: '#/components/schemas/ml._common:Task' ml.register_model_group@200: content: application/json: - schema: - type: object - properties: - model_group_id: - type: string - description: The model group ID. - status: - type: string - description: The status. - required: - - model_group_id - - status + $ref: '#/components/schemas/ml._common:ModelGroupRegistration' ml.register_model@200: content: application/json: - schema: - type: object - properties: - task_id: - type: string - description: The task ID. - model_id: - type: string - description: The model ID. - status: - type: string - description: The status. - required: - - status - - task_id + $ref: '#/components/schemas/ml._common:Task' ml.search_models@200: content: application/json: - schema: - type: object - properties: - hits: - $ref: '#/components/schemas/ml._common:SearchModelHits' - required: - - hits + $ref: '#/components/schemas/ml._common:SearchModelsResponse' msearch_template@200: description: '' content: @@ -25965,6 +26192,36 @@ components: $ref: '#/components/schemas/snapshot.verify_repository:CompactNodeInfo' required: - nodes + sql.close@200: + content: + application/json: + schema: + $ref: '#/components/schemas/sql._common:SqlCloseResponse' + required: true + sql.explain@200: + content: + application/json: + schema: + $ref: '#/components/schemas/sql._common:SqlExplainResponse' + required: true + sql.get_stats@200: + content: + text/plain: + schema: + type: string + required: true + sql.post_stats@200: + content: + text/plain: + schema: + type: string + required: true + sql.query@200: + description: '' + content: + application/json: + schema: + $ref: '#/components/schemas/sql._common:SqlQueryResponse' tasks.cancel@200: description: '' content: @@ -26449,6 +26706,9 @@ components: $ref: '#/components/schemas/_common:ErrorCause' required: - type + additionalProperties: + title: metadata + description: Additional details about the error _common:ErrorResponseBase: type: object properties: @@ -27531,8 +27791,7 @@ components: Specifies any named parameters that are passed into the script as variables. Use parameters instead of hard-coded values to decrease compile time. type: object - additionalProperties: - type: object + additionalProperties: true _common:ScriptField: type: object properties: @@ -28097,6 +28356,7 @@ components: _common:UnitMillis: description: Time unit for milliseconds type: number + format: int64 _common:UnitNanos: description: Time unit for nanoseconds type: number @@ -33841,8 +34101,8 @@ components: type: string enum: - 'false' - - runtime - strict + - strict_allow_templates - 'true' _common.mapping:DynamicProperty: allOf: @@ -36106,7 +36366,9 @@ components: To return a document, the query term must exactly match the queried field's value, including whitespace and capitalization. type: object additionalProperties: - $ref: '#/components/schemas/_common.query_dsl:TermQuery' + anyOf: + - $ref: '#/components/schemas/_common.query_dsl:TermQuery' + - $ref: '#/components/schemas/_common:FieldValue' minProperties: 1 maxProperties: 1 terms: @@ -41704,6 +41966,8 @@ components: type: string index_uuid: type: string + creation_date: + $ref: '#/components/schemas/_common:DateTime' creation_date_millis: $ref: '#/components/schemas/_common:EpochTimeUnitMillis' node_ids: @@ -44738,7 +45002,45 @@ components: required: - relation - value - ml._common:SearchModelHits: + ml._common:ModelGroup: + type: object + properties: + name: + type: string + description: The model group name. + latest_version: + type: number + description: The latest version. + description: + type: string + description: The model group description. + access: + type: string + description: The model group access. + created_time: + type: integer + format: int64 + last_updated_time: + type: integer + format: int64 + required: + - access + - description + - latest_version + - name + ml._common:ModelGroupRegistration: + type: object + properties: + model_group_id: + type: string + description: The model group ID. + status: + type: string + description: The status. + required: + - model_group_id + - status + ml._common:SearchModelsHits: type: object properties: total: @@ -44746,11 +45048,11 @@ components: hits: type: array items: - $ref: '#/components/schemas/ml._common:SearchModelHitsHit' + $ref: '#/components/schemas/ml._common:SearchModelsHitsHit' required: - hits - total - ml._common:SearchModelHitsHit: + ml._common:SearchModelsHitsHit: type: object properties: _index: @@ -44765,6 +45067,62 @@ components: required: - _id - model_id + ml._common:SearchModelsQuery: + type: object + properties: + query: + type: object + description: The query. + size: + type: integer + description: The number of models to return. + required: + - query + - size + ml._common:SearchModelsResponse: + type: object + properties: + hits: + $ref: '#/components/schemas/ml._common:SearchModelsHits' + required: + - hits + ml._common:Task: + type: object + properties: + model_id: + type: string + description: The model ID. + state: + type: string + description: The state. + enum: + - CANCELLED + - COMPLETED + - COMPLETED_WITH_ERROR + - CREATED + - FAILED + - RUNNING + task_type: + type: string + description: Task type. + enum: + - DEPLOY_MODEL + function_name: + type: string + worker_node: + type: array + items: + $ref: '#/components/schemas/_common:NodeIds' + create_time: + type: integer + format: int64 + last_update_time: + type: integer + format: int64 + is_async: + type: boolean + required: + - state nodes._common:AdaptiveSelection: type: object properties: @@ -48503,6 +48861,86 @@ components: $ref: '#/components/schemas/_common:Name' required: - name + sql._common:Explain: + type: object + properties: + name: + type: string + description: + type: object + children: + type: array + items: + $ref: '#/components/schemas/sql._common:Explain' + sql._common:SqlClose: + type: object + properties: + cursor: + type: string + sql._common:SqlCloseResponse: + type: object + properties: + succeeded: + type: boolean + sql._common:SqlExplain: + type: object + properties: + query: + type: string + filter: + type: object + fetch_size: + type: integer + sql._common:SqlExplainResponse: + type: object + properties: + root: + $ref: '#/components/schemas/sql._common:Explain' + sql._common:SqlQuery: + type: object + properties: + query: + type: string + filter: + type: object + fetch_size: + type: integer + sql._common:SqlQueryResponse: + type: object + properties: + schema: + type: array + items: + type: object + datarows: + type: array + items: + type: array + cursor: + type: string + total: + type: integer + size: + type: integer + status: + type: integer + sql._common:SqlStats: + type: object + properties: + start_time: + type: string + end_time: + type: object + cluster_name: + type: object + index: + type: object + query: + type: object + user: + type: object + execution_time: + type: object tasks._common:GroupBy: type: string enum: diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java index 16db1f6d3e..457bc38f80 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java @@ -33,7 +33,7 @@ public class CodeGenerator { private static final Logger LOGGER = LogManager.getLogger(); - private static final OperationGroup.Matcher OPERATION_MATCHER = OperationGroup.matcher().add(null, "info"); + private static final OperationGroup.Matcher OPERATION_MATCHER = OperationGroup.matcher().add(null, "info").add("dangling_indices"); public static void main(String[] args) { var inputOpt = Option.builder("i") diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/ArrayShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/ArrayShape.java index 97540564eb..d04f66f6f7 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/ArrayShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/ArrayShape.java @@ -31,7 +31,7 @@ public Collection getAnnotations() { @Override public Collection getImplementsTypes() { - return List.of(Types.Client.Json.JsonpSerializable); + return List.of(Types.Client.Json.PlainJsonSerializable); } public Field getValueBodyField() { diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Field.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Field.java index f2a95028d4..e4d1734572 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Field.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Field.java @@ -24,6 +24,7 @@ public class Field { private final String description; @Nullable private final Deprecation deprecation; + private final boolean isAdditionalProperties; public Field( @Nonnull String wireName, @@ -31,12 +32,24 @@ public Field( boolean required, @Nullable String description, @Nullable Deprecation deprecation + ) { + this(wireName, type, required, description, deprecation, false); + } + + public Field( + @Nonnull String wireName, + @Nonnull Type type, + boolean required, + @Nullable String description, + @Nullable Deprecation deprecation, + boolean isAdditionalProperties ) { this.wireName = Strings.requireNonBlank(wireName, "wireName must not be null"); this.type = Objects.requireNonNull(type, "type must not be null"); this.required = required; this.description = description; this.deprecation = deprecation; + this.isAdditionalProperties = isAdditionalProperties; } @Nonnull diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/HttpPath.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/HttpPath.java index 8050fc21e6..36573e6e5e 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/HttpPath.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/HttpPath.java @@ -64,8 +64,8 @@ public List getParams() { return Lists.filterMap(parts, Part::isParameter, Part::getParameter); } - public Set getParamNameSet() { - return parts.stream().filter(Part::isParameter).map(p -> p.getParameter().getName()).collect(Collectors.toSet()); + public Set getParamWireNameSet() { + return parts.stream().filter(Part::isParameter).map(p -> p.getParameter().getWireName()).collect(Collectors.toSet()); } public Deprecation getDeprecation() { diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java index 3398b98583..1f455426a3 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Namespace.java @@ -16,6 +16,7 @@ import java.util.TreeMap; import javax.annotation.Nonnull; import javax.annotation.Nullable; +import org.apache.commons.lang3.builder.ToStringBuilder; import org.opensearch.client.codegen.exceptions.RenderException; import org.opensearch.client.codegen.utils.Lists; import org.opensearch.client.codegen.utils.Strings; @@ -96,7 +97,7 @@ private String getClientClassName(boolean async, boolean base) { private Type getClientType(boolean async, boolean base) { var type = Type.builder().pkg(getPackageName()).name(getClientClassName(async, base)); if (base) { - type.genericArgs(getClientType(async, false)); + type.typeParams(getClientType(async, false)); } return type.build(); } @@ -106,7 +107,7 @@ private static class Client extends Shape { private final Collection operations; private Client(Namespace parent, boolean async, Collection operations) { - super(parent, parent.getClientClassName(async, false), null, null); + super(parent, parent.getClientClassName(async, false), null, "Client for the " + parent.name + " namespace."); this.async = async; this.operations = operations; } @@ -137,6 +138,11 @@ public boolean isAsync() { return this.async; } + @Override + public String toString() { + return new ToStringBuilder(this).append("type", getType()).toString(); + } + private static class ClientRef { private final Type type; private final String name; diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/ObjectShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/ObjectShape.java index 3dcbd1127a..39bb2e2e86 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/ObjectShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/ObjectShape.java @@ -56,11 +56,19 @@ public Type getExtendsType() { return extendsType; } + public boolean extendsOtherShape() { + return extendsType != null; + } + + public boolean hasFieldsToSerialize() { + return !bodyFields.isEmpty() || additionalPropertiesField != null; + } + public Collection getImplementsTypes() { - return !bodyFields.isEmpty() ? List.of(Types.Client.Json.JsonpSerializable) : null; + return hasFieldsToSerialize() && !extendsOtherShape() ? List.of(Types.Client.Json.PlainJsonSerializable) : null; } public Collection getAnnotations() { - return !bodyFields.isEmpty() ? List.of(Types.Client.Json.JsonpDeserializable) : null; + return (hasFieldsToSerialize() || extendsOtherShape()) && !isAbstract() ? List.of(Types.Client.Json.JsonpDeserializable) : null; } } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java index b46ef19025..a2625fc7ce 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java @@ -50,6 +50,11 @@ public String getId() { return operationGroup.getName(); } + @Override + public boolean extendsOtherShape() { + return extendsType != Types.Client.OpenSearch._Types.RequestBase; + } + public String getHttpMethod() { return Streams.sortedBy(httpMethods.stream(), m -> { switch (m) { @@ -144,6 +149,10 @@ public boolean hasAnyRequiredFields() { return fields.values().stream().anyMatch(Field::isRequired); } + public Type getJsonEndpointType() { + return Types.Client.Transport.JsonEndpoint(getType(), getResponseType(), Types.Client.OpenSearch._Types.ErrorResponse); + } + @Nonnull private static String requestClassName(@Nonnull OperationGroup operationGroup) { Objects.requireNonNull(operationGroup, "operationGroup must not be null"); diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java index 9b24cac8d9..bd20d083c6 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Shape.java @@ -45,6 +45,10 @@ public JavaClassKind getClassKind() { return JavaClassKind.Class; } + public boolean isAbstract() { + return this.className.endsWith("Base"); + } + public String getTypedefName() { return this.typedefName; } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java index 09f24a35e0..91af05c63f 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/SpecTransformer.java @@ -28,11 +28,13 @@ import org.apache.logging.log4j.Logger; import org.opensearch.client.codegen.openapi.HttpStatusCode; import org.opensearch.client.codegen.openapi.In; +import org.opensearch.client.codegen.openapi.JsonPointer; import org.opensearch.client.codegen.openapi.MimeType; import org.opensearch.client.codegen.openapi.OpenApiMediaType; import org.opensearch.client.codegen.openapi.OpenApiOperation; import org.opensearch.client.codegen.openapi.OpenApiParameter; import org.opensearch.client.codegen.openapi.OpenApiPath; +import org.opensearch.client.codegen.openapi.OpenApiRefElement; import org.opensearch.client.codegen.openapi.OpenApiRequestBody; import org.opensearch.client.codegen.openapi.OpenApiResponse; import org.opensearch.client.codegen.openapi.OpenApiSchema; @@ -104,7 +106,16 @@ private void visit(@Nonnull OperationGroup group, @Nonnull List c.get(MimeType.Json)) .flatMap(OpenApiMediaType::getSchema) - .map(OpenApiSchema::resolve) + .map(s -> { + if (s.get$ref() + .map(OpenApiRefElement.RelativeRef::getPointer) + .flatMap(JsonPointer::getLastKey) + .map("_common:AcknowledgedResponseBase"::equals) + .orElse(false)) { + return OpenApiSchema.builder().withPointer(s.getPointer()).withAllOf(s, OpenApiSchema.ANONYMOUS_OBJECT).build(); + } + return s.resolve(); + }) .orElse(OpenApiSchema.ANONYMOUS_OBJECT); visit(parent, requestShape.getResponseType().getName(), group + ".Response", responseSchema); @@ -139,12 +150,12 @@ private RequestShape visit(@Nonnull Namespace parent, @Nonnull OperationGroup gr var httpPath = HttpPath.from(httpPathStr, variant, allPathParams); - (httpPath.getDeprecation() == null ? canonicalPaths : deprecatedPaths).put(httpPath.getParamNameSet(), httpPath); + (httpPath.getDeprecation() == null ? canonicalPaths : deprecatedPaths).put(httpPath.getParamWireNameSet(), httpPath); if (requiredPathParams != null) { - requiredPathParams.retainAll(httpPath.getParamNameSet()); + requiredPathParams.retainAll(httpPath.getParamWireNameSet()); } else { - requiredPathParams = new HashSet<>(httpPath.getParamNameSet()); + requiredPathParams = new HashSet<>(httpPath.getParamWireNameSet()); } } @@ -277,16 +288,17 @@ private void visitInto(OpenApiSchema schema, ObjectShape shape) { ) ); - var additionalProperties = schema.getAdditionalProperties(); - if (additionalProperties.isPresent()) { - var valueType = mapType(additionalProperties.get()); + var additionalProperties = schema.getAdditionalProperties().orElse(null); + if (additionalProperties != null) { + var valueType = mapType(additionalProperties); shape.setAdditionalPropertiesField( new Field( - "metadata", + additionalProperties.getTitle().orElseThrow(), Types.Java.Util.Map(Types.Java.Lang.String, valueType), false, - additionalProperties.get().getDescription().orElse(null), - null + additionalProperties.getDescription().orElse(null), + null, + true ) ); } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/TaggedUnionShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/TaggedUnionShape.java index 85e96761a0..36dc7e2f2a 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/TaggedUnionShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/TaggedUnionShape.java @@ -41,7 +41,7 @@ public Collection getAnnotations() { public Collection getImplementsTypes() { return List.of( Types.Client.Util.TaggedUnion(getType().getNestedType("Kind"), Types.Java.Lang.Object), - Types.Client.Json.JsonpSerializable + Types.Client.Json.PlainJsonSerializable ); } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java index 96ef37d344..ca4d27a0a3 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Type.java @@ -45,26 +45,26 @@ public static Builder builder() { private final String pkg; private final String name; - private final Type[] genericArgs; + private final Type[] typeParams; private final boolean isEnum; private Type(Builder builder) { this.pkg = builder.pkg; this.name = builder.name; - this.genericArgs = builder.genericArgs; + this.typeParams = builder.typeParams; this.isEnum = builder.isEnum; } public Builder toBuilder() { - return new Builder().pkg(pkg).name(name).genericArgs(genericArgs).isEnum(isEnum); + return new Builder().pkg(pkg).name(name).typeParams(typeParams).isEnum(isEnum); } @Override public String toString() { String str = name; - if (genericArgs != null && genericArgs.length > 0) { + if (typeParams != null && typeParams.length > 0) { str += "<"; - str += Arrays.stream(genericArgs).map(Type::toString).collect(Collectors.joining(", ")); + str += Arrays.stream(typeParams).map(Type::toString).collect(Collectors.joining(", ")); str += ">"; } return str; @@ -104,19 +104,19 @@ public boolean isMap() { public Type getMapEntryType() { if (!isMap()) return null; - return Java.Util.MapEntry(this.genericArgs[0], this.genericArgs[1]); + return Java.Util.MapEntry(this.typeParams[0], this.typeParams[1]); } public Type getMapKeyType() { if (!isMap()) return null; - return this.genericArgs[0]; + return this.typeParams[0]; } public Type getMapValueType() { if (!isMap()) return null; - return this.genericArgs[1]; + return this.typeParams[1]; } public boolean isList() { @@ -126,7 +126,7 @@ public boolean isList() { public Type getListValueType() { if (!isList()) return null; - return this.genericArgs[0]; + return this.typeParams[0]; } public boolean isListOrMap() { @@ -186,15 +186,15 @@ public void getRequiredImports(Set imports, String currentPkg) { var dotIdx = name.indexOf('.'); imports.add(pkg + '.' + (dotIdx > 0 ? name.substring(0, dotIdx) : name)); } - if (genericArgs != null) { - for (Type arg : genericArgs) { + if (typeParams != null) { + for (Type arg : typeParams) { arg.getRequiredImports(imports, currentPkg); } } } - public Type withGenericArgs(Type... genericArgs) { - return toBuilder().genericArgs(genericArgs).build(); + public Type withTypeParams(Type... typeParams) { + return toBuilder().typeParams(typeParams).build(); } public Mustache.Lambda queryParamify() { @@ -204,7 +204,7 @@ public Mustache.Lambda queryParamify() { public static final class Builder { private String pkg; private String name; - private Type[] genericArgs; + private Type[] typeParams; private boolean isEnum; public Builder pkg(String pkg) { @@ -217,8 +217,8 @@ public Builder name(String name) { return this; } - public Builder genericArgs(Type... genericArgs) { - this.genericArgs = genericArgs; + public Builder typeParams(Type... typeParams) { + this.typeParams = typeParams; return this; } diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java index 7dc66ca479..1ce5a4806f 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/Types.java @@ -74,17 +74,17 @@ public static final class Util { public static final Type HashMap = Type.builder().pkg(PACKAGE).name("HashMap").build(); public static Type Map(Type keyType, Type valueType) { - return Map.withGenericArgs(keyType, valueType); + return Map.withTypeParams(keyType, valueType); } public static final Type Map = Type.builder().pkg(PACKAGE).name("Map").build(); public static Type MapEntry(Type keyType, Type valueType) { - return Type.builder().pkg(PACKAGE).name("Map.Entry").genericArgs(keyType, valueType).build(); + return Type.builder().pkg(PACKAGE).name("Map.Entry").typeParams(keyType, valueType).build(); } public static Type List(Type valueType) { - return Type.builder().pkg(PACKAGE).name("List").genericArgs(valueType).build(); + return Type.builder().pkg(PACKAGE).name("List").typeParams(valueType).build(); } public static final class Concurrent { @@ -96,7 +96,7 @@ public static final class Function { public static final String PACKAGE = Util.PACKAGE + ".function"; public static Type Function(Type argType, Type returnType) { - return Type.builder().pkg(PACKAGE).name("Function").genericArgs(argType, returnType).build(); + return Type.builder().pkg(PACKAGE).name("Function").typeParams(argType, returnType).build(); } } @@ -121,7 +121,7 @@ public static final class Client { public static final String PACKAGE = "org.opensearch.client"; public static Type ApiClient(Type transport, Type client) { - return ApiClient.withGenericArgs(transport, client); + return ApiClient.withTypeParams(transport, client); } public static final Type ApiClient = Type.builder().pkg(PACKAGE).name("ApiClient").build(); @@ -136,6 +136,7 @@ public static final class Json { public static final Type JsonpSerializable = Type.builder().pkg(PACKAGE).name("JsonpSerializable").build(); public static final Type ObjectBuilderDeserializer = Type.builder().pkg(PACKAGE).name("ObjectBuilderDeserializer").build(); public static final Type ObjectDeserializer = Type.builder().pkg(PACKAGE).name("ObjectDeserializer").build(); + public static final Type PlainJsonSerializable = Type.builder().pkg(PACKAGE).name("PlainJsonSerializable").build(); public static final Type UnionDeserializer = Type.builder().pkg(PACKAGE).name("UnionDeserializer").build(); } @@ -154,6 +155,11 @@ public static final class _Types { public static final class Transport { public static final String PACKAGE = Client.PACKAGE + ".transport"; public static final Type Endpoint = Type.builder().pkg(PACKAGE).name("Endpoint").build(); + + public static Type JsonEndpoint(Type requestType, Type responseType, Type errorType) { + return JsonEndpoint.withTypeParams(requestType, responseType, errorType); + } + public static final Type JsonEndpoint = Type.builder().pkg(PACKAGE).name("JsonEndpoint").build(); public static final Type OpenSearchTransport = Type.builder().pkg(PACKAGE).name("OpenSearchTransport").build(); public static final Type TransportOptions = Type.builder().pkg(PACKAGE).name("TransportOptions").build(); @@ -169,14 +175,14 @@ public static final class Util { public static final Type ApiTypeHelper = Type.builder().pkg(PACKAGE).name("ApiTypeHelper").build(); public static Type ObjectBuilder(Type type) { - return ObjectBuilder.withGenericArgs(type); + return ObjectBuilder.withTypeParams(type); } public static final Type ObjectBuilder = Type.builder().pkg(PACKAGE).name("ObjectBuilder").build(); public static final Type ObjectBuilderBase = Type.builder().pkg(PACKAGE).name("ObjectBuilderBase").build(); public static Type TaggedUnion(Type tagType, Type baseType) { - return TaggedUnion.withGenericArgs(tagType, baseType); + return TaggedUnion.withTypeParams(tagType, baseType); } public static final Type TaggedUnion = Type.builder().pkg(PACKAGE).name("TaggedUnion").build(); diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiRefElement.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiRefElement.java index 55f6829628..94328a7282 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiRefElement.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiRefElement.java @@ -86,6 +86,11 @@ public > TElement resolveIn(OpenApiSpe return specification.getElement(pointer, clazz); } + @Nonnull + public JsonPointer getPointer() { + return pointer; + } + @Override public String toString() { return new ToStringBuilder(this).append("pointer", pointer).append("relativeLocation", relativeLocation).toString(); diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java index ea9ab3a957..4d12ae2659 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/openapi/OpenApiSchema.java @@ -10,7 +10,6 @@ import static org.opensearch.client.codegen.utils.Functional.ifNonnull; -import io.swagger.v3.oas.models.media.ObjectSchema; import io.swagger.v3.oas.models.media.Schema; import java.util.HashSet; import java.util.List; @@ -28,7 +27,9 @@ public class OpenApiSchema extends OpenApiRefElement { private static final JsonPointer ANONYMOUS = JsonPointer.of(""); - public static final OpenApiSchema ANONYMOUS_OBJECT = new OpenApiSchema(null, ANONYMOUS.append("object"), new ObjectSchema()); + public static final OpenApiSchema ANONYMOUS_OBJECT = builder().withPointer(ANONYMOUS.append("object")) + .withTypes(OpenApiSchemaType.Object) + .build(); @Nullable private final String name; @@ -59,6 +60,24 @@ public class OpenApiSchema extends OpenApiRefElement { @Nullable private final String pattern; + private OpenApiSchema(@Nonnull Builder builder) { + super(builder.parent, Objects.requireNonNull(builder.pointer, "pointer must not be null"), builder.$ref, OpenApiSchema.class); + name = builder.name; + namespace = builder.namespace; + description = builder.description; + types = builder.types; + format = builder.format; + allOf = builder.allOf; + oneOf = builder.oneOf; + enums = builder.enums; + items = builder.items; + additionalProperties = builder.additionalProperties; + properties = builder.properties; + required = builder.required; + title = builder.title; + pattern = builder.pattern; + } + protected OpenApiSchema(@Nullable OpenApiElement parent, @Nonnull JsonPointer pointer, @Nonnull Schema schema) { super(parent, pointer, schema.get$ref(), OpenApiSchema.class); @@ -230,4 +249,79 @@ public Set determineTypes() { throw new IllegalStateException("Cannot determine type for schema: " + getPointer()); } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + public static class Builder { + @Nullable + private OpenApiElement parent; + @Nullable + private JsonPointer pointer; + @Nullable + private String $ref; + @Nullable + private String name; + @Nullable + private String namespace; + @Nullable + private String description; + @Nullable + private Set types; + @Nullable + private OpenApiSchemaFormat format; + @Nullable + private List allOf; + @Nullable + private List oneOf; + @Nullable + private List enums; + @Nullable + private OpenApiSchema items; + @Nullable + private OpenApiSchema additionalProperties; + @Nullable + private Map properties; + @Nullable + private Set required; + @Nullable + private String title; + @Nullable + private String pattern; + + @Nonnull + public Builder withPointer(@Nonnull JsonPointer pointer) { + this.pointer = Objects.requireNonNull(pointer, "pointer must not be null"); + return this; + } + + @Nonnull + public Builder withTypes(OpenApiSchemaType... types) { + return withTypes(Set.of(types)); + } + + @Nonnull + public Builder withTypes(@Nullable Set types) { + this.types = types; + return this; + } + + @Nonnull + public Builder withAllOf(OpenApiSchema... allOf) { + return withAllOf(List.of(allOf)); + } + + @Nonnull + public Builder withAllOf(@Nullable List allOf) { + this.allOf = allOf; + return this; + } + + @Nonnull + public OpenApiSchema build() { + return new OpenApiSchema(this); + } + } } diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape.mustache index 3d4c1b94ce..627af1db03 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape.mustache @@ -7,8 +7,10 @@ {{>ObjectShape/Getters}} +{{#hasFieldsToSerialize}} {{>ObjectShape/Serialize}} +{{/hasFieldsToSerialize}} // --------------------------------------------------------------------------------------------- diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder.mustache index 47f7ce70dd..2ef354df7a 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Builder.mustache @@ -1,46 +1,64 @@ +{{^abstract}} /** * Builder for {@link {{className}}}. */ - public static class Builder extends {{TYPES.Client.Util.ObjectBuilderBase}} implements {{TYPES.Client.Util.ObjectBuilder}}<{{className}}> { - {{#fields}} + public static class Builder extends +{{#extendsOtherShape}} + {{extendsType}}.AbstractBuilder +{{/extendsOtherShape}} +{{^extendsOtherShape}} + {{TYPES.Client.Util.ObjectBuilderBase}} +{{/extendsOtherShape}} + implements {{TYPES.Client.Util.ObjectBuilder}}<{{className}}> { + {{#extendsOtherShape}} + @Override + protected Builder self() { + return this; + } + {{/extendsOtherShape}} +{{/abstract}} +{{#abstract}} + protected abstract static class AbstractBuilder> extends {{TYPES.Client.Util.ObjectBuilderBase}} { +{{/abstract}} + {{#fields}} {{^required}}@{{TYPES.Javax.Annotation.Nullable}} {{/required}}private {{type.boxed}} {{name}}; - {{/fields}} + {{/fields}} - {{#fields}} + {{#fields}} {{#type.isMap}} {{>ObjectShape/FieldDoc/Basic}} {{#deprecation}}@Deprecated{{/deprecation}} - public final Builder {{name}}({{type}} map) { + public final Builder{{#abstract}}T{{/abstract}} {{name}}({{type}} map) { this.{{name}} = _mapPutAll(this.{{name}}, map); - return this; + return {{^abstract}}this{{/abstract}}{{#abstract}}self(){{/abstract}}; } {{>ObjectShape/FieldDoc/Basic}} {{#deprecation}}@Deprecated{{/deprecation}} - public final Builder {{name}}({{type.mapKeyType}} key, {{type.mapValueType}} value) { + public final Builder{{#abstract}}T{{/abstract}} {{name}}({{type.mapKeyType}} key, {{type.mapValueType}} value) { this.{{name}} = _mapPut(this.{{name}}, key, value); - return this; + return {{^abstract}}this{{/abstract}}{{#abstract}}self(){{/abstract}}; } {{/type.isMap}} {{#type.isList}} {{>ObjectShape/FieldDoc/ListAddAll}} {{#deprecation}}@Deprecated{{/deprecation}} - public final Builder {{name}}({{type}} list) { + public final Builder{{#abstract}}T{{/abstract}} {{name}}({{type}} list) { this.{{name}} = _listAddAll(this.{{name}}, list); - return this; + return {{^abstract}}this{{/abstract}}{{#abstract}}self(){{/abstract}}; } {{>ObjectShape/FieldDoc/ListAdd}} {{#deprecation}}@Deprecated{{/deprecation}} - public final Builder {{name}}({{type.listValueType}} value, {{type.listValueType}}... values) { + public final Builder{{#abstract}}T{{/abstract}} {{name}}({{type.listValueType}} value, {{type.listValueType}}... values) { this.{{name}} = _listAdd(this.{{name}}, value, values); - return this; + return {{^abstract}}this{{/abstract}}{{#abstract}}self(){{/abstract}}; } {{#type.listValueType.hasBuilder}} {{>ObjectShape/FieldDoc/ListAddBuilderFn}} {{#deprecation}}@Deprecated{{/deprecation}} - public final Builder {{name}}({{type.listValueType.builderFnType}} fn) { + public final Builder{{#abstract}}T{{/abstract}} {{name}}({{type.listValueType.builderFnType}} fn) { return {{name}}(fn.apply(new {{type.listValueType.builderType}}()).build()); } {{/type.listValueType.hasBuilder}} @@ -48,21 +66,22 @@ {{^type.isListOrMap}} {{>ObjectShape/FieldDoc/Basic}} {{#deprecation}}@Deprecated{{/deprecation}} - public final Builder {{name}}({{^required}}@{{TYPES.Javax.Annotation.Nullable}} {{/required}}{{type}} value) { + public final Builder{{#abstract}}T{{/abstract}} {{name}}({{^required}}@{{TYPES.Javax.Annotation.Nullable}} {{/required}}{{type}} value) { this.{{name}} = value; - return this; + return {{^abstract}}this{{/abstract}}{{#abstract}}self(){{/abstract}}; } {{#type.hasBuilder}} {{>ObjectShape/FieldDoc/Basic}} {{#deprecation}}@Deprecated{{/deprecation}} - public final Builder {{name}}({{type.builderFnType}} fn) { - return this.{{name}}(fn.apply(new {{type.builderType}}()).build()); + public final Builder{{#abstract}}T{{/abstract}} {{name}}({{type.builderFnType}} fn) { + return {{name}}(fn.apply(new {{type.builderType}}()).build()); } {{/type.hasBuilder}} {{/type.isListOrMap}} - {{/fields}} + {{/fields}} + {{^abstract}} /** * Builds a {@link {{className}}}. * @@ -74,4 +93,8 @@ return new {{className}}(this); } + {{/abstract}} + {{#abstract}} + protected abstract BuilderT self(); + {{/abstract}} } \ No newline at end of file diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Constructor.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Constructor.mustache index 92995e9d00..d526639524 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Constructor.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Constructor.mustache @@ -1,4 +1,12 @@ +{{^abstract}} private {{className}}(Builder builder) { +{{/abstract}} +{{#abstract}} + protected {{className}}(AbstractBuilder builder) { +{{/abstract}} +{{#extendsOtherShape}} + super(builder); +{{/extendsOtherShape}} {{#fields}} {{#type.isListOrMap}} {{#required}} @@ -18,7 +26,9 @@ {{/type.isListOrMap}} {{/fields}} } +{{^abstract}} public static {{className}} of({{type.builderFnType}} fn) { return fn.apply(new Builder()).build(); - } \ No newline at end of file + } +{{/abstract}} \ No newline at end of file diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Deserialize.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Deserialize.mustache index 42966164a4..366d666744 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Deserialize.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Deserialize.mustache @@ -1,11 +1,19 @@ +{{^abstract}} /** * Json deserializer for {@link {{className}}} */ public static final {{TYPES.Client.Json.JsonpDeserializer}}<{{className}}> _DESERIALIZER = {{TYPES.Client.Json.ObjectBuilderDeserializer}}.lazy(Builder::new, {{className}}::setup{{className}}Deserializer); protected static void setup{{className}}Deserializer({{TYPES.Client.Json.ObjectDeserializer}}<{{type.builderType}}> op) { +{{/abstract}} +{{#abstract}} + protected static > void setup{{className}}Deserializer({{TYPES.Client.Json.ObjectDeserializer}} op) { +{{/abstract}} + {{#extendsOtherShape}} + {{extendsType}}.setup{{extendsType.name}}Deserializer(op); + {{/extendsOtherShape}} {{#bodyFields}} - op.add(Builder::{{name}}, {{#type}}{{>Type/deserializer}}{{/type}}, {{#quoted}}{{wireName}}{{/quoted}}); + op.add({{#abstract}}Abstract{{/abstract}}Builder::{{name}}, {{#type}}{{>Type/deserializer}}{{/type}}, {{#quoted}}{{wireName}}{{/quoted}}); {{/bodyFields}} {{#additionalPropertiesField}} op.setUnknownFieldHandler((builder, name, parser, mapper) -> { diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/BasicInner.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/BasicInner.mustache index 332d7bfb4a..851ccc468e 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/BasicInner.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/BasicInner.mustache @@ -1 +1,6 @@ -* {{#required}}Required - {{/required}}{{#description}}{{.}}
{{/description}}API name: {@code {{wireName}}} \ No newline at end of file +{{^isAdditionalProperties}} +* {{#required}}Required - {{/required}}{{#description}}{{.}}

{{/description}}API name: {@code {{wireName}}}{{#description}}

{{/description}} +{{/isAdditionalProperties}} +{{#isAdditionalProperties}} +* {{description}} +{{/isAdditionalProperties}} diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/ListAdd.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/ListAdd.mustache index 65cb2a3aa7..d8720ba088 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/ListAdd.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/ListAdd.mustache @@ -1,4 +1,5 @@ /** {{>ObjectShape/FieldDoc/BasicInner}} + *

Adds one or more values to {{name}}.

*/ \ No newline at end of file diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/ListAddAll.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/ListAddAll.mustache index 9f38e2fdba..2894d9549d 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/ListAddAll.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/ListAddAll.mustache @@ -1,4 +1,5 @@ /** {{>ObjectShape/FieldDoc/BasicInner}} + *

Adds all elements of list to {{name}}.

*/ \ No newline at end of file diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/ListAddBuilderFn.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/ListAddBuilderFn.mustache index 72123b3e31..867d0eca28 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/ListAddBuilderFn.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/FieldDoc/ListAddBuilderFn.mustache @@ -1,4 +1,5 @@ /** {{>ObjectShape/FieldDoc/BasicInner}} + *

Adds a value to {{name}} using a builder lambda.

*/ \ No newline at end of file diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Serialize.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Serialize.mustache index 2a2e1e914c..56e993fa67 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Serialize.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/ObjectShape/Serialize.mustache @@ -1,3 +1,4 @@ +{{^extendsOtherType}} /** * Serialize this object to JSON. */ @@ -8,6 +9,7 @@ generator.writeEnd(); } +{{/extendsOtherType}} protected void serializeInternal({{TYPES.Jakarta.Json.Stream.JsonGenerator}} generator, {{TYPES.Client.Json.JsonpMapper}} mapper) { {{#additionalPropertiesField}} {{#type.directSerializer}}this.{{name}}{{/type.directSerializer}} diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Partials/ClassDeclaration.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Partials/ClassDeclaration.mustache index ee29f712fb..fdb7a05eea 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Partials/ClassDeclaration.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Partials/ClassDeclaration.mustache @@ -11,4 +11,4 @@ @{{.}} {{/annotations}} @{{TYPES.Javax.Annotation.Generated}}("org.opensearch.client.codegen.CodeGenerator") -public {{classKind}} {{className}}{{#extendsType}} extends {{.}}{{/extendsType}}{{#implementsTypes}}{{#-first}} implements{{/-first}} {{.}}{{^-last}},{{/-last}}{{/implementsTypes}} +public {{#abstract}}abstract {{/abstract}}{{classKind}} {{className}}{{#extendsType}} extends {{.}}{{/extendsType}}{{#implementsTypes}}{{#-first}} implements{{/-first}} {{.}}{{^-last}},{{/-last}}{{/implementsTypes}} diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/RequestShape.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/RequestShape.mustache index 99a3039a73..3b21b2216e 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/RequestShape.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/RequestShape.mustache @@ -77,16 +77,20 @@ {{#hasQueryParams}} request -> { {{TYPES.Java.Util.Map}} params = new {{TYPES.Java.Util.HashMap}}<>(); - {{#queryParams}} + {{#queryParams}} + {{^required}} {{#type.isListOrMap}} if ({{TYPES.Client.Util.ApiTypeHelper}}.isDefined(request.{{name}})) { {{/type.isListOrMap}} {{^type.isListOrMap}} if (request.{{name}} != null) { {{/type.isListOrMap}} + {{/required}} params.put({{#quoted}}{{wireName}}{{/quoted}}, {{#type.queryParamify}}request.{{name}}{{/type.queryParamify}}); + {{^required}} } - {{/queryParams}} + {{/required}} + {{/queryParams}} return params; }, {{/hasQueryParams}} diff --git a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/deserializer.mustache b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/deserializer.mustache index 52c4913328..61fb38b72b 100644 --- a/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/deserializer.mustache +++ b/java-codegen/src/main/resources/org/opensearch/client/codegen/templates/Type/deserializer.mustache @@ -1,12 +1,12 @@ {{#isPrimitive}} - JsonpDeserializer.{{#toLower}}{{boxed.name}}{{/toLower}}Deserializer() + {{TYPES.Client.Json.JsonpDeserializer}}.{{#toLower}}{{boxed.name}}{{/toLower}}Deserializer() {{/isPrimitive}} {{^isPrimitive}} {{#isList}} - JsonpDeserializer.arrayDeserializer({{#listValueType}}{{>Type/deserializer}}{{/listValueType}}) + {{TYPES.Client.Json.JsonpDeserializer}}.arrayDeserializer({{#listValueType}}{{>Type/deserializer}}{{/listValueType}}) {{/isList}} {{#isMap}} - JsonpDeserializer.stringMapDeserializer({{#mapValueType}}{{>Type/deserializer}}{{/mapValueType}}) + {{TYPES.Client.Json.JsonpDeserializer}}.stringMapDeserializer({{#mapValueType}}{{>Type/deserializer}}{{/mapValueType}}) {{/isMap}} {{^isListOrMap}} {{name}}._DESERIALIZER