diff --git a/java-client/build.gradle.kts b/java-client/build.gradle.kts index b357788591..67ae397fd3 100644 --- a/java-client/build.gradle.kts +++ b/java-client/build.gradle.kts @@ -272,7 +272,7 @@ tasks.withType { spotless { java { - target("**/json/**/*.java", "**/transport/**/*.java", "**/util/**/*.java") + target("**/json/**/*.java", "**/transport/**/*.java", "**/util/**/*.java", "**/_types/**/*.java") // Use the default importOrder configuration importOrder() diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java index 548be19f3d..96afe7515c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/AcknowledgedResponseBase.java @@ -32,80 +32,78 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.JsonpSerializable; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; // typedef: _types.AcknowledgedResponseBase - public abstract class AcknowledgedResponseBase implements JsonpSerializable { - private final boolean acknowledged; + private final boolean acknowledged; - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - protected AcknowledgedResponseBase(AbstractBuilder builder) { + protected AcknowledgedResponseBase(AbstractBuilder builder) { - this.acknowledged = ApiTypeHelper.requireNonNull(builder.acknowledged, this, "acknowledged"); + 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. - *

- * API name: {@code acknowledged} - */ - public final boolean acknowledged() { - return this.acknowledged; - } + /** + * 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; + } - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("acknowledged"); - generator.write(this.acknowledged); + generator.writeKey("acknowledged"); + generator.write(this.acknowledged); - } + } - protected abstract static class AbstractBuilder> - extends - ObjectBuilderBase { - private Boolean 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. - *

- * API name: {@code acknowledged} - */ - public final BuilderT acknowledged(boolean value) { - this.acknowledged = value; - return self(); - } + /** + * 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; + return self(); + } - protected abstract BuilderT self(); + protected abstract BuilderT self(); - } + } - // --------------------------------------------------------------------------------------------- - protected static > void setupAcknowledgedResponseBaseDeserializer( - ObjectDeserializer op) { + // --------------------------------------------------------------------------------------------- + protected static > void setupAcknowledgedResponseBaseDeserializer( + ObjectDeserializer op + ) { - op.add(AbstractBuilder::acknowledged, JsonpDeserializer.booleanDeserializer(), "acknowledged"); + op.add(AbstractBuilder::acknowledged, JsonpDeserializer.booleanDeserializer(), "acknowledged"); - } + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/BaseNode.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/BaseNode.java index 3fee84a10f..abd2b4204e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/BaseNode.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/BaseNode.java @@ -32,242 +32,237 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.Map; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.JsonpSerializable; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.Map; -import javax.annotation.Nullable; // typedef: _spec_utils.BaseNode - public abstract class BaseNode implements JsonpSerializable { - private final Map attributes; - - private final String host; - - private final String ip; - - private final String name; - - private final List roles; - - private final String transportAddress; - - // --------------------------------------------------------------------------------------------- - - protected BaseNode(AbstractBuilder builder) { - - this.attributes = ApiTypeHelper.unmodifiable(builder.attributes); - this.host = builder.host; - this.ip = builder.ip; - this.name = builder.name; - this.roles = ApiTypeHelper.unmodifiable(builder.roles); - this.transportAddress = builder.transportAddress; - - } - - /** - * API name: {@code attributes} - */ - public final Map attributes() { - return this.attributes; - } - - /** - * API name: {@code host} - */ - public final String host() { - return this.host; - } - - /** - * API name: {@code ip} - */ - public final String ip() { - return this.ip; - } - - /** - * API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * API name: {@code roles} - */ - public final List roles() { - return this.roles; - } - - /** - * API name: {@code transport_address} - */ - public final String transportAddress() { - return this.transportAddress; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.attributes)) { - generator.writeKey("attributes"); - generator.writeStartObject(); - for (Map.Entry item0 : this.attributes.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); - - } - generator.writeKey("host"); - generator.write(this.host); - - generator.writeKey("ip"); - generator.write(this.ip); - - generator.writeKey("name"); - generator.write(this.name); - - if (ApiTypeHelper.isDefined(this.roles)) { - generator.writeKey("roles"); - generator.writeStartArray(); - for (NodeRole item0 : this.roles) { - item0.serialize(generator, mapper); - } - generator.writeEnd(); - - } - generator.writeKey("transport_address"); - generator.write(this.transportAddress); - - } - - protected abstract static class AbstractBuilder> - extends - ObjectBuilderBase { - @Nullable - private Map attributes; - - @Nullable - private String host; - - @Nullable - private String ip; - - @Nullable - private String name; - - @Nullable - private List roles; - - @Nullable - private String transportAddress; - - /** - * API name: {@code attributes} - *

- * Adds all entries of map to attributes. - */ - public final BuilderT attributes(Map map) { - this.attributes = _mapPutAll(this.attributes, map); - return self(); - } - - /** - * API name: {@code attributes} - *

- * Adds an entry to attributes. - */ - public final BuilderT attributes(String key, String value) { - this.attributes = _mapPut(this.attributes, key, value); - return self(); - } - - /** - * API name: {@code host} - */ - public final BuilderT host(String value) { - this.host = value; - return self(); - } - - /** - * API name: {@code ip} - */ - public final BuilderT ip(String value) { - this.ip = value; - return self(); - } - - /** - * API name: {@code name} - */ - public final BuilderT name(String value) { - this.name = value; - return self(); - } - - /** - * API name: {@code roles} - *

- * Adds all elements of list to roles. - */ - public final BuilderT roles(List list) { - this.roles = _listAddAll(this.roles, list); - return self(); - } - - /** - * API name: {@code roles} - *

- * Adds one or more values to roles. - */ - public final BuilderT roles(NodeRole value, NodeRole... values) { - this.roles = _listAdd(this.roles, value, values); - return self(); - } - - /** - * API name: {@code transport_address} - */ - public final BuilderT transportAddress(String value) { - this.transportAddress = value; - return self(); - } - - protected abstract BuilderT self(); - - } - - // --------------------------------------------------------------------------------------------- - protected static > void setupBaseNodeDeserializer( - ObjectDeserializer op) { - - op.add(AbstractBuilder::attributes, - JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "attributes"); - op.add(AbstractBuilder::host, JsonpDeserializer.stringDeserializer(), "host"); - op.add(AbstractBuilder::ip, JsonpDeserializer.stringDeserializer(), "ip"); - op.add(AbstractBuilder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(AbstractBuilder::roles, JsonpDeserializer.arrayDeserializer(NodeRole._DESERIALIZER), "roles"); - op.add(AbstractBuilder::transportAddress, JsonpDeserializer.stringDeserializer(), "transport_address"); - - } + private final Map attributes; + + private final String host; + + private final String ip; + + private final String name; + + private final List roles; + + private final String transportAddress; + + // --------------------------------------------------------------------------------------------- + + protected BaseNode(AbstractBuilder builder) { + + this.attributes = ApiTypeHelper.unmodifiable(builder.attributes); + this.host = builder.host; + this.ip = builder.ip; + this.name = builder.name; + this.roles = ApiTypeHelper.unmodifiable(builder.roles); + this.transportAddress = builder.transportAddress; + + } + + /** + * API name: {@code attributes} + */ + public final Map attributes() { + return this.attributes; + } + + /** + * API name: {@code host} + */ + public final String host() { + return this.host; + } + + /** + * API name: {@code ip} + */ + public final String ip() { + return this.ip; + } + + /** + * API name: {@code name} + */ + public final String name() { + return this.name; + } + + /** + * API name: {@code roles} + */ + public final List roles() { + return this.roles; + } + + /** + * API name: {@code transport_address} + */ + public final String transportAddress() { + return this.transportAddress; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (ApiTypeHelper.isDefined(this.attributes)) { + generator.writeKey("attributes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.attributes.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + + } + generator.writeEnd(); + + } + generator.writeKey("host"); + generator.write(this.host); + + generator.writeKey("ip"); + generator.write(this.ip); + + generator.writeKey("name"); + generator.write(this.name); + + if (ApiTypeHelper.isDefined(this.roles)) { + generator.writeKey("roles"); + generator.writeStartArray(); + for (NodeRole item0 : this.roles) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + + } + generator.writeKey("transport_address"); + generator.write(this.transportAddress); + + } + + protected abstract static class AbstractBuilder> extends ObjectBuilderBase { + @Nullable + private Map attributes; + + @Nullable + private String host; + + @Nullable + private String ip; + + @Nullable + private String name; + + @Nullable + private List roles; + + @Nullable + private String transportAddress; + + /** + * API name: {@code attributes} + *

+ * Adds all entries of map to attributes. + */ + public final BuilderT attributes(Map map) { + this.attributes = _mapPutAll(this.attributes, map); + return self(); + } + + /** + * API name: {@code attributes} + *

+ * Adds an entry to attributes. + */ + public final BuilderT attributes(String key, String value) { + this.attributes = _mapPut(this.attributes, key, value); + return self(); + } + + /** + * API name: {@code host} + */ + public final BuilderT host(String value) { + this.host = value; + return self(); + } + + /** + * API name: {@code ip} + */ + public final BuilderT ip(String value) { + this.ip = value; + return self(); + } + + /** + * API name: {@code name} + */ + public final BuilderT name(String value) { + this.name = value; + return self(); + } + + /** + * API name: {@code roles} + *

+ * Adds all elements of list to roles. + */ + public final BuilderT roles(List list) { + this.roles = _listAddAll(this.roles, list); + return self(); + } + + /** + * API name: {@code roles} + *

+ * Adds one or more values to roles. + */ + public final BuilderT roles(NodeRole value, NodeRole... values) { + this.roles = _listAdd(this.roles, value, values); + return self(); + } + + /** + * API name: {@code transport_address} + */ + public final BuilderT transportAddress(String value) { + this.transportAddress = value; + return self(); + } + + protected abstract BuilderT self(); + + } + + // --------------------------------------------------------------------------------------------- + protected static > void setupBaseNodeDeserializer(ObjectDeserializer op) { + + op.add(AbstractBuilder::attributes, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "attributes"); + op.add(AbstractBuilder::host, JsonpDeserializer.stringDeserializer(), "host"); + op.add(AbstractBuilder::ip, JsonpDeserializer.stringDeserializer(), "ip"); + op.add(AbstractBuilder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(AbstractBuilder::roles, JsonpDeserializer.arrayDeserializer(NodeRole._DESERIALIZER), "roles"); + op.add(AbstractBuilder::transportAddress, JsonpDeserializer.stringDeserializer(), "transport_address"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/BulkIndexByScrollFailure.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/BulkIndexByScrollFailure.java index 183b486e8c..4718d336ab 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/BulkIndexByScrollFailure.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/BulkIndexByScrollFailure.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,196 +43,195 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; // typedef: _types.BulkIndexByScrollFailure @JsonpDeserializable public class BulkIndexByScrollFailure implements JsonpSerializable { - private final ErrorCause cause; + private final ErrorCause cause; - private final String id; + private final String id; - private final String index; + private final String index; - private final int status; + private final int status; - private final String type; + private final String type; - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - private BulkIndexByScrollFailure(Builder builder) { + private BulkIndexByScrollFailure(Builder builder) { - this.cause = ApiTypeHelper.requireNonNull(builder.cause, this, "cause"); - this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); - this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); - this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); + this.cause = ApiTypeHelper.requireNonNull(builder.cause, this, "cause"); + this.id = ApiTypeHelper.requireNonNull(builder.id, this, "id"); + this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); + this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - } + } - public static BulkIndexByScrollFailure of(Function> fn) { - return fn.apply(new Builder()).build(); - } + public static BulkIndexByScrollFailure of(Function> fn) { + return fn.apply(new Builder()).build(); + } - /** - * Required - API name: {@code cause} - */ - public final ErrorCause cause() { - return this.cause; - } + /** + * Required - API name: {@code cause} + */ + public final ErrorCause cause() { + return this.cause; + } - /** - * Required - API name: {@code id} - */ - public final String id() { - return this.id; - } - - /** - * Required - API name: {@code index} - */ - public final String index() { - return this.index; - } - - /** - * Required - API name: {@code status} - */ - public final int status() { - return this.status; - } - - /** - * Required - API name: {@code type} - */ - public final String type() { - return this.type; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("cause"); - this.cause.serialize(generator, mapper); - - generator.writeKey("id"); - generator.write(this.id); - - generator.writeKey("index"); - generator.write(this.index); - - generator.writeKey("status"); - generator.write(this.status); - - generator.writeKey("type"); - generator.write(this.type); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link BulkIndexByScrollFailure}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private ErrorCause cause; - - private String id; - - private String index; - - private Integer status; - - private String type; - - /** - * Required - API name: {@code cause} - */ - public final Builder cause(ErrorCause value) { - this.cause = value; - return this; - } - - /** - * Required - API name: {@code cause} - */ - public final Builder cause(Function> fn) { - return this.cause(fn.apply(new ErrorCause.Builder()).build()); - } - - /** - * Required - API name: {@code id} - */ - public final Builder id(String value) { - this.id = value; - return this; - } - - /** - * Required - API name: {@code index} - */ - public final Builder index(String value) { - this.index = value; - return this; - } - - /** - * Required - API name: {@code status} - */ - public final Builder status(int value) { - this.status = value; - return this; - } - - /** - * Required - API name: {@code type} - */ - public final Builder type(String value) { - this.type = value; - return this; - } - - /** - * Builds a {@link BulkIndexByScrollFailure}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public BulkIndexByScrollFailure build() { - _checkSingleUse(); - - return new BulkIndexByScrollFailure(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link BulkIndexByScrollFailure} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, BulkIndexByScrollFailure::setupBulkIndexByScrollFailureDeserializer); - - protected static void setupBulkIndexByScrollFailureDeserializer( - ObjectDeserializer op) { - - op.add(Builder::cause, ErrorCause._DESERIALIZER, "cause"); - op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); - op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); - op.add(Builder::status, JsonpDeserializer.integerDeserializer(), "status"); - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); - - } + /** + * Required - API name: {@code id} + */ + public final String id() { + return this.id; + } + + /** + * Required - API name: {@code index} + */ + public final String index() { + return this.index; + } + + /** + * Required - API name: {@code status} + */ + public final int status() { + return this.status; + } + + /** + * Required - API name: {@code type} + */ + public final String type() { + return this.type; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("cause"); + this.cause.serialize(generator, mapper); + + generator.writeKey("id"); + generator.write(this.id); + + generator.writeKey("index"); + generator.write(this.index); + + generator.writeKey("status"); + generator.write(this.status); + + generator.writeKey("type"); + generator.write(this.type); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link BulkIndexByScrollFailure}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private ErrorCause cause; + + private String id; + + private String index; + + private Integer status; + + private String type; + + /** + * Required - API name: {@code cause} + */ + public final Builder cause(ErrorCause value) { + this.cause = value; + return this; + } + + /** + * Required - API name: {@code cause} + */ + public final Builder cause(Function> fn) { + return this.cause(fn.apply(new ErrorCause.Builder()).build()); + } + + /** + * Required - API name: {@code id} + */ + public final Builder id(String value) { + this.id = value; + return this; + } + + /** + * Required - API name: {@code index} + */ + public final Builder index(String value) { + this.index = value; + return this; + } + + /** + * Required - API name: {@code status} + */ + public final Builder status(int value) { + this.status = value; + return this; + } + + /** + * Required - API name: {@code type} + */ + public final Builder type(String value) { + this.type = value; + return this; + } + + /** + * Builds a {@link BulkIndexByScrollFailure}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public BulkIndexByScrollFailure build() { + _checkSingleUse(); + + return new BulkIndexByScrollFailure(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link BulkIndexByScrollFailure} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + BulkIndexByScrollFailure::setupBulkIndexByScrollFailureDeserializer + ); + + protected static void setupBulkIndexByScrollFailureDeserializer(ObjectDeserializer op) { + + op.add(Builder::cause, ErrorCause._DESERIALIZER, "cause"); + op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); + op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); + op.add(Builder::status, JsonpDeserializer.integerDeserializer(), "status"); + op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/BulkStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/BulkStats.java index 6cf3fb2dd0..ab174f1dcf 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/BulkStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/BulkStats.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,306 +44,304 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; - -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.BulkStats @JsonpDeserializable public class BulkStats implements JsonpSerializable { - private final long totalOperations; - - @Nullable - private final String totalTime; - - private final long totalTimeInMillis; - - @Nullable - private final String totalSize; - - private final long totalSizeInBytes; - - @Nullable - private final String avgTime; - - private final long avgTimeInMillis; - - @Nullable - private final String avgSize; - - private final long avgSizeInBytes; - - // --------------------------------------------------------------------------------------------- - - private BulkStats(Builder builder) { - - this.totalOperations = ApiTypeHelper.requireNonNull(builder.totalOperations, this, "totalOperations"); - this.totalTime = builder.totalTime; - this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); - this.totalSize = builder.totalSize; - this.totalSizeInBytes = ApiTypeHelper.requireNonNull(builder.totalSizeInBytes, this, "totalSizeInBytes"); - this.avgTime = builder.avgTime; - this.avgTimeInMillis = ApiTypeHelper.requireNonNull(builder.avgTimeInMillis, this, "avgTimeInMillis"); - this.avgSize = builder.avgSize; - this.avgSizeInBytes = ApiTypeHelper.requireNonNull(builder.avgSizeInBytes, this, "avgSizeInBytes"); - - } - - public static BulkStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code total_operations} - */ - public final long totalOperations() { - return this.totalOperations; - } - - /** - * API name: {@code total_time} - */ - @Nullable - public final String totalTime() { - return this.totalTime; - } - - /** - * Required - API name: {@code total_time_in_millis} - */ - public final long totalTimeInMillis() { - return this.totalTimeInMillis; - } - - /** - * API name: {@code total_size} - */ - @Nullable - public final String totalSize() { - return this.totalSize; - } - - /** - * Required - API name: {@code total_size_in_bytes} - */ - public final long totalSizeInBytes() { - return this.totalSizeInBytes; - } - - /** - * API name: {@code avg_time} - */ - @Nullable - public final String avgTime() { - return this.avgTime; - } + private final long totalOperations; + + @Nullable + private final String totalTime; + + private final long totalTimeInMillis; + + @Nullable + private final String totalSize; + + private final long totalSizeInBytes; + + @Nullable + private final String avgTime; + + private final long avgTimeInMillis; + + @Nullable + private final String avgSize; + + private final long avgSizeInBytes; + + // --------------------------------------------------------------------------------------------- + + private BulkStats(Builder builder) { + + this.totalOperations = ApiTypeHelper.requireNonNull(builder.totalOperations, this, "totalOperations"); + this.totalTime = builder.totalTime; + this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); + this.totalSize = builder.totalSize; + this.totalSizeInBytes = ApiTypeHelper.requireNonNull(builder.totalSizeInBytes, this, "totalSizeInBytes"); + this.avgTime = builder.avgTime; + this.avgTimeInMillis = ApiTypeHelper.requireNonNull(builder.avgTimeInMillis, this, "avgTimeInMillis"); + this.avgSize = builder.avgSize; + this.avgSizeInBytes = ApiTypeHelper.requireNonNull(builder.avgSizeInBytes, this, "avgSizeInBytes"); + + } + + public static BulkStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code total_operations} + */ + public final long totalOperations() { + return this.totalOperations; + } + + /** + * API name: {@code total_time} + */ + @Nullable + public final String totalTime() { + return this.totalTime; + } + + /** + * Required - API name: {@code total_time_in_millis} + */ + public final long totalTimeInMillis() { + return this.totalTimeInMillis; + } + + /** + * API name: {@code total_size} + */ + @Nullable + public final String totalSize() { + return this.totalSize; + } + + /** + * Required - API name: {@code total_size_in_bytes} + */ + public final long totalSizeInBytes() { + return this.totalSizeInBytes; + } + + /** + * API name: {@code avg_time} + */ + @Nullable + public final String avgTime() { + return this.avgTime; + } - /** - * Required - API name: {@code avg_time_in_millis} - */ - public final long avgTimeInMillis() { - return this.avgTimeInMillis; - } - - /** - * API name: {@code avg_size} - */ - @Nullable - public final String avgSize() { - return this.avgSize; - } - - /** - * Required - API name: {@code avg_size_in_bytes} - */ - public final long avgSizeInBytes() { - return this.avgSizeInBytes; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("total_operations"); - generator.write(this.totalOperations); - - if (this.totalTime != null) { - generator.writeKey("total_time"); - generator.write(this.totalTime); - - } - generator.writeKey("total_time_in_millis"); - generator.write(this.totalTimeInMillis); - - if (this.totalSize != null) { - generator.writeKey("total_size"); - generator.write(this.totalSize); - - } - generator.writeKey("total_size_in_bytes"); - generator.write(this.totalSizeInBytes); - - if (this.avgTime != null) { - generator.writeKey("avg_time"); - generator.write(this.avgTime); - - } - generator.writeKey("avg_time_in_millis"); - generator.write(this.avgTimeInMillis); - - if (this.avgSize != null) { - generator.writeKey("avg_size"); - generator.write(this.avgSize); - - } - generator.writeKey("avg_size_in_bytes"); - generator.write(this.avgSizeInBytes); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link BulkStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long totalOperations; - - @Nullable - private String totalTime; - - private Long totalTimeInMillis; - - @Nullable - private String totalSize; - - private Long totalSizeInBytes; - - @Nullable - private String avgTime; - - private Long avgTimeInMillis; - - @Nullable - private String avgSize; - - private Long avgSizeInBytes; - - /** - * Required - API name: {@code total_operations} - */ - public final Builder totalOperations(long value) { - this.totalOperations = value; - return this; - } - - /** - * API name: {@code total_time} - */ - public final Builder totalTime(@Nullable String value) { - this.totalTime = value; - return this; - } - - /** - * Required - API name: {@code total_time_in_millis} - */ - public final Builder totalTimeInMillis(long value) { - this.totalTimeInMillis = value; - return this; - } - - /** - * API name: {@code total_size} - */ - public final Builder totalSize(@Nullable String value) { - this.totalSize = value; - return this; - } - - /** - * Required - API name: {@code total_size_in_bytes} - */ - public final Builder totalSizeInBytes(long value) { - this.totalSizeInBytes = value; - return this; - } - - /** - * API name: {@code avg_time} - */ - public final Builder avgTime(@Nullable String value) { - this.avgTime = value; - return this; - } - - /** - * Required - API name: {@code avg_time_in_millis} - */ - public final Builder avgTimeInMillis(long value) { - this.avgTimeInMillis = value; - return this; - } - - /** - * API name: {@code avg_size} - */ - public final Builder avgSize(@Nullable String value) { - this.avgSize = value; - return this; - } - - /** - * Required - API name: {@code avg_size_in_bytes} - */ - public final Builder avgSizeInBytes(long value) { - this.avgSizeInBytes = value; - return this; - } - - /** - * Builds a {@link BulkStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public BulkStats build() { - _checkSingleUse(); - - return new BulkStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link BulkStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - BulkStats::setupBulkStatsDeserializer); - - protected static void setupBulkStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::totalOperations, JsonpDeserializer.longDeserializer(), "total_operations"); - op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); - op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); - op.add(Builder::totalSize, JsonpDeserializer.stringDeserializer(), "total_size"); - op.add(Builder::totalSizeInBytes, JsonpDeserializer.longDeserializer(), "total_size_in_bytes"); - op.add(Builder::avgTime, JsonpDeserializer.stringDeserializer(), "avg_time"); - op.add(Builder::avgTimeInMillis, JsonpDeserializer.longDeserializer(), "avg_time_in_millis"); - op.add(Builder::avgSize, JsonpDeserializer.stringDeserializer(), "avg_size"); - op.add(Builder::avgSizeInBytes, JsonpDeserializer.longDeserializer(), "avg_size_in_bytes"); - - } + /** + * Required - API name: {@code avg_time_in_millis} + */ + public final long avgTimeInMillis() { + return this.avgTimeInMillis; + } + + /** + * API name: {@code avg_size} + */ + @Nullable + public final String avgSize() { + return this.avgSize; + } + + /** + * Required - API name: {@code avg_size_in_bytes} + */ + public final long avgSizeInBytes() { + return this.avgSizeInBytes; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("total_operations"); + generator.write(this.totalOperations); + + if (this.totalTime != null) { + generator.writeKey("total_time"); + generator.write(this.totalTime); + + } + generator.writeKey("total_time_in_millis"); + generator.write(this.totalTimeInMillis); + + if (this.totalSize != null) { + generator.writeKey("total_size"); + generator.write(this.totalSize); + + } + generator.writeKey("total_size_in_bytes"); + generator.write(this.totalSizeInBytes); + + if (this.avgTime != null) { + generator.writeKey("avg_time"); + generator.write(this.avgTime); + + } + generator.writeKey("avg_time_in_millis"); + generator.write(this.avgTimeInMillis); + + if (this.avgSize != null) { + generator.writeKey("avg_size"); + generator.write(this.avgSize); + + } + generator.writeKey("avg_size_in_bytes"); + generator.write(this.avgSizeInBytes); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link BulkStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long totalOperations; + + @Nullable + private String totalTime; + + private Long totalTimeInMillis; + + @Nullable + private String totalSize; + + private Long totalSizeInBytes; + + @Nullable + private String avgTime; + + private Long avgTimeInMillis; + + @Nullable + private String avgSize; + + private Long avgSizeInBytes; + + /** + * Required - API name: {@code total_operations} + */ + public final Builder totalOperations(long value) { + this.totalOperations = value; + return this; + } + + /** + * API name: {@code total_time} + */ + public final Builder totalTime(@Nullable String value) { + this.totalTime = value; + return this; + } + + /** + * Required - API name: {@code total_time_in_millis} + */ + public final Builder totalTimeInMillis(long value) { + this.totalTimeInMillis = value; + return this; + } + + /** + * API name: {@code total_size} + */ + public final Builder totalSize(@Nullable String value) { + this.totalSize = value; + return this; + } + + /** + * Required - API name: {@code total_size_in_bytes} + */ + public final Builder totalSizeInBytes(long value) { + this.totalSizeInBytes = value; + return this; + } + + /** + * API name: {@code avg_time} + */ + public final Builder avgTime(@Nullable String value) { + this.avgTime = value; + return this; + } + + /** + * Required - API name: {@code avg_time_in_millis} + */ + public final Builder avgTimeInMillis(long value) { + this.avgTimeInMillis = value; + return this; + } + + /** + * API name: {@code avg_size} + */ + public final Builder avgSize(@Nullable String value) { + this.avgSize = value; + return this; + } + + /** + * Required - API name: {@code avg_size_in_bytes} + */ + public final Builder avgSizeInBytes(long value) { + this.avgSizeInBytes = value; + return this; + } + + /** + * Builds a {@link BulkStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public BulkStats build() { + _checkSingleUse(); + + return new BulkStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link BulkStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + BulkStats::setupBulkStatsDeserializer + ); + + protected static void setupBulkStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::totalOperations, JsonpDeserializer.longDeserializer(), "total_operations"); + op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); + op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); + op.add(Builder::totalSize, JsonpDeserializer.stringDeserializer(), "total_size"); + op.add(Builder::totalSizeInBytes, JsonpDeserializer.longDeserializer(), "total_size_in_bytes"); + op.add(Builder::avgTime, JsonpDeserializer.stringDeserializer(), "avg_time"); + op.add(Builder::avgTimeInMillis, JsonpDeserializer.longDeserializer(), "avg_time_in_millis"); + op.add(Builder::avgSize, JsonpDeserializer.stringDeserializer(), "avg_size"); + op.add(Builder::avgSizeInBytes, JsonpDeserializer.longDeserializer(), "avg_size_in_bytes"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Bytes.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Bytes.java index 5f3cf670f8..0d6077e653 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Bytes.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Bytes.java @@ -37,29 +37,29 @@ @JsonpDeserializable public enum Bytes implements JsonEnum { - Bytes("b"), + Bytes("b"), - KiloBytes("kb"), + KiloBytes("kb"), - MegaBytes("mb"), + MegaBytes("mb"), - GigaBytes("gb"), + GigaBytes("gb"), - TeraBytes("tb"), + TeraBytes("tb"), - PetaBytes("pb"), + PetaBytes("pb"), - ; + ; - private final String jsonValue; + private final String jsonValue; - Bytes(String jsonValue) { - this.jsonValue = jsonValue; - } + Bytes(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Bytes.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Bytes.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ClusterStatistics.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ClusterStatistics.java index 1c3bd5fa9a..025ebbe097 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ClusterStatistics.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ClusterStatistics.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,140 +43,140 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; // typedef: _types.ClusterStatistics @JsonpDeserializable public class ClusterStatistics implements JsonpSerializable { - private final int skipped; - - private final int successful; - - private final int total; - - // --------------------------------------------------------------------------------------------- - - private ClusterStatistics(Builder builder) { - - this.skipped = ApiTypeHelper.requireNonNull(builder.skipped, this, "skipped"); - this.successful = ApiTypeHelper.requireNonNull(builder.successful, this, "successful"); - this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); - - } - - public static ClusterStatistics of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code skipped} - */ - public final int skipped() { - return this.skipped; - } + private final int skipped; - /** - * Required - API name: {@code successful} - */ - public final int successful() { - return this.successful; - } - - /** - * Required - API name: {@code total} - */ - public final int total() { - return this.total; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("skipped"); - generator.write(this.skipped); - - generator.writeKey("successful"); - generator.write(this.successful); - - generator.writeKey("total"); - generator.write(this.total); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ClusterStatistics}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Integer skipped; - - private Integer successful; - - private Integer total; - - /** - * Required - API name: {@code skipped} - */ - public final Builder skipped(int value) { - this.skipped = value; - return this; - } - - /** - * Required - API name: {@code successful} - */ - public final Builder successful(int value) { - this.successful = value; - return this; - } - - /** - * Required - API name: {@code total} - */ - public final Builder total(int value) { - this.total = value; - return this; - } - - /** - * Builds a {@link ClusterStatistics}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ClusterStatistics build() { - _checkSingleUse(); - - return new ClusterStatistics(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ClusterStatistics} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, ClusterStatistics::setupClusterStatisticsDeserializer); - - protected static void setupClusterStatisticsDeserializer(ObjectDeserializer op) { - - op.add(Builder::skipped, JsonpDeserializer.integerDeserializer(), "skipped"); - op.add(Builder::successful, JsonpDeserializer.integerDeserializer(), "successful"); - op.add(Builder::total, JsonpDeserializer.integerDeserializer(), "total"); - - } + private final int successful; + + private final int total; + + // --------------------------------------------------------------------------------------------- + + private ClusterStatistics(Builder builder) { + + this.skipped = ApiTypeHelper.requireNonNull(builder.skipped, this, "skipped"); + this.successful = ApiTypeHelper.requireNonNull(builder.successful, this, "successful"); + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); + + } + + public static ClusterStatistics of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code skipped} + */ + public final int skipped() { + return this.skipped; + } + + /** + * Required - API name: {@code successful} + */ + public final int successful() { + return this.successful; + } + + /** + * Required - API name: {@code total} + */ + public final int total() { + return this.total; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("skipped"); + generator.write(this.skipped); + + generator.writeKey("successful"); + generator.write(this.successful); + + generator.writeKey("total"); + generator.write(this.total); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ClusterStatistics}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Integer skipped; + + private Integer successful; + + private Integer total; + + /** + * Required - API name: {@code skipped} + */ + public final Builder skipped(int value) { + this.skipped = value; + return this; + } + + /** + * Required - API name: {@code successful} + */ + public final Builder successful(int value) { + this.successful = value; + return this; + } + + /** + * Required - API name: {@code total} + */ + public final Builder total(int value) { + this.total = value; + return this; + } + + /** + * Builds a {@link ClusterStatistics}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ClusterStatistics build() { + _checkSingleUse(); + + return new ClusterStatistics(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ClusterStatistics} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ClusterStatistics::setupClusterStatisticsDeserializer + ); + + protected static void setupClusterStatisticsDeserializer(ObjectDeserializer op) { + + op.add(Builder::skipped, JsonpDeserializer.integerDeserializer(), "skipped"); + op.add(Builder::successful, JsonpDeserializer.integerDeserializer(), "successful"); + op.add(Builder::total, JsonpDeserializer.integerDeserializer(), "total"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/CompletionStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/CompletionStats.java index d375f28eab..85a4f4c1d3 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/CompletionStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/CompletionStats.java @@ -32,6 +32,10 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,178 +45,176 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Map; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.CompletionStats @JsonpDeserializable public class CompletionStats implements JsonpSerializable { - private final long sizeInBytes; + private final long sizeInBytes; - @Nullable - private final String size; - - private final Map fields; + @Nullable + private final String size; + + private final Map fields; - // --------------------------------------------------------------------------------------------- - - private CompletionStats(Builder builder) { - - this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); - this.size = builder.size; - this.fields = ApiTypeHelper.unmodifiable(builder.fields); - - } - - public static CompletionStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code size_in_bytes} - */ - public final long sizeInBytes() { - return this.sizeInBytes; - } - - /** - * API name: {@code size} - */ - @Nullable - public final String size() { - return this.size; - } - - /** - * API name: {@code fields} - */ - public final Map fields() { - return this.fields; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("size_in_bytes"); - generator.write(this.sizeInBytes); - - if (this.size != null) { - generator.writeKey("size"); - generator.write(this.size); - - } - if (ApiTypeHelper.isDefined(this.fields)) { - generator.writeKey("fields"); - generator.writeStartObject(); - for (Map.Entry item0 : this.fields.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link CompletionStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long sizeInBytes; - - @Nullable - private String size; - - @Nullable - private Map fields; - - /** - * Required - API name: {@code size_in_bytes} - */ - public final Builder sizeInBytes(long value) { - this.sizeInBytes = value; - return this; - } - - /** - * API name: {@code size} - */ - public final Builder size(@Nullable String value) { - this.size = value; - return this; - } - - /** - * API name: {@code fields} - *

- * Adds all entries of map to fields. - */ - public final Builder fields(Map map) { - this.fields = _mapPutAll(this.fields, map); - return this; - } - - /** - * API name: {@code fields} - *

- * Adds an entry to fields. - */ - public final Builder fields(String key, FieldSizeUsage value) { - this.fields = _mapPut(this.fields, key, value); - return this; - } - - /** - * API name: {@code fields} - *

- * Adds an entry to fields using a builder lambda. - */ - public final Builder fields(String key, Function> fn) { - return fields(key, fn.apply(new FieldSizeUsage.Builder()).build()); - } - - /** - * Builds a {@link CompletionStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public CompletionStats build() { - _checkSingleUse(); - - return new CompletionStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link CompletionStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - CompletionStats::setupCompletionStatsDeserializer); - - protected static void setupCompletionStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); - op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size"); - op.add(Builder::fields, JsonpDeserializer.stringMapDeserializer(FieldSizeUsage._DESERIALIZER), "fields"); - - } + // --------------------------------------------------------------------------------------------- + + private CompletionStats(Builder builder) { + + this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); + this.size = builder.size; + this.fields = ApiTypeHelper.unmodifiable(builder.fields); + + } + + public static CompletionStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code size_in_bytes} + */ + public final long sizeInBytes() { + return this.sizeInBytes; + } + + /** + * API name: {@code size} + */ + @Nullable + public final String size() { + return this.size; + } + + /** + * API name: {@code fields} + */ + public final Map fields() { + return this.fields; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("size_in_bytes"); + generator.write(this.sizeInBytes); + + if (this.size != null) { + generator.writeKey("size"); + generator.write(this.size); + + } + if (ApiTypeHelper.isDefined(this.fields)) { + generator.writeKey("fields"); + generator.writeStartObject(); + for (Map.Entry item0 : this.fields.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link CompletionStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long sizeInBytes; + + @Nullable + private String size; + + @Nullable + private Map fields; + + /** + * Required - API name: {@code size_in_bytes} + */ + public final Builder sizeInBytes(long value) { + this.sizeInBytes = value; + return this; + } + + /** + * API name: {@code size} + */ + public final Builder size(@Nullable String value) { + this.size = value; + return this; + } + + /** + * API name: {@code fields} + *

+ * Adds all entries of map to fields. + */ + public final Builder fields(Map map) { + this.fields = _mapPutAll(this.fields, map); + return this; + } + + /** + * API name: {@code fields} + *

+ * Adds an entry to fields. + */ + public final Builder fields(String key, FieldSizeUsage value) { + this.fields = _mapPut(this.fields, key, value); + return this; + } + + /** + * API name: {@code fields} + *

+ * Adds an entry to fields using a builder lambda. + */ + public final Builder fields(String key, Function> fn) { + return fields(key, fn.apply(new FieldSizeUsage.Builder()).build()); + } + + /** + * Builds a {@link CompletionStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public CompletionStats build() { + _checkSingleUse(); + + return new CompletionStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CompletionStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + CompletionStats::setupCompletionStatsDeserializer + ); + + protected static void setupCompletionStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); + op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size"); + op.add(Builder::fields, JsonpDeserializer.stringMapDeserializer(FieldSizeUsage._DESERIALIZER), "fields"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Conflicts.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Conflicts.java index 7bd42f6bc9..dc551c5d2a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Conflicts.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Conflicts.java @@ -37,22 +37,21 @@ @JsonpDeserializable public enum Conflicts implements JsonEnum { - Abort("abort"), + Abort("abort"), - Proceed("proceed"), + Proceed("proceed"), - ; + ; - private final String jsonValue; + private final String jsonValue; - Conflicts(String jsonValue) { - this.jsonValue = jsonValue; - } + Conflicts(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - Conflicts.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Conflicts.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/CoordsGeoBounds.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/CoordsGeoBounds.java index dd7db05815..0551e8642c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/CoordsGeoBounds.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/CoordsGeoBounds.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,164 +43,164 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; // typedef: _types.CoordsGeoBounds @JsonpDeserializable public class CoordsGeoBounds implements JsonpSerializable { - private final double top; + private final double top; - private final double bottom; + private final double bottom; - private final double left; + private final double left; - private final double right; + private final double right; - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - private CoordsGeoBounds(Builder builder) { + private CoordsGeoBounds(Builder builder) { - this.top = ApiTypeHelper.requireNonNull(builder.top, this, "top"); - this.bottom = ApiTypeHelper.requireNonNull(builder.bottom, this, "bottom"); - this.left = ApiTypeHelper.requireNonNull(builder.left, this, "left"); - this.right = ApiTypeHelper.requireNonNull(builder.right, this, "right"); + this.top = ApiTypeHelper.requireNonNull(builder.top, this, "top"); + this.bottom = ApiTypeHelper.requireNonNull(builder.bottom, this, "bottom"); + this.left = ApiTypeHelper.requireNonNull(builder.left, this, "left"); + this.right = ApiTypeHelper.requireNonNull(builder.right, this, "right"); - } + } - public static CoordsGeoBounds of(Function> fn) { - return fn.apply(new Builder()).build(); - } + public static CoordsGeoBounds of(Function> fn) { + return fn.apply(new Builder()).build(); + } - /** - * Required - API name: {@code top} - */ - public final double top() { - return this.top; - } - - /** - * Required - API name: {@code bottom} - */ - public final double bottom() { - return this.bottom; - } - - /** - * Required - API name: {@code left} - */ - public final double left() { - return this.left; - } - - /** - * Required - API name: {@code right} - */ - public final double right() { - return this.right; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("top"); - generator.write(this.top); - - generator.writeKey("bottom"); - generator.write(this.bottom); - - generator.writeKey("left"); - generator.write(this.left); - - generator.writeKey("right"); - generator.write(this.right); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link CoordsGeoBounds}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Double top; - - private Double bottom; - - private Double left; - - private Double right; - - /** - * Required - API name: {@code top} - */ - public final Builder top(double value) { - this.top = value; - return this; - } - - /** - * Required - API name: {@code bottom} - */ - public final Builder bottom(double value) { - this.bottom = value; - return this; - } - - /** - * Required - API name: {@code left} - */ - public final Builder left(double value) { - this.left = value; - return this; - } - - /** - * Required - API name: {@code right} - */ - public final Builder right(double value) { - this.right = value; - return this; - } - - /** - * Builds a {@link CoordsGeoBounds}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public CoordsGeoBounds build() { - _checkSingleUse(); - - return new CoordsGeoBounds(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link CoordsGeoBounds} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - CoordsGeoBounds::setupCoordsGeoBoundsDeserializer); - - protected static void setupCoordsGeoBoundsDeserializer(ObjectDeserializer op) { - - op.add(Builder::top, JsonpDeserializer.doubleDeserializer(), "top"); - op.add(Builder::bottom, JsonpDeserializer.doubleDeserializer(), "bottom"); - op.add(Builder::left, JsonpDeserializer.doubleDeserializer(), "left"); - op.add(Builder::right, JsonpDeserializer.doubleDeserializer(), "right"); - - } + /** + * Required - API name: {@code top} + */ + public final double top() { + return this.top; + } + + /** + * Required - API name: {@code bottom} + */ + public final double bottom() { + return this.bottom; + } + + /** + * Required - API name: {@code left} + */ + public final double left() { + return this.left; + } + + /** + * Required - API name: {@code right} + */ + public final double right() { + return this.right; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("top"); + generator.write(this.top); + + generator.writeKey("bottom"); + generator.write(this.bottom); + + generator.writeKey("left"); + generator.write(this.left); + + generator.writeKey("right"); + generator.write(this.right); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link CoordsGeoBounds}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Double top; + + private Double bottom; + + private Double left; + + private Double right; + + /** + * Required - API name: {@code top} + */ + public final Builder top(double value) { + this.top = value; + return this; + } + + /** + * Required - API name: {@code bottom} + */ + public final Builder bottom(double value) { + this.bottom = value; + return this; + } + + /** + * Required - API name: {@code left} + */ + public final Builder left(double value) { + this.left = value; + return this; + } + + /** + * Required - API name: {@code right} + */ + public final Builder right(double value) { + this.right = value; + return this; + } + + /** + * Builds a {@link CoordsGeoBounds}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public CoordsGeoBounds build() { + _checkSingleUse(); + + return new CoordsGeoBounds(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link CoordsGeoBounds} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + CoordsGeoBounds::setupCoordsGeoBoundsDeserializer + ); + + protected static void setupCoordsGeoBoundsDeserializer(ObjectDeserializer op) { + + op.add(Builder::top, JsonpDeserializer.doubleDeserializer(), "top"); + op.add(Builder::bottom, JsonpDeserializer.doubleDeserializer(), "bottom"); + op.add(Builder::left, JsonpDeserializer.doubleDeserializer(), "left"); + op.add(Builder::right, JsonpDeserializer.doubleDeserializer(), "right"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/DistanceUnit.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/DistanceUnit.java index 89bfa132da..fa3511a98c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/DistanceUnit.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/DistanceUnit.java @@ -37,36 +37,35 @@ @JsonpDeserializable public enum DistanceUnit implements JsonEnum { - Inches("in"), + Inches("in"), - Feet("ft"), + Feet("ft"), - Yards("yd"), + Yards("yd"), - Miles("mi"), + Miles("mi"), - NauticMiles("nmi"), + NauticMiles("nmi"), - Kilometers("km"), + Kilometers("km"), - Meters("m"), + Meters("m"), - Centimeters("cm"), + Centimeters("cm"), - Millimeters("mm"), + Millimeters("mm"), - ; + ; - private final String jsonValue; + private final String jsonValue; - DistanceUnit(String jsonValue) { - this.jsonValue = jsonValue; - } + DistanceUnit(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - DistanceUnit.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(DistanceUnit.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/DocStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/DocStats.java index 9cd3381b5b..25f5f8a39f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/DocStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/DocStats.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,116 +43,116 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; // typedef: _types.DocStats @JsonpDeserializable public class DocStats implements JsonpSerializable { - private final long count; - - private final long deleted; - - // --------------------------------------------------------------------------------------------- + private final long count; - private DocStats(Builder builder) { + private final long deleted; + + // --------------------------------------------------------------------------------------------- - this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); - this.deleted = ApiTypeHelper.requireNonNull(builder.deleted, this, "deleted"); + private DocStats(Builder builder) { - } + this.count = ApiTypeHelper.requireNonNull(builder.count, this, "count"); + this.deleted = ApiTypeHelper.requireNonNull(builder.deleted, this, "deleted"); - public static DocStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } + } - /** - * Required - API name: {@code count} - */ - public final long count() { - return this.count; - } + public static DocStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } - /** - * Required - API name: {@code deleted} - */ - public final long deleted() { - return this.deleted; - } + /** + * Required - API name: {@code count} + */ + public final long count() { + return this.count; + } - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } + /** + * Required - API name: {@code deleted} + */ + public final long deleted() { + return this.deleted; + } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } - generator.writeKey("count"); - generator.write(this.count); + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("deleted"); - generator.write(this.deleted); + generator.writeKey("count"); + generator.write(this.count); - } + generator.writeKey("deleted"); + generator.write(this.deleted); - // --------------------------------------------------------------------------------------------- + } - /** - * Builder for {@link DocStats}. - */ + // --------------------------------------------------------------------------------------------- - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long count; + /** + * Builder for {@link DocStats}. + */ - private Long deleted; + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long count; - /** - * Required - API name: {@code count} - */ - public final Builder count(long value) { - this.count = value; - return this; - } + private Long deleted; - /** - * Required - API name: {@code deleted} - */ - public final Builder deleted(long value) { - this.deleted = value; - return this; - } + /** + * Required - API name: {@code count} + */ + public final Builder count(long value) { + this.count = value; + return this; + } - /** - * Builds a {@link DocStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public DocStats build() { - _checkSingleUse(); + /** + * Required - API name: {@code deleted} + */ + public final Builder deleted(long value) { + this.deleted = value; + return this; + } - return new DocStats(this); - } - } + /** + * Builds a {@link DocStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public DocStats build() { + _checkSingleUse(); - // --------------------------------------------------------------------------------------------- + return new DocStats(this); + } + } - /** - * Json deserializer for {@link DocStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - DocStats::setupDocStatsDeserializer); + // --------------------------------------------------------------------------------------------- - protected static void setupDocStatsDeserializer(ObjectDeserializer op) { + /** + * Json deserializer for {@link DocStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + DocStats::setupDocStatsDeserializer + ); - op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); - op.add(Builder::deleted, JsonpDeserializer.longDeserializer(), "deleted"); + protected static void setupDocStatsDeserializer(ObjectDeserializer op) { - } + op.add(Builder::count, JsonpDeserializer.longDeserializer(), "count"); + op.add(Builder::deleted, JsonpDeserializer.longDeserializer(), "deleted"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/EmptyObject.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/EmptyObject.java index a4de144e2f..2bac7df617 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/EmptyObject.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/EmptyObject.java @@ -32,41 +32,40 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; 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.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; /** * For empty Class assignments - * + * */ @JsonpDeserializable public class EmptyObject implements JsonpSerializable { - public static final class Builder implements ObjectBuilder { - @Override - public EmptyObject build() { - return EmptyObject._INSTANCE; - } - } + public static final class Builder implements ObjectBuilder { + @Override + public EmptyObject build() { + return EmptyObject._INSTANCE; + } + } - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - generator.writeEnd(); - } + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + generator.writeEnd(); + } - /** - * Singleton instance for empty class {@link EmptyObject}. - */ - public static final EmptyObject _INSTANCE = new EmptyObject(); + /** + * Singleton instance for empty class {@link EmptyObject}. + */ + public static final EmptyObject _INSTANCE = new EmptyObject(); - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .emptyObject(EmptyObject._INSTANCE); + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.emptyObject(EmptyObject._INSTANCE); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/EmptyTransform.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/EmptyTransform.java index 8baccedfaa..6d298b5a7c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/EmptyTransform.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/EmptyTransform.java @@ -32,37 +32,36 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; 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.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; @JsonpDeserializable public class EmptyTransform implements JsonpSerializable { - public static final class Builder implements ObjectBuilder { - @Override - public EmptyTransform build() { - return EmptyTransform._INSTANCE; - } - } + public static final class Builder implements ObjectBuilder { + @Override + public EmptyTransform build() { + return EmptyTransform._INSTANCE; + } + } - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - generator.writeEnd(); - } + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + generator.writeEnd(); + } - /** - * Singleton instance for empty class {@link EmptyTransform}. - */ - public static final EmptyTransform _INSTANCE = new EmptyTransform(); + /** + * Singleton instance for empty class {@link EmptyTransform}. + */ + public static final EmptyTransform _INSTANCE = new EmptyTransform(); - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .emptyObject(EmptyTransform._INSTANCE); + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.emptyObject(EmptyTransform._INSTANCE); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorCause.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorCause.java index c2b4b1cd13..469134d325 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorCause.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorCause.java @@ -32,6 +32,12 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -42,12 +48,6 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.ErrorCause @@ -58,342 +58,344 @@ */ @JsonpDeserializable public class ErrorCause implements JsonpSerializable { - private final Map metadata; - - private final String type; - - private final String reason; - - @Nullable - private final String stackTrace; - - @Nullable - private final ErrorCause causedBy; - - private final List rootCause; - - private final List suppressed; - - // --------------------------------------------------------------------------------------------- - - 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.rootCause = ApiTypeHelper.unmodifiable(builder.rootCause); - this.suppressed = ApiTypeHelper.unmodifiable(builder.suppressed); - - } - - public static ErrorCause of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Additional details about the error - */ - public final Map metadata() { - return this.metadata; - } - - /** - * Required - The type of error - *

- * API name: {@code type} - */ - public final String type() { - return this.type; - } - - /** - * Required - A human-readable explanation of the error, in english - *

- * API name: {@code reason} - */ - public final String reason() { - return this.reason; - } - - /** - * 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() { - return this.stackTrace; - } - - /** - * API name: {@code caused_by} - */ - @Nullable - public final ErrorCause causedBy() { - return this.causedBy; - } - - /** - * API name: {@code root_cause} - */ - public final List rootCause() { - return this.rootCause; - } - - /** - * API name: {@code suppressed} - */ - public final List suppressed() { - return this.suppressed; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - 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 (ApiTypeHelper.isDefined(this.rootCause)) { - generator.writeKey("root_cause"); - generator.writeStartArray(); - for (ErrorCause item0 : this.rootCause) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.suppressed)) { - generator.writeKey("suppressed"); - generator.writeStartArray(); - for (ErrorCause item0 : this.suppressed) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * 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 List rootCause; - - @Nullable - private List suppressed; - - /** - * Required - The type of error - *

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

- * API name: {@code reason} - */ - public final Builder reason(String value) { - this.reason = value; - return this; - } - - /** - * 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 caused_by} - */ - public final Builder causedBy(@Nullable ErrorCause value) { - this.causedBy = 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); - return this; - } - - /** - * 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); - return this; - } - - /** - * 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()); - } - - /** - * API name: {@code suppressed} - *

- * Adds all elements of list to suppressed. - */ - public final Builder suppressed(List list) { - this.suppressed = _listAddAll(this.suppressed, list); - return this; - } - - /** - * 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); - return this; - } - - /** - * 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()); - } - - /** - * Builds a {@link ErrorCause}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ErrorCause build() { - _checkSingleUse(); - - return new ErrorCause(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ErrorCause} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ErrorCause::setupErrorCauseDeserializer); - - 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::rootCause, JsonpDeserializer.arrayDeserializer(ErrorCause._DESERIALIZER), "root_cause"); - op.add(Builder::suppressed, JsonpDeserializer.arrayDeserializer(ErrorCause._DESERIALIZER), "suppressed"); - - op.setUnknownFieldHandler((builder, name, parser, mapper) -> { - if (builder.metadata == null) { - builder.metadata = new HashMap<>(); - } - builder.metadata.put(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); - }); - - } + private final Map metadata; + + private final String type; + + private final String reason; + + @Nullable + private final String stackTrace; + + @Nullable + private final ErrorCause causedBy; + + private final List rootCause; + + private final List suppressed; + + // --------------------------------------------------------------------------------------------- + + 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.rootCause = ApiTypeHelper.unmodifiable(builder.rootCause); + this.suppressed = ApiTypeHelper.unmodifiable(builder.suppressed); + + } + + public static ErrorCause of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Additional details about the error + */ + public final Map metadata() { + return this.metadata; + } + + /** + * Required - The type of error + *

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

+ * API name: {@code reason} + */ + public final String reason() { + return this.reason; + } + + /** + * 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() { + return this.stackTrace; + } + + /** + * API name: {@code caused_by} + */ + @Nullable + public final ErrorCause causedBy() { + return this.causedBy; + } + + /** + * API name: {@code root_cause} + */ + public final List rootCause() { + return this.rootCause; + } + + /** + * API name: {@code suppressed} + */ + public final List suppressed() { + return this.suppressed; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + 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 (ApiTypeHelper.isDefined(this.rootCause)) { + generator.writeKey("root_cause"); + generator.writeStartArray(); + for (ErrorCause item0 : this.rootCause) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.suppressed)) { + generator.writeKey("suppressed"); + generator.writeStartArray(); + for (ErrorCause item0 : this.suppressed) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * 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 List rootCause; + + @Nullable + private List suppressed; + + /** + * Required - The type of error + *

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

+ * API name: {@code reason} + */ + public final Builder reason(String value) { + this.reason = value; + return this; + } + + /** + * 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 caused_by} + */ + public final Builder causedBy(@Nullable ErrorCause value) { + this.causedBy = 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); + return this; + } + + /** + * 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); + return this; + } + + /** + * 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()); + } + + /** + * API name: {@code suppressed} + *

+ * Adds all elements of list to suppressed. + */ + public final Builder suppressed(List list) { + this.suppressed = _listAddAll(this.suppressed, list); + return this; + } + + /** + * 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); + return this; + } + + /** + * 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()); + } + + /** + * Builds a {@link ErrorCause}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ErrorCause build() { + _checkSingleUse(); + + return new ErrorCause(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ErrorCause} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ErrorCause::setupErrorCauseDeserializer + ); + + 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::rootCause, JsonpDeserializer.arrayDeserializer(ErrorCause._DESERIALIZER), "root_cause"); + op.add(Builder::suppressed, JsonpDeserializer.arrayDeserializer(ErrorCause._DESERIALIZER), "suppressed"); + + 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/ErrorResponse.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorResponse.java index 19d97fec9e..029d6a20c0 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorResponse.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorResponse.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,147 +44,146 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; - -import java.util.function.Function; // typedef: _types.ErrorResponseBase /** * The response returned by Elasticsearch when request execution did not * succeed. - * + * */ @JsonpDeserializable public class ErrorResponse implements JsonpSerializable { - private enum Kind { - OBJECT, - STRING - } - private final ErrorCause error; - - private final int status; - - // --------------------------------------------------------------------------------------------- - - private ErrorResponse(Builder builder) { - - this.error = ApiTypeHelper.requireNonNull(builder.error, this, "error"); - this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); - - } + private enum Kind { + OBJECT, + STRING + } + + private final ErrorCause error; + + private final int status; + + // --------------------------------------------------------------------------------------------- + + private ErrorResponse(Builder builder) { + + this.error = ApiTypeHelper.requireNonNull(builder.error, this, "error"); + this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + + } + + public static ErrorResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } - public static ErrorResponse of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code error} - */ - public final ErrorCause error() { - return this.error; - } - - /** - * Required - API name: {@code status} - */ - public final int status() { - return this.status; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("error"); - this.error.serialize(generator, mapper); - - generator.writeKey("status"); - generator.write(this.status); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ErrorResponse}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private ErrorCause error; - - private Integer status; - - /** - * Required - API name: {@code error} - */ - public final Builder error(ErrorCause value) { - this.error = value; - return this; - } - - /** - * Required - API name: {@code error} - */ - public final Builder error(Function> fn) { - return this.error(fn.apply(new ErrorCause.Builder()).build()); - } - - /** - * Required - API name: {@code status} - */ - public final Builder status(int value) { - this.status = value; - return this; - } - - /** - * Builds a {@link ErrorResponse}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ErrorResponse build() { - _checkSingleUse(); - - return new ErrorResponse(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ErrorResponse} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ErrorResponse::setupErrorResponseDeserializer); - - protected static void setupErrorResponseDeserializer(ObjectDeserializer op) { - - op.add(Builder::error, buildErrorCauseDeserializers(), "error"); - op.add(Builder::status, JsonpDeserializer.integerDeserializer(), "status"); - - } - - protected static JsonpDeserializer buildErrorCauseDeserializers() { - return new UnionDeserializer.Builder<>(ErrorResponse::getErrorCause, false) - .addMember(Kind.OBJECT, ErrorCause._DESERIALIZER) - .addMember(Kind.STRING, JsonpDeserializer.stringDeserializer()) - .build(); - } - - private static ErrorCause getErrorCause(Kind kind, Object errorCause) { - return Kind.STRING.equals(kind) ? - ErrorCause.of(builder -> builder.type("string_error").reason((String) errorCause)) : - (ErrorCause) errorCause; - } + /** + * Required - API name: {@code error} + */ + public final ErrorCause error() { + return this.error; + } + + /** + * Required - API name: {@code status} + */ + public final int status() { + return this.status; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("error"); + this.error.serialize(generator, mapper); + + generator.writeKey("status"); + generator.write(this.status); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ErrorResponse}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private ErrorCause error; + + private Integer status; + + /** + * Required - API name: {@code error} + */ + public final Builder error(ErrorCause value) { + this.error = value; + return this; + } + + /** + * Required - API name: {@code error} + */ + public final Builder error(Function> fn) { + return this.error(fn.apply(new ErrorCause.Builder()).build()); + } + + /** + * Required - API name: {@code status} + */ + public final Builder status(int value) { + this.status = value; + return this; + } + + /** + * Builds a {@link ErrorResponse}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ErrorResponse build() { + _checkSingleUse(); + + return new ErrorResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ErrorResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ErrorResponse::setupErrorResponseDeserializer + ); + + protected static void setupErrorResponseDeserializer(ObjectDeserializer op) { + + op.add(Builder::error, buildErrorCauseDeserializers(), "error"); + op.add(Builder::status, JsonpDeserializer.integerDeserializer(), "status"); + + } + + protected static JsonpDeserializer buildErrorCauseDeserializers() { + return new UnionDeserializer.Builder<>(ErrorResponse::getErrorCause, false).addMember(Kind.OBJECT, ErrorCause._DESERIALIZER) + .addMember(Kind.STRING, JsonpDeserializer.stringDeserializer()) + .build(); + } + + private static ErrorCause getErrorCause(Kind kind, Object errorCause) { + return Kind.STRING.equals(kind) + ? ErrorCause.of(builder -> builder.type("string_error").reason((String) errorCause)) + : (ErrorCause) errorCause; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ExpandWildcard.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ExpandWildcard.java index 352063ee54..5b66a33bd2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ExpandWildcard.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ExpandWildcard.java @@ -37,45 +37,44 @@ @JsonpDeserializable public enum ExpandWildcard implements JsonEnum { - /** - * Match any data stream or index, including hidden ones. - */ - All("all"), + /** + * Match any data stream or index, including hidden ones. + */ + All("all"), - /** - * Match open, non-hidden indices. Also matches any non-hidden data stream. - */ - Open("open"), + /** + * Match open, non-hidden indices. Also matches any non-hidden data stream. + */ + Open("open"), - /** - * Match closed, non-hidden indices. Also matches any non-hidden data stream. - * Data streams cannot be closed. - */ - Closed("closed"), + /** + * Match closed, non-hidden indices. Also matches any non-hidden data stream. + * Data streams cannot be closed. + */ + Closed("closed"), - /** - * Match hidden data streams and hidden indices. Must be combined with open, - * closed, or both. - */ - Hidden("hidden"), + /** + * Match hidden data streams and hidden indices. Must be combined with open, + * closed, or both. + */ + Hidden("hidden"), - /** - * Wildcard expressions are not accepted. - */ - None("none"), + /** + * Wildcard expressions are not accepted. + */ + None("none"), - ; + ; - private final String jsonValue; + private final String jsonValue; - ExpandWildcard(String jsonValue) { - this.jsonValue = jsonValue; - } + ExpandWildcard(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - ExpandWildcard.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(ExpandWildcard.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldMemoryUsage.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldMemoryUsage.java index 0802fbdaa5..b202739387 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldMemoryUsage.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldMemoryUsage.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,122 +44,121 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.FieldMemoryUsage @JsonpDeserializable public class FieldMemoryUsage implements JsonpSerializable { - @Nullable - private final String memorySize; - - private final long memorySizeInBytes; - - // --------------------------------------------------------------------------------------------- - - private FieldMemoryUsage(Builder builder) { - - this.memorySize = builder.memorySize; - this.memorySizeInBytes = ApiTypeHelper.requireNonNull(builder.memorySizeInBytes, this, "memorySizeInBytes"); - - } - - public static FieldMemoryUsage of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code memory_size} - */ - @Nullable - public final String memorySize() { - return this.memorySize; - } - - /** - * Required - API name: {@code memory_size_in_bytes} - */ - public final long memorySizeInBytes() { - return this.memorySizeInBytes; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.memorySize != null) { - generator.writeKey("memory_size"); - generator.write(this.memorySize); - - } - generator.writeKey("memory_size_in_bytes"); - generator.write(this.memorySizeInBytes); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link FieldMemoryUsage}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private String memorySize; - - private Long memorySizeInBytes; - - /** - * API name: {@code memory_size} - */ - public final Builder memorySize(@Nullable String value) { - this.memorySize = value; - return this; - } - - /** - * Required - API name: {@code memory_size_in_bytes} - */ - public final Builder memorySizeInBytes(long value) { - this.memorySizeInBytes = value; - return this; - } - - /** - * Builds a {@link FieldMemoryUsage}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public FieldMemoryUsage build() { - _checkSingleUse(); - - return new FieldMemoryUsage(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link FieldMemoryUsage} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - FieldMemoryUsage::setupFieldMemoryUsageDeserializer); - - protected static void setupFieldMemoryUsageDeserializer(ObjectDeserializer op) { - - op.add(Builder::memorySize, JsonpDeserializer.stringDeserializer(), "memory_size"); - op.add(Builder::memorySizeInBytes, JsonpDeserializer.longDeserializer(), "memory_size_in_bytes"); - - } + @Nullable + private final String memorySize; + + private final long memorySizeInBytes; + + // --------------------------------------------------------------------------------------------- + + private FieldMemoryUsage(Builder builder) { + + this.memorySize = builder.memorySize; + this.memorySizeInBytes = ApiTypeHelper.requireNonNull(builder.memorySizeInBytes, this, "memorySizeInBytes"); + + } + + public static FieldMemoryUsage of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code memory_size} + */ + @Nullable + public final String memorySize() { + return this.memorySize; + } + + /** + * Required - API name: {@code memory_size_in_bytes} + */ + public final long memorySizeInBytes() { + return this.memorySizeInBytes; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (this.memorySize != null) { + generator.writeKey("memory_size"); + generator.write(this.memorySize); + + } + generator.writeKey("memory_size_in_bytes"); + generator.write(this.memorySizeInBytes); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link FieldMemoryUsage}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String memorySize; + + private Long memorySizeInBytes; + + /** + * API name: {@code memory_size} + */ + public final Builder memorySize(@Nullable String value) { + this.memorySize = value; + return this; + } + + /** + * Required - API name: {@code memory_size_in_bytes} + */ + public final Builder memorySizeInBytes(long value) { + this.memorySizeInBytes = value; + return this; + } + + /** + * Builds a {@link FieldMemoryUsage}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public FieldMemoryUsage build() { + _checkSingleUse(); + + return new FieldMemoryUsage(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link FieldMemoryUsage} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + FieldMemoryUsage::setupFieldMemoryUsageDeserializer + ); + + protected static void setupFieldMemoryUsageDeserializer(ObjectDeserializer op) { + + op.add(Builder::memorySize, JsonpDeserializer.stringDeserializer(), "memory_size"); + op.add(Builder::memorySizeInBytes, JsonpDeserializer.longDeserializer(), "memory_size_in_bytes"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSizeUsage.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSizeUsage.java index edb66f531e..9d90e1e566 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSizeUsage.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSizeUsage.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,122 +44,121 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.FieldSizeUsage @JsonpDeserializable public class FieldSizeUsage implements JsonpSerializable { - @Nullable - private final String size; - - private final long sizeInBytes; - - // --------------------------------------------------------------------------------------------- - - private FieldSizeUsage(Builder builder) { - - this.size = builder.size; - this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); - - } - - public static FieldSizeUsage of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code size} - */ - @Nullable - public final String size() { - return this.size; - } - - /** - * Required - API name: {@code size_in_bytes} - */ - public final long sizeInBytes() { - return this.sizeInBytes; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.size != null) { - generator.writeKey("size"); - generator.write(this.size); - - } - generator.writeKey("size_in_bytes"); - generator.write(this.sizeInBytes); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link FieldSizeUsage}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private String size; - - private Long sizeInBytes; - - /** - * API name: {@code size} - */ - public final Builder size(@Nullable String value) { - this.size = value; - return this; - } - - /** - * Required - API name: {@code size_in_bytes} - */ - public final Builder sizeInBytes(long value) { - this.sizeInBytes = value; - return this; - } - - /** - * Builds a {@link FieldSizeUsage}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public FieldSizeUsage build() { - _checkSingleUse(); - - return new FieldSizeUsage(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link FieldSizeUsage} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - FieldSizeUsage::setupFieldSizeUsageDeserializer); - - protected static void setupFieldSizeUsageDeserializer(ObjectDeserializer op) { - - op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size"); - op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); - - } + @Nullable + private final String size; + + private final long sizeInBytes; + + // --------------------------------------------------------------------------------------------- + + private FieldSizeUsage(Builder builder) { + + this.size = builder.size; + this.sizeInBytes = ApiTypeHelper.requireNonNull(builder.sizeInBytes, this, "sizeInBytes"); + + } + + public static FieldSizeUsage of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code size} + */ + @Nullable + public final String size() { + return this.size; + } + + /** + * Required - API name: {@code size_in_bytes} + */ + public final long sizeInBytes() { + return this.sizeInBytes; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (this.size != null) { + generator.writeKey("size"); + generator.write(this.size); + + } + generator.writeKey("size_in_bytes"); + generator.write(this.sizeInBytes); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link FieldSizeUsage}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private String size; + + private Long sizeInBytes; + + /** + * API name: {@code size} + */ + public final Builder size(@Nullable String value) { + this.size = value; + return this; + } + + /** + * Required - API name: {@code size_in_bytes} + */ + public final Builder sizeInBytes(long value) { + this.sizeInBytes = value; + return this; + } + + /** + * Builds a {@link FieldSizeUsage}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public FieldSizeUsage build() { + _checkSingleUse(); + + return new FieldSizeUsage(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link FieldSizeUsage} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + FieldSizeUsage::setupFieldSizeUsageDeserializer + ); + + protected static void setupFieldSizeUsageDeserializer(ObjectDeserializer op) { + + op.add(Builder::size, JsonpDeserializer.stringDeserializer(), "size"); + op.add(Builder::sizeInBytes, JsonpDeserializer.longDeserializer(), "size_in_bytes"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSort.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSort.java index c9ab537e29..08806a7cc8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSort.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSort.java @@ -32,322 +32,323 @@ package org.opensearch.client.opensearch._types; -import org.opensearch.client.opensearch._types.mapping.FieldType; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +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.JsonpSerializable; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.mapping.FieldType; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; - -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.FieldSort @JsonpDeserializable public class FieldSort implements JsonpSerializable { - // Single key dictionary - private final String field; - - @Nullable - private final FieldValue missing; - - @Nullable - private final SortMode mode; - - @Nullable - private final NestedSortValue nested; - - @Nullable - private final SortOrder order; - - @Nullable - private final FieldType unmappedType; - - @Nullable - private final FieldSortNumericType numericType; - - @Nullable - private final String format; - - // --------------------------------------------------------------------------------------------- - - private FieldSort(Builder builder) { - - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - - this.missing = builder.missing; - this.mode = builder.mode; - this.nested = builder.nested; - this.order = builder.order; - this.unmappedType = builder.unmappedType; - this.numericType = builder.numericType; - this.format = builder.format; - - } - - public static FieldSort of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - The target field - */ - public final String field() { - return this.field; - } - - /** - * API name: {@code missing} - */ - @Nullable - public final FieldValue missing() { - return this.missing; - } - - /** - * API name: {@code mode} - */ - @Nullable - public final SortMode mode() { - return this.mode; - } - - /** - * API name: {@code nested} - */ - @Nullable - public final NestedSortValue nested() { - return this.nested; - } - - /** - * API name: {@code order} - */ - @Nullable - public final SortOrder order() { - return this.order; - } - - /** - * API name: {@code unmapped_type} - */ - @Nullable - public final FieldType unmappedType() { - return this.unmappedType; - } - - /** - * API name: {@code numeric_type} - */ - @Nullable - public final FieldSortNumericType numericType() { - return this.numericType; - } - - /** - * API name: {@code format} - */ - @Nullable - public final String format() { - return this.format; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(this.field); - - if (this.missing != null) { - generator.writeKey("missing"); - this.missing.serialize(generator, mapper); - - } - if (this.mode != null) { - generator.writeKey("mode"); - this.mode.serialize(generator, mapper); - } - if (this.nested != null) { - generator.writeKey("nested"); - this.nested.serialize(generator, mapper); - - } - if (this.order != null) { - generator.writeKey("order"); - this.order.serialize(generator, mapper); - } - if (this.unmappedType != null) { - generator.writeKey("unmapped_type"); - this.unmappedType.serialize(generator, mapper); - } - if (this.numericType != null) { - generator.writeKey("numeric_type"); - this.numericType.serialize(generator, mapper); - } - if (this.format != null) { - generator.writeKey("format"); - generator.write(this.format); - - } - - generator.writeEnd(); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link FieldSort}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String field; - - /** - * Required - The target field - */ - public final Builder field(String value) { - this.field = value; - return this; - } - - @Nullable - private FieldValue missing; - - @Nullable - private SortMode mode; - - @Nullable - private NestedSortValue nested; - - @Nullable - private SortOrder order; - - @Nullable - private FieldType unmappedType; - - @Nullable - private FieldSortNumericType numericType; - - @Nullable - private String format; - - /** - * API name: {@code missing} - */ - public final Builder missing(@Nullable FieldValue value) { - this.missing = value; - return this; - } - - /** - * API name: {@code missing} - */ - public final Builder missing(Function> fn) { - return this.missing(fn.apply(new FieldValue.Builder()).build()); - } - - /** - * API name: {@code mode} - */ - public final Builder mode(@Nullable SortMode value) { - this.mode = value; - return this; - } - - /** - * API name: {@code nested} - */ - public final Builder nested(@Nullable NestedSortValue value) { - this.nested = value; - return this; - } - - /** - * API name: {@code nested} - */ - public final Builder nested(Function> fn) { - return this.nested(fn.apply(new NestedSortValue.Builder()).build()); - } - - /** - * API name: {@code order} - */ - public final Builder order(@Nullable SortOrder value) { - this.order = value; - return this; - } - - /** - * API name: {@code unmapped_type} - */ - public final Builder unmappedType(@Nullable FieldType value) { - this.unmappedType = value; - return this; - } - - /** - * API name: {@code numeric_type} - */ - public final Builder numericType(@Nullable FieldSortNumericType value) { - this.numericType = value; - return this; - } - - /** - * API name: {@code format} - */ - public final Builder format(@Nullable String value) { - this.format = value; - return this; - } - - /** - * Builds a {@link FieldSort}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public FieldSort build() { - _checkSingleUse(); - - return new FieldSort(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link FieldSort} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - FieldSort::setupFieldSortDeserializer); - - protected static void setupFieldSortDeserializer(ObjectDeserializer op) { - - op.add(Builder::missing, FieldValue._DESERIALIZER, "missing"); - op.add(Builder::mode, SortMode._DESERIALIZER, "mode"); - op.add(Builder::nested, NestedSortValue._DESERIALIZER, "nested"); - op.add(Builder::order, SortOrder._DESERIALIZER, "order"); - op.add(Builder::unmappedType, FieldType._DESERIALIZER, "unmapped_type"); - op.add(Builder::numericType, FieldSortNumericType._DESERIALIZER, "numeric_type"); - op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); - - op.setKey(Builder::field, JsonpDeserializer.stringDeserializer()); - op.shortcutProperty("order"); - - } + // Single key dictionary + private final String field; + + @Nullable + private final FieldValue missing; + + @Nullable + private final SortMode mode; + + @Nullable + private final NestedSortValue nested; + + @Nullable + private final SortOrder order; + + @Nullable + private final FieldType unmappedType; + + @Nullable + private final FieldSortNumericType numericType; + + @Nullable + private final String format; + + // --------------------------------------------------------------------------------------------- + + private FieldSort(Builder builder) { + + this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + + this.missing = builder.missing; + this.mode = builder.mode; + this.nested = builder.nested; + this.order = builder.order; + this.unmappedType = builder.unmappedType; + this.numericType = builder.numericType; + this.format = builder.format; + + } + + public static FieldSort of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - The target field + */ + public final String field() { + return this.field; + } + + /** + * API name: {@code missing} + */ + @Nullable + public final FieldValue missing() { + return this.missing; + } + + /** + * API name: {@code mode} + */ + @Nullable + public final SortMode mode() { + return this.mode; + } + + /** + * API name: {@code nested} + */ + @Nullable + public final NestedSortValue nested() { + return this.nested; + } + + /** + * API name: {@code order} + */ + @Nullable + public final SortOrder order() { + return this.order; + } + + /** + * API name: {@code unmapped_type} + */ + @Nullable + public final FieldType unmappedType() { + return this.unmappedType; + } + + /** + * API name: {@code numeric_type} + */ + @Nullable + public final FieldSortNumericType numericType() { + return this.numericType; + } + + /** + * API name: {@code format} + */ + @Nullable + public final String format() { + return this.format; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(this.field); + + if (this.missing != null) { + generator.writeKey("missing"); + this.missing.serialize(generator, mapper); + + } + if (this.mode != null) { + generator.writeKey("mode"); + this.mode.serialize(generator, mapper); + } + if (this.nested != null) { + generator.writeKey("nested"); + this.nested.serialize(generator, mapper); + + } + if (this.order != null) { + generator.writeKey("order"); + this.order.serialize(generator, mapper); + } + if (this.unmappedType != null) { + generator.writeKey("unmapped_type"); + this.unmappedType.serialize(generator, mapper); + } + if (this.numericType != null) { + generator.writeKey("numeric_type"); + this.numericType.serialize(generator, mapper); + } + if (this.format != null) { + generator.writeKey("format"); + generator.write(this.format); + + } + + generator.writeEnd(); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link FieldSort}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String field; + + /** + * Required - The target field + */ + public final Builder field(String value) { + this.field = value; + return this; + } + + @Nullable + private FieldValue missing; + + @Nullable + private SortMode mode; + + @Nullable + private NestedSortValue nested; + + @Nullable + private SortOrder order; + + @Nullable + private FieldType unmappedType; + + @Nullable + private FieldSortNumericType numericType; + + @Nullable + private String format; + + /** + * API name: {@code missing} + */ + public final Builder missing(@Nullable FieldValue value) { + this.missing = value; + return this; + } + + /** + * API name: {@code missing} + */ + public final Builder missing(Function> fn) { + return this.missing(fn.apply(new FieldValue.Builder()).build()); + } + + /** + * API name: {@code mode} + */ + public final Builder mode(@Nullable SortMode value) { + this.mode = value; + return this; + } + + /** + * API name: {@code nested} + */ + public final Builder nested(@Nullable NestedSortValue value) { + this.nested = value; + return this; + } + + /** + * API name: {@code nested} + */ + public final Builder nested(Function> fn) { + return this.nested(fn.apply(new NestedSortValue.Builder()).build()); + } + + /** + * API name: {@code order} + */ + public final Builder order(@Nullable SortOrder value) { + this.order = value; + return this; + } + + /** + * API name: {@code unmapped_type} + */ + public final Builder unmappedType(@Nullable FieldType value) { + this.unmappedType = value; + return this; + } + + /** + * API name: {@code numeric_type} + */ + public final Builder numericType(@Nullable FieldSortNumericType value) { + this.numericType = value; + return this; + } + + /** + * API name: {@code format} + */ + public final Builder format(@Nullable String value) { + this.format = value; + return this; + } + + /** + * Builds a {@link FieldSort}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public FieldSort build() { + _checkSingleUse(); + + return new FieldSort(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link FieldSort} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + FieldSort::setupFieldSortDeserializer + ); + + protected static void setupFieldSortDeserializer(ObjectDeserializer op) { + + op.add(Builder::missing, FieldValue._DESERIALIZER, "missing"); + op.add(Builder::mode, SortMode._DESERIALIZER, "mode"); + op.add(Builder::nested, NestedSortValue._DESERIALIZER, "nested"); + op.add(Builder::order, SortOrder._DESERIALIZER, "order"); + op.add(Builder::unmappedType, FieldType._DESERIALIZER, "unmapped_type"); + op.add(Builder::numericType, FieldSortNumericType._DESERIALIZER, "numeric_type"); + op.add(Builder::format, JsonpDeserializer.stringDeserializer(), "format"); + + op.setKey(Builder::field, JsonpDeserializer.stringDeserializer()); + op.shortcutProperty("order"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSortNumericType.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSortNumericType.java index 776101e80c..faf7f9d667 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSortNumericType.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldSortNumericType.java @@ -37,26 +37,27 @@ @JsonpDeserializable public enum FieldSortNumericType implements JsonEnum { - Long("long"), + Long("long"), - Double("double"), + Double("double"), - Date("date"), + Date("date"), - DateNanos("date_nanos"), + DateNanos("date_nanos"), - ; + ; - private final String jsonValue; + private final String jsonValue; - FieldSortNumericType(String jsonValue) { - this.jsonValue = jsonValue; - } + FieldSortNumericType(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - FieldSortNumericType.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + FieldSortNumericType.values() + ); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldValue.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldValue.java index c5efb8350e..fbf6808921 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldValue.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FieldValue.java @@ -32,6 +32,10 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import jakarta.json.stream.JsonParser; +import java.util.EnumSet; +import java.util.function.Consumer; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,245 +45,250 @@ import org.opensearch.client.util.ObjectBuilderBase; import org.opensearch.client.util.TaggedUnion; import org.opensearch.client.util.TaggedUnionUtils; -import jakarta.json.stream.JsonGenerator; -import jakarta.json.stream.JsonParser; - -import java.util.EnumSet; -import java.util.function.Consumer; // typedef: _types.FieldValue @JsonpDeserializable public class FieldValue implements TaggedUnion, JsonpSerializable { - public static FieldValue of(long value) { - return new FieldValue(Kind.Long, value); - } - - public static FieldValue of(double value) { - return new FieldValue(Kind.Double, value); - } - - public static FieldValue of(boolean value) { - return value ? TRUE : FALSE; - } - - public static FieldValue of(String value) { - return new FieldValue(Kind.String, value); - } - - public static final FieldValue NULL = new FieldValue(Kind.Null, null); - public static final FieldValue TRUE = new FieldValue(Kind.Boolean, Boolean.TRUE); - public static final FieldValue FALSE = new FieldValue(Kind.Boolean, Boolean.FALSE); - - public enum Kind { - Double, Long, Boolean, String, Null - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - public String _toJsonString() { - switch (_kind) { - case Double : - return String.valueOf(this.doubleValue()); - case Long : - return String.valueOf(this.longValue()); - case Boolean : - return String.valueOf(this.booleanValue()); - case String : - return this.stringValue(); - case Null : - return "null"; - - default : - throw new IllegalStateException("Unknown kind " + _kind); - } - } - - private FieldValue(Builder builder) { - this(builder._kind, builder._value); - } - - private FieldValue(Kind kind, Object value) { - this._kind = ApiTypeHelper.requireNonNull(kind, this, ""); - this._value = kind == Kind.Null ? null : ApiTypeHelper.requireNonNull(value, this, ""); - } - - public static FieldValue of(Consumer fn) { - Builder builder = new Builder(); - fn.accept(builder); - return builder.build(); - } - - /** - * Is this variant instance of kind {@code double}? - */ - public boolean isDouble() { - return _kind == Kind.Double; - } - - /** - * Get the {@code double} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code double} kind. - */ - public double doubleValue() { - return TaggedUnionUtils.get(this, Kind.Double); - } - - /** - * Is this variant instance of kind {@code long}? - */ - public boolean isLong() { - return _kind == Kind.Long; - } - - /** - * Get the {@code long} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code long} kind. - */ - public long longValue() { - return TaggedUnionUtils.get(this, Kind.Long); - } - - /** - * Is this variant instance of kind {@code boolean}? - */ - public boolean isBoolean() { - return _kind == Kind.Boolean; - } - - /** - * Get the {@code boolean} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code boolean} kind. - */ - public boolean booleanValue() { - return TaggedUnionUtils.get(this, Kind.Boolean); - } - - /** - * Is this variant instance of kind {@code string}? - */ - public boolean isString() { - return _kind == Kind.String; - } - - /** - * Get the {@code string} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code string} kind. - */ - public String stringValue() { - return TaggedUnionUtils.get(this, Kind.String); - } - - /** - * Is this variant instance of kind {@code null}? - */ - public boolean isNull() { - return _kind == Kind.Null; - } - - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - switch (_kind) { - case Double : - generator.write(((Double) this._value)); - break; - case Long : - generator.write(((Long) this._value)); - break; - case Boolean : - generator.write(((Boolean) this._value)); - break; - case String : - generator.write(((String) this._value)); - break; - case Null : - generator.writeNull(); - break; - } - } - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Kind _kind; - private Object _value; - - public ObjectBuilder doubleValue(double v) { - this._kind = Kind.Double; - this._value = v; - return this; - } - - public ObjectBuilder longValue(long v) { - this._kind = Kind.Long; - this._value = v; - return this; - } - - public ObjectBuilder booleanValue(boolean v) { - this._kind = Kind.Boolean; - this._value = v; - return this; - } - - public ObjectBuilder stringValue(String v) { - this._kind = Kind.String; - this._value = v; - return this; - } - - public ObjectBuilder nullValue() { - this._kind = Kind.Null; - this._value = null; - return this; - } - - public FieldValue build() { - _checkSingleUse(); - return new FieldValue(this); - } - } - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .lazy(() -> JsonpDeserializer.of( - EnumSet.of(JsonParser.Event.VALUE_STRING, JsonParser.Event.VALUE_NUMBER, - JsonParser.Event.VALUE_NULL, - JsonParser.Event.VALUE_TRUE, JsonParser.Event.VALUE_FALSE), - (parser, mapper, event) -> { - switch (event) { - case VALUE_NULL : - return NULL; - case VALUE_STRING : - return FieldValue.of(parser.getString()); - case VALUE_TRUE : - return FieldValue.of(true); - case VALUE_FALSE : - return FieldValue.of(false); - case VALUE_NUMBER : - if (parser.isIntegralNumber()) { - return FieldValue.of(parser.getLong()); - } else { - return FieldValue.of(parser.getBigDecimal().doubleValue()); - } - } - return null; - })); + public static FieldValue of(long value) { + return new FieldValue(Kind.Long, value); + } + + public static FieldValue of(double value) { + return new FieldValue(Kind.Double, value); + } + + public static FieldValue of(boolean value) { + return value ? TRUE : FALSE; + } + + public static FieldValue of(String value) { + return new FieldValue(Kind.String, value); + } + + public static final FieldValue NULL = new FieldValue(Kind.Null, null); + public static final FieldValue TRUE = new FieldValue(Kind.Boolean, Boolean.TRUE); + public static final FieldValue FALSE = new FieldValue(Kind.Boolean, Boolean.FALSE); + + public enum Kind { + Double, + Long, + Boolean, + String, + Null + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + public String _toJsonString() { + switch (_kind) { + case Double: + return String.valueOf(this.doubleValue()); + case Long: + return String.valueOf(this.longValue()); + case Boolean: + return String.valueOf(this.booleanValue()); + case String: + return this.stringValue(); + case Null: + return "null"; + + default: + throw new IllegalStateException("Unknown kind " + _kind); + } + } + + private FieldValue(Builder builder) { + this(builder._kind, builder._value); + } + + private FieldValue(Kind kind, Object value) { + this._kind = ApiTypeHelper.requireNonNull(kind, this, ""); + this._value = kind == Kind.Null ? null : ApiTypeHelper.requireNonNull(value, this, ""); + } + + public static FieldValue of(Consumer fn) { + Builder builder = new Builder(); + fn.accept(builder); + return builder.build(); + } + + /** + * Is this variant instance of kind {@code double}? + */ + public boolean isDouble() { + return _kind == Kind.Double; + } + + /** + * Get the {@code double} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code double} kind. + */ + public double doubleValue() { + return TaggedUnionUtils.get(this, Kind.Double); + } + + /** + * Is this variant instance of kind {@code long}? + */ + public boolean isLong() { + return _kind == Kind.Long; + } + + /** + * Get the {@code long} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code long} kind. + */ + public long longValue() { + return TaggedUnionUtils.get(this, Kind.Long); + } + + /** + * Is this variant instance of kind {@code boolean}? + */ + public boolean isBoolean() { + return _kind == Kind.Boolean; + } + + /** + * Get the {@code boolean} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code boolean} kind. + */ + public boolean booleanValue() { + return TaggedUnionUtils.get(this, Kind.Boolean); + } + + /** + * Is this variant instance of kind {@code string}? + */ + public boolean isString() { + return _kind == Kind.String; + } + + /** + * Get the {@code string} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code string} kind. + */ + public String stringValue() { + return TaggedUnionUtils.get(this, Kind.String); + } + + /** + * Is this variant instance of kind {@code null}? + */ + public boolean isNull() { + return _kind == Kind.Null; + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + switch (_kind) { + case Double: + generator.write(((Double) this._value)); + break; + case Long: + generator.write(((Long) this._value)); + break; + case Boolean: + generator.write(((Boolean) this._value)); + break; + case String: + generator.write(((String) this._value)); + break; + case Null: + generator.writeNull(); + break; + } + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + + public ObjectBuilder doubleValue(double v) { + this._kind = Kind.Double; + this._value = v; + return this; + } + + public ObjectBuilder longValue(long v) { + this._kind = Kind.Long; + this._value = v; + return this; + } + + public ObjectBuilder booleanValue(boolean v) { + this._kind = Kind.Boolean; + this._value = v; + return this; + } + + public ObjectBuilder stringValue(String v) { + this._kind = Kind.String; + this._value = v; + return this; + } + + public ObjectBuilder nullValue() { + this._kind = Kind.Null; + this._value = null; + return this; + } + + public FieldValue build() { + _checkSingleUse(); + return new FieldValue(this); + } + } + + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy( + () -> JsonpDeserializer.of( + EnumSet.of( + JsonParser.Event.VALUE_STRING, + JsonParser.Event.VALUE_NUMBER, + JsonParser.Event.VALUE_NULL, + JsonParser.Event.VALUE_TRUE, + JsonParser.Event.VALUE_FALSE + ), + (parser, mapper, event) -> { + switch (event) { + case VALUE_NULL: + return NULL; + case VALUE_STRING: + return FieldValue.of(parser.getString()); + case VALUE_TRUE: + return FieldValue.of(true); + case VALUE_FALSE: + return FieldValue.of(false); + case VALUE_NUMBER: + if (parser.isIntegralNumber()) { + return FieldValue.of(parser.getLong()); + } else { + return FieldValue.of(parser.getBigDecimal().doubleValue()); + } + } + return null; + } + ) + ); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FielddataStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FielddataStats.java index ea10424dd4..ece673c2b5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FielddataStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FielddataStats.java @@ -32,6 +32,10 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,208 +45,205 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Map; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.FielddataStats @JsonpDeserializable public class FielddataStats implements JsonpSerializable { - @Nullable - private final Long evictions; + @Nullable + private final Long evictions; - @Nullable - private final String memorySize; + @Nullable + private final String memorySize; - private final long memorySizeInBytes; + private final long memorySizeInBytes; - private final Map fields; + private final Map fields; - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - private FielddataStats(Builder builder) { + private FielddataStats(Builder builder) { - this.evictions = builder.evictions; - this.memorySize = builder.memorySize; - this.memorySizeInBytes = ApiTypeHelper.requireNonNull(builder.memorySizeInBytes, this, "memorySizeInBytes"); - this.fields = ApiTypeHelper.unmodifiable(builder.fields); + this.evictions = builder.evictions; + this.memorySize = builder.memorySize; + this.memorySizeInBytes = ApiTypeHelper.requireNonNull(builder.memorySizeInBytes, this, "memorySizeInBytes"); + this.fields = ApiTypeHelper.unmodifiable(builder.fields); - } - - public static FielddataStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code evictions} - */ - @Nullable - public final Long evictions() { - return this.evictions; - } - - /** - * API name: {@code memory_size} - */ - @Nullable - public final String memorySize() { - return this.memorySize; - } - - /** - * Required - API name: {@code memory_size_in_bytes} - */ - public final long memorySizeInBytes() { - return this.memorySizeInBytes; - } - - /** - * API name: {@code fields} - */ - public final Map fields() { - return this.fields; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.evictions != null) { - generator.writeKey("evictions"); - generator.write(this.evictions); - - } - if (this.memorySize != null) { - generator.writeKey("memory_size"); - generator.write(this.memorySize); - - } - generator.writeKey("memory_size_in_bytes"); - generator.write(this.memorySizeInBytes); - - if (ApiTypeHelper.isDefined(this.fields)) { - generator.writeKey("fields"); - generator.writeStartObject(); - for (Map.Entry item0 : this.fields.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link FielddataStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private Long evictions; - - @Nullable - private String memorySize; - - private Long memorySizeInBytes; - - @Nullable - private Map fields; - - /** - * API name: {@code evictions} - */ - public final Builder evictions(@Nullable Long value) { - this.evictions = value; - return this; - } - - /** - * API name: {@code memory_size} - */ - public final Builder memorySize(@Nullable String value) { - this.memorySize = value; - return this; - } - - /** - * Required - API name: {@code memory_size_in_bytes} - */ - public final Builder memorySizeInBytes(long value) { - this.memorySizeInBytes = value; - return this; - } - - /** - * API name: {@code fields} - *

- * Adds all entries of map to fields. - */ - public final Builder fields(Map map) { - this.fields = _mapPutAll(this.fields, map); - return this; - } - - /** - * API name: {@code fields} - *

- * Adds an entry to fields. - */ - public final Builder fields(String key, FieldMemoryUsage value) { - this.fields = _mapPut(this.fields, key, value); - return this; - } - - /** - * API name: {@code fields} - *

- * Adds an entry to fields using a builder lambda. - */ - public final Builder fields(String key, - Function> fn) { - return fields(key, fn.apply(new FieldMemoryUsage.Builder()).build()); - } - - /** - * Builds a {@link FielddataStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public FielddataStats build() { - _checkSingleUse(); - - return new FielddataStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link FielddataStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - FielddataStats::setupFielddataStatsDeserializer); - - protected static void setupFielddataStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::evictions, JsonpDeserializer.longDeserializer(), "evictions"); - op.add(Builder::memorySize, JsonpDeserializer.stringDeserializer(), "memory_size"); - op.add(Builder::memorySizeInBytes, JsonpDeserializer.longDeserializer(), "memory_size_in_bytes"); - op.add(Builder::fields, JsonpDeserializer.stringMapDeserializer(FieldMemoryUsage._DESERIALIZER), "fields"); - - } + } + + public static FielddataStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code evictions} + */ + @Nullable + public final Long evictions() { + return this.evictions; + } + + /** + * API name: {@code memory_size} + */ + @Nullable + public final String memorySize() { + return this.memorySize; + } + + /** + * Required - API name: {@code memory_size_in_bytes} + */ + public final long memorySizeInBytes() { + return this.memorySizeInBytes; + } + + /** + * API name: {@code fields} + */ + public final Map fields() { + return this.fields; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (this.evictions != null) { + generator.writeKey("evictions"); + generator.write(this.evictions); + + } + if (this.memorySize != null) { + generator.writeKey("memory_size"); + generator.write(this.memorySize); + + } + generator.writeKey("memory_size_in_bytes"); + generator.write(this.memorySizeInBytes); + + if (ApiTypeHelper.isDefined(this.fields)) { + generator.writeKey("fields"); + generator.writeStartObject(); + for (Map.Entry item0 : this.fields.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link FielddataStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private Long evictions; + + @Nullable + private String memorySize; + + private Long memorySizeInBytes; + + @Nullable + private Map fields; + + /** + * API name: {@code evictions} + */ + public final Builder evictions(@Nullable Long value) { + this.evictions = value; + return this; + } + + /** + * API name: {@code memory_size} + */ + public final Builder memorySize(@Nullable String value) { + this.memorySize = value; + return this; + } + + /** + * Required - API name: {@code memory_size_in_bytes} + */ + public final Builder memorySizeInBytes(long value) { + this.memorySizeInBytes = value; + return this; + } + + /** + * API name: {@code fields} + *

+ * Adds all entries of map to fields. + */ + public final Builder fields(Map map) { + this.fields = _mapPutAll(this.fields, map); + return this; + } + + /** + * API name: {@code fields} + *

+ * Adds an entry to fields. + */ + public final Builder fields(String key, FieldMemoryUsage value) { + this.fields = _mapPut(this.fields, key, value); + return this; + } + + /** + * API name: {@code fields} + *

+ * Adds an entry to fields using a builder lambda. + */ + public final Builder fields(String key, Function> fn) { + return fields(key, fn.apply(new FieldMemoryUsage.Builder()).build()); + } + + /** + * Builds a {@link FielddataStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public FielddataStats build() { + _checkSingleUse(); + + return new FielddataStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link FielddataStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + FielddataStats::setupFielddataStatsDeserializer + ); + + protected static void setupFielddataStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::evictions, JsonpDeserializer.longDeserializer(), "evictions"); + op.add(Builder::memorySize, JsonpDeserializer.stringDeserializer(), "memory_size"); + op.add(Builder::memorySizeInBytes, JsonpDeserializer.longDeserializer(), "memory_size_in_bytes"); + op.add(Builder::fields, JsonpDeserializer.stringMapDeserializer(FieldMemoryUsage._DESERIALIZER), "fields"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FlushStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FlushStats.java index 2747d47c4d..709cc8f81e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/FlushStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/FlushStats.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,170 +44,169 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.FlushStats @JsonpDeserializable public class FlushStats implements JsonpSerializable { - private final long periodic; + private final long periodic; - private final long total; + private final long total; - @Nullable - private final String totalTime; + @Nullable + private final String totalTime; - private final long totalTimeInMillis; + private final long totalTimeInMillis; - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - private FlushStats(Builder builder) { + private FlushStats(Builder builder) { - this.periodic = ApiTypeHelper.requireNonNull(builder.periodic, this, "periodic"); - this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); - this.totalTime = builder.totalTime; - this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); - - } - - public static FlushStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code periodic} - */ - public final long periodic() { - return this.periodic; - } - - /** - * Required - API name: {@code total} - */ - public final long total() { - return this.total; - } - - /** - * API name: {@code total_time} - */ - @Nullable - public final String totalTime() { - return this.totalTime; - } - - /** - * Required - API name: {@code total_time_in_millis} - */ - public final long totalTimeInMillis() { - return this.totalTimeInMillis; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("periodic"); - generator.write(this.periodic); - - generator.writeKey("total"); - generator.write(this.total); - - if (this.totalTime != null) { - generator.writeKey("total_time"); - generator.write(this.totalTime); - - } - generator.writeKey("total_time_in_millis"); - generator.write(this.totalTimeInMillis); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link FlushStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long periodic; - - private Long total; - - @Nullable - private String totalTime; - - private Long totalTimeInMillis; - - /** - * Required - API name: {@code periodic} - */ - public final Builder periodic(long value) { - this.periodic = value; - return this; - } - - /** - * Required - API name: {@code total} - */ - public final Builder total(long value) { - this.total = value; - return this; - } - - /** - * API name: {@code total_time} - */ - public final Builder totalTime(@Nullable String value) { - this.totalTime = value; - return this; - } - - /** - * Required - API name: {@code total_time_in_millis} - */ - public final Builder totalTimeInMillis(long value) { - this.totalTimeInMillis = value; - return this; - } - - /** - * Builds a {@link FlushStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public FlushStats build() { - _checkSingleUse(); - - return new FlushStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link FlushStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - FlushStats::setupFlushStatsDeserializer); - - protected static void setupFlushStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::periodic, JsonpDeserializer.longDeserializer(), "periodic"); - op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); - op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); - op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); - - } + this.periodic = ApiTypeHelper.requireNonNull(builder.periodic, this, "periodic"); + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); + this.totalTime = builder.totalTime; + this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); + + } + + public static FlushStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code periodic} + */ + public final long periodic() { + return this.periodic; + } + + /** + * Required - API name: {@code total} + */ + public final long total() { + return this.total; + } + + /** + * API name: {@code total_time} + */ + @Nullable + public final String totalTime() { + return this.totalTime; + } + + /** + * Required - API name: {@code total_time_in_millis} + */ + public final long totalTimeInMillis() { + return this.totalTimeInMillis; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("periodic"); + generator.write(this.periodic); + + generator.writeKey("total"); + generator.write(this.total); + + if (this.totalTime != null) { + generator.writeKey("total_time"); + generator.write(this.totalTime); + + } + generator.writeKey("total_time_in_millis"); + generator.write(this.totalTimeInMillis); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link FlushStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long periodic; + + private Long total; + + @Nullable + private String totalTime; + + private Long totalTimeInMillis; + + /** + * Required - API name: {@code periodic} + */ + public final Builder periodic(long value) { + this.periodic = value; + return this; + } + + /** + * Required - API name: {@code total} + */ + public final Builder total(long value) { + this.total = value; + return this; + } + + /** + * API name: {@code total_time} + */ + public final Builder totalTime(@Nullable String value) { + this.totalTime = value; + return this; + } + + /** + * Required - API name: {@code total_time_in_millis} + */ + public final Builder totalTimeInMillis(long value) { + this.totalTimeInMillis = value; + return this; + } + + /** + * Builds a {@link FlushStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public FlushStats build() { + _checkSingleUse(); + + return new FlushStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link FlushStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + FlushStats::setupFlushStatsDeserializer + ); + + protected static void setupFlushStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::periodic, JsonpDeserializer.longDeserializer(), "periodic"); + op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); + op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); + op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoBounds.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoBounds.java index 7be1836e37..56f23b35d9 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoBounds.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoBounds.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,8 +44,6 @@ import org.opensearch.client.util.ObjectBuilderBase; import org.opensearch.client.util.TaggedUnion; import org.opensearch.client.util.TaggedUnionUtils; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; // typedef: _types.GeoBounds @@ -60,177 +60,180 @@ @JsonpDeserializable public class GeoBounds implements TaggedUnion, JsonpSerializable { - public enum Kind { - Coords, Tlbr, Trbl, Wkt - - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - private GeoBounds(Kind kind, Object value) { - this._kind = kind; - this._value = value; - } - - private GeoBounds(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static GeoBounds of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Is this variant instance of kind {@code coords}? - */ - public boolean isCoords() { - return _kind == Kind.Coords; - } - - /** - * Get the {@code coords} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code coords} kind. - */ - public CoordsGeoBounds coords() { - return TaggedUnionUtils.get(this, Kind.Coords); - } - - /** - * Is this variant instance of kind {@code tlbr}? - */ - public boolean isTlbr() { - return _kind == Kind.Tlbr; - } - - /** - * Get the {@code tlbr} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code tlbr} kind. - */ - public TopLeftBottomRightGeoBounds tlbr() { - return TaggedUnionUtils.get(this, Kind.Tlbr); - } - - /** - * Is this variant instance of kind {@code trbl}? - */ - public boolean isTrbl() { - return _kind == Kind.Trbl; - } - - /** - * Get the {@code trbl} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code trbl} kind. - */ - public TopRightBottomLeftGeoBounds trbl() { - return TaggedUnionUtils.get(this, Kind.Trbl); - } - - /** - * Is this variant instance of kind {@code wkt}? - */ - public boolean isWkt() { - return _kind == Kind.Wkt; - } - - /** - * Get the {@code wkt} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code wkt} kind. - */ - public WktGeoBounds wkt() { - return TaggedUnionUtils.get(this, Kind.Wkt); - } - - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - if (_value instanceof JsonpSerializable) { - ((JsonpSerializable) _value).serialize(generator, mapper); - } - - } - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Kind _kind; - private Object _value; - - public ObjectBuilder coords(CoordsGeoBounds v) { - this._kind = Kind.Coords; - this._value = v; - return this; - } - - public ObjectBuilder coords(Function> fn) { - return this.coords(fn.apply(new CoordsGeoBounds.Builder()).build()); - } - - public ObjectBuilder tlbr(TopLeftBottomRightGeoBounds v) { - this._kind = Kind.Tlbr; - this._value = v; - return this; - } - - public ObjectBuilder tlbr( - Function> fn) { - return this.tlbr(fn.apply(new TopLeftBottomRightGeoBounds.Builder()).build()); - } - - public ObjectBuilder trbl(TopRightBottomLeftGeoBounds v) { - this._kind = Kind.Trbl; - this._value = v; - return this; - } - - public ObjectBuilder trbl( - Function> fn) { - return this.trbl(fn.apply(new TopRightBottomLeftGeoBounds.Builder()).build()); - } - - public ObjectBuilder wkt(WktGeoBounds v) { - this._kind = Kind.Wkt; - this._value = v; - return this; - } - - public ObjectBuilder wkt(Function> fn) { - return this.wkt(fn.apply(new WktGeoBounds.Builder()).build()); - } - - public GeoBounds build() { - _checkSingleUse(); - return new GeoBounds(this); - } - - } - - private static JsonpDeserializer buildGeoBoundsDeserializer() { - return new UnionDeserializer.Builder(GeoBounds::new, false) - .addMember(Kind.Coords, CoordsGeoBounds._DESERIALIZER) - .addMember(Kind.Tlbr, TopLeftBottomRightGeoBounds._DESERIALIZER) - .addMember(Kind.Trbl, TopRightBottomLeftGeoBounds._DESERIALIZER) - .addMember(Kind.Wkt, WktGeoBounds._DESERIALIZER).build(); - } - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .lazy(GeoBounds::buildGeoBoundsDeserializer); + public enum Kind { + Coords, + Tlbr, + Trbl, + Wkt + + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + private GeoBounds(Kind kind, Object value) { + this._kind = kind; + this._value = value; + } + + private GeoBounds(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + } + + public static GeoBounds of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code coords}? + */ + public boolean isCoords() { + return _kind == Kind.Coords; + } + + /** + * Get the {@code coords} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code coords} kind. + */ + public CoordsGeoBounds coords() { + return TaggedUnionUtils.get(this, Kind.Coords); + } + + /** + * Is this variant instance of kind {@code tlbr}? + */ + public boolean isTlbr() { + return _kind == Kind.Tlbr; + } + + /** + * Get the {@code tlbr} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code tlbr} kind. + */ + public TopLeftBottomRightGeoBounds tlbr() { + return TaggedUnionUtils.get(this, Kind.Tlbr); + } + + /** + * Is this variant instance of kind {@code trbl}? + */ + public boolean isTrbl() { + return _kind == Kind.Trbl; + } + + /** + * Get the {@code trbl} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code trbl} kind. + */ + public TopRightBottomLeftGeoBounds trbl() { + return TaggedUnionUtils.get(this, Kind.Trbl); + } + + /** + * Is this variant instance of kind {@code wkt}? + */ + public boolean isWkt() { + return _kind == Kind.Wkt; + } + + /** + * Get the {@code wkt} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code wkt} kind. + */ + public WktGeoBounds wkt() { + return TaggedUnionUtils.get(this, Kind.Wkt); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } + + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + + public ObjectBuilder coords(CoordsGeoBounds v) { + this._kind = Kind.Coords; + this._value = v; + return this; + } + + public ObjectBuilder coords(Function> fn) { + return this.coords(fn.apply(new CoordsGeoBounds.Builder()).build()); + } + + public ObjectBuilder tlbr(TopLeftBottomRightGeoBounds v) { + this._kind = Kind.Tlbr; + this._value = v; + return this; + } + + public ObjectBuilder tlbr(Function> fn) { + return this.tlbr(fn.apply(new TopLeftBottomRightGeoBounds.Builder()).build()); + } + + public ObjectBuilder trbl(TopRightBottomLeftGeoBounds v) { + this._kind = Kind.Trbl; + this._value = v; + return this; + } + + public ObjectBuilder trbl(Function> fn) { + return this.trbl(fn.apply(new TopRightBottomLeftGeoBounds.Builder()).build()); + } + + public ObjectBuilder wkt(WktGeoBounds v) { + this._kind = Kind.Wkt; + this._value = v; + return this; + } + + public ObjectBuilder wkt(Function> fn) { + return this.wkt(fn.apply(new WktGeoBounds.Builder()).build()); + } + + public GeoBounds build() { + _checkSingleUse(); + return new GeoBounds(this); + } + + } + + private static JsonpDeserializer buildGeoBoundsDeserializer() { + return new UnionDeserializer.Builder(GeoBounds::new, false).addMember( + Kind.Coords, + CoordsGeoBounds._DESERIALIZER + ) + .addMember(Kind.Tlbr, TopLeftBottomRightGeoBounds._DESERIALIZER) + .addMember(Kind.Trbl, TopRightBottomLeftGeoBounds._DESERIALIZER) + .addMember(Kind.Wkt, WktGeoBounds._DESERIALIZER) + .build(); + } + + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy(GeoBounds::buildGeoBoundsDeserializer); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoBoundsBuilders.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoBoundsBuilders.java index 5c8c63f16c..614522f557 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoBoundsBuilders.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoBoundsBuilders.java @@ -36,38 +36,37 @@ * Builders for {@link GeoBounds} variants. */ public class GeoBoundsBuilders { - private GeoBoundsBuilders() { - } + private GeoBoundsBuilders() {} - /** - * Creates a builder for the {@link CoordsGeoBounds coords} {@code GeoBounds} - * variant. - */ - public static CoordsGeoBounds.Builder coords() { - return new CoordsGeoBounds.Builder(); - } + /** + * Creates a builder for the {@link CoordsGeoBounds coords} {@code GeoBounds} + * variant. + */ + public static CoordsGeoBounds.Builder coords() { + return new CoordsGeoBounds.Builder(); + } - /** - * Creates a builder for the {@link TopLeftBottomRightGeoBounds tlbr} - * {@code GeoBounds} variant. - */ - public static TopLeftBottomRightGeoBounds.Builder tlbr() { - return new TopLeftBottomRightGeoBounds.Builder(); - } + /** + * Creates a builder for the {@link TopLeftBottomRightGeoBounds tlbr} + * {@code GeoBounds} variant. + */ + public static TopLeftBottomRightGeoBounds.Builder tlbr() { + return new TopLeftBottomRightGeoBounds.Builder(); + } - /** - * Creates a builder for the {@link TopRightBottomLeftGeoBounds trbl} - * {@code GeoBounds} variant. - */ - public static TopRightBottomLeftGeoBounds.Builder trbl() { - return new TopRightBottomLeftGeoBounds.Builder(); - } + /** + * Creates a builder for the {@link TopRightBottomLeftGeoBounds trbl} + * {@code GeoBounds} variant. + */ + public static TopRightBottomLeftGeoBounds.Builder trbl() { + return new TopRightBottomLeftGeoBounds.Builder(); + } - /** - * Creates a builder for the {@link WktGeoBounds wkt} {@code GeoBounds} variant. - */ - public static WktGeoBounds.Builder wkt() { - return new WktGeoBounds.Builder(); - } + /** + * Creates a builder for the {@link WktGeoBounds wkt} {@code GeoBounds} variant. + */ + public static WktGeoBounds.Builder wkt() { + return new WktGeoBounds.Builder(); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoDistanceSort.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoDistanceSort.java index c08ae130a6..6aaa338fb3 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoDistanceSort.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoDistanceSort.java @@ -32,6 +32,10 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,289 +45,286 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.GeoDistanceSort @JsonpDeserializable public class GeoDistanceSort implements SortOptionsVariant, JsonpSerializable { - private final String field; - - private final List location; - - @Nullable - private final SortMode mode; - - @Nullable - private final GeoDistanceType distanceType; - - @Nullable - private final Boolean ignoreUnmapped; - - @Nullable - private final SortOrder order; - - @Nullable - private final DistanceUnit unit; - - // --------------------------------------------------------------------------------------------- - - private GeoDistanceSort(Builder builder) { - - this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); - this.location = ApiTypeHelper.unmodifiableRequired(builder.location, this, "location"); - - this.mode = builder.mode; - this.distanceType = builder.distanceType; - this.ignoreUnmapped = builder.ignoreUnmapped; - this.order = builder.order; - this.unit = builder.unit; - - } - - public static GeoDistanceSort of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * SortOptions variant kind. - */ - @Override - public SortOptions.Kind _sortOptionsKind() { - return SortOptions.Kind.GeoDistance; - } - - /** - * Required - - */ - public final String field() { - return this.field; - } - - /** - * Required - - */ - public final List location() { - return this.location; - } - - /** - * API name: {@code mode} - */ - @Nullable - public final SortMode mode() { - return this.mode; - } - - /** - * API name: {@code distance_type} - */ - @Nullable - public final GeoDistanceType distanceType() { - return this.distanceType; - } - - /** - * API name: {@code ignore_unmapped} - */ - @Nullable - public final Boolean ignoreUnmapped() { - return this.ignoreUnmapped; - } - - /** - * API name: {@code order} - */ - @Nullable - public final SortOrder order() { - return this.order; - } - - /** - * API name: {@code unit} - */ - @Nullable - public final DistanceUnit unit() { - return this.unit; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey(this.field); - generator.writeStartArray(); - for (GeoLocation item0 : this.location) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - if (this.mode != null) { - generator.writeKey("mode"); - this.mode.serialize(generator, mapper); - } - if (this.distanceType != null) { - generator.writeKey("distance_type"); - this.distanceType.serialize(generator, mapper); - } - if (this.ignoreUnmapped != null) { - generator.writeKey("ignore_unmapped"); - generator.write(this.ignoreUnmapped); - - } - if (this.order != null) { - generator.writeKey("order"); - this.order.serialize(generator, mapper); - } - if (this.unit != null) { - generator.writeKey("unit"); - this.unit.serialize(generator, mapper); - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GeoDistanceSort}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String field; - - private List location; - - /** - * Required - - */ - public final Builder field(String value) { - this.field = value; - return this; - } - - /** - * Required - Adds all elements of list to location. - */ - public final Builder location(List list) { - this.location = _listAddAll(this.location, list); - return this; - } - - /** - * Required - Adds one or more values to location. - */ - public final Builder location(GeoLocation value, GeoLocation... values) { - this.location = _listAdd(this.location, value, values); - return this; - } - - /** - * Required - Adds a value to location using a builder lambda. - */ - public final Builder location(Function> fn) { - return location(fn.apply(new GeoLocation.Builder()).build()); - } - - @Nullable - private SortMode mode; - - @Nullable - private GeoDistanceType distanceType; - - @Nullable - private Boolean ignoreUnmapped; - - @Nullable - private SortOrder order; - - @Nullable - private DistanceUnit unit; - - /** - * API name: {@code mode} - */ - public final Builder mode(@Nullable SortMode value) { - this.mode = value; - return this; - } - - /** - * API name: {@code distance_type} - */ - public final Builder distanceType(@Nullable GeoDistanceType value) { - this.distanceType = value; - return this; - } - - /** - * API name: {@code ignore_unmapped} - */ - public final Builder ignoreUnmapped(@Nullable Boolean value) { - this.ignoreUnmapped = value; - return this; - } - - /** - * API name: {@code order} - */ - public final Builder order(@Nullable SortOrder value) { - this.order = value; - return this; - } - - /** - * API name: {@code unit} - */ - public final Builder unit(@Nullable DistanceUnit value) { - this.unit = value; - return this; - } - - /** - * Builds a {@link GeoDistanceSort}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GeoDistanceSort build() { - _checkSingleUse(); - - return new GeoDistanceSort(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link GeoDistanceSort} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - GeoDistanceSort::setupGeoDistanceSortDeserializer); - - protected static void setupGeoDistanceSortDeserializer(ObjectDeserializer op) { - - op.add(Builder::mode, SortMode._DESERIALIZER, "mode"); - op.add(Builder::distanceType, GeoDistanceType._DESERIALIZER, "distance_type"); - op.add(Builder::ignoreUnmapped, JsonpDeserializer.booleanDeserializer(), "ignore_unmapped"); - op.add(Builder::order, SortOrder._DESERIALIZER, "order"); - op.add(Builder::unit, DistanceUnit._DESERIALIZER, "unit"); - - op.setUnknownFieldHandler((builder, name, parser, mapper) -> { - builder.field(name); - builder.location( - JsonpDeserializer.arrayDeserializer(GeoLocation._DESERIALIZER).deserialize(parser, mapper)); - }); - - } + private final String field; + + private final List location; + + @Nullable + private final SortMode mode; + + @Nullable + private final GeoDistanceType distanceType; + + @Nullable + private final Boolean ignoreUnmapped; + + @Nullable + private final SortOrder order; + + @Nullable + private final DistanceUnit unit; + + // --------------------------------------------------------------------------------------------- + + private GeoDistanceSort(Builder builder) { + + this.field = ApiTypeHelper.requireNonNull(builder.field, this, "field"); + this.location = ApiTypeHelper.unmodifiableRequired(builder.location, this, "location"); + + this.mode = builder.mode; + this.distanceType = builder.distanceType; + this.ignoreUnmapped = builder.ignoreUnmapped; + this.order = builder.order; + this.unit = builder.unit; + + } + + public static GeoDistanceSort of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * SortOptions variant kind. + */ + @Override + public SortOptions.Kind _sortOptionsKind() { + return SortOptions.Kind.GeoDistance; + } + + /** + * Required - + */ + public final String field() { + return this.field; + } + + /** + * Required - + */ + public final List location() { + return this.location; + } + + /** + * API name: {@code mode} + */ + @Nullable + public final SortMode mode() { + return this.mode; + } + + /** + * API name: {@code distance_type} + */ + @Nullable + public final GeoDistanceType distanceType() { + return this.distanceType; + } + + /** + * API name: {@code ignore_unmapped} + */ + @Nullable + public final Boolean ignoreUnmapped() { + return this.ignoreUnmapped; + } + + /** + * API name: {@code order} + */ + @Nullable + public final SortOrder order() { + return this.order; + } + + /** + * API name: {@code unit} + */ + @Nullable + public final DistanceUnit unit() { + return this.unit; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey(this.field); + generator.writeStartArray(); + for (GeoLocation item0 : this.location) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + if (this.mode != null) { + generator.writeKey("mode"); + this.mode.serialize(generator, mapper); + } + if (this.distanceType != null) { + generator.writeKey("distance_type"); + this.distanceType.serialize(generator, mapper); + } + if (this.ignoreUnmapped != null) { + generator.writeKey("ignore_unmapped"); + generator.write(this.ignoreUnmapped); + + } + if (this.order != null) { + generator.writeKey("order"); + this.order.serialize(generator, mapper); + } + if (this.unit != null) { + generator.writeKey("unit"); + this.unit.serialize(generator, mapper); + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GeoDistanceSort}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String field; + + private List location; + + /** + * Required - + */ + public final Builder field(String value) { + this.field = value; + return this; + } + + /** + * Required - Adds all elements of list to location. + */ + public final Builder location(List list) { + this.location = _listAddAll(this.location, list); + return this; + } + + /** + * Required - Adds one or more values to location. + */ + public final Builder location(GeoLocation value, GeoLocation... values) { + this.location = _listAdd(this.location, value, values); + return this; + } + + /** + * Required - Adds a value to location using a builder lambda. + */ + public final Builder location(Function> fn) { + return location(fn.apply(new GeoLocation.Builder()).build()); + } + + @Nullable + private SortMode mode; + + @Nullable + private GeoDistanceType distanceType; + + @Nullable + private Boolean ignoreUnmapped; + + @Nullable + private SortOrder order; + + @Nullable + private DistanceUnit unit; + + /** + * API name: {@code mode} + */ + public final Builder mode(@Nullable SortMode value) { + this.mode = value; + return this; + } + + /** + * API name: {@code distance_type} + */ + public final Builder distanceType(@Nullable GeoDistanceType value) { + this.distanceType = value; + return this; + } + + /** + * API name: {@code ignore_unmapped} + */ + public final Builder ignoreUnmapped(@Nullable Boolean value) { + this.ignoreUnmapped = value; + return this; + } + + /** + * API name: {@code order} + */ + public final Builder order(@Nullable SortOrder value) { + this.order = value; + return this; + } + + /** + * API name: {@code unit} + */ + public final Builder unit(@Nullable DistanceUnit value) { + this.unit = value; + return this; + } + + /** + * Builds a {@link GeoDistanceSort}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GeoDistanceSort build() { + _checkSingleUse(); + + return new GeoDistanceSort(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GeoDistanceSort} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GeoDistanceSort::setupGeoDistanceSortDeserializer + ); + + protected static void setupGeoDistanceSortDeserializer(ObjectDeserializer op) { + + op.add(Builder::mode, SortMode._DESERIALIZER, "mode"); + op.add(Builder::distanceType, GeoDistanceType._DESERIALIZER, "distance_type"); + op.add(Builder::ignoreUnmapped, JsonpDeserializer.booleanDeserializer(), "ignore_unmapped"); + op.add(Builder::order, SortOrder._DESERIALIZER, "order"); + op.add(Builder::unit, DistanceUnit._DESERIALIZER, "unit"); + + op.setUnknownFieldHandler((builder, name, parser, mapper) -> { + builder.field(name); + builder.location(JsonpDeserializer.arrayDeserializer(GeoLocation._DESERIALIZER).deserialize(parser, mapper)); + }); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoDistanceType.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoDistanceType.java index f9b0266251..ff616f352f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoDistanceType.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoDistanceType.java @@ -37,22 +37,21 @@ @JsonpDeserializable public enum GeoDistanceType implements JsonEnum { - Arc("arc"), + Arc("arc"), - Plane("plane"), + Plane("plane"), - ; + ; - private final String jsonValue; + private final String jsonValue; - GeoDistanceType(String jsonValue) { - this.jsonValue = jsonValue; - } + GeoDistanceType(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - GeoDistanceType.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(GeoDistanceType.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashLocation.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashLocation.java index 47ba815a26..ddb345f60d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashLocation.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashLocation.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,92 +43,92 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; // typedef: _types.GeoHashLocation @JsonpDeserializable public class GeoHashLocation implements JsonpSerializable { - private final String geohash; + private final String geohash; - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - private GeoHashLocation(Builder builder) { + private GeoHashLocation(Builder builder) { - this.geohash = ApiTypeHelper.requireNonNull(builder.geohash, this, "geohash"); + this.geohash = ApiTypeHelper.requireNonNull(builder.geohash, this, "geohash"); - } + } - public static GeoHashLocation of(Function> fn) { - return fn.apply(new Builder()).build(); - } + public static GeoHashLocation of(Function> fn) { + return fn.apply(new Builder()).build(); + } - /** - * Required - API name: {@code geohash} - */ - public final String geohash() { - return this.geohash; - } + /** + * Required - API name: {@code geohash} + */ + public final String geohash() { + return this.geohash; + } - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("geohash"); - generator.write(this.geohash); + generator.writeKey("geohash"); + generator.write(this.geohash); - } + } - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - /** - * Builder for {@link GeoHashLocation}. - */ + /** + * Builder for {@link GeoHashLocation}. + */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String geohash; + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String geohash; - /** - * Required - API name: {@code geohash} - */ - public final Builder geohash(String value) { - this.geohash = value; - return this; - } + /** + * Required - API name: {@code geohash} + */ + public final Builder geohash(String value) { + this.geohash = value; + return this; + } - /** - * Builds a {@link GeoHashLocation}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GeoHashLocation build() { - _checkSingleUse(); + /** + * Builds a {@link GeoHashLocation}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GeoHashLocation build() { + _checkSingleUse(); - return new GeoHashLocation(this); - } - } + return new GeoHashLocation(this); + } + } - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - /** - * Json deserializer for {@link GeoHashLocation} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - GeoHashLocation::setupGeoHashLocationDeserializer); + /** + * Json deserializer for {@link GeoHashLocation} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GeoHashLocation::setupGeoHashLocationDeserializer + ); - protected static void setupGeoHashLocationDeserializer(ObjectDeserializer op) { + protected static void setupGeoHashLocationDeserializer(ObjectDeserializer op) { - op.add(Builder::geohash, JsonpDeserializer.stringDeserializer(), "geohash"); + op.add(Builder::geohash, JsonpDeserializer.stringDeserializer(), "geohash"); - } + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashPrecision.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashPrecision.java index 9ab1939d53..0b25072c7e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashPrecision.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashPrecision.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,147 +44,148 @@ import org.opensearch.client.util.ObjectBuilderBase; import org.opensearch.client.util.TaggedUnion; import org.opensearch.client.util.TaggedUnionUtils; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; // typedef: _types.GeoHashPrecision /** * A precision that can be expressed as a geohash length between 1 and 12, or a * distance measure like "1km", "10m". - * + * */ @JsonpDeserializable public class GeoHashPrecision implements TaggedUnion, JsonpSerializable { - public enum Kind { - GeohashLength, Distance - - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - private GeoHashPrecision(Kind kind, Object value) { - this._kind = kind; - this._value = value; - } - - public String _toJsonString() { - switch (_kind) { - case GeohashLength : - return this.geohashLength().toString(); - case Distance : - return this.distance(); - - default : - throw new IllegalStateException("Unknown kind " + _kind); - } - } - - private GeoHashPrecision(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static GeoHashPrecision of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Is this variant instance of kind {@code geohash_length}? - */ - public boolean isGeohashLength() { - return _kind == Kind.GeohashLength; - } - - /** - * Get the {@code geohash_length} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code geohash_length} kind. - */ - public Number geohashLength() { - return TaggedUnionUtils.get(this, Kind.GeohashLength); - } - - /** - * Is this variant instance of kind {@code distance}? - */ - public boolean isDistance() { - return _kind == Kind.Distance; - } - - /** - * Get the {@code distance} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code distance} kind. - */ - public String distance() { - return TaggedUnionUtils.get(this, Kind.Distance); - } - - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - if (_value instanceof JsonpSerializable) { - ((JsonpSerializable) _value).serialize(generator, mapper); - } else { - switch (_kind) { - case GeohashLength : - generator.write(((Number) this._value).doubleValue()); - - break; - case Distance : - generator.write(((String) this._value)); - - break; - } - } - - } - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Kind _kind; - private Object _value; - - public ObjectBuilder geohashLength(Number v) { - this._kind = Kind.GeohashLength; - this._value = v; - return this; - } - - public ObjectBuilder distance(String v) { - this._kind = Kind.Distance; - this._value = v; - return this; - } - - public GeoHashPrecision build() { - _checkSingleUse(); - return new GeoHashPrecision(this); - } - - } - - private static JsonpDeserializer buildGeoHashPrecisionDeserializer() { - return new UnionDeserializer.Builder(GeoHashPrecision::new, false) - .addMember(Kind.GeohashLength, JsonpDeserializer.numberDeserializer()) - .addMember(Kind.Distance, JsonpDeserializer.stringDeserializer()).build(); - } - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .lazy(GeoHashPrecision::buildGeoHashPrecisionDeserializer); + public enum Kind { + GeohashLength, + Distance + + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + private GeoHashPrecision(Kind kind, Object value) { + this._kind = kind; + this._value = value; + } + + public String _toJsonString() { + switch (_kind) { + case GeohashLength: + return this.geohashLength().toString(); + case Distance: + return this.distance(); + + default: + throw new IllegalStateException("Unknown kind " + _kind); + } + } + + private GeoHashPrecision(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + } + + public static GeoHashPrecision of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code geohash_length}? + */ + public boolean isGeohashLength() { + return _kind == Kind.GeohashLength; + } + + /** + * Get the {@code geohash_length} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code geohash_length} kind. + */ + public Number geohashLength() { + return TaggedUnionUtils.get(this, Kind.GeohashLength); + } + + /** + * Is this variant instance of kind {@code distance}? + */ + public boolean isDistance() { + return _kind == Kind.Distance; + } + + /** + * Get the {@code distance} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code distance} kind. + */ + public String distance() { + return TaggedUnionUtils.get(this, Kind.Distance); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } else { + switch (_kind) { + case GeohashLength: + generator.write(((Number) this._value).doubleValue()); + + break; + case Distance: + generator.write(((String) this._value)); + + break; + } + } + + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + + public ObjectBuilder geohashLength(Number v) { + this._kind = Kind.GeohashLength; + this._value = v; + return this; + } + + public ObjectBuilder distance(String v) { + this._kind = Kind.Distance; + this._value = v; + return this; + } + + public GeoHashPrecision build() { + _checkSingleUse(); + return new GeoHashPrecision(this); + } + + } + + private static JsonpDeserializer buildGeoHashPrecisionDeserializer() { + return new UnionDeserializer.Builder(GeoHashPrecision::new, false).addMember( + Kind.GeohashLength, + JsonpDeserializer.numberDeserializer() + ).addMember(Kind.Distance, JsonpDeserializer.stringDeserializer()).build(); + } + + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy( + GeoHashPrecision::buildGeoHashPrecisionDeserializer + ); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashPrecisionBuilders.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashPrecisionBuilders.java index 1a635a467c..be883f856f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashPrecisionBuilders.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoHashPrecisionBuilders.java @@ -38,10 +38,9 @@ * Variants geohash_length, distance are not available * here as they don't have a dedicated class. Use {@link GeoHashPrecision}'s * builder for these. - * + * */ public class GeoHashPrecisionBuilders { - private GeoHashPrecisionBuilders() { - } + private GeoHashPrecisionBuilders() {} } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLine.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLine.java index 872218cbf2..0b21c874f9 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLine.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLine.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,159 +44,161 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.function.Function; // typedef: _types.GeoLine /** * A GeoJson GeoLine. - * + * */ @JsonpDeserializable public class GeoLine implements JsonpSerializable { - private final String type; - - private final List> coordinates; - - // --------------------------------------------------------------------------------------------- - - private GeoLine(Builder builder) { - - this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); - this.coordinates = ApiTypeHelper.unmodifiableRequired(builder.coordinates, this, "coordinates"); - - } - - public static GeoLine of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Always "LineString" - *

- * API name: {@code type} - */ - public final String type() { - return this.type; - } - - /** - * Required - Array of [lon, lat] coordinates - *

- * API name: {@code coordinates} - */ - public final List> coordinates() { - return this.coordinates; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("type"); - generator.write(this.type); - - if (ApiTypeHelper.isDefined(this.coordinates)) { - generator.writeKey("coordinates"); - generator.writeStartArray(); - for (List item0 : this.coordinates) { - generator.writeStartArray(); - if (item0 != null) { - for (Double item1 : item0) { - generator.write(item1); - - } - } - generator.writeEnd(); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GeoLine}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String type; - - private List> coordinates; - - /** - * Required - Always "LineString" - *

- * API name: {@code type} - */ - public final Builder type(String value) { - this.type = value; - return this; - } - - /** - * Required - Array of [lon, lat] coordinates - *

- * API name: {@code coordinates} - *

- * Adds all elements of list to coordinates. - */ - public final Builder coordinates(List> list) { - this.coordinates = _listAddAll(this.coordinates, list); - return this; - } - - /** - * Required - Array of [lon, lat] coordinates - *

- * API name: {@code coordinates} - *

- * Adds one or more values to coordinates. - */ - public final Builder coordinates(List value, List... values) { - this.coordinates = _listAdd(this.coordinates, value, values); - return this; - } - - /** - * Builds a {@link GeoLine}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GeoLine build() { - _checkSingleUse(); - - return new GeoLine(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link GeoLine} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - GeoLine::setupGeoLineDeserializer); - - protected static void setupGeoLineDeserializer(ObjectDeserializer op) { - - op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); - op.add(Builder::coordinates, JsonpDeserializer.arrayDeserializer( - JsonpDeserializer.arrayDeserializer(JsonpDeserializer.doubleDeserializer())), "coordinates"); - - } + private final String type; + + private final List> coordinates; + + // --------------------------------------------------------------------------------------------- + + private GeoLine(Builder builder) { + + this.type = ApiTypeHelper.requireNonNull(builder.type, this, "type"); + this.coordinates = ApiTypeHelper.unmodifiableRequired(builder.coordinates, this, "coordinates"); + + } + + public static GeoLine of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Always "LineString" + *

+ * API name: {@code type} + */ + public final String type() { + return this.type; + } + + /** + * Required - Array of [lon, lat] coordinates + *

+ * API name: {@code coordinates} + */ + public final List> coordinates() { + return this.coordinates; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("type"); + generator.write(this.type); + + if (ApiTypeHelper.isDefined(this.coordinates)) { + generator.writeKey("coordinates"); + generator.writeStartArray(); + for (List item0 : this.coordinates) { + generator.writeStartArray(); + if (item0 != null) { + for (Double item1 : item0) { + generator.write(item1); + + } + } + generator.writeEnd(); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GeoLine}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String type; + + private List> coordinates; + + /** + * Required - Always "LineString" + *

+ * API name: {@code type} + */ + public final Builder type(String value) { + this.type = value; + return this; + } + + /** + * Required - Array of [lon, lat] coordinates + *

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

+ * Adds all elements of list to coordinates. + */ + public final Builder coordinates(List> list) { + this.coordinates = _listAddAll(this.coordinates, list); + return this; + } + + /** + * Required - Array of [lon, lat] coordinates + *

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

+ * Adds one or more values to coordinates. + */ + public final Builder coordinates(List value, List... values) { + this.coordinates = _listAdd(this.coordinates, value, values); + return this; + } + + /** + * Builds a {@link GeoLine}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GeoLine build() { + _checkSingleUse(); + + return new GeoLine(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GeoLine} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GeoLine::setupGeoLineDeserializer + ); + + protected static void setupGeoLineDeserializer(ObjectDeserializer op) { + + op.add(Builder::type, JsonpDeserializer.stringDeserializer(), "type"); + op.add( + Builder::coordinates, + JsonpDeserializer.arrayDeserializer(JsonpDeserializer.arrayDeserializer(JsonpDeserializer.doubleDeserializer())), + "coordinates" + ); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocation.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocation.java index 41a8a107a0..f04f86d802 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocation.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocation.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,9 +45,6 @@ import org.opensearch.client.util.ObjectBuilderBase; import org.opensearch.client.util.TaggedUnion; import org.opensearch.client.util.TaggedUnionUtils; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.function.Function; // typedef: _types.GeoLocation @@ -63,185 +63,188 @@ @JsonpDeserializable public class GeoLocation implements TaggedUnion, JsonpSerializable { - public enum Kind { - Coords, Geohash, Latlon, Text - - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - private GeoLocation(Kind kind, Object value) { - this._kind = kind; - this._value = value; - } - - private GeoLocation(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static GeoLocation of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Is this variant instance of kind {@code coords}? - */ - public boolean isCoords() { - return _kind == Kind.Coords; - } - - /** - * Get the {@code coords} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code coords} kind. - */ - public List coords() { - return TaggedUnionUtils.get(this, Kind.Coords); - } - - /** - * Is this variant instance of kind {@code geohash}? - */ - public boolean isGeohash() { - return _kind == Kind.Geohash; - } - - /** - * Get the {@code geohash} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code geohash} kind. - */ - public GeoHashLocation geohash() { - return TaggedUnionUtils.get(this, Kind.Geohash); - } - - /** - * Is this variant instance of kind {@code latlon}? - */ - public boolean isLatlon() { - return _kind == Kind.Latlon; - } - - /** - * Get the {@code latlon} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code latlon} kind. - */ - public LatLonGeoLocation latlon() { - return TaggedUnionUtils.get(this, Kind.Latlon); - } - - /** - * Is this variant instance of kind {@code text}? - */ - public boolean isText() { - return _kind == Kind.Text; - } - - /** - * Get the {@code text} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code text} kind. - */ - public String text() { - return TaggedUnionUtils.get(this, Kind.Text); - } - - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - if (_value instanceof JsonpSerializable) { - ((JsonpSerializable) _value).serialize(generator, mapper); - } else { - switch (_kind) { - case Coords : - generator.writeStartArray(); - for (Double item0 : ((List) this._value)) { - generator.write(item0); - - } - generator.writeEnd(); - - break; - case Text : - generator.write(((String) this._value)); - - break; - } - } - - } - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Kind _kind; - private Object _value; - - public ObjectBuilder coords(List v) { - this._kind = Kind.Coords; - this._value = v; - return this; - } - - public ObjectBuilder geohash(GeoHashLocation v) { - this._kind = Kind.Geohash; - this._value = v; - return this; - } - - public ObjectBuilder geohash( - Function> fn) { - return this.geohash(fn.apply(new GeoHashLocation.Builder()).build()); - } - - public ObjectBuilder latlon(LatLonGeoLocation v) { - this._kind = Kind.Latlon; - this._value = v; - return this; - } - - public ObjectBuilder latlon( - Function> fn) { - return this.latlon(fn.apply(new LatLonGeoLocation.Builder()).build()); - } - - public ObjectBuilder text(String v) { - this._kind = Kind.Text; - this._value = v; - return this; - } - - public GeoLocation build() { - _checkSingleUse(); - return new GeoLocation(this); - } - - } - - private static JsonpDeserializer buildGeoLocationDeserializer() { - return new UnionDeserializer.Builder(GeoLocation::new, false) - .addMember(Kind.Coords, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.doubleDeserializer())) - .addMember(Kind.Geohash, GeoHashLocation._DESERIALIZER) - .addMember(Kind.Latlon, LatLonGeoLocation._DESERIALIZER) - .addMember(Kind.Text, JsonpDeserializer.stringDeserializer()).build(); - } - - public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer - .lazy(GeoLocation::buildGeoLocationDeserializer); + public enum Kind { + Coords, + Geohash, + Latlon, + Text + + } + + private final Kind _kind; + private final Object _value; + + @Override + public final Kind _kind() { + return _kind; + } + + @Override + public final Object _get() { + return _value; + } + + private GeoLocation(Kind kind, Object value) { + this._kind = kind; + this._value = value; + } + + private GeoLocation(Builder builder) { + + this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); + this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); + + } + + public static GeoLocation of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Is this variant instance of kind {@code coords}? + */ + public boolean isCoords() { + return _kind == Kind.Coords; + } + + /** + * Get the {@code coords} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code coords} kind. + */ + public List coords() { + return TaggedUnionUtils.get(this, Kind.Coords); + } + + /** + * Is this variant instance of kind {@code geohash}? + */ + public boolean isGeohash() { + return _kind == Kind.Geohash; + } + + /** + * Get the {@code geohash} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code geohash} kind. + */ + public GeoHashLocation geohash() { + return TaggedUnionUtils.get(this, Kind.Geohash); + } + + /** + * Is this variant instance of kind {@code latlon}? + */ + public boolean isLatlon() { + return _kind == Kind.Latlon; + } + + /** + * Get the {@code latlon} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code latlon} kind. + */ + public LatLonGeoLocation latlon() { + return TaggedUnionUtils.get(this, Kind.Latlon); + } + + /** + * Is this variant instance of kind {@code text}? + */ + public boolean isText() { + return _kind == Kind.Text; + } + + /** + * Get the {@code text} variant value. + * + * @throws IllegalStateException + * if the current variant is not of the {@code text} kind. + */ + public String text() { + return TaggedUnionUtils.get(this, Kind.Text); + } + + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + if (_value instanceof JsonpSerializable) { + ((JsonpSerializable) _value).serialize(generator, mapper); + } else { + switch (_kind) { + case Coords: + generator.writeStartArray(); + for (Double item0 : ((List) this._value)) { + generator.write(item0); + + } + generator.writeEnd(); + + break; + case Text: + generator.write(((String) this._value)); + + break; + } + } + + } + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Kind _kind; + private Object _value; + + public ObjectBuilder coords(List v) { + this._kind = Kind.Coords; + this._value = v; + return this; + } + + public ObjectBuilder geohash(GeoHashLocation v) { + this._kind = Kind.Geohash; + this._value = v; + return this; + } + + public ObjectBuilder geohash(Function> fn) { + return this.geohash(fn.apply(new GeoHashLocation.Builder()).build()); + } + + public ObjectBuilder latlon(LatLonGeoLocation v) { + this._kind = Kind.Latlon; + this._value = v; + return this; + } + + public ObjectBuilder latlon(Function> fn) { + return this.latlon(fn.apply(new LatLonGeoLocation.Builder()).build()); + } + + public ObjectBuilder text(String v) { + this._kind = Kind.Text; + this._value = v; + return this; + } + + public GeoLocation build() { + _checkSingleUse(); + return new GeoLocation(this); + } + + } + + private static JsonpDeserializer buildGeoLocationDeserializer() { + return new UnionDeserializer.Builder(GeoLocation::new, false).addMember( + Kind.Coords, + JsonpDeserializer.arrayDeserializer(JsonpDeserializer.doubleDeserializer()) + ) + .addMember(Kind.Geohash, GeoHashLocation._DESERIALIZER) + .addMember(Kind.Latlon, LatLonGeoLocation._DESERIALIZER) + .addMember(Kind.Text, JsonpDeserializer.stringDeserializer()) + .build(); + } + + public static final JsonpDeserializer _DESERIALIZER = JsonpDeserializer.lazy(GeoLocation::buildGeoLocationDeserializer); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocationBuilders.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocationBuilders.java index 602c5f1ff8..7568ad87a6 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocationBuilders.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoLocationBuilders.java @@ -38,26 +38,25 @@ * Variants coords, text are not available here as * they don't have a dedicated class. Use {@link GeoLocation}'s builder for * these. - * + * */ public class GeoLocationBuilders { - private GeoLocationBuilders() { - } + private GeoLocationBuilders() {} - /** - * Creates a builder for the {@link GeoHashLocation geohash} {@code GeoLocation} - * variant. - */ - public static GeoHashLocation.Builder geohash() { - return new GeoHashLocation.Builder(); - } + /** + * Creates a builder for the {@link GeoHashLocation geohash} {@code GeoLocation} + * variant. + */ + public static GeoHashLocation.Builder geohash() { + return new GeoHashLocation.Builder(); + } - /** - * Creates a builder for the {@link LatLonGeoLocation latlon} - * {@code GeoLocation} variant. - */ - public static LatLonGeoLocation.Builder latlon() { - return new LatLonGeoLocation.Builder(); - } + /** + * Creates a builder for the {@link LatLonGeoLocation latlon} + * {@code GeoLocation} variant. + */ + public static LatLonGeoLocation.Builder latlon() { + return new LatLonGeoLocation.Builder(); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoShapeRelation.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoShapeRelation.java index 1098174b2b..f51d42a238 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoShapeRelation.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GeoShapeRelation.java @@ -37,26 +37,25 @@ @JsonpDeserializable public enum GeoShapeRelation implements JsonEnum { - Intersects("intersects"), + Intersects("intersects"), - Disjoint("disjoint"), + Disjoint("disjoint"), - Within("within"), + Within("within"), - Contains("contains"), + Contains("contains"), - ; + ; - private final String jsonValue; + private final String jsonValue; - GeoShapeRelation(String jsonValue) { - this.jsonValue = jsonValue; - } + GeoShapeRelation(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - GeoShapeRelation.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(GeoShapeRelation.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GetStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GetStats.java index 42f595cb30..4e53545c95 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/GetStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/GetStats.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,325 +44,323 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.GetStats @JsonpDeserializable public class GetStats implements JsonpSerializable { - private final long current; - - @Nullable - private final String existsTime; - - private final long existsTimeInMillis; - - private final long existsTotal; - - @Nullable - private final String missingTime; - - private final long missingTimeInMillis; - - private final long missingTotal; - - @Nullable - private final String time; - - private final long timeInMillis; - - private final long total; - - // --------------------------------------------------------------------------------------------- - - private GetStats(Builder builder) { - - this.current = ApiTypeHelper.requireNonNull(builder.current, this, "current"); - this.existsTime = builder.existsTime; - this.existsTimeInMillis = ApiTypeHelper.requireNonNull(builder.existsTimeInMillis, this, "existsTimeInMillis"); - this.existsTotal = ApiTypeHelper.requireNonNull(builder.existsTotal, this, "existsTotal"); - this.missingTime = builder.missingTime; - this.missingTimeInMillis = ApiTypeHelper.requireNonNull(builder.missingTimeInMillis, this, - "missingTimeInMillis"); - this.missingTotal = ApiTypeHelper.requireNonNull(builder.missingTotal, this, "missingTotal"); - this.time = builder.time; - this.timeInMillis = ApiTypeHelper.requireNonNull(builder.timeInMillis, this, "timeInMillis"); - this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); - - } - - public static GetStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code current} - */ - public final long current() { - return this.current; - } - - /** - * API name: {@code exists_time} - */ - @Nullable - public final String existsTime() { - return this.existsTime; - } - - /** - * Required - API name: {@code exists_time_in_millis} - */ - public final long existsTimeInMillis() { - return this.existsTimeInMillis; - } - - /** - * Required - API name: {@code exists_total} - */ - public final long existsTotal() { - return this.existsTotal; - } - - /** - * API name: {@code missing_time} - */ - @Nullable - public final String missingTime() { - return this.missingTime; - } - - /** - * Required - API name: {@code missing_time_in_millis} - */ - public final long missingTimeInMillis() { - return this.missingTimeInMillis; - } - - /** - * Required - API name: {@code missing_total} - */ - public final long missingTotal() { - return this.missingTotal; - } + private final long current; + + @Nullable + private final String existsTime; + + private final long existsTimeInMillis; + + private final long existsTotal; + + @Nullable + private final String missingTime; + + private final long missingTimeInMillis; + + private final long missingTotal; + + @Nullable + private final String time; + + private final long timeInMillis; + + private final long total; + + // --------------------------------------------------------------------------------------------- + + private GetStats(Builder builder) { + + this.current = ApiTypeHelper.requireNonNull(builder.current, this, "current"); + this.existsTime = builder.existsTime; + this.existsTimeInMillis = ApiTypeHelper.requireNonNull(builder.existsTimeInMillis, this, "existsTimeInMillis"); + this.existsTotal = ApiTypeHelper.requireNonNull(builder.existsTotal, this, "existsTotal"); + this.missingTime = builder.missingTime; + this.missingTimeInMillis = ApiTypeHelper.requireNonNull(builder.missingTimeInMillis, this, "missingTimeInMillis"); + this.missingTotal = ApiTypeHelper.requireNonNull(builder.missingTotal, this, "missingTotal"); + this.time = builder.time; + this.timeInMillis = ApiTypeHelper.requireNonNull(builder.timeInMillis, this, "timeInMillis"); + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); + + } + + public static GetStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code current} + */ + public final long current() { + return this.current; + } + + /** + * API name: {@code exists_time} + */ + @Nullable + public final String existsTime() { + return this.existsTime; + } + + /** + * Required - API name: {@code exists_time_in_millis} + */ + public final long existsTimeInMillis() { + return this.existsTimeInMillis; + } + + /** + * Required - API name: {@code exists_total} + */ + public final long existsTotal() { + return this.existsTotal; + } + + /** + * API name: {@code missing_time} + */ + @Nullable + public final String missingTime() { + return this.missingTime; + } + + /** + * Required - API name: {@code missing_time_in_millis} + */ + public final long missingTimeInMillis() { + return this.missingTimeInMillis; + } + + /** + * Required - API name: {@code missing_total} + */ + public final long missingTotal() { + return this.missingTotal; + } - /** - * API name: {@code time} - */ - @Nullable - public final String time() { - return this.time; - } - - /** - * Required - API name: {@code time_in_millis} - */ - public final long timeInMillis() { - return this.timeInMillis; - } - - /** - * Required - API name: {@code total} - */ - public final long total() { - return this.total; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("current"); - generator.write(this.current); - - if (this.existsTime != null) { - generator.writeKey("exists_time"); - generator.write(this.existsTime); - - } - generator.writeKey("exists_time_in_millis"); - generator.write(this.existsTimeInMillis); - - generator.writeKey("exists_total"); - generator.write(this.existsTotal); - - if (this.missingTime != null) { - generator.writeKey("missing_time"); - generator.write(this.missingTime); - - } - generator.writeKey("missing_time_in_millis"); - generator.write(this.missingTimeInMillis); - - generator.writeKey("missing_total"); - generator.write(this.missingTotal); - - if (this.time != null) { - generator.writeKey("time"); - generator.write(this.time); - - } - generator.writeKey("time_in_millis"); - generator.write(this.timeInMillis); - - generator.writeKey("total"); - generator.write(this.total); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link GetStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long current; - - @Nullable - private String existsTime; - - private Long existsTimeInMillis; - - private Long existsTotal; - - @Nullable - private String missingTime; - - private Long missingTimeInMillis; - - private Long missingTotal; - - @Nullable - private String time; - - private Long timeInMillis; - - private Long total; - - /** - * Required - API name: {@code current} - */ - public final Builder current(long value) { - this.current = value; - return this; - } - - /** - * API name: {@code exists_time} - */ - public final Builder existsTime(@Nullable String value) { - this.existsTime = value; - return this; - } - - /** - * Required - API name: {@code exists_time_in_millis} - */ - public final Builder existsTimeInMillis(long value) { - this.existsTimeInMillis = value; - return this; - } - - /** - * Required - API name: {@code exists_total} - */ - public final Builder existsTotal(long value) { - this.existsTotal = value; - return this; - } - - /** - * API name: {@code missing_time} - */ - public final Builder missingTime(@Nullable String value) { - this.missingTime = value; - return this; - } - - /** - * Required - API name: {@code missing_time_in_millis} - */ - public final Builder missingTimeInMillis(long value) { - this.missingTimeInMillis = value; - return this; - } - - /** - * Required - API name: {@code missing_total} - */ - public final Builder missingTotal(long value) { - this.missingTotal = value; - return this; - } - - /** - * API name: {@code time} - */ - public final Builder time(@Nullable String value) { - this.time = value; - return this; - } - - /** - * Required - API name: {@code time_in_millis} - */ - public final Builder timeInMillis(long value) { - this.timeInMillis = value; - return this; - } - - /** - * Required - API name: {@code total} - */ - public final Builder total(long value) { - this.total = value; - return this; - } - - /** - * Builds a {@link GetStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public GetStats build() { - _checkSingleUse(); - - return new GetStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link GetStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - GetStats::setupGetStatsDeserializer); - - protected static void setupGetStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::current, JsonpDeserializer.longDeserializer(), "current"); - op.add(Builder::existsTime, JsonpDeserializer.stringDeserializer(), "exists_time"); - op.add(Builder::existsTimeInMillis, JsonpDeserializer.longDeserializer(), "exists_time_in_millis"); - op.add(Builder::existsTotal, JsonpDeserializer.longDeserializer(), "exists_total"); - op.add(Builder::missingTime, JsonpDeserializer.stringDeserializer(), "missing_time"); - op.add(Builder::missingTimeInMillis, JsonpDeserializer.longDeserializer(), "missing_time_in_millis"); - op.add(Builder::missingTotal, JsonpDeserializer.longDeserializer(), "missing_total"); - op.add(Builder::time, JsonpDeserializer.stringDeserializer(), "time"); - op.add(Builder::timeInMillis, JsonpDeserializer.longDeserializer(), "time_in_millis"); - op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); - - } + /** + * API name: {@code time} + */ + @Nullable + public final String time() { + return this.time; + } + + /** + * Required - API name: {@code time_in_millis} + */ + public final long timeInMillis() { + return this.timeInMillis; + } + + /** + * Required - API name: {@code total} + */ + public final long total() { + return this.total; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("current"); + generator.write(this.current); + + if (this.existsTime != null) { + generator.writeKey("exists_time"); + generator.write(this.existsTime); + + } + generator.writeKey("exists_time_in_millis"); + generator.write(this.existsTimeInMillis); + + generator.writeKey("exists_total"); + generator.write(this.existsTotal); + + if (this.missingTime != null) { + generator.writeKey("missing_time"); + generator.write(this.missingTime); + + } + generator.writeKey("missing_time_in_millis"); + generator.write(this.missingTimeInMillis); + + generator.writeKey("missing_total"); + generator.write(this.missingTotal); + + if (this.time != null) { + generator.writeKey("time"); + generator.write(this.time); + + } + generator.writeKey("time_in_millis"); + generator.write(this.timeInMillis); + + generator.writeKey("total"); + generator.write(this.total); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link GetStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long current; + + @Nullable + private String existsTime; + + private Long existsTimeInMillis; + + private Long existsTotal; + + @Nullable + private String missingTime; + + private Long missingTimeInMillis; + + private Long missingTotal; + + @Nullable + private String time; + + private Long timeInMillis; + + private Long total; + + /** + * Required - API name: {@code current} + */ + public final Builder current(long value) { + this.current = value; + return this; + } + + /** + * API name: {@code exists_time} + */ + public final Builder existsTime(@Nullable String value) { + this.existsTime = value; + return this; + } + + /** + * Required - API name: {@code exists_time_in_millis} + */ + public final Builder existsTimeInMillis(long value) { + this.existsTimeInMillis = value; + return this; + } + + /** + * Required - API name: {@code exists_total} + */ + public final Builder existsTotal(long value) { + this.existsTotal = value; + return this; + } + + /** + * API name: {@code missing_time} + */ + public final Builder missingTime(@Nullable String value) { + this.missingTime = value; + return this; + } + + /** + * Required - API name: {@code missing_time_in_millis} + */ + public final Builder missingTimeInMillis(long value) { + this.missingTimeInMillis = value; + return this; + } + + /** + * Required - API name: {@code missing_total} + */ + public final Builder missingTotal(long value) { + this.missingTotal = value; + return this; + } + + /** + * API name: {@code time} + */ + public final Builder time(@Nullable String value) { + this.time = value; + return this; + } + + /** + * Required - API name: {@code time_in_millis} + */ + public final Builder timeInMillis(long value) { + this.timeInMillis = value; + return this; + } + + /** + * Required - API name: {@code total} + */ + public final Builder total(long value) { + this.total = value; + return this; + } + + /** + * Builds a {@link GetStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public GetStats build() { + _checkSingleUse(); + + return new GetStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link GetStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + GetStats::setupGetStatsDeserializer + ); + + protected static void setupGetStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::current, JsonpDeserializer.longDeserializer(), "current"); + op.add(Builder::existsTime, JsonpDeserializer.stringDeserializer(), "exists_time"); + op.add(Builder::existsTimeInMillis, JsonpDeserializer.longDeserializer(), "exists_time_in_millis"); + op.add(Builder::existsTotal, JsonpDeserializer.longDeserializer(), "exists_total"); + op.add(Builder::missingTime, JsonpDeserializer.stringDeserializer(), "missing_time"); + op.add(Builder::missingTimeInMillis, JsonpDeserializer.longDeserializer(), "missing_time_in_millis"); + op.add(Builder::missingTotal, JsonpDeserializer.longDeserializer(), "missing_total"); + op.add(Builder::time, JsonpDeserializer.stringDeserializer(), "time"); + op.add(Builder::timeInMillis, JsonpDeserializer.longDeserializer(), "time_in_millis"); + op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/HealthStatus.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/HealthStatus.java index 371497cf65..09a9914a63 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/HealthStatus.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/HealthStatus.java @@ -37,42 +37,41 @@ @JsonpDeserializable public enum HealthStatus implements JsonEnum { - /** - * All shards are assigned. - */ - Green("green", "GREEN"), + /** + * All shards are assigned. + */ + Green("green", "GREEN"), - /** - * All primary shards are assigned, but one or more replica shards are - * unassigned. If a node in the cluster fails, some data could be unavailable - * until that node is repaired. - */ - Yellow("yellow", "YELLOW"), + /** + * All primary shards are assigned, but one or more replica shards are + * unassigned. If a node in the cluster fails, some data could be unavailable + * until that node is repaired. + */ + Yellow("yellow", "YELLOW"), - /** - * One or more primary shards are unassigned, so some data is unavailable. This - * can occur briefly during cluster startup as primary shards are assigned. - */ - Red("red", "RED"), + /** + * One or more primary shards are unassigned, so some data is unavailable. This + * can occur briefly during cluster startup as primary shards are assigned. + */ + Red("red", "RED"), - ; + ; - private final String jsonValue; - private final String[] aliases; + private final String jsonValue; + private final String[] aliases; - HealthStatus(String jsonValue, String... aliases) { - this.jsonValue = jsonValue; - this.aliases = aliases; - } + HealthStatus(String jsonValue, String... aliases) { + this.jsonValue = jsonValue; + this.aliases = aliases; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public String[] aliases() { - return this.aliases; - } + public String[] aliases() { + return this.aliases; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - HealthStatus.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(HealthStatus.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/IndexingStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/IndexingStats.java index 85dd47c932..9c81681f7a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/IndexingStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/IndexingStats.java @@ -32,6 +32,10 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,453 +45,450 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.Map; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.IndexingStats @JsonpDeserializable public class IndexingStats implements JsonpSerializable { - private final long indexCurrent; + private final long indexCurrent; - private final long deleteCurrent; - - @Nullable - private final String deleteTime; + private final long deleteCurrent; + + @Nullable + private final String deleteTime; - private final long deleteTimeInMillis; - - private final long deleteTotal; - - private final boolean isThrottled; - - private final long noopUpdateTotal; - - @Nullable - private final String throttleTime; - - private final long throttleTimeInMillis; - - @Nullable - private final String indexTime; - - private final long indexTimeInMillis; - - private final long indexTotal; - - private final long indexFailed; - - private final Map types; - - // --------------------------------------------------------------------------------------------- - - private IndexingStats(Builder builder) { - - this.indexCurrent = ApiTypeHelper.requireNonNull(builder.indexCurrent, this, "indexCurrent"); - this.deleteCurrent = ApiTypeHelper.requireNonNull(builder.deleteCurrent, this, "deleteCurrent"); - this.deleteTime = builder.deleteTime; - this.deleteTimeInMillis = ApiTypeHelper.requireNonNull(builder.deleteTimeInMillis, this, "deleteTimeInMillis"); - this.deleteTotal = ApiTypeHelper.requireNonNull(builder.deleteTotal, this, "deleteTotal"); - this.isThrottled = ApiTypeHelper.requireNonNull(builder.isThrottled, this, "isThrottled"); - this.noopUpdateTotal = ApiTypeHelper.requireNonNull(builder.noopUpdateTotal, this, "noopUpdateTotal"); - this.throttleTime = builder.throttleTime; - this.throttleTimeInMillis = ApiTypeHelper.requireNonNull(builder.throttleTimeInMillis, this, - "throttleTimeInMillis"); - this.indexTime = builder.indexTime; - this.indexTimeInMillis = ApiTypeHelper.requireNonNull(builder.indexTimeInMillis, this, "indexTimeInMillis"); - this.indexTotal = ApiTypeHelper.requireNonNull(builder.indexTotal, this, "indexTotal"); - this.indexFailed = ApiTypeHelper.requireNonNull(builder.indexFailed, this, "indexFailed"); - this.types = ApiTypeHelper.unmodifiable(builder.types); - - } - - public static IndexingStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code index_current} - */ - public final long indexCurrent() { - return this.indexCurrent; - } - - /** - * Required - API name: {@code delete_current} - */ - public final long deleteCurrent() { - return this.deleteCurrent; - } - - /** - * API name: {@code delete_time} - */ - @Nullable - public final String deleteTime() { - return this.deleteTime; - } - - /** - * Required - API name: {@code delete_time_in_millis} - */ - public final long deleteTimeInMillis() { - return this.deleteTimeInMillis; - } - - /** - * Required - API name: {@code delete_total} - */ - public final long deleteTotal() { - return this.deleteTotal; - } - - /** - * Required - API name: {@code is_throttled} - */ - public final boolean isThrottled() { - return this.isThrottled; - } - - /** - * Required - API name: {@code noop_update_total} - */ - public final long noopUpdateTotal() { - return this.noopUpdateTotal; - } - - /** - * API name: {@code throttle_time} - */ - @Nullable - public final String throttleTime() { - return this.throttleTime; - } - - /** - * Required - API name: {@code throttle_time_in_millis} - */ - public final long throttleTimeInMillis() { - return this.throttleTimeInMillis; - } - - /** - * API name: {@code index_time} - */ - @Nullable - public final String indexTime() { - return this.indexTime; - } - - /** - * Required - API name: {@code index_time_in_millis} - */ - public final long indexTimeInMillis() { - return this.indexTimeInMillis; - } - - /** - * Required - API name: {@code index_total} - */ - public final long indexTotal() { - return this.indexTotal; - } - - /** - * Required - API name: {@code index_failed} - */ - public final long indexFailed() { - return this.indexFailed; - } - - /** - * API name: {@code types} - */ - public final Map types() { - return this.types; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("index_current"); - generator.write(this.indexCurrent); - - generator.writeKey("delete_current"); - generator.write(this.deleteCurrent); - - if (this.deleteTime != null) { - generator.writeKey("delete_time"); - generator.write(this.deleteTime); - - } - generator.writeKey("delete_time_in_millis"); - generator.write(this.deleteTimeInMillis); - - generator.writeKey("delete_total"); - generator.write(this.deleteTotal); - - generator.writeKey("is_throttled"); - generator.write(this.isThrottled); - - generator.writeKey("noop_update_total"); - generator.write(this.noopUpdateTotal); - - if (this.throttleTime != null) { - generator.writeKey("throttle_time"); - generator.write(this.throttleTime); - - } - generator.writeKey("throttle_time_in_millis"); - generator.write(this.throttleTimeInMillis); - - if (this.indexTime != null) { - generator.writeKey("index_time"); - generator.write(this.indexTime); - - } - generator.writeKey("index_time_in_millis"); - generator.write(this.indexTimeInMillis); - - generator.writeKey("index_total"); - generator.write(this.indexTotal); - - generator.writeKey("index_failed"); - generator.write(this.indexFailed); - - if (ApiTypeHelper.isDefined(this.types)) { - generator.writeKey("types"); - generator.writeStartObject(); - for (Map.Entry item0 : this.types.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link IndexingStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long indexCurrent; - - private Long deleteCurrent; - - @Nullable - private String deleteTime; - - private Long deleteTimeInMillis; - - private Long deleteTotal; - - private Boolean isThrottled; - - private Long noopUpdateTotal; - - @Nullable - private String throttleTime; - - private Long throttleTimeInMillis; - - @Nullable - private String indexTime; - - private Long indexTimeInMillis; - - private Long indexTotal; - - private Long indexFailed; - - @Nullable - private Map types; - - /** - * Required - API name: {@code index_current} - */ - public final Builder indexCurrent(long value) { - this.indexCurrent = value; - return this; - } - - /** - * Required - API name: {@code delete_current} - */ - public final Builder deleteCurrent(long value) { - this.deleteCurrent = value; - return this; - } - - /** - * API name: {@code delete_time} - */ - public final Builder deleteTime(@Nullable String value) { - this.deleteTime = value; - return this; - } - - /** - * Required - API name: {@code delete_time_in_millis} - */ - public final Builder deleteTimeInMillis(long value) { - this.deleteTimeInMillis = value; - return this; - } - - /** - * Required - API name: {@code delete_total} - */ - public final Builder deleteTotal(long value) { - this.deleteTotal = value; - return this; - } - - /** - * Required - API name: {@code is_throttled} - */ - public final Builder isThrottled(boolean value) { - this.isThrottled = value; - return this; - } - - /** - * Required - API name: {@code noop_update_total} - */ - public final Builder noopUpdateTotal(long value) { - this.noopUpdateTotal = value; - return this; - } - - /** - * API name: {@code throttle_time} - */ - public final Builder throttleTime(@Nullable String value) { - this.throttleTime = value; - return this; - } - - /** - * Required - API name: {@code throttle_time_in_millis} - */ - public final Builder throttleTimeInMillis(long value) { - this.throttleTimeInMillis = value; - return this; - } - - /** - * API name: {@code index_time} - */ - public final Builder indexTime(@Nullable String value) { - this.indexTime = value; - return this; - } - - /** - * Required - API name: {@code index_time_in_millis} - */ - public final Builder indexTimeInMillis(long value) { - this.indexTimeInMillis = value; - return this; - } - - /** - * Required - API name: {@code index_total} - */ - public final Builder indexTotal(long value) { - this.indexTotal = value; - return this; - } - - /** - * Required - API name: {@code index_failed} - */ - public final Builder indexFailed(long value) { - this.indexFailed = value; - return this; - } - - /** - * API name: {@code types} - *

- * Adds all entries of map to types. - */ - public final Builder types(Map map) { - this.types = _mapPutAll(this.types, map); - return this; - } - - /** - * API name: {@code types} - *

- * Adds an entry to types. - */ - public final Builder types(String key, IndexingStats value) { - this.types = _mapPut(this.types, key, value); - return this; - } - - /** - * API name: {@code types} - *

- * Adds an entry to types using a builder lambda. - */ - public final Builder types(String key, Function> fn) { - return types(key, fn.apply(new IndexingStats.Builder()).build()); - } - - /** - * Builds a {@link IndexingStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public IndexingStats build() { - _checkSingleUse(); - - return new IndexingStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link IndexingStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - IndexingStats::setupIndexingStatsDeserializer); - - protected static void setupIndexingStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::indexCurrent, JsonpDeserializer.longDeserializer(), "index_current"); - op.add(Builder::deleteCurrent, JsonpDeserializer.longDeserializer(), "delete_current"); - op.add(Builder::deleteTime, JsonpDeserializer.stringDeserializer(), "delete_time"); - op.add(Builder::deleteTimeInMillis, JsonpDeserializer.longDeserializer(), "delete_time_in_millis"); - op.add(Builder::deleteTotal, JsonpDeserializer.longDeserializer(), "delete_total"); - op.add(Builder::isThrottled, JsonpDeserializer.booleanDeserializer(), "is_throttled"); - op.add(Builder::noopUpdateTotal, JsonpDeserializer.longDeserializer(), "noop_update_total"); - op.add(Builder::throttleTime, JsonpDeserializer.stringDeserializer(), "throttle_time"); - op.add(Builder::throttleTimeInMillis, JsonpDeserializer.longDeserializer(), "throttle_time_in_millis"); - op.add(Builder::indexTime, JsonpDeserializer.stringDeserializer(), "index_time"); - op.add(Builder::indexTimeInMillis, JsonpDeserializer.longDeserializer(), "index_time_in_millis"); - op.add(Builder::indexTotal, JsonpDeserializer.longDeserializer(), "index_total"); - op.add(Builder::indexFailed, JsonpDeserializer.longDeserializer(), "index_failed"); - op.add(Builder::types, JsonpDeserializer.stringMapDeserializer(IndexingStats._DESERIALIZER), "types"); - - } + private final long deleteTimeInMillis; + + private final long deleteTotal; + + private final boolean isThrottled; + + private final long noopUpdateTotal; + + @Nullable + private final String throttleTime; + + private final long throttleTimeInMillis; + + @Nullable + private final String indexTime; + + private final long indexTimeInMillis; + + private final long indexTotal; + + private final long indexFailed; + + private final Map types; + + // --------------------------------------------------------------------------------------------- + + private IndexingStats(Builder builder) { + + this.indexCurrent = ApiTypeHelper.requireNonNull(builder.indexCurrent, this, "indexCurrent"); + this.deleteCurrent = ApiTypeHelper.requireNonNull(builder.deleteCurrent, this, "deleteCurrent"); + this.deleteTime = builder.deleteTime; + this.deleteTimeInMillis = ApiTypeHelper.requireNonNull(builder.deleteTimeInMillis, this, "deleteTimeInMillis"); + this.deleteTotal = ApiTypeHelper.requireNonNull(builder.deleteTotal, this, "deleteTotal"); + this.isThrottled = ApiTypeHelper.requireNonNull(builder.isThrottled, this, "isThrottled"); + this.noopUpdateTotal = ApiTypeHelper.requireNonNull(builder.noopUpdateTotal, this, "noopUpdateTotal"); + this.throttleTime = builder.throttleTime; + this.throttleTimeInMillis = ApiTypeHelper.requireNonNull(builder.throttleTimeInMillis, this, "throttleTimeInMillis"); + this.indexTime = builder.indexTime; + this.indexTimeInMillis = ApiTypeHelper.requireNonNull(builder.indexTimeInMillis, this, "indexTimeInMillis"); + this.indexTotal = ApiTypeHelper.requireNonNull(builder.indexTotal, this, "indexTotal"); + this.indexFailed = ApiTypeHelper.requireNonNull(builder.indexFailed, this, "indexFailed"); + this.types = ApiTypeHelper.unmodifiable(builder.types); + + } + + public static IndexingStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code index_current} + */ + public final long indexCurrent() { + return this.indexCurrent; + } + + /** + * Required - API name: {@code delete_current} + */ + public final long deleteCurrent() { + return this.deleteCurrent; + } + + /** + * API name: {@code delete_time} + */ + @Nullable + public final String deleteTime() { + return this.deleteTime; + } + + /** + * Required - API name: {@code delete_time_in_millis} + */ + public final long deleteTimeInMillis() { + return this.deleteTimeInMillis; + } + + /** + * Required - API name: {@code delete_total} + */ + public final long deleteTotal() { + return this.deleteTotal; + } + + /** + * Required - API name: {@code is_throttled} + */ + public final boolean isThrottled() { + return this.isThrottled; + } + + /** + * Required - API name: {@code noop_update_total} + */ + public final long noopUpdateTotal() { + return this.noopUpdateTotal; + } + + /** + * API name: {@code throttle_time} + */ + @Nullable + public final String throttleTime() { + return this.throttleTime; + } + + /** + * Required - API name: {@code throttle_time_in_millis} + */ + public final long throttleTimeInMillis() { + return this.throttleTimeInMillis; + } + + /** + * API name: {@code index_time} + */ + @Nullable + public final String indexTime() { + return this.indexTime; + } + + /** + * Required - API name: {@code index_time_in_millis} + */ + public final long indexTimeInMillis() { + return this.indexTimeInMillis; + } + + /** + * Required - API name: {@code index_total} + */ + public final long indexTotal() { + return this.indexTotal; + } + + /** + * Required - API name: {@code index_failed} + */ + public final long indexFailed() { + return this.indexFailed; + } + + /** + * API name: {@code types} + */ + public final Map types() { + return this.types; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("index_current"); + generator.write(this.indexCurrent); + + generator.writeKey("delete_current"); + generator.write(this.deleteCurrent); + + if (this.deleteTime != null) { + generator.writeKey("delete_time"); + generator.write(this.deleteTime); + + } + generator.writeKey("delete_time_in_millis"); + generator.write(this.deleteTimeInMillis); + + generator.writeKey("delete_total"); + generator.write(this.deleteTotal); + + generator.writeKey("is_throttled"); + generator.write(this.isThrottled); + + generator.writeKey("noop_update_total"); + generator.write(this.noopUpdateTotal); + + if (this.throttleTime != null) { + generator.writeKey("throttle_time"); + generator.write(this.throttleTime); + + } + generator.writeKey("throttle_time_in_millis"); + generator.write(this.throttleTimeInMillis); + + if (this.indexTime != null) { + generator.writeKey("index_time"); + generator.write(this.indexTime); + + } + generator.writeKey("index_time_in_millis"); + generator.write(this.indexTimeInMillis); + + generator.writeKey("index_total"); + generator.write(this.indexTotal); + + generator.writeKey("index_failed"); + generator.write(this.indexFailed); + + if (ApiTypeHelper.isDefined(this.types)) { + generator.writeKey("types"); + generator.writeStartObject(); + for (Map.Entry item0 : this.types.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link IndexingStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long indexCurrent; + + private Long deleteCurrent; + + @Nullable + private String deleteTime; + + private Long deleteTimeInMillis; + + private Long deleteTotal; + + private Boolean isThrottled; + + private Long noopUpdateTotal; + + @Nullable + private String throttleTime; + + private Long throttleTimeInMillis; + + @Nullable + private String indexTime; + + private Long indexTimeInMillis; + + private Long indexTotal; + + private Long indexFailed; + + @Nullable + private Map types; + + /** + * Required - API name: {@code index_current} + */ + public final Builder indexCurrent(long value) { + this.indexCurrent = value; + return this; + } + + /** + * Required - API name: {@code delete_current} + */ + public final Builder deleteCurrent(long value) { + this.deleteCurrent = value; + return this; + } + + /** + * API name: {@code delete_time} + */ + public final Builder deleteTime(@Nullable String value) { + this.deleteTime = value; + return this; + } + + /** + * Required - API name: {@code delete_time_in_millis} + */ + public final Builder deleteTimeInMillis(long value) { + this.deleteTimeInMillis = value; + return this; + } + + /** + * Required - API name: {@code delete_total} + */ + public final Builder deleteTotal(long value) { + this.deleteTotal = value; + return this; + } + + /** + * Required - API name: {@code is_throttled} + */ + public final Builder isThrottled(boolean value) { + this.isThrottled = value; + return this; + } + + /** + * Required - API name: {@code noop_update_total} + */ + public final Builder noopUpdateTotal(long value) { + this.noopUpdateTotal = value; + return this; + } + + /** + * API name: {@code throttle_time} + */ + public final Builder throttleTime(@Nullable String value) { + this.throttleTime = value; + return this; + } + + /** + * Required - API name: {@code throttle_time_in_millis} + */ + public final Builder throttleTimeInMillis(long value) { + this.throttleTimeInMillis = value; + return this; + } + + /** + * API name: {@code index_time} + */ + public final Builder indexTime(@Nullable String value) { + this.indexTime = value; + return this; + } + + /** + * Required - API name: {@code index_time_in_millis} + */ + public final Builder indexTimeInMillis(long value) { + this.indexTimeInMillis = value; + return this; + } + + /** + * Required - API name: {@code index_total} + */ + public final Builder indexTotal(long value) { + this.indexTotal = value; + return this; + } + + /** + * Required - API name: {@code index_failed} + */ + public final Builder indexFailed(long value) { + this.indexFailed = value; + return this; + } + + /** + * API name: {@code types} + *

+ * Adds all entries of map to types. + */ + public final Builder types(Map map) { + this.types = _mapPutAll(this.types, map); + return this; + } + + /** + * API name: {@code types} + *

+ * Adds an entry to types. + */ + public final Builder types(String key, IndexingStats value) { + this.types = _mapPut(this.types, key, value); + return this; + } + + /** + * API name: {@code types} + *

+ * Adds an entry to types using a builder lambda. + */ + public final Builder types(String key, Function> fn) { + return types(key, fn.apply(new IndexingStats.Builder()).build()); + } + + /** + * Builds a {@link IndexingStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public IndexingStats build() { + _checkSingleUse(); + + return new IndexingStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link IndexingStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + IndexingStats::setupIndexingStatsDeserializer + ); + + protected static void setupIndexingStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::indexCurrent, JsonpDeserializer.longDeserializer(), "index_current"); + op.add(Builder::deleteCurrent, JsonpDeserializer.longDeserializer(), "delete_current"); + op.add(Builder::deleteTime, JsonpDeserializer.stringDeserializer(), "delete_time"); + op.add(Builder::deleteTimeInMillis, JsonpDeserializer.longDeserializer(), "delete_time_in_millis"); + op.add(Builder::deleteTotal, JsonpDeserializer.longDeserializer(), "delete_total"); + op.add(Builder::isThrottled, JsonpDeserializer.booleanDeserializer(), "is_throttled"); + op.add(Builder::noopUpdateTotal, JsonpDeserializer.longDeserializer(), "noop_update_total"); + op.add(Builder::throttleTime, JsonpDeserializer.stringDeserializer(), "throttle_time"); + op.add(Builder::throttleTimeInMillis, JsonpDeserializer.longDeserializer(), "throttle_time_in_millis"); + op.add(Builder::indexTime, JsonpDeserializer.stringDeserializer(), "index_time"); + op.add(Builder::indexTimeInMillis, JsonpDeserializer.longDeserializer(), "index_time_in_millis"); + op.add(Builder::indexTotal, JsonpDeserializer.longDeserializer(), "index_total"); + op.add(Builder::indexFailed, JsonpDeserializer.longDeserializer(), "index_failed"); + op.add(Builder::types, JsonpDeserializer.stringMapDeserializer(IndexingStats._DESERIALIZER), "types"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/IndicesResponseBase.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/IndicesResponseBase.java index 3c72c61935..ba251d885a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/IndicesResponseBase.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/IndicesResponseBase.java @@ -32,78 +32,76 @@ package org.opensearch.client.opensearch._types; -import org.opensearch.client.json.JsonpMapper; -import org.opensearch.client.json.ObjectDeserializer; -import org.opensearch.client.util.ObjectBuilder; import jakarta.json.stream.JsonGenerator; - import java.util.function.Function; import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.ObjectBuilder; // typedef: _types.IndicesResponseBase - public abstract class IndicesResponseBase extends AcknowledgedResponseBase { - @Nullable - private final ShardStatistics shards; + @Nullable + private final ShardStatistics shards; - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - protected IndicesResponseBase(AbstractBuilder builder) { - super(builder); + protected IndicesResponseBase(AbstractBuilder builder) { + super(builder); - this.shards = builder.shards; + this.shards = builder.shards; - } + } - /** - * API name: {@code _shards} - */ - @Nullable - public final ShardStatistics shards() { - return this.shards; - } + /** + * API name: {@code _shards} + */ + @Nullable + public final ShardStatistics shards() { + return this.shards; + } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); - if (this.shards != null) { - generator.writeKey("_shards"); - this.shards.serialize(generator, mapper); + super.serializeInternal(generator, mapper); + if (this.shards != null) { + generator.writeKey("_shards"); + this.shards.serialize(generator, mapper); - } + } - } + } - protected abstract static class AbstractBuilder> - extends - AcknowledgedResponseBase.AbstractBuilder { - @Nullable - private ShardStatistics shards; + protected abstract static class AbstractBuilder> extends + AcknowledgedResponseBase.AbstractBuilder { + @Nullable + private ShardStatistics shards; - /** - * API name: {@code _shards} - */ - public final BuilderT shards(@Nullable ShardStatistics value) { - this.shards = value; - return self(); - } + /** + * API name: {@code _shards} + */ + public final BuilderT shards(@Nullable ShardStatistics value) { + this.shards = value; + return self(); + } - /** - * API name: {@code _shards} - */ - public final BuilderT shards(Function> fn) { - return this.shards(fn.apply(new ShardStatistics.Builder()).build()); - } + /** + * API name: {@code _shards} + */ + public final BuilderT shards(Function> fn) { + return this.shards(fn.apply(new ShardStatistics.Builder()).build()); + } - } + } - // --------------------------------------------------------------------------------------------- - protected static > void setupIndicesResponseBaseDeserializer( - ObjectDeserializer op) { - setupAcknowledgedResponseBaseDeserializer(op); - op.add(AbstractBuilder::shards, ShardStatistics._DESERIALIZER, "_shards"); + // --------------------------------------------------------------------------------------------- + protected static > void setupIndicesResponseBaseDeserializer( + ObjectDeserializer op + ) { + setupAcknowledgedResponseBaseDeserializer(op); + op.add(AbstractBuilder::shards, ShardStatistics._DESERIALIZER, "_shards"); - } + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/InlineGet.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/InlineGet.java index 57ae78d5b1..cdebb2c397 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/InlineGet.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/InlineGet.java @@ -32,6 +32,12 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Function; +import java.util.function.Supplier; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -43,321 +49,317 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; - -import java.util.HashMap; -import java.util.Map; -import java.util.function.Function; -import java.util.function.Supplier; -import javax.annotation.Nullable; // typedef: _types.InlineGet - public class InlineGet implements JsonpSerializable { - private final Map metadata; - - private final Map fields; - - private final boolean found; - - @Nullable - private final Long seqNo; - - @Nullable - private final Long primaryTerm; - - @Nullable - private final String routing; - - private final TDocument source; - - @Nullable - private final JsonpSerializer tDocumentSerializer; - - // --------------------------------------------------------------------------------------------- - - private InlineGet(Builder builder) { - - this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); - - this.fields = ApiTypeHelper.unmodifiable(builder.fields); - this.found = ApiTypeHelper.requireNonNull(builder.found, this, "found"); - this.seqNo = builder.seqNo; - this.primaryTerm = builder.primaryTerm; - this.routing = builder.routing; - this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source"); - this.tDocumentSerializer = builder.tDocumentSerializer; - - } - - public static InlineGet of( - Function, ObjectBuilder>> fn) { - return fn.apply(new Builder<>()).build(); - } - - /** - * Document metadata - */ - public final Map metadata() { - return this.metadata; - } - - /** - * API name: {@code fields} - */ - public final Map fields() { - return this.fields; - } - - /** - * Required - API name: {@code found} - */ - public final boolean found() { - return this.found; - } - - /** - * API name: {@code _seq_no} - */ - @Nullable - public final Long seqNo() { - return this.seqNo; - } - - /** - * API name: {@code _primary_term} - */ - @Nullable - public final Long primaryTerm() { - return this.primaryTerm; - } - - /** - * API name: {@code _routing} - */ - @Nullable - public final String routing() { - return this.routing; - } - - /** - * Required - API name: {@code _source} - */ - public final TDocument source() { - return this.source; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - for (Map.Entry item0 : this.metadata.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - - if (ApiTypeHelper.isDefined(this.fields)) { - generator.writeKey("fields"); - generator.writeStartObject(); - for (Map.Entry item0 : this.fields.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - generator.writeKey("found"); - generator.write(this.found); - - if (this.seqNo != null) { - generator.writeKey("_seq_no"); - generator.write(this.seqNo); - - } - if (this.primaryTerm != null) { - generator.writeKey("_primary_term"); - generator.write(this.primaryTerm); - - } - if (this.routing != null) { - generator.writeKey("_routing"); - generator.write(this.routing); - - } - generator.writeKey("_source"); - JsonpUtils.serialize(this.source, generator, tDocumentSerializer, mapper); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link InlineGet}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder> { - @Nullable - private Map metadata = new HashMap<>(); - - /** - * Document metadata - *

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

- * Adds an entry to metadata. - */ - public final Builder metadata(String key, JsonData value) { - this.metadata = _mapPut(this.metadata, key, value); - return this; - } - - @Nullable - private Map fields; - - private Boolean found; - - @Nullable - private Long seqNo; - - @Nullable - private Long primaryTerm; - - @Nullable - private String routing; - - private TDocument source; - - @Nullable - private JsonpSerializer tDocumentSerializer; - - /** - * API name: {@code fields} - *

- * Adds all entries of map to fields. - */ - public final Builder fields(Map map) { - this.fields = _mapPutAll(this.fields, map); - return this; - } - - /** - * API name: {@code fields} - *

- * Adds an entry to fields. - */ - public final Builder fields(String key, JsonData value) { - this.fields = _mapPut(this.fields, key, value); - return this; - } - - /** - * Required - API name: {@code found} - */ - public final Builder found(boolean value) { - this.found = value; - return this; - } - - /** - * API name: {@code _seq_no} - */ - public final Builder seqNo(@Nullable Long value) { - this.seqNo = value; - return this; - } - - /** - * API name: {@code _primary_term} - */ - public final Builder primaryTerm(@Nullable Long value) { - this.primaryTerm = value; - return this; - } - - /** - * API name: {@code _routing} - */ - public final Builder routing(@Nullable String value) { - this.routing = value; - return this; - } - - /** - * Required - API name: {@code _source} - */ - public final Builder source(TDocument value) { - this.source = value; - return this; - } - - /** - * Serializer for TDocument. If not set, an attempt will be made to find a - * serializer from the JSON context. - */ - public final Builder tDocumentSerializer(@Nullable JsonpSerializer value) { - this.tDocumentSerializer = value; - return this; - } - - /** - * Builds a {@link InlineGet}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public InlineGet build() { - _checkSingleUse(); - - return new InlineGet(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Create a JSON deserializer for InlineGet - */ - public static JsonpDeserializer> createInlineGetDeserializer( - JsonpDeserializer tDocumentDeserializer) { - return ObjectBuilderDeserializer.createForObject((Supplier>) Builder::new, - op -> InlineGet.setupInlineGetDeserializer(op, tDocumentDeserializer)); - }; - - protected static void setupInlineGetDeserializer(ObjectDeserializer> op, - JsonpDeserializer tDocumentDeserializer) { - - op.add(Builder::fields, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "fields"); - op.add(Builder::found, JsonpDeserializer.booleanDeserializer(), "found"); - op.add(Builder::seqNo, JsonpDeserializer.longDeserializer(), "_seq_no"); - op.add(Builder::primaryTerm, JsonpDeserializer.longDeserializer(), "_primary_term"); - op.add(Builder::routing, JsonpDeserializer.stringDeserializer(), "_routing"); - op.add(Builder::source, tDocumentDeserializer, "_source"); - - op.setUnknownFieldHandler((builder, name, parser, mapper) -> { - if (builder.metadata == null) { - builder.metadata = new HashMap<>(); - } - builder.metadata.put(name, JsonData._DESERIALIZER.deserialize(parser, mapper)); - }); - - } + private final Map metadata; + + private final Map fields; + + private final boolean found; + + @Nullable + private final Long seqNo; + + @Nullable + private final Long primaryTerm; + + @Nullable + private final String routing; + + private final TDocument source; + + @Nullable + private final JsonpSerializer tDocumentSerializer; + + // --------------------------------------------------------------------------------------------- + + private InlineGet(Builder builder) { + + this.metadata = ApiTypeHelper.unmodifiable(builder.metadata); + + this.fields = ApiTypeHelper.unmodifiable(builder.fields); + this.found = ApiTypeHelper.requireNonNull(builder.found, this, "found"); + this.seqNo = builder.seqNo; + this.primaryTerm = builder.primaryTerm; + this.routing = builder.routing; + this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source"); + this.tDocumentSerializer = builder.tDocumentSerializer; + + } + + public static InlineGet of(Function, ObjectBuilder>> fn) { + return fn.apply(new Builder<>()).build(); + } + + /** + * Document metadata + */ + public final Map metadata() { + return this.metadata; + } + + /** + * API name: {@code fields} + */ + public final Map fields() { + return this.fields; + } + + /** + * Required - API name: {@code found} + */ + public final boolean found() { + return this.found; + } + + /** + * API name: {@code _seq_no} + */ + @Nullable + public final Long seqNo() { + return this.seqNo; + } + + /** + * API name: {@code _primary_term} + */ + @Nullable + public final Long primaryTerm() { + return this.primaryTerm; + } + + /** + * API name: {@code _routing} + */ + @Nullable + public final String routing() { + return this.routing; + } + + /** + * Required - API name: {@code _source} + */ + public final TDocument source() { + return this.source; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + for (Map.Entry item0 : this.metadata.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + + if (ApiTypeHelper.isDefined(this.fields)) { + generator.writeKey("fields"); + generator.writeStartObject(); + for (Map.Entry item0 : this.fields.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + + } + generator.writeEnd(); + + } + generator.writeKey("found"); + generator.write(this.found); + + if (this.seqNo != null) { + generator.writeKey("_seq_no"); + generator.write(this.seqNo); + + } + if (this.primaryTerm != null) { + generator.writeKey("_primary_term"); + generator.write(this.primaryTerm); + + } + if (this.routing != null) { + generator.writeKey("_routing"); + generator.write(this.routing); + + } + generator.writeKey("_source"); + JsonpUtils.serialize(this.source, generator, tDocumentSerializer, mapper); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link InlineGet}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder> { + @Nullable + private Map metadata = new HashMap<>(); + + /** + * Document metadata + *

+ * Adds all entries of map to metadata. + */ + public final Builder metadata(Map map) { + this.metadata = _mapPutAll(this.metadata, map); + return this; + } + + /** + * Document metadata + *

+ * Adds an entry to metadata. + */ + public final Builder metadata(String key, JsonData value) { + this.metadata = _mapPut(this.metadata, key, value); + return this; + } + + @Nullable + private Map fields; + + private Boolean found; + + @Nullable + private Long seqNo; + + @Nullable + private Long primaryTerm; + + @Nullable + private String routing; + + private TDocument source; + + @Nullable + private JsonpSerializer tDocumentSerializer; + + /** + * API name: {@code fields} + *

+ * Adds all entries of map to fields. + */ + public final Builder fields(Map map) { + this.fields = _mapPutAll(this.fields, map); + return this; + } + + /** + * API name: {@code fields} + *

+ * Adds an entry to fields. + */ + public final Builder fields(String key, JsonData value) { + this.fields = _mapPut(this.fields, key, value); + return this; + } + + /** + * Required - API name: {@code found} + */ + public final Builder found(boolean value) { + this.found = value; + return this; + } + + /** + * API name: {@code _seq_no} + */ + public final Builder seqNo(@Nullable Long value) { + this.seqNo = value; + return this; + } + + /** + * API name: {@code _primary_term} + */ + public final Builder primaryTerm(@Nullable Long value) { + this.primaryTerm = value; + return this; + } + + /** + * API name: {@code _routing} + */ + public final Builder routing(@Nullable String value) { + this.routing = value; + return this; + } + + /** + * Required - API name: {@code _source} + */ + public final Builder source(TDocument value) { + this.source = value; + return this; + } + + /** + * Serializer for TDocument. If not set, an attempt will be made to find a + * serializer from the JSON context. + */ + public final Builder tDocumentSerializer(@Nullable JsonpSerializer value) { + this.tDocumentSerializer = value; + return this; + } + + /** + * Builds a {@link InlineGet}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public InlineGet build() { + _checkSingleUse(); + + return new InlineGet(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Create a JSON deserializer for InlineGet + */ + public static JsonpDeserializer> createInlineGetDeserializer( + JsonpDeserializer tDocumentDeserializer + ) { + return ObjectBuilderDeserializer.createForObject( + (Supplier>) Builder::new, + op -> InlineGet.setupInlineGetDeserializer(op, tDocumentDeserializer) + ); + }; + + protected static void setupInlineGetDeserializer( + ObjectDeserializer> op, + JsonpDeserializer tDocumentDeserializer + ) { + + op.add(Builder::fields, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "fields"); + op.add(Builder::found, JsonpDeserializer.booleanDeserializer(), "found"); + op.add(Builder::seqNo, JsonpDeserializer.longDeserializer(), "_seq_no"); + op.add(Builder::primaryTerm, JsonpDeserializer.longDeserializer(), "_primary_term"); + op.add(Builder::routing, JsonpDeserializer.stringDeserializer(), "_routing"); + op.add(Builder::source, tDocumentDeserializer, "_source"); + + 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/InlineScript.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/InlineScript.java index f6aafdd58f..be2177029b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/InlineScript.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/InlineScript.java @@ -32,6 +32,10 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -39,169 +43,166 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; -import jakarta.json.stream.JsonGenerator; -import java.util.Map; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.InlineScript @JsonpDeserializable public class InlineScript extends ScriptBase { - @Nullable - private final String lang; - - private final Map options; - - private final String source; - - // --------------------------------------------------------------------------------------------- - - private InlineScript(Builder builder) { - super(builder); - - this.lang = builder.lang; - this.options = ApiTypeHelper.unmodifiable(builder.options); - this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source"); - - } - - public static InlineScript of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code lang} - */ - @Nullable - public final String lang() { - return this.lang; - } - - /** - * API name: {@code options} - */ - public final Map options() { - return this.options; - } - - /** - * Required - API name: {@code source} - */ - public final String source() { - return this.source; - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - super.serializeInternal(generator, mapper); - if (this.lang != null) { - generator.writeKey("lang"); - generator.write(this.lang); - - } - if (ApiTypeHelper.isDefined(this.options)) { - generator.writeKey("options"); - generator.writeStartObject(); - for (Map.Entry item0 : this.options.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); - - } - generator.writeKey("source"); - generator.write(this.source); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link InlineScript}. - */ - - public static class Builder extends ScriptBase.AbstractBuilder implements ObjectBuilder { - @Nullable - private String lang; - - @Nullable - private Map options; - - private String source; - - /** - * API name: {@code lang} - */ - public final Builder lang(@Nullable String value) { - this.lang = value; - return this; - } - - /** - * API name: {@code options} - *

- * Adds all entries of map to options. - */ - public final Builder options(Map map) { - this.options = _mapPutAll(this.options, map); - return this; - } - - /** - * API name: {@code options} - *

- * Adds an entry to options. - */ - public final Builder options(String key, String value) { - this.options = _mapPut(this.options, key, value); - return this; - } - - /** - * Required - API name: {@code source} - */ - public final Builder source(String value) { - this.source = value; - return this; - } - - @Override - protected Builder self() { - return this; - } - - /** - * Builds a {@link InlineScript}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public InlineScript build() { - _checkSingleUse(); - - return new InlineScript(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link InlineScript} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - InlineScript::setupInlineScriptDeserializer); - - protected static void setupInlineScriptDeserializer(ObjectDeserializer op) { - ScriptBase.setupScriptBaseDeserializer(op); - op.add(Builder::lang, JsonpDeserializer.stringDeserializer(), "lang"); - op.add(Builder::options, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), - "options"); - op.add(Builder::source, JsonpDeserializer.stringDeserializer(), "source"); - - op.shortcutProperty("source"); - - } + @Nullable + private final String lang; + + private final Map options; + + private final String source; + + // --------------------------------------------------------------------------------------------- + + private InlineScript(Builder builder) { + super(builder); + + this.lang = builder.lang; + this.options = ApiTypeHelper.unmodifiable(builder.options); + this.source = ApiTypeHelper.requireNonNull(builder.source, this, "source"); + + } + + public static InlineScript of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code lang} + */ + @Nullable + public final String lang() { + return this.lang; + } + + /** + * API name: {@code options} + */ + public final Map options() { + return this.options; + } + + /** + * Required - API name: {@code source} + */ + public final String source() { + return this.source; + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + super.serializeInternal(generator, mapper); + if (this.lang != null) { + generator.writeKey("lang"); + generator.write(this.lang); + + } + if (ApiTypeHelper.isDefined(this.options)) { + generator.writeKey("options"); + generator.writeStartObject(); + for (Map.Entry item0 : this.options.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + + } + generator.writeEnd(); + + } + generator.writeKey("source"); + generator.write(this.source); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link InlineScript}. + */ + + public static class Builder extends ScriptBase.AbstractBuilder implements ObjectBuilder { + @Nullable + private String lang; + + @Nullable + private Map options; + + private String source; + + /** + * API name: {@code lang} + */ + public final Builder lang(@Nullable String value) { + this.lang = value; + return this; + } + + /** + * API name: {@code options} + *

+ * Adds all entries of map to options. + */ + public final Builder options(Map map) { + this.options = _mapPutAll(this.options, map); + return this; + } + + /** + * API name: {@code options} + *

+ * Adds an entry to options. + */ + public final Builder options(String key, String value) { + this.options = _mapPut(this.options, key, value); + return this; + } + + /** + * Required - API name: {@code source} + */ + public final Builder source(String value) { + this.source = value; + return this; + } + + @Override + protected Builder self() { + return this; + } + + /** + * Builds a {@link InlineScript}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public InlineScript build() { + _checkSingleUse(); + + return new InlineScript(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link InlineScript} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + InlineScript::setupInlineScriptDeserializer + ); + + protected static void setupInlineScriptDeserializer(ObjectDeserializer op) { + ScriptBase.setupScriptBaseDeserializer(op); + op.add(Builder::lang, JsonpDeserializer.stringDeserializer(), "lang"); + op.add(Builder::options, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "options"); + op.add(Builder::source, JsonpDeserializer.stringDeserializer(), "source"); + + op.shortcutProperty("source"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/LatLonGeoLocation.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/LatLonGeoLocation.java index d100024525..986416874a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/LatLonGeoLocation.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/LatLonGeoLocation.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,116 +43,116 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; // typedef: _types.LatLonGeoLocation @JsonpDeserializable public class LatLonGeoLocation implements JsonpSerializable { - private final double lat; - - private final double lon; - - // --------------------------------------------------------------------------------------------- + private final double lat; - private LatLonGeoLocation(Builder builder) { + private final double lon; + + // --------------------------------------------------------------------------------------------- - this.lat = ApiTypeHelper.requireNonNull(builder.lat, this, "lat"); - this.lon = ApiTypeHelper.requireNonNull(builder.lon, this, "lon"); + private LatLonGeoLocation(Builder builder) { - } + this.lat = ApiTypeHelper.requireNonNull(builder.lat, this, "lat"); + this.lon = ApiTypeHelper.requireNonNull(builder.lon, this, "lon"); - public static LatLonGeoLocation of(Function> fn) { - return fn.apply(new Builder()).build(); - } + } - /** - * Required - API name: {@code lat} - */ - public final double lat() { - return this.lat; - } + public static LatLonGeoLocation of(Function> fn) { + return fn.apply(new Builder()).build(); + } - /** - * Required - API name: {@code lon} - */ - public final double lon() { - return this.lon; - } + /** + * Required - API name: {@code lat} + */ + public final double lat() { + return this.lat; + } - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } + /** + * Required - API name: {@code lon} + */ + public final double lon() { + return this.lon; + } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } - generator.writeKey("lat"); - generator.write(this.lat); + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("lon"); - generator.write(this.lon); + generator.writeKey("lat"); + generator.write(this.lat); - } + generator.writeKey("lon"); + generator.write(this.lon); - // --------------------------------------------------------------------------------------------- + } - /** - * Builder for {@link LatLonGeoLocation}. - */ + // --------------------------------------------------------------------------------------------- - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Double lat; + /** + * Builder for {@link LatLonGeoLocation}. + */ - private Double lon; + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Double lat; - /** - * Required - API name: {@code lat} - */ - public final Builder lat(double value) { - this.lat = value; - return this; - } + private Double lon; - /** - * Required - API name: {@code lon} - */ - public final Builder lon(double value) { - this.lon = value; - return this; - } + /** + * Required - API name: {@code lat} + */ + public final Builder lat(double value) { + this.lat = value; + return this; + } - /** - * Builds a {@link LatLonGeoLocation}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public LatLonGeoLocation build() { - _checkSingleUse(); + /** + * Required - API name: {@code lon} + */ + public final Builder lon(double value) { + this.lon = value; + return this; + } - return new LatLonGeoLocation(this); - } - } + /** + * Builds a {@link LatLonGeoLocation}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public LatLonGeoLocation build() { + _checkSingleUse(); - // --------------------------------------------------------------------------------------------- + return new LatLonGeoLocation(this); + } + } - /** - * Json deserializer for {@link LatLonGeoLocation} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, LatLonGeoLocation::setupLatLonGeoLocationDeserializer); + // --------------------------------------------------------------------------------------------- - protected static void setupLatLonGeoLocationDeserializer(ObjectDeserializer op) { + /** + * Json deserializer for {@link LatLonGeoLocation} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + LatLonGeoLocation::setupLatLonGeoLocationDeserializer + ); - op.add(Builder::lat, JsonpDeserializer.doubleDeserializer(), "lat"); - op.add(Builder::lon, JsonpDeserializer.doubleDeserializer(), "lon"); + protected static void setupLatLonGeoLocationDeserializer(ObjectDeserializer op) { - } + op.add(Builder::lat, JsonpDeserializer.doubleDeserializer(), "lat"); + op.add(Builder::lon, JsonpDeserializer.doubleDeserializer(), "lon"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Level.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Level.java index 0987308078..a7df990bb7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Level.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Level.java @@ -37,23 +37,23 @@ @JsonpDeserializable public enum Level implements JsonEnum { - Cluster("cluster"), + Cluster("cluster"), - Indices("indices"), + Indices("indices"), - Shards("shards"), + Shards("shards"), - ; + ; - private final String jsonValue; + private final String jsonValue; - Level(String jsonValue) { - this.jsonValue = jsonValue; - } + Level(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Level.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Level.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/LifecycleOperationMode.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/LifecycleOperationMode.java index 85e8b718e2..71cd0307ce 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/LifecycleOperationMode.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/LifecycleOperationMode.java @@ -37,24 +37,25 @@ @JsonpDeserializable public enum LifecycleOperationMode implements JsonEnum { - Running("RUNNING"), + Running("RUNNING"), - Stopping("STOPPING"), + Stopping("STOPPING"), - Stopped("STOPPED"), + Stopped("STOPPED"), - ; + ; - private final String jsonValue; + private final String jsonValue; - LifecycleOperationMode(String jsonValue) { - this.jsonValue = jsonValue; - } + LifecycleOperationMode(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( - LifecycleOperationMode.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>( + LifecycleOperationMode.values() + ); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/MergesStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/MergesStats.java index d98b62be8a..7a09b9de4a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/MergesStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/MergesStats.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,487 +44,486 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.MergesStats @JsonpDeserializable public class MergesStats implements JsonpSerializable { - private final long current; - - private final long currentDocs; + private final long current; - @Nullable - private final String currentSize; + private final long currentDocs; + + @Nullable + private final String currentSize; - private final long currentSizeInBytes; - - private final long total; - - @Nullable - private final String totalAutoThrottle; - - private final long totalAutoThrottleInBytes; - - private final long totalDocs; - - @Nullable - private final String totalSize; - - private final long totalSizeInBytes; - - @Nullable - private final String totalStoppedTime; - - private final long totalStoppedTimeInMillis; - - @Nullable - private final String totalThrottledTime; - - private final long totalThrottledTimeInMillis; - - @Nullable - private final String totalTime; - - private final long totalTimeInMillis; - - // --------------------------------------------------------------------------------------------- - - private MergesStats(Builder builder) { - - this.current = ApiTypeHelper.requireNonNull(builder.current, this, "current"); - this.currentDocs = ApiTypeHelper.requireNonNull(builder.currentDocs, this, "currentDocs"); - this.currentSize = builder.currentSize; - this.currentSizeInBytes = ApiTypeHelper.requireNonNull(builder.currentSizeInBytes, this, "currentSizeInBytes"); - this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); - this.totalAutoThrottle = builder.totalAutoThrottle; - this.totalAutoThrottleInBytes = ApiTypeHelper.requireNonNull(builder.totalAutoThrottleInBytes, this, - "totalAutoThrottleInBytes"); - this.totalDocs = ApiTypeHelper.requireNonNull(builder.totalDocs, this, "totalDocs"); - this.totalSize = builder.totalSize; - this.totalSizeInBytes = ApiTypeHelper.requireNonNull(builder.totalSizeInBytes, this, "totalSizeInBytes"); - this.totalStoppedTime = builder.totalStoppedTime; - this.totalStoppedTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalStoppedTimeInMillis, this, - "totalStoppedTimeInMillis"); - this.totalThrottledTime = builder.totalThrottledTime; - this.totalThrottledTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalThrottledTimeInMillis, this, - "totalThrottledTimeInMillis"); - this.totalTime = builder.totalTime; - this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); - - } - - public static MergesStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code current} - */ - public final long current() { - return this.current; - } - - /** - * Required - API name: {@code current_docs} - */ - public final long currentDocs() { - return this.currentDocs; - } - - /** - * API name: {@code current_size} - */ - @Nullable - public final String currentSize() { - return this.currentSize; - } - - /** - * Required - API name: {@code current_size_in_bytes} - */ - public final long currentSizeInBytes() { - return this.currentSizeInBytes; - } - - /** - * Required - API name: {@code total} - */ - public final long total() { - return this.total; - } - - /** - * API name: {@code total_auto_throttle} - */ - @Nullable - public final String totalAutoThrottle() { - return this.totalAutoThrottle; - } - - /** - * Required - API name: {@code total_auto_throttle_in_bytes} - */ - public final long totalAutoThrottleInBytes() { - return this.totalAutoThrottleInBytes; - } - - /** - * Required - API name: {@code total_docs} - */ - public final long totalDocs() { - return this.totalDocs; - } - - /** - * API name: {@code total_size} - */ - @Nullable - public final String totalSize() { - return this.totalSize; - } - - /** - * Required - API name: {@code total_size_in_bytes} - */ - public final long totalSizeInBytes() { - return this.totalSizeInBytes; - } - - /** - * API name: {@code total_stopped_time} - */ - @Nullable - public final String totalStoppedTime() { - return this.totalStoppedTime; - } - - /** - * Required - API name: {@code total_stopped_time_in_millis} - */ - public final long totalStoppedTimeInMillis() { - return this.totalStoppedTimeInMillis; - } - - /** - * API name: {@code total_throttled_time} - */ - @Nullable - public final String totalThrottledTime() { - return this.totalThrottledTime; - } - - /** - * Required - API name: {@code total_throttled_time_in_millis} - */ - public final long totalThrottledTimeInMillis() { - return this.totalThrottledTimeInMillis; - } - - /** - * API name: {@code total_time} - */ - @Nullable - public final String totalTime() { - return this.totalTime; - } - - /** - * Required - API name: {@code total_time_in_millis} - */ - public final long totalTimeInMillis() { - return this.totalTimeInMillis; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("current"); - generator.write(this.current); - - generator.writeKey("current_docs"); - generator.write(this.currentDocs); - - if (this.currentSize != null) { - generator.writeKey("current_size"); - generator.write(this.currentSize); - - } - generator.writeKey("current_size_in_bytes"); - generator.write(this.currentSizeInBytes); - - generator.writeKey("total"); - generator.write(this.total); - - if (this.totalAutoThrottle != null) { - generator.writeKey("total_auto_throttle"); - generator.write(this.totalAutoThrottle); - - } - generator.writeKey("total_auto_throttle_in_bytes"); - generator.write(this.totalAutoThrottleInBytes); - - generator.writeKey("total_docs"); - generator.write(this.totalDocs); - - if (this.totalSize != null) { - generator.writeKey("total_size"); - generator.write(this.totalSize); - - } - generator.writeKey("total_size_in_bytes"); - generator.write(this.totalSizeInBytes); - - if (this.totalStoppedTime != null) { - generator.writeKey("total_stopped_time"); - generator.write(this.totalStoppedTime); - - } - generator.writeKey("total_stopped_time_in_millis"); - generator.write(this.totalStoppedTimeInMillis); - - if (this.totalThrottledTime != null) { - generator.writeKey("total_throttled_time"); - generator.write(this.totalThrottledTime); - - } - generator.writeKey("total_throttled_time_in_millis"); - generator.write(this.totalThrottledTimeInMillis); - - if (this.totalTime != null) { - generator.writeKey("total_time"); - generator.write(this.totalTime); - - } - generator.writeKey("total_time_in_millis"); - generator.write(this.totalTimeInMillis); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link MergesStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long current; - - private Long currentDocs; - - @Nullable - private String currentSize; - - private Long currentSizeInBytes; - - private Long total; - - @Nullable - private String totalAutoThrottle; - - private Long totalAutoThrottleInBytes; - - private Long totalDocs; - - @Nullable - private String totalSize; - - private Long totalSizeInBytes; - - @Nullable - private String totalStoppedTime; - - private Long totalStoppedTimeInMillis; - - @Nullable - private String totalThrottledTime; - - private Long totalThrottledTimeInMillis; - - @Nullable - private String totalTime; - - private Long totalTimeInMillis; - - /** - * Required - API name: {@code current} - */ - public final Builder current(long value) { - this.current = value; - return this; - } - - /** - * Required - API name: {@code current_docs} - */ - public final Builder currentDocs(long value) { - this.currentDocs = value; - return this; - } - - /** - * API name: {@code current_size} - */ - public final Builder currentSize(@Nullable String value) { - this.currentSize = value; - return this; - } - - /** - * Required - API name: {@code current_size_in_bytes} - */ - public final Builder currentSizeInBytes(long value) { - this.currentSizeInBytes = value; - return this; - } - - /** - * Required - API name: {@code total} - */ - public final Builder total(long value) { - this.total = value; - return this; - } - - /** - * API name: {@code total_auto_throttle} - */ - public final Builder totalAutoThrottle(@Nullable String value) { - this.totalAutoThrottle = value; - return this; - } - - /** - * Required - API name: {@code total_auto_throttle_in_bytes} - */ - public final Builder totalAutoThrottleInBytes(long value) { - this.totalAutoThrottleInBytes = value; - return this; - } - - /** - * Required - API name: {@code total_docs} - */ - public final Builder totalDocs(long value) { - this.totalDocs = value; - return this; - } - - /** - * API name: {@code total_size} - */ - public final Builder totalSize(@Nullable String value) { - this.totalSize = value; - return this; - } - - /** - * Required - API name: {@code total_size_in_bytes} - */ - public final Builder totalSizeInBytes(long value) { - this.totalSizeInBytes = value; - return this; - } - - /** - * API name: {@code total_stopped_time} - */ - public final Builder totalStoppedTime(@Nullable String value) { - this.totalStoppedTime = value; - return this; - } - - /** - * Required - API name: {@code total_stopped_time_in_millis} - */ - public final Builder totalStoppedTimeInMillis(long value) { - this.totalStoppedTimeInMillis = value; - return this; - } - - /** - * API name: {@code total_throttled_time} - */ - public final Builder totalThrottledTime(@Nullable String value) { - this.totalThrottledTime = value; - return this; - } - - /** - * Required - API name: {@code total_throttled_time_in_millis} - */ - public final Builder totalThrottledTimeInMillis(long value) { - this.totalThrottledTimeInMillis = value; - return this; - } - - /** - * API name: {@code total_time} - */ - public final Builder totalTime(@Nullable String value) { - this.totalTime = value; - return this; - } - - /** - * Required - API name: {@code total_time_in_millis} - */ - public final Builder totalTimeInMillis(long value) { - this.totalTimeInMillis = value; - return this; - } - - /** - * Builds a {@link MergesStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public MergesStats build() { - _checkSingleUse(); - - return new MergesStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link MergesStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - MergesStats::setupMergesStatsDeserializer); - - protected static void setupMergesStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::current, JsonpDeserializer.longDeserializer(), "current"); - op.add(Builder::currentDocs, JsonpDeserializer.longDeserializer(), "current_docs"); - op.add(Builder::currentSize, JsonpDeserializer.stringDeserializer(), "current_size"); - op.add(Builder::currentSizeInBytes, JsonpDeserializer.longDeserializer(), "current_size_in_bytes"); - op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); - op.add(Builder::totalAutoThrottle, JsonpDeserializer.stringDeserializer(), "total_auto_throttle"); - op.add(Builder::totalAutoThrottleInBytes, JsonpDeserializer.longDeserializer(), "total_auto_throttle_in_bytes"); - op.add(Builder::totalDocs, JsonpDeserializer.longDeserializer(), "total_docs"); - op.add(Builder::totalSize, JsonpDeserializer.stringDeserializer(), "total_size"); - op.add(Builder::totalSizeInBytes, JsonpDeserializer.longDeserializer(), "total_size_in_bytes"); - op.add(Builder::totalStoppedTime, JsonpDeserializer.stringDeserializer(), "total_stopped_time"); - op.add(Builder::totalStoppedTimeInMillis, JsonpDeserializer.longDeserializer(), "total_stopped_time_in_millis"); - op.add(Builder::totalThrottledTime, JsonpDeserializer.stringDeserializer(), "total_throttled_time"); - op.add(Builder::totalThrottledTimeInMillis, JsonpDeserializer.longDeserializer(), - "total_throttled_time_in_millis"); - op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); - op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); - - } + private final long currentSizeInBytes; + + private final long total; + + @Nullable + private final String totalAutoThrottle; + + private final long totalAutoThrottleInBytes; + + private final long totalDocs; + + @Nullable + private final String totalSize; + + private final long totalSizeInBytes; + + @Nullable + private final String totalStoppedTime; + + private final long totalStoppedTimeInMillis; + + @Nullable + private final String totalThrottledTime; + + private final long totalThrottledTimeInMillis; + + @Nullable + private final String totalTime; + + private final long totalTimeInMillis; + + // --------------------------------------------------------------------------------------------- + + private MergesStats(Builder builder) { + + this.current = ApiTypeHelper.requireNonNull(builder.current, this, "current"); + this.currentDocs = ApiTypeHelper.requireNonNull(builder.currentDocs, this, "currentDocs"); + this.currentSize = builder.currentSize; + this.currentSizeInBytes = ApiTypeHelper.requireNonNull(builder.currentSizeInBytes, this, "currentSizeInBytes"); + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); + this.totalAutoThrottle = builder.totalAutoThrottle; + this.totalAutoThrottleInBytes = ApiTypeHelper.requireNonNull(builder.totalAutoThrottleInBytes, this, "totalAutoThrottleInBytes"); + this.totalDocs = ApiTypeHelper.requireNonNull(builder.totalDocs, this, "totalDocs"); + this.totalSize = builder.totalSize; + this.totalSizeInBytes = ApiTypeHelper.requireNonNull(builder.totalSizeInBytes, this, "totalSizeInBytes"); + this.totalStoppedTime = builder.totalStoppedTime; + this.totalStoppedTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalStoppedTimeInMillis, this, "totalStoppedTimeInMillis"); + this.totalThrottledTime = builder.totalThrottledTime; + this.totalThrottledTimeInMillis = ApiTypeHelper.requireNonNull( + builder.totalThrottledTimeInMillis, + this, + "totalThrottledTimeInMillis" + ); + this.totalTime = builder.totalTime; + this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); + + } + + public static MergesStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code current} + */ + public final long current() { + return this.current; + } + + /** + * Required - API name: {@code current_docs} + */ + public final long currentDocs() { + return this.currentDocs; + } + + /** + * API name: {@code current_size} + */ + @Nullable + public final String currentSize() { + return this.currentSize; + } + + /** + * Required - API name: {@code current_size_in_bytes} + */ + public final long currentSizeInBytes() { + return this.currentSizeInBytes; + } + + /** + * Required - API name: {@code total} + */ + public final long total() { + return this.total; + } + + /** + * API name: {@code total_auto_throttle} + */ + @Nullable + public final String totalAutoThrottle() { + return this.totalAutoThrottle; + } + + /** + * Required - API name: {@code total_auto_throttle_in_bytes} + */ + public final long totalAutoThrottleInBytes() { + return this.totalAutoThrottleInBytes; + } + + /** + * Required - API name: {@code total_docs} + */ + public final long totalDocs() { + return this.totalDocs; + } + + /** + * API name: {@code total_size} + */ + @Nullable + public final String totalSize() { + return this.totalSize; + } + + /** + * Required - API name: {@code total_size_in_bytes} + */ + public final long totalSizeInBytes() { + return this.totalSizeInBytes; + } + + /** + * API name: {@code total_stopped_time} + */ + @Nullable + public final String totalStoppedTime() { + return this.totalStoppedTime; + } + + /** + * Required - API name: {@code total_stopped_time_in_millis} + */ + public final long totalStoppedTimeInMillis() { + return this.totalStoppedTimeInMillis; + } + + /** + * API name: {@code total_throttled_time} + */ + @Nullable + public final String totalThrottledTime() { + return this.totalThrottledTime; + } + + /** + * Required - API name: {@code total_throttled_time_in_millis} + */ + public final long totalThrottledTimeInMillis() { + return this.totalThrottledTimeInMillis; + } + + /** + * API name: {@code total_time} + */ + @Nullable + public final String totalTime() { + return this.totalTime; + } + + /** + * Required - API name: {@code total_time_in_millis} + */ + public final long totalTimeInMillis() { + return this.totalTimeInMillis; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("current"); + generator.write(this.current); + + generator.writeKey("current_docs"); + generator.write(this.currentDocs); + + if (this.currentSize != null) { + generator.writeKey("current_size"); + generator.write(this.currentSize); + + } + generator.writeKey("current_size_in_bytes"); + generator.write(this.currentSizeInBytes); + + generator.writeKey("total"); + generator.write(this.total); + + if (this.totalAutoThrottle != null) { + generator.writeKey("total_auto_throttle"); + generator.write(this.totalAutoThrottle); + + } + generator.writeKey("total_auto_throttle_in_bytes"); + generator.write(this.totalAutoThrottleInBytes); + + generator.writeKey("total_docs"); + generator.write(this.totalDocs); + + if (this.totalSize != null) { + generator.writeKey("total_size"); + generator.write(this.totalSize); + + } + generator.writeKey("total_size_in_bytes"); + generator.write(this.totalSizeInBytes); + + if (this.totalStoppedTime != null) { + generator.writeKey("total_stopped_time"); + generator.write(this.totalStoppedTime); + + } + generator.writeKey("total_stopped_time_in_millis"); + generator.write(this.totalStoppedTimeInMillis); + + if (this.totalThrottledTime != null) { + generator.writeKey("total_throttled_time"); + generator.write(this.totalThrottledTime); + + } + generator.writeKey("total_throttled_time_in_millis"); + generator.write(this.totalThrottledTimeInMillis); + + if (this.totalTime != null) { + generator.writeKey("total_time"); + generator.write(this.totalTime); + + } + generator.writeKey("total_time_in_millis"); + generator.write(this.totalTimeInMillis); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link MergesStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long current; + + private Long currentDocs; + + @Nullable + private String currentSize; + + private Long currentSizeInBytes; + + private Long total; + + @Nullable + private String totalAutoThrottle; + + private Long totalAutoThrottleInBytes; + + private Long totalDocs; + + @Nullable + private String totalSize; + + private Long totalSizeInBytes; + + @Nullable + private String totalStoppedTime; + + private Long totalStoppedTimeInMillis; + + @Nullable + private String totalThrottledTime; + + private Long totalThrottledTimeInMillis; + + @Nullable + private String totalTime; + + private Long totalTimeInMillis; + + /** + * Required - API name: {@code current} + */ + public final Builder current(long value) { + this.current = value; + return this; + } + + /** + * Required - API name: {@code current_docs} + */ + public final Builder currentDocs(long value) { + this.currentDocs = value; + return this; + } + + /** + * API name: {@code current_size} + */ + public final Builder currentSize(@Nullable String value) { + this.currentSize = value; + return this; + } + + /** + * Required - API name: {@code current_size_in_bytes} + */ + public final Builder currentSizeInBytes(long value) { + this.currentSizeInBytes = value; + return this; + } + + /** + * Required - API name: {@code total} + */ + public final Builder total(long value) { + this.total = value; + return this; + } + + /** + * API name: {@code total_auto_throttle} + */ + public final Builder totalAutoThrottle(@Nullable String value) { + this.totalAutoThrottle = value; + return this; + } + + /** + * Required - API name: {@code total_auto_throttle_in_bytes} + */ + public final Builder totalAutoThrottleInBytes(long value) { + this.totalAutoThrottleInBytes = value; + return this; + } + + /** + * Required - API name: {@code total_docs} + */ + public final Builder totalDocs(long value) { + this.totalDocs = value; + return this; + } + + /** + * API name: {@code total_size} + */ + public final Builder totalSize(@Nullable String value) { + this.totalSize = value; + return this; + } + + /** + * Required - API name: {@code total_size_in_bytes} + */ + public final Builder totalSizeInBytes(long value) { + this.totalSizeInBytes = value; + return this; + } + + /** + * API name: {@code total_stopped_time} + */ + public final Builder totalStoppedTime(@Nullable String value) { + this.totalStoppedTime = value; + return this; + } + + /** + * Required - API name: {@code total_stopped_time_in_millis} + */ + public final Builder totalStoppedTimeInMillis(long value) { + this.totalStoppedTimeInMillis = value; + return this; + } + + /** + * API name: {@code total_throttled_time} + */ + public final Builder totalThrottledTime(@Nullable String value) { + this.totalThrottledTime = value; + return this; + } + + /** + * Required - API name: {@code total_throttled_time_in_millis} + */ + public final Builder totalThrottledTimeInMillis(long value) { + this.totalThrottledTimeInMillis = value; + return this; + } + + /** + * API name: {@code total_time} + */ + public final Builder totalTime(@Nullable String value) { + this.totalTime = value; + return this; + } + + /** + * Required - API name: {@code total_time_in_millis} + */ + public final Builder totalTimeInMillis(long value) { + this.totalTimeInMillis = value; + return this; + } + + /** + * Builds a {@link MergesStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public MergesStats build() { + _checkSingleUse(); + + return new MergesStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link MergesStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + MergesStats::setupMergesStatsDeserializer + ); + + protected static void setupMergesStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::current, JsonpDeserializer.longDeserializer(), "current"); + op.add(Builder::currentDocs, JsonpDeserializer.longDeserializer(), "current_docs"); + op.add(Builder::currentSize, JsonpDeserializer.stringDeserializer(), "current_size"); + op.add(Builder::currentSizeInBytes, JsonpDeserializer.longDeserializer(), "current_size_in_bytes"); + op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); + op.add(Builder::totalAutoThrottle, JsonpDeserializer.stringDeserializer(), "total_auto_throttle"); + op.add(Builder::totalAutoThrottleInBytes, JsonpDeserializer.longDeserializer(), "total_auto_throttle_in_bytes"); + op.add(Builder::totalDocs, JsonpDeserializer.longDeserializer(), "total_docs"); + op.add(Builder::totalSize, JsonpDeserializer.stringDeserializer(), "total_size"); + op.add(Builder::totalSizeInBytes, JsonpDeserializer.longDeserializer(), "total_size_in_bytes"); + op.add(Builder::totalStoppedTime, JsonpDeserializer.stringDeserializer(), "total_stopped_time"); + op.add(Builder::totalStoppedTimeInMillis, JsonpDeserializer.longDeserializer(), "total_stopped_time_in_millis"); + op.add(Builder::totalThrottledTime, JsonpDeserializer.stringDeserializer(), "total_throttled_time"); + op.add(Builder::totalThrottledTimeInMillis, JsonpDeserializer.longDeserializer(), "total_throttled_time_in_millis"); + op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); + op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NestedSortValue.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/NestedSortValue.java index b1f16ea6bb..366abbca50 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NestedSortValue.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/NestedSortValue.java @@ -32,205 +32,206 @@ package org.opensearch.client.opensearch._types; -import org.opensearch.client.opensearch._types.query_dsl.Query; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +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.JsonpSerializable; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch._types.query_dsl.Query; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; - -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.NestedSortValue @JsonpDeserializable public class NestedSortValue implements JsonpSerializable { - @Nullable - private final Query filter; - - @Nullable - private final Integer maxChildren; + @Nullable + private final Query filter; + + @Nullable + private final Integer maxChildren; - @Nullable - private final NestedSortValue nested; - - private final String path; - - // --------------------------------------------------------------------------------------------- - - private NestedSortValue(Builder builder) { - - this.filter = builder.filter; - this.maxChildren = builder.maxChildren; - this.nested = builder.nested; - this.path = ApiTypeHelper.requireNonNull(builder.path, this, "path"); - - } - - public static NestedSortValue of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code filter} - */ - @Nullable - public final Query filter() { - return this.filter; - } - - /** - * API name: {@code max_children} - */ - @Nullable - public final Integer maxChildren() { - return this.maxChildren; - } - - /** - * API name: {@code nested} - */ - @Nullable - public final NestedSortValue nested() { - return this.nested; - } - - /** - * Required - API name: {@code path} - */ - public final String path() { - return this.path; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.filter != null) { - generator.writeKey("filter"); - this.filter.serialize(generator, mapper); - - } - if (this.maxChildren != null) { - generator.writeKey("max_children"); - generator.write(this.maxChildren); - - } - if (this.nested != null) { - generator.writeKey("nested"); - this.nested.serialize(generator, mapper); - - } - generator.writeKey("path"); - generator.write(this.path); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link NestedSortValue}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private Query filter; - - @Nullable - private Integer maxChildren; - - @Nullable - private NestedSortValue nested; - - private String path; - - /** - * API name: {@code filter} - */ - public final Builder filter(@Nullable Query value) { - this.filter = value; - return this; - } - - /** - * API name: {@code filter} - */ - public final Builder filter(Function> fn) { - return this.filter(fn.apply(new Query.Builder()).build()); - } - - /** - * API name: {@code max_children} - */ - public final Builder maxChildren(@Nullable Integer value) { - this.maxChildren = value; - return this; - } - - /** - * API name: {@code nested} - */ - public final Builder nested(@Nullable NestedSortValue value) { - this.nested = value; - return this; - } - - /** - * API name: {@code nested} - */ - public final Builder nested(Function> fn) { - return this.nested(fn.apply(new NestedSortValue.Builder()).build()); - } - - /** - * Required - API name: {@code path} - */ - public final Builder path(String value) { - this.path = value; - return this; - } - - /** - * Builds a {@link NestedSortValue}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public NestedSortValue build() { - _checkSingleUse(); - - return new NestedSortValue(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link NestedSortValue} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - NestedSortValue::setupNestedSortValueDeserializer); - - protected static void setupNestedSortValueDeserializer(ObjectDeserializer op) { - - op.add(Builder::filter, Query._DESERIALIZER, "filter"); - op.add(Builder::maxChildren, JsonpDeserializer.integerDeserializer(), "max_children"); - op.add(Builder::nested, NestedSortValue._DESERIALIZER, "nested"); - op.add(Builder::path, JsonpDeserializer.stringDeserializer(), "path"); - - } + @Nullable + private final NestedSortValue nested; + + private final String path; + + // --------------------------------------------------------------------------------------------- + + private NestedSortValue(Builder builder) { + + this.filter = builder.filter; + this.maxChildren = builder.maxChildren; + this.nested = builder.nested; + this.path = ApiTypeHelper.requireNonNull(builder.path, this, "path"); + + } + + public static NestedSortValue of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code filter} + */ + @Nullable + public final Query filter() { + return this.filter; + } + + /** + * API name: {@code max_children} + */ + @Nullable + public final Integer maxChildren() { + return this.maxChildren; + } + + /** + * API name: {@code nested} + */ + @Nullable + public final NestedSortValue nested() { + return this.nested; + } + + /** + * Required - API name: {@code path} + */ + public final String path() { + return this.path; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (this.filter != null) { + generator.writeKey("filter"); + this.filter.serialize(generator, mapper); + + } + if (this.maxChildren != null) { + generator.writeKey("max_children"); + generator.write(this.maxChildren); + + } + if (this.nested != null) { + generator.writeKey("nested"); + this.nested.serialize(generator, mapper); + + } + generator.writeKey("path"); + generator.write(this.path); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link NestedSortValue}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private Query filter; + + @Nullable + private Integer maxChildren; + + @Nullable + private NestedSortValue nested; + + private String path; + + /** + * API name: {@code filter} + */ + public final Builder filter(@Nullable Query value) { + this.filter = value; + return this; + } + + /** + * API name: {@code filter} + */ + public final Builder filter(Function> fn) { + return this.filter(fn.apply(new Query.Builder()).build()); + } + + /** + * API name: {@code max_children} + */ + public final Builder maxChildren(@Nullable Integer value) { + this.maxChildren = value; + return this; + } + + /** + * API name: {@code nested} + */ + public final Builder nested(@Nullable NestedSortValue value) { + this.nested = value; + return this; + } + + /** + * API name: {@code nested} + */ + public final Builder nested(Function> fn) { + return this.nested(fn.apply(new NestedSortValue.Builder()).build()); + } + + /** + * Required - API name: {@code path} + */ + public final Builder path(String value) { + this.path = value; + return this; + } + + /** + * Builds a {@link NestedSortValue}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public NestedSortValue build() { + _checkSingleUse(); + + return new NestedSortValue(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link NestedSortValue} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + NestedSortValue::setupNestedSortValueDeserializer + ); + + protected static void setupNestedSortValueDeserializer(ObjectDeserializer op) { + + op.add(Builder::filter, Query._DESERIALIZER, "filter"); + op.add(Builder::maxChildren, JsonpDeserializer.integerDeserializer(), "max_children"); + op.add(Builder::nested, NestedSortValue._DESERIALIZER, "nested"); + op.add(Builder::path, JsonpDeserializer.stringDeserializer(), "path"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeAttributes.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeAttributes.java index 53f19e7382..ac02a7b1d3 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeAttributes.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeAttributes.java @@ -32,6 +32,11 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,283 +46,279 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.NodeAttributes @JsonpDeserializable public class NodeAttributes implements JsonpSerializable { - private final Map attributes; - - private final String ephemeralId; - - @Nullable - private final String id; - - private final String name; - - private final String transportAddress; - - private final List roles; - - // --------------------------------------------------------------------------------------------- - - private NodeAttributes(Builder builder) { - - this.attributes = ApiTypeHelper.unmodifiableRequired(builder.attributes, this, "attributes"); - this.ephemeralId = ApiTypeHelper.requireNonNull(builder.ephemeralId, this, "ephemeralId"); - this.id = builder.id; - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.transportAddress = ApiTypeHelper.requireNonNull(builder.transportAddress, this, "transportAddress"); - this.roles = ApiTypeHelper.unmodifiable(builder.roles); - - } - - public static NodeAttributes of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - Lists node attributes. - *

- * API name: {@code attributes} - */ - public final Map attributes() { - return this.attributes; - } - - /** - * Required - The ephemeral ID of the node. - *

- * API name: {@code ephemeral_id} - */ - public final String ephemeralId() { - return this.ephemeralId; - } - - /** - * The unique identifier of the node. - *

- * API name: {@code id} - */ - @Nullable - public final String id() { - return this.id; - } - - /** - * Required - The unique identifier of the node. - *

- * API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Required - The host and port where transport HTTP connections are accepted. - *

- * API name: {@code transport_address} - */ - public final String transportAddress() { - return this.transportAddress; - } - - /** - * API name: {@code roles} - */ - public final List roles() { - return this.roles; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.attributes)) { - generator.writeKey("attributes"); - generator.writeStartObject(); - for (Map.Entry item0 : this.attributes.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); - - } - generator.writeKey("ephemeral_id"); - generator.write(this.ephemeralId); - - if (this.id != null) { - generator.writeKey("id"); - generator.write(this.id); - - } - generator.writeKey("name"); - generator.write(this.name); - - generator.writeKey("transport_address"); - generator.write(this.transportAddress); - - if (ApiTypeHelper.isDefined(this.roles)) { - generator.writeKey("roles"); - generator.writeStartArray(); - for (NodeRole item0 : this.roles) { - item0.serialize(generator, mapper); - } - generator.writeEnd(); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link NodeAttributes}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Map attributes; - - private String ephemeralId; - - @Nullable - private String id; - - private String name; - - private String transportAddress; - - @Nullable - private List roles; - - /** - * Required - Lists node attributes. - *

- * API name: {@code attributes} - *

- * Adds all entries of map to attributes. - */ - public final Builder attributes(Map map) { - this.attributes = _mapPutAll(this.attributes, map); - return this; - } - - /** - * Required - Lists node attributes. - *

- * API name: {@code attributes} - *

- * Adds an entry to attributes. - */ - public final Builder attributes(String key, String value) { - this.attributes = _mapPut(this.attributes, key, value); - return this; - } - - /** - * Required - The ephemeral ID of the node. - *

- * API name: {@code ephemeral_id} - */ - public final Builder ephemeralId(String value) { - this.ephemeralId = value; - return this; - } - - /** - * The unique identifier of the node. - *

- * API name: {@code id} - */ - public final Builder id(@Nullable String value) { - this.id = value; - return this; - } - - /** - * Required - The unique identifier of the node. - *

- * API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * Required - The host and port where transport HTTP connections are accepted. - *

- * API name: {@code transport_address} - */ - public final Builder transportAddress(String value) { - this.transportAddress = value; - return this; - } - - /** - * API name: {@code roles} - *

- * Adds all elements of list to roles. - */ - public final Builder roles(List list) { - this.roles = _listAddAll(this.roles, list); - return this; - } - - /** - * API name: {@code roles} - *

- * Adds one or more values to roles. - */ - public final Builder roles(NodeRole value, NodeRole... values) { - this.roles = _listAdd(this.roles, value, values); - return this; - } - - /** - * Builds a {@link NodeAttributes}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public NodeAttributes build() { - _checkSingleUse(); - - return new NodeAttributes(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link NodeAttributes} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - NodeAttributes::setupNodeAttributesDeserializer); - - protected static void setupNodeAttributesDeserializer(ObjectDeserializer op) { - - op.add(Builder::attributes, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), - "attributes"); - op.add(Builder::ephemeralId, JsonpDeserializer.stringDeserializer(), "ephemeral_id"); - op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::transportAddress, JsonpDeserializer.stringDeserializer(), "transport_address"); - op.add(Builder::roles, JsonpDeserializer.arrayDeserializer(NodeRole._DESERIALIZER), "roles"); - - } + private final Map attributes; + + private final String ephemeralId; + + @Nullable + private final String id; + + private final String name; + + private final String transportAddress; + + private final List roles; + + // --------------------------------------------------------------------------------------------- + + private NodeAttributes(Builder builder) { + + this.attributes = ApiTypeHelper.unmodifiableRequired(builder.attributes, this, "attributes"); + this.ephemeralId = ApiTypeHelper.requireNonNull(builder.ephemeralId, this, "ephemeralId"); + this.id = builder.id; + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.transportAddress = ApiTypeHelper.requireNonNull(builder.transportAddress, this, "transportAddress"); + this.roles = ApiTypeHelper.unmodifiable(builder.roles); + + } + + public static NodeAttributes of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - Lists node attributes. + *

+ * API name: {@code attributes} + */ + public final Map attributes() { + return this.attributes; + } + + /** + * Required - The ephemeral ID of the node. + *

+ * API name: {@code ephemeral_id} + */ + public final String ephemeralId() { + return this.ephemeralId; + } + + /** + * The unique identifier of the node. + *

+ * API name: {@code id} + */ + @Nullable + public final String id() { + return this.id; + } + + /** + * Required - The unique identifier of the node. + *

+ * API name: {@code name} + */ + public final String name() { + return this.name; + } + + /** + * Required - The host and port where transport HTTP connections are accepted. + *

+ * API name: {@code transport_address} + */ + public final String transportAddress() { + return this.transportAddress; + } + + /** + * API name: {@code roles} + */ + public final List roles() { + return this.roles; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (ApiTypeHelper.isDefined(this.attributes)) { + generator.writeKey("attributes"); + generator.writeStartObject(); + for (Map.Entry item0 : this.attributes.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + + } + generator.writeEnd(); + + } + generator.writeKey("ephemeral_id"); + generator.write(this.ephemeralId); + + if (this.id != null) { + generator.writeKey("id"); + generator.write(this.id); + + } + generator.writeKey("name"); + generator.write(this.name); + + generator.writeKey("transport_address"); + generator.write(this.transportAddress); + + if (ApiTypeHelper.isDefined(this.roles)) { + generator.writeKey("roles"); + generator.writeStartArray(); + for (NodeRole item0 : this.roles) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link NodeAttributes}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Map attributes; + + private String ephemeralId; + + @Nullable + private String id; + + private String name; + + private String transportAddress; + + @Nullable + private List roles; + + /** + * Required - Lists node attributes. + *

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

+ * Adds all entries of map to attributes. + */ + public final Builder attributes(Map map) { + this.attributes = _mapPutAll(this.attributes, map); + return this; + } + + /** + * Required - Lists node attributes. + *

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

+ * Adds an entry to attributes. + */ + public final Builder attributes(String key, String value) { + this.attributes = _mapPut(this.attributes, key, value); + return this; + } + + /** + * Required - The ephemeral ID of the node. + *

+ * API name: {@code ephemeral_id} + */ + public final Builder ephemeralId(String value) { + this.ephemeralId = value; + return this; + } + + /** + * The unique identifier of the node. + *

+ * API name: {@code id} + */ + public final Builder id(@Nullable String value) { + this.id = value; + return this; + } + + /** + * Required - The unique identifier of the node. + *

+ * API name: {@code name} + */ + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * Required - The host and port where transport HTTP connections are accepted. + *

+ * API name: {@code transport_address} + */ + public final Builder transportAddress(String value) { + this.transportAddress = value; + return this; + } + + /** + * API name: {@code roles} + *

+ * Adds all elements of list to roles. + */ + public final Builder roles(List list) { + this.roles = _listAddAll(this.roles, list); + return this; + } + + /** + * API name: {@code roles} + *

+ * Adds one or more values to roles. + */ + public final Builder roles(NodeRole value, NodeRole... values) { + this.roles = _listAdd(this.roles, value, values); + return this; + } + + /** + * Builds a {@link NodeAttributes}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public NodeAttributes build() { + _checkSingleUse(); + + return new NodeAttributes(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link NodeAttributes} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + NodeAttributes::setupNodeAttributesDeserializer + ); + + protected static void setupNodeAttributesDeserializer(ObjectDeserializer op) { + + op.add(Builder::attributes, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "attributes"); + op.add(Builder::ephemeralId, JsonpDeserializer.stringDeserializer(), "ephemeral_id"); + op.add(Builder::id, JsonpDeserializer.stringDeserializer(), "id"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::transportAddress, JsonpDeserializer.stringDeserializer(), "transport_address"); + op.add(Builder::roles, JsonpDeserializer.arrayDeserializer(NodeRole._DESERIALIZER), "roles"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeRole.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeRole.java index f00cbc9146..530603353f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeRole.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeRole.java @@ -37,48 +37,48 @@ @JsonpDeserializable public enum NodeRole implements JsonEnum { - @Deprecated - Master("master"), + @Deprecated + Master("master"), - ClusterManager("cluster_manager"), + ClusterManager("cluster_manager"), - Data("data"), + Data("data"), - DataCold("data_cold"), + DataCold("data_cold"), - DataContent("data_content"), + DataContent("data_content"), - DataFrozen("data_frozen"), + DataFrozen("data_frozen"), - DataHot("data_hot"), + DataHot("data_hot"), - DataWarm("data_warm"), + DataWarm("data_warm"), - Client("client"), + Client("client"), - Ingest("ingest"), + Ingest("ingest"), - Ml("ml"), + Ml("ml"), - VotingOnly("voting_only"), + VotingOnly("voting_only"), - Transform("transform"), + Transform("transform"), - RemoteClusterClient("remote_cluster_client"), + RemoteClusterClient("remote_cluster_client"), - CoordinatingOnly("coordinating_only"), + CoordinatingOnly("coordinating_only"), - ; + ; - private final String jsonValue; + private final String jsonValue; - NodeRole(String jsonValue) { - this.jsonValue = jsonValue; - } + NodeRole(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(NodeRole.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(NodeRole.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeShard.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeShard.java index 1c77110356..2e504aa517 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeShard.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeShard.java @@ -32,336 +32,334 @@ package org.opensearch.client.opensearch._types; -import org.opensearch.client.opensearch.cluster.allocation_explain.UnassignedInformation; -import org.opensearch.client.opensearch.indices.stats.ShardRoutingState; +import jakarta.json.stream.JsonGenerator; +import java.util.Map; +import java.util.function.Function; +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.JsonpSerializable; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.opensearch.cluster.allocation_explain.UnassignedInformation; +import org.opensearch.client.opensearch.indices.stats.ShardRoutingState; import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; - -import java.util.Map; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.NodeShard @JsonpDeserializable public class NodeShard implements JsonpSerializable { - private final ShardRoutingState state; - - private final boolean primary; - - @Nullable - private final String node; - - private final int shard; - - private final String index; - - private final Map allocationId; - - private final Map recoverySource; - - @Nullable - private final UnassignedInformation unassignedInfo; - - // --------------------------------------------------------------------------------------------- - - private NodeShard(Builder builder) { - - this.state = ApiTypeHelper.requireNonNull(builder.state, this, "state"); - this.primary = ApiTypeHelper.requireNonNull(builder.primary, this, "primary"); - this.node = builder.node; - this.shard = ApiTypeHelper.requireNonNull(builder.shard, this, "shard"); - this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); - this.allocationId = ApiTypeHelper.unmodifiable(builder.allocationId); - this.recoverySource = ApiTypeHelper.unmodifiable(builder.recoverySource); - this.unassignedInfo = builder.unassignedInfo; - - } - - public static NodeShard of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code state} - */ - public final ShardRoutingState state() { - return this.state; - } - - /** - * Required - API name: {@code primary} - */ - public final boolean primary() { - return this.primary; - } - - /** - * API name: {@code node} - */ - @Nullable - public final String node() { - return this.node; - } - - /** - * Required - API name: {@code shard} - */ - public final int shard() { - return this.shard; - } - - /** - * Required - API name: {@code index} - */ - public final String index() { - return this.index; - } - - /** - * API name: {@code allocation_id} - */ - public final Map allocationId() { - return this.allocationId; - } - - /** - * API name: {@code recovery_source} - */ - public final Map recoverySource() { - return this.recoverySource; - } - - /** - * API name: {@code unassigned_info} - */ - @Nullable - public final UnassignedInformation unassignedInfo() { - return this.unassignedInfo; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("state"); - this.state.serialize(generator, mapper); - generator.writeKey("primary"); - generator.write(this.primary); - - if (this.node != null) { - generator.writeKey("node"); - generator.write(this.node); - - } - generator.writeKey("shard"); - generator.write(this.shard); - - generator.writeKey("index"); - generator.write(this.index); - - if (ApiTypeHelper.isDefined(this.allocationId)) { - generator.writeKey("allocation_id"); - generator.writeStartObject(); - for (Map.Entry item0 : this.allocationId.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); - - } - if (ApiTypeHelper.isDefined(this.recoverySource)) { - generator.writeKey("recovery_source"); - generator.writeStartObject(); - for (Map.Entry item0 : this.recoverySource.entrySet()) { - generator.writeKey(item0.getKey()); - generator.write(item0.getValue()); - - } - generator.writeEnd(); - - } - if (this.unassignedInfo != null) { - generator.writeKey("unassigned_info"); - this.unassignedInfo.serialize(generator, mapper); - - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link NodeShard}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private ShardRoutingState state; - - private Boolean primary; - - @Nullable - private String node; - - private Integer shard; - - private String index; - - @Nullable - private Map allocationId; - - @Nullable - private Map recoverySource; - - @Nullable - private UnassignedInformation unassignedInfo; - - /** - * Required - API name: {@code state} - */ - public final Builder state(ShardRoutingState value) { - this.state = value; - return this; - } - - /** - * Required - API name: {@code primary} - */ - public final Builder primary(boolean value) { - this.primary = value; - return this; - } - - /** - * API name: {@code node} - */ - public final Builder node(@Nullable String value) { - this.node = value; - return this; - } - - /** - * Required - API name: {@code shard} - */ - public final Builder shard(int value) { - this.shard = value; - return this; - } - - /** - * Required - API name: {@code index} - */ - public final Builder index(String value) { - this.index = value; - return this; - } - - /** - * API name: {@code allocation_id} - *

- * Adds all entries of map to allocationId. - */ - public final Builder allocationId(Map map) { - this.allocationId = _mapPutAll(this.allocationId, map); - return this; - } - - /** - * API name: {@code allocation_id} - *

- * Adds an entry to allocationId. - */ - public final Builder allocationId(String key, String value) { - this.allocationId = _mapPut(this.allocationId, key, value); - return this; - } - - /** - * API name: {@code recovery_source} - *

- * Adds all entries of map to recoverySource. - */ - public final Builder recoverySource(Map map) { - this.recoverySource = _mapPutAll(this.recoverySource, map); - return this; - } - - /** - * API name: {@code recovery_source} - *

- * Adds an entry to recoverySource. - */ - public final Builder recoverySource(String key, String value) { - this.recoverySource = _mapPut(this.recoverySource, key, value); - return this; - } - - /** - * API name: {@code unassigned_info} - */ - public final Builder unassignedInfo(@Nullable UnassignedInformation value) { - this.unassignedInfo = value; - return this; - } - - /** - * API name: {@code unassigned_info} - */ - public final Builder unassignedInfo( - Function> fn) { - return this.unassignedInfo(fn.apply(new UnassignedInformation.Builder()).build()); - } - - /** - * Builds a {@link NodeShard}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public NodeShard build() { - _checkSingleUse(); - - return new NodeShard(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link NodeShard} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - NodeShard::setupNodeShardDeserializer); - - protected static void setupNodeShardDeserializer(ObjectDeserializer op) { - - op.add(Builder::state, ShardRoutingState._DESERIALIZER, "state"); - op.add(Builder::primary, JsonpDeserializer.booleanDeserializer(), "primary"); - op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node"); - op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard"); - op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); - op.add(Builder::allocationId, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), - "allocation_id"); - op.add(Builder::recoverySource, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), - "recovery_source"); - op.add(Builder::unassignedInfo, UnassignedInformation._DESERIALIZER, "unassigned_info"); - - } + private final ShardRoutingState state; + + private final boolean primary; + + @Nullable + private final String node; + + private final int shard; + + private final String index; + + private final Map allocationId; + + private final Map recoverySource; + + @Nullable + private final UnassignedInformation unassignedInfo; + + // --------------------------------------------------------------------------------------------- + + private NodeShard(Builder builder) { + + this.state = ApiTypeHelper.requireNonNull(builder.state, this, "state"); + this.primary = ApiTypeHelper.requireNonNull(builder.primary, this, "primary"); + this.node = builder.node; + this.shard = ApiTypeHelper.requireNonNull(builder.shard, this, "shard"); + this.index = ApiTypeHelper.requireNonNull(builder.index, this, "index"); + this.allocationId = ApiTypeHelper.unmodifiable(builder.allocationId); + this.recoverySource = ApiTypeHelper.unmodifiable(builder.recoverySource); + this.unassignedInfo = builder.unassignedInfo; + + } + + public static NodeShard of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code state} + */ + public final ShardRoutingState state() { + return this.state; + } + + /** + * Required - API name: {@code primary} + */ + public final boolean primary() { + return this.primary; + } + + /** + * API name: {@code node} + */ + @Nullable + public final String node() { + return this.node; + } + + /** + * Required - API name: {@code shard} + */ + public final int shard() { + return this.shard; + } + + /** + * Required - API name: {@code index} + */ + public final String index() { + return this.index; + } + + /** + * API name: {@code allocation_id} + */ + public final Map allocationId() { + return this.allocationId; + } + + /** + * API name: {@code recovery_source} + */ + public final Map recoverySource() { + return this.recoverySource; + } + + /** + * API name: {@code unassigned_info} + */ + @Nullable + public final UnassignedInformation unassignedInfo() { + return this.unassignedInfo; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("state"); + this.state.serialize(generator, mapper); + generator.writeKey("primary"); + generator.write(this.primary); + + if (this.node != null) { + generator.writeKey("node"); + generator.write(this.node); + + } + generator.writeKey("shard"); + generator.write(this.shard); + + generator.writeKey("index"); + generator.write(this.index); + + if (ApiTypeHelper.isDefined(this.allocationId)) { + generator.writeKey("allocation_id"); + generator.writeStartObject(); + for (Map.Entry item0 : this.allocationId.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + + } + generator.writeEnd(); + + } + if (ApiTypeHelper.isDefined(this.recoverySource)) { + generator.writeKey("recovery_source"); + generator.writeStartObject(); + for (Map.Entry item0 : this.recoverySource.entrySet()) { + generator.writeKey(item0.getKey()); + generator.write(item0.getValue()); + + } + generator.writeEnd(); + + } + if (this.unassignedInfo != null) { + generator.writeKey("unassigned_info"); + this.unassignedInfo.serialize(generator, mapper); + + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link NodeShard}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private ShardRoutingState state; + + private Boolean primary; + + @Nullable + private String node; + + private Integer shard; + + private String index; + + @Nullable + private Map allocationId; + + @Nullable + private Map recoverySource; + + @Nullable + private UnassignedInformation unassignedInfo; + + /** + * Required - API name: {@code state} + */ + public final Builder state(ShardRoutingState value) { + this.state = value; + return this; + } + + /** + * Required - API name: {@code primary} + */ + public final Builder primary(boolean value) { + this.primary = value; + return this; + } + + /** + * API name: {@code node} + */ + public final Builder node(@Nullable String value) { + this.node = value; + return this; + } + + /** + * Required - API name: {@code shard} + */ + public final Builder shard(int value) { + this.shard = value; + return this; + } + + /** + * Required - API name: {@code index} + */ + public final Builder index(String value) { + this.index = value; + return this; + } + + /** + * API name: {@code allocation_id} + *

+ * Adds all entries of map to allocationId. + */ + public final Builder allocationId(Map map) { + this.allocationId = _mapPutAll(this.allocationId, map); + return this; + } + + /** + * API name: {@code allocation_id} + *

+ * Adds an entry to allocationId. + */ + public final Builder allocationId(String key, String value) { + this.allocationId = _mapPut(this.allocationId, key, value); + return this; + } + + /** + * API name: {@code recovery_source} + *

+ * Adds all entries of map to recoverySource. + */ + public final Builder recoverySource(Map map) { + this.recoverySource = _mapPutAll(this.recoverySource, map); + return this; + } + + /** + * API name: {@code recovery_source} + *

+ * Adds an entry to recoverySource. + */ + public final Builder recoverySource(String key, String value) { + this.recoverySource = _mapPut(this.recoverySource, key, value); + return this; + } + + /** + * API name: {@code unassigned_info} + */ + public final Builder unassignedInfo(@Nullable UnassignedInformation value) { + this.unassignedInfo = value; + return this; + } + + /** + * API name: {@code unassigned_info} + */ + public final Builder unassignedInfo(Function> fn) { + return this.unassignedInfo(fn.apply(new UnassignedInformation.Builder()).build()); + } + + /** + * Builds a {@link NodeShard}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public NodeShard build() { + _checkSingleUse(); + + return new NodeShard(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link NodeShard} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + NodeShard::setupNodeShardDeserializer + ); + + protected static void setupNodeShardDeserializer(ObjectDeserializer op) { + + op.add(Builder::state, ShardRoutingState._DESERIALIZER, "state"); + op.add(Builder::primary, JsonpDeserializer.booleanDeserializer(), "primary"); + op.add(Builder::node, JsonpDeserializer.stringDeserializer(), "node"); + op.add(Builder::shard, JsonpDeserializer.integerDeserializer(), "shard"); + op.add(Builder::index, JsonpDeserializer.stringDeserializer(), "index"); + op.add(Builder::allocationId, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "allocation_id"); + op.add(Builder::recoverySource, JsonpDeserializer.stringMapDeserializer(JsonpDeserializer.stringDeserializer()), "recovery_source"); + op.add(Builder::unassignedInfo, UnassignedInformation._DESERIALIZER, "unassigned_info"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeStatistics.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeStatistics.java index ea17496835..61bc2e5fc1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeStatistics.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/NodeStatistics.java @@ -32,6 +32,10 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,211 +45,209 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.NodeStatistics @JsonpDeserializable public class NodeStatistics implements JsonpSerializable { - private final List failures; - - private final int total; - - private final int successful; + private final List failures; + + private final int total; + + private final int successful; - private final int failed; + private final int failed; - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - private NodeStatistics(Builder builder) { - - 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"); - - } - - public static NodeStatistics of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * API name: {@code failures} - */ - public final List failures() { - return this.failures; - } - - /** - * Required - Total number of nodes selected by the request. - *

- * API name: {@code total} - */ - public final int total() { - return this.total; - } - - /** - * 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. - *

- * API name: {@code failed} - */ - public final int failed() { - return this.failed; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.failures)) { - generator.writeKey("failures"); - generator.writeStartArray(); - for (ErrorCause item0 : this.failures) { - item0.serialize(generator, mapper); - - } - generator.writeEnd(); - - } - generator.writeKey("total"); - generator.write(this.total); - - generator.writeKey("successful"); - generator.write(this.successful); - - generator.writeKey("failed"); - generator.write(this.failed); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link NodeStatistics}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private List failures; - - private Integer total; - - private Integer successful; - - private Integer failed; - - /** - * API name: {@code failures} - *

- * Adds all elements of list to failures. - */ - public final Builder failures(List list) { - this.failures = _listAddAll(this.failures, list); - return this; - } - - /** - * 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); - return this; - } - - /** - * 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; - return this; - } - - /** - * 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; - } - - /** - * Builds a {@link NodeStatistics}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public NodeStatistics build() { - _checkSingleUse(); - - return new NodeStatistics(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link NodeStatistics} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - NodeStatistics::setupNodeStatisticsDeserializer); - - protected static void setupNodeStatisticsDeserializer(ObjectDeserializer op) { - - 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"); - - } + private NodeStatistics(Builder builder) { + + 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"); + + } + + public static NodeStatistics of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code failures} + */ + public final List failures() { + return this.failures; + } + + /** + * Required - Total number of nodes selected by the request. + *

+ * API name: {@code total} + */ + public final int total() { + return this.total; + } + + /** + * 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. + *

+ * API name: {@code failed} + */ + public final int failed() { + return this.failed; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (ApiTypeHelper.isDefined(this.failures)) { + generator.writeKey("failures"); + generator.writeStartArray(); + for (ErrorCause item0 : this.failures) { + item0.serialize(generator, mapper); + + } + generator.writeEnd(); + + } + generator.writeKey("total"); + generator.write(this.total); + + generator.writeKey("successful"); + generator.write(this.successful); + + generator.writeKey("failed"); + generator.write(this.failed); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link NodeStatistics}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private List failures; + + private Integer total; + + private Integer successful; + + private Integer failed; + + /** + * API name: {@code failures} + *

+ * Adds all elements of list to failures. + */ + public final Builder failures(List list) { + this.failures = _listAddAll(this.failures, list); + return this; + } + + /** + * 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); + return this; + } + + /** + * 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; + return this; + } + + /** + * 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; + } + + /** + * Builds a {@link NodeStatistics}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public NodeStatistics build() { + _checkSingleUse(); + + return new NodeStatistics(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link NodeStatistics} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + NodeStatistics::setupNodeStatisticsDeserializer + ); + + protected static void setupNodeStatisticsDeserializer(ObjectDeserializer op) { + + 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"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpType.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpType.java index e415250039..0a3151caa2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpType.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpType.java @@ -37,21 +37,21 @@ @JsonpDeserializable public enum OpType implements JsonEnum { - Index("index"), + Index("index"), - Create("create"), + Create("create"), - ; + ; - private final String jsonValue; + private final String jsonValue; - OpType(String jsonValue) { - this.jsonValue = jsonValue; - } + OpType(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(OpType.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(OpType.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpenSearchException.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpenSearchException.java index 993d68989d..e2addab959 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpenSearchException.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpenSearchException.java @@ -42,32 +42,32 @@ */ public class OpenSearchException extends RuntimeException { - private final ErrorResponse response; + private final ErrorResponse response; - public OpenSearchException(ErrorResponse response) { - super("Request failed: [" + response.error().type() + "] " + response.error().reason()); - this.response = response; - } + public OpenSearchException(ErrorResponse response) { + super("Request failed: [" + response.error().type() + "] " + response.error().reason()); + this.response = response; + } - /** - * The error response sent by Elasticsearch - */ - public ErrorResponse response() { - return this.response; - } + /** + * The error response sent by Elasticsearch + */ + public ErrorResponse response() { + return this.response; + } - /** - * The cause of the error. Shortcut for {@code response().error()}. - */ - public ErrorCause error() { - return this.response.error(); - } + /** + * The cause of the error. Shortcut for {@code response().error()}. + */ + public ErrorCause error() { + return this.response.error(); + } - /** - * Status code returned by Elasticsearch. Shortcut for - * {@code response().status()}. - */ - public int status() { - return this.response.status(); - } + /** + * Status code returned by Elasticsearch. Shortcut for + * {@code response().status()}. + */ + public int status() { + return this.response.status(); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java index 3995461826..12f9e60a7e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpenSearchVersionInfo.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,310 +43,313 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; @JsonpDeserializable public final class OpenSearchVersionInfo implements JsonpSerializable { - private final String buildDate; - - private final String buildFlavor; - - private final String buildHash; - - private final boolean buildSnapshot; - - private final String buildType; - - private final String distribution; - - private final String luceneVersion; - - private final String minimumIndexCompatibilityVersion; - - private final String minimumWireCompatibilityVersion; - - private final String number; - - // --------------------------------------------------------------------------------------------- - - private OpenSearchVersionInfo(Builder builder) { - - this.buildDate = ApiTypeHelper.requireNonNull(builder.buildDate, this, "buildDate"); - this.buildFlavor = builder.buildFlavor; - this.buildHash = ApiTypeHelper.requireNonNull(builder.buildHash, this, "buildHash"); - this.buildSnapshot = ApiTypeHelper.requireNonNull(builder.buildSnapshot, this, "buildSnapshot"); - this.buildType = ApiTypeHelper.requireNonNull(builder.buildType, this, "buildType"); - this.distribution = ApiTypeHelper.requireNonNull(builder.distribution, this, "distribution"); - this.luceneVersion = ApiTypeHelper.requireNonNull(builder.luceneVersion, this, "luceneVersion"); - this.minimumIndexCompatibilityVersion = ApiTypeHelper.requireNonNull(builder.minimumIndexCompatibilityVersion, - this, "minimumIndexCompatibilityVersion"); - this.minimumWireCompatibilityVersion = ApiTypeHelper.requireNonNull(builder.minimumWireCompatibilityVersion, - this, "minimumWireCompatibilityVersion"); - this.number = ApiTypeHelper.requireNonNull(builder.number, this, "number"); - - } - - public static OpenSearchVersionInfo of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code build_date} - */ - public String buildDate() { - return this.buildDate; - } - - /** - * API name: {@code build_flavor} - */ - public String buildFlavor() { - return this.buildFlavor; - } - - /** - * API name: {@code build_hash} - */ - public String buildHash() { - return this.buildHash; - } - - /** - * Required - API name: {@code build_snapshot} - */ - public boolean buildSnapshot() { - return this.buildSnapshot; - } - - /** - * Required - API name: {@code build_type} - */ - public String buildType() { - return this.buildType; - } - - /** - * API name: {@code distribution} - */ - public String distribution() { - return this.distribution; - } - - /** - * API name: {@code lucene_version} - */ - public String luceneVersion() { - return this.luceneVersion; - } + private final String buildDate; + + private final String buildFlavor; + + private final String buildHash; + + private final boolean buildSnapshot; + + private final String buildType; + + private final String distribution; + + private final String luceneVersion; + + private final String minimumIndexCompatibilityVersion; + + private final String minimumWireCompatibilityVersion; + + private final String number; + + // --------------------------------------------------------------------------------------------- + + private OpenSearchVersionInfo(Builder builder) { + + this.buildDate = ApiTypeHelper.requireNonNull(builder.buildDate, this, "buildDate"); + this.buildFlavor = builder.buildFlavor; + this.buildHash = ApiTypeHelper.requireNonNull(builder.buildHash, this, "buildHash"); + this.buildSnapshot = ApiTypeHelper.requireNonNull(builder.buildSnapshot, this, "buildSnapshot"); + this.buildType = ApiTypeHelper.requireNonNull(builder.buildType, this, "buildType"); + this.distribution = ApiTypeHelper.requireNonNull(builder.distribution, this, "distribution"); + this.luceneVersion = ApiTypeHelper.requireNonNull(builder.luceneVersion, this, "luceneVersion"); + this.minimumIndexCompatibilityVersion = ApiTypeHelper.requireNonNull( + builder.minimumIndexCompatibilityVersion, + this, + "minimumIndexCompatibilityVersion" + ); + this.minimumWireCompatibilityVersion = ApiTypeHelper.requireNonNull( + builder.minimumWireCompatibilityVersion, + this, + "minimumWireCompatibilityVersion" + ); + this.number = ApiTypeHelper.requireNonNull(builder.number, this, "number"); + + } + + public static OpenSearchVersionInfo of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code build_date} + */ + public String buildDate() { + return this.buildDate; + } + + /** + * API name: {@code build_flavor} + */ + public String buildFlavor() { + return this.buildFlavor; + } + + /** + * API name: {@code build_hash} + */ + public String buildHash() { + return this.buildHash; + } + + /** + * Required - API name: {@code build_snapshot} + */ + public boolean buildSnapshot() { + return this.buildSnapshot; + } + + /** + * Required - API name: {@code build_type} + */ + public String buildType() { + return this.buildType; + } - /** - * Required - API name: {@code minimum_index_compatibility_version} - */ - public String minimumIndexCompatibilityVersion() { - return this.minimumIndexCompatibilityVersion; - } + /** + * API name: {@code distribution} + */ + public String distribution() { + return this.distribution; + } - /** - * Required - API name: {@code minimum_wire_compatibility_version} - */ - public String minimumWireCompatibilityVersion() { - return this.minimumWireCompatibilityVersion; - } + /** + * API name: {@code lucene_version} + */ + public String luceneVersion() { + return this.luceneVersion; + } - /** - * Required - API name: {@code number} - */ - public String number() { - return this.number; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("build_date"); - generator.write(this.buildDate); - - generator.writeKey("build_flavor"); - generator.write(this.buildFlavor); - - generator.writeKey("build_hash"); - generator.write(this.buildHash); - - generator.writeKey("build_snapshot"); - generator.write(this.buildSnapshot); - - generator.writeKey("build_type"); - generator.write(this.buildType); - - generator.writeKey("distribution"); - generator.write(this.distribution); - - generator.writeKey("lucene_version"); - generator.write(this.luceneVersion); - - generator.writeKey("minimum_index_compatibility_version"); - generator.write(this.minimumIndexCompatibilityVersion); - - generator.writeKey("minimum_wire_compatibility_version"); - generator.write(this.minimumWireCompatibilityVersion); - - generator.writeKey("number"); - generator.write(this.number); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link OpenSearchVersionInfo}. - */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String buildDate; - - private String buildFlavor; - - private String buildHash; - - private Boolean buildSnapshot; - - private String buildType; - - private String distribution; - - private String luceneVersion; - - private String minimumIndexCompatibilityVersion; - - private String minimumWireCompatibilityVersion; - - private String number; - - /** - * Required - API name: {@code build_date} - */ - public final Builder buildDate(String value) { - this.buildDate = value; - return this; - } - - /** - * API name: {@code build_flavor} - */ - public Builder buildFlavor(String value) { - this.buildFlavor = value; - return this; - } - - /** - * API name: {@code build_hash} - */ - public final Builder buildHash(String value) { - this.buildHash = value; - return this; - } - - /** - * Required - API name: {@code build_snapshot} - */ - public final Builder buildSnapshot(boolean value) { - this.buildSnapshot = value; - return this; - } - - /** - * Required - API name: {@code build_type} - */ - public final Builder buildType(String value) { - this.buildType = value; - return this; - } - - /** - * API name: {@code distribution} - */ - public Builder distribution(String value) { - this.distribution = value; - return this; - } - - /** - * API name: {@code lucene_version} - */ - public final Builder luceneVersion(String value) { - this.luceneVersion = value; - return this; - } - - /** - * Required - API name: {@code minimum_index_compatibility_version} - */ - public final Builder minimumIndexCompatibilityVersion(String value) { - this.minimumIndexCompatibilityVersion = value; - return this; - } - - /** - * Required - API name: {@code minimum_wire_compatibility_version} - */ - public final Builder minimumWireCompatibilityVersion(String value) { - this.minimumWireCompatibilityVersion = value; - return this; - } - - /** - * Required - API name: {@code number} - */ - public final Builder number(String value) { - this.number = value; - return this; - } - - /** - * Builds a {@link OpenSearchVersionInfo}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - - public OpenSearchVersionInfo build() { - _checkSingleUse(); - return new OpenSearchVersionInfo(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for OpenSearchVersionInfo - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, OpenSearchVersionInfo::setupOpenSearchVersionInfoDeserializer); - - protected static void setupOpenSearchVersionInfoDeserializer( - ObjectDeserializer op) { - - op.add(Builder::buildDate, JsonpDeserializer.stringDeserializer(), "build_date"); - op.add(Builder::buildFlavor, JsonpDeserializer.stringDeserializer(), "build_flavor"); - op.add(Builder::buildHash, JsonpDeserializer.stringDeserializer(), "build_hash"); - op.add(Builder::buildSnapshot, JsonpDeserializer.booleanDeserializer(), "build_snapshot"); - op.add(Builder::buildType, JsonpDeserializer.stringDeserializer(), "build_type"); - op.add(Builder::distribution, JsonpDeserializer.stringDeserializer(), "distribution"); - op.add(Builder::luceneVersion, JsonpDeserializer.stringDeserializer(), "lucene_version"); - op.add(Builder::minimumIndexCompatibilityVersion, JsonpDeserializer.stringDeserializer(), - "minimum_index_compatibility_version"); - op.add(Builder::minimumWireCompatibilityVersion, JsonpDeserializer.stringDeserializer(), - "minimum_wire_compatibility_version"); - op.add(Builder::number, JsonpDeserializer.stringDeserializer(), "number"); - - } + /** + * Required - API name: {@code minimum_index_compatibility_version} + */ + public String minimumIndexCompatibilityVersion() { + return this.minimumIndexCompatibilityVersion; + } + + /** + * Required - API name: {@code minimum_wire_compatibility_version} + */ + public String minimumWireCompatibilityVersion() { + return this.minimumWireCompatibilityVersion; + } + + /** + * Required - API name: {@code number} + */ + public String number() { + return this.number; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("build_date"); + generator.write(this.buildDate); + + generator.writeKey("build_flavor"); + generator.write(this.buildFlavor); + + generator.writeKey("build_hash"); + generator.write(this.buildHash); + + generator.writeKey("build_snapshot"); + generator.write(this.buildSnapshot); + + generator.writeKey("build_type"); + generator.write(this.buildType); + + generator.writeKey("distribution"); + generator.write(this.distribution); + + generator.writeKey("lucene_version"); + generator.write(this.luceneVersion); + + generator.writeKey("minimum_index_compatibility_version"); + generator.write(this.minimumIndexCompatibilityVersion); + + generator.writeKey("minimum_wire_compatibility_version"); + generator.write(this.minimumWireCompatibilityVersion); + + generator.writeKey("number"); + generator.write(this.number); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link OpenSearchVersionInfo}. + */ + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String buildDate; + + private String buildFlavor; + + private String buildHash; + + private Boolean buildSnapshot; + + private String buildType; + + private String distribution; + + private String luceneVersion; + + private String minimumIndexCompatibilityVersion; + + private String minimumWireCompatibilityVersion; + + private String number; + + /** + * Required - API name: {@code build_date} + */ + public final Builder buildDate(String value) { + this.buildDate = value; + return this; + } + + /** + * API name: {@code build_flavor} + */ + public Builder buildFlavor(String value) { + this.buildFlavor = value; + return this; + } + + /** + * API name: {@code build_hash} + */ + public final Builder buildHash(String value) { + this.buildHash = value; + return this; + } + + /** + * Required - API name: {@code build_snapshot} + */ + public final Builder buildSnapshot(boolean value) { + this.buildSnapshot = value; + return this; + } + + /** + * Required - API name: {@code build_type} + */ + public final Builder buildType(String value) { + this.buildType = value; + return this; + } + + /** + * API name: {@code distribution} + */ + public Builder distribution(String value) { + this.distribution = value; + return this; + } + + /** + * API name: {@code lucene_version} + */ + public final Builder luceneVersion(String value) { + this.luceneVersion = value; + return this; + } + + /** + * Required - API name: {@code minimum_index_compatibility_version} + */ + public final Builder minimumIndexCompatibilityVersion(String value) { + this.minimumIndexCompatibilityVersion = value; + return this; + } + + /** + * Required - API name: {@code minimum_wire_compatibility_version} + */ + public final Builder minimumWireCompatibilityVersion(String value) { + this.minimumWireCompatibilityVersion = value; + return this; + } + + /** + * Required - API name: {@code number} + */ + public final Builder number(String value) { + this.number = value; + return this; + } + + /** + * Builds a {@link OpenSearchVersionInfo}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + + public OpenSearchVersionInfo build() { + _checkSingleUse(); + return new OpenSearchVersionInfo(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for OpenSearchVersionInfo + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + OpenSearchVersionInfo::setupOpenSearchVersionInfoDeserializer + ); + + protected static void setupOpenSearchVersionInfoDeserializer(ObjectDeserializer op) { + + op.add(Builder::buildDate, JsonpDeserializer.stringDeserializer(), "build_date"); + op.add(Builder::buildFlavor, JsonpDeserializer.stringDeserializer(), "build_flavor"); + op.add(Builder::buildHash, JsonpDeserializer.stringDeserializer(), "build_hash"); + op.add(Builder::buildSnapshot, JsonpDeserializer.booleanDeserializer(), "build_snapshot"); + op.add(Builder::buildType, JsonpDeserializer.stringDeserializer(), "build_type"); + op.add(Builder::distribution, JsonpDeserializer.stringDeserializer(), "distribution"); + op.add(Builder::luceneVersion, JsonpDeserializer.stringDeserializer(), "lucene_version"); + op.add(Builder::minimumIndexCompatibilityVersion, JsonpDeserializer.stringDeserializer(), "minimum_index_compatibility_version"); + op.add(Builder::minimumWireCompatibilityVersion, JsonpDeserializer.stringDeserializer(), "minimum_wire_compatibility_version"); + op.add(Builder::number, JsonpDeserializer.stringDeserializer(), "number"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/PluginStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/PluginStats.java index d421b224fe..9ed07791d4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/PluginStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/PluginStats.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,282 +44,278 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.List; -import java.util.function.Function; // typedef: _types.PluginStats @JsonpDeserializable public class PluginStats implements JsonpSerializable { - private final String classname; - - private final String description; - - private final String opensearchVersion; - - private final List extendedPlugins; - - private final boolean hasNativeController; - - private final String javaVersion; - - private final String name; - - private final String version; - - // --------------------------------------------------------------------------------------------- - - private PluginStats(Builder builder) { - - this.classname = ApiTypeHelper.requireNonNull(builder.classname, this, "classname"); - this.description = ApiTypeHelper.requireNonNull(builder.description, this, "description"); - this.opensearchVersion = ApiTypeHelper.requireNonNull(builder.opensearchVersion, this, - "opensearchVersion"); - this.extendedPlugins = ApiTypeHelper.unmodifiableRequired(builder.extendedPlugins, this, "extendedPlugins"); - this.hasNativeController = ApiTypeHelper.requireNonNull(builder.hasNativeController, this, - "hasNativeController"); - this.javaVersion = ApiTypeHelper.requireNonNull(builder.javaVersion, this, "javaVersion"); - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); - this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); - - } - - public static PluginStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code classname} - */ - public final String classname() { - return this.classname; - } - - /** - * Required - API name: {@code description} - */ - public final String description() { - return this.description; - } + private final String classname; + + private final String description; + + private final String opensearchVersion; + + private final List extendedPlugins; + + private final boolean hasNativeController; + + private final String javaVersion; + + private final String name; + + private final String version; + + // --------------------------------------------------------------------------------------------- + + private PluginStats(Builder builder) { + + this.classname = ApiTypeHelper.requireNonNull(builder.classname, this, "classname"); + this.description = ApiTypeHelper.requireNonNull(builder.description, this, "description"); + this.opensearchVersion = ApiTypeHelper.requireNonNull(builder.opensearchVersion, this, "opensearchVersion"); + this.extendedPlugins = ApiTypeHelper.unmodifiableRequired(builder.extendedPlugins, this, "extendedPlugins"); + this.hasNativeController = ApiTypeHelper.requireNonNull(builder.hasNativeController, this, "hasNativeController"); + this.javaVersion = ApiTypeHelper.requireNonNull(builder.javaVersion, this, "javaVersion"); + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); + this.version = ApiTypeHelper.requireNonNull(builder.version, this, "version"); + + } + + public static PluginStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code classname} + */ + public final String classname() { + return this.classname; + } + + /** + * Required - API name: {@code description} + */ + public final String description() { + return this.description; + } - /** - * API name: {@code opensearch_version} - */ - public String opensearchVersion() { - return this.opensearchVersion; - } + /** + * API name: {@code opensearch_version} + */ + public String opensearchVersion() { + return this.opensearchVersion; + } - /** - * Required - API name: {@code extended_plugins} - */ - public final List extendedPlugins() { - return this.extendedPlugins; - } + /** + * Required - API name: {@code extended_plugins} + */ + public final List extendedPlugins() { + return this.extendedPlugins; + } - /** - * Required - API name: {@code has_native_controller} - */ - public final boolean hasNativeController() { - return this.hasNativeController; - } + /** + * Required - API name: {@code has_native_controller} + */ + public final boolean hasNativeController() { + return this.hasNativeController; + } - /** - * Required - API name: {@code java_version} - */ - public final String javaVersion() { - return this.javaVersion; - } + /** + * Required - API name: {@code java_version} + */ + public final String javaVersion() { + return this.javaVersion; + } - /** - * Required - API name: {@code name} - */ - public final String name() { - return this.name; - } - - /** - * Required - API name: {@code version} - */ - public final String version() { - return this.version; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("classname"); - generator.write(this.classname); - - generator.writeKey("description"); - generator.write(this.description); - - generator.writeKey("opensearch_version"); - generator.write(this.opensearchVersion); - - if (ApiTypeHelper.isDefined(this.extendedPlugins)) { - generator.writeKey("extended_plugins"); - generator.writeStartArray(); - for (String item0 : this.extendedPlugins) { - generator.write(item0); - - } - generator.writeEnd(); - - } - generator.writeKey("has_native_controller"); - generator.write(this.hasNativeController); - - generator.writeKey("java_version"); - generator.write(this.javaVersion); - - generator.writeKey("name"); - generator.write(this.name); - - generator.writeKey("version"); - generator.write(this.version); - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link PluginStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private String classname; - - private String description; - - private String opensearchVersion; - - private List extendedPlugins; - - private Boolean hasNativeController; - - private String javaVersion; - - private String name; - - private String version; - - /** - * Required - API name: {@code classname} - */ - public final Builder classname(String value) { - this.classname = value; - return this; - } - - /** - * Required - API name: {@code description} - */ - public final Builder description(String value) { - this.description = value; - return this; - } - - /** - * Required - API name: {@code opensearch_version} - */ - public final Builder opensearchVersion(String value) { - this.opensearchVersion = value; - return this; - } - - /** - * Required - API name: {@code extended_plugins} - *

- * Adds all elements of list to extendedPlugins. - */ - public final Builder extendedPlugins(List list) { - this.extendedPlugins = _listAddAll(this.extendedPlugins, list); - return this; - } - - /** - * Required - API name: {@code extended_plugins} - *

- * Adds one or more values to extendedPlugins. - */ - public final Builder extendedPlugins(String value, String... values) { - this.extendedPlugins = _listAdd(this.extendedPlugins, value, values); - return this; - } - - /** - * Required - API name: {@code has_native_controller} - */ - public final Builder hasNativeController(boolean value) { - this.hasNativeController = value; - return this; - } - - /** - * Required - API name: {@code java_version} - */ - public final Builder javaVersion(String value) { - this.javaVersion = value; - return this; - } - - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; - } - - /** - * Required - API name: {@code version} - */ - public final Builder version(String value) { - this.version = value; - return this; - } - - /** - * Builds a {@link PluginStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public PluginStats build() { - _checkSingleUse(); - - return new PluginStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link PluginStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - PluginStats::setupPluginStatsDeserializer); - - protected static void setupPluginStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::classname, JsonpDeserializer.stringDeserializer(), "classname"); - op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); - op.add(Builder::opensearchVersion, JsonpDeserializer.stringDeserializer(), "opensearch_version"); - op.add(Builder::extendedPlugins, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), - "extended_plugins"); - op.add(Builder::hasNativeController, JsonpDeserializer.booleanDeserializer(), "has_native_controller"); - op.add(Builder::javaVersion, JsonpDeserializer.stringDeserializer(), "java_version"); - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); - op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); - - } + /** + * Required - API name: {@code name} + */ + public final String name() { + return this.name; + } + + /** + * Required - API name: {@code version} + */ + public final String version() { + return this.version; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("classname"); + generator.write(this.classname); + + generator.writeKey("description"); + generator.write(this.description); + + generator.writeKey("opensearch_version"); + generator.write(this.opensearchVersion); + + if (ApiTypeHelper.isDefined(this.extendedPlugins)) { + generator.writeKey("extended_plugins"); + generator.writeStartArray(); + for (String item0 : this.extendedPlugins) { + generator.write(item0); + + } + generator.writeEnd(); + + } + generator.writeKey("has_native_controller"); + generator.write(this.hasNativeController); + + generator.writeKey("java_version"); + generator.write(this.javaVersion); + + generator.writeKey("name"); + generator.write(this.name); + + generator.writeKey("version"); + generator.write(this.version); + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link PluginStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String classname; + + private String description; + + private String opensearchVersion; + + private List extendedPlugins; + + private Boolean hasNativeController; + + private String javaVersion; + + private String name; + + private String version; + + /** + * Required - API name: {@code classname} + */ + public final Builder classname(String value) { + this.classname = value; + return this; + } + + /** + * Required - API name: {@code description} + */ + public final Builder description(String value) { + this.description = value; + return this; + } + + /** + * Required - API name: {@code opensearch_version} + */ + public final Builder opensearchVersion(String value) { + this.opensearchVersion = value; + return this; + } + + /** + * Required - API name: {@code extended_plugins} + *

+ * Adds all elements of list to extendedPlugins. + */ + public final Builder extendedPlugins(List list) { + this.extendedPlugins = _listAddAll(this.extendedPlugins, list); + return this; + } + + /** + * Required - API name: {@code extended_plugins} + *

+ * Adds one or more values to extendedPlugins. + */ + public final Builder extendedPlugins(String value, String... values) { + this.extendedPlugins = _listAdd(this.extendedPlugins, value, values); + return this; + } + + /** + * Required - API name: {@code has_native_controller} + */ + public final Builder hasNativeController(boolean value) { + this.hasNativeController = value; + return this; + } + + /** + * Required - API name: {@code java_version} + */ + public final Builder javaVersion(String value) { + this.javaVersion = value; + return this; + } + + /** + * Required - API name: {@code name} + */ + public final Builder name(String value) { + this.name = value; + return this; + } + + /** + * Required - API name: {@code version} + */ + public final Builder version(String value) { + this.version = value; + return this; + } + + /** + * Builds a {@link PluginStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public PluginStats build() { + _checkSingleUse(); + + return new PluginStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link PluginStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + PluginStats::setupPluginStatsDeserializer + ); + + protected static void setupPluginStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::classname, JsonpDeserializer.stringDeserializer(), "classname"); + op.add(Builder::description, JsonpDeserializer.stringDeserializer(), "description"); + op.add(Builder::opensearchVersion, JsonpDeserializer.stringDeserializer(), "opensearch_version"); + op.add(Builder::extendedPlugins, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "extended_plugins"); + op.add(Builder::hasNativeController, JsonpDeserializer.booleanDeserializer(), "has_native_controller"); + op.add(Builder::javaVersion, JsonpDeserializer.stringDeserializer(), "java_version"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + op.add(Builder::version, JsonpDeserializer.stringDeserializer(), "version"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/QueryCacheStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/QueryCacheStats.java index 6b3df16c7e..d5ba4b1224 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/QueryCacheStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/QueryCacheStats.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,266 +44,265 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.QueryCacheStats @JsonpDeserializable public class QueryCacheStats implements JsonpSerializable { - private final int cacheCount; - - private final int cacheSize; - - private final int evictions; - - private final int hitCount; - - @Nullable - private final String memorySize; - - private final int memorySizeInBytes; - - private final int missCount; - - private final int totalCount; - - // --------------------------------------------------------------------------------------------- - - private QueryCacheStats(Builder builder) { - - this.cacheCount = ApiTypeHelper.requireNonNull(builder.cacheCount, this, "cacheCount"); - this.cacheSize = ApiTypeHelper.requireNonNull(builder.cacheSize, this, "cacheSize"); - this.evictions = ApiTypeHelper.requireNonNull(builder.evictions, this, "evictions"); - this.hitCount = ApiTypeHelper.requireNonNull(builder.hitCount, this, "hitCount"); - this.memorySize = builder.memorySize; - this.memorySizeInBytes = ApiTypeHelper.requireNonNull(builder.memorySizeInBytes, this, "memorySizeInBytes"); - this.missCount = ApiTypeHelper.requireNonNull(builder.missCount, this, "missCount"); - this.totalCount = ApiTypeHelper.requireNonNull(builder.totalCount, this, "totalCount"); - - } - - public static QueryCacheStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code cache_count} - */ - public final int cacheCount() { - return this.cacheCount; - } + private final int cacheCount; + + private final int cacheSize; + + private final int evictions; + + private final int hitCount; + + @Nullable + private final String memorySize; + + private final int memorySizeInBytes; + + private final int missCount; + + private final int totalCount; + + // --------------------------------------------------------------------------------------------- + + private QueryCacheStats(Builder builder) { + + this.cacheCount = ApiTypeHelper.requireNonNull(builder.cacheCount, this, "cacheCount"); + this.cacheSize = ApiTypeHelper.requireNonNull(builder.cacheSize, this, "cacheSize"); + this.evictions = ApiTypeHelper.requireNonNull(builder.evictions, this, "evictions"); + this.hitCount = ApiTypeHelper.requireNonNull(builder.hitCount, this, "hitCount"); + this.memorySize = builder.memorySize; + this.memorySizeInBytes = ApiTypeHelper.requireNonNull(builder.memorySizeInBytes, this, "memorySizeInBytes"); + this.missCount = ApiTypeHelper.requireNonNull(builder.missCount, this, "missCount"); + this.totalCount = ApiTypeHelper.requireNonNull(builder.totalCount, this, "totalCount"); + + } + + public static QueryCacheStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code cache_count} + */ + public final int cacheCount() { + return this.cacheCount; + } - /** - * Required - API name: {@code cache_size} - */ - public final int cacheSize() { - return this.cacheSize; - } + /** + * Required - API name: {@code cache_size} + */ + public final int cacheSize() { + return this.cacheSize; + } - /** - * Required - API name: {@code evictions} - */ - public final int evictions() { - return this.evictions; - } + /** + * Required - API name: {@code evictions} + */ + public final int evictions() { + return this.evictions; + } - /** - * Required - API name: {@code hit_count} - */ - public final int hitCount() { - return this.hitCount; - } + /** + * Required - API name: {@code hit_count} + */ + public final int hitCount() { + return this.hitCount; + } - /** - * API name: {@code memory_size} - */ - @Nullable - public final String memorySize() { - return this.memorySize; - } + /** + * API name: {@code memory_size} + */ + @Nullable + public final String memorySize() { + return this.memorySize; + } - /** - * Required - API name: {@code memory_size_in_bytes} - */ - public final int memorySizeInBytes() { - return this.memorySizeInBytes; - } + /** + * Required - API name: {@code memory_size_in_bytes} + */ + public final int memorySizeInBytes() { + return this.memorySizeInBytes; + } - /** - * Required - API name: {@code miss_count} - */ - public final int missCount() { - return this.missCount; - } - - /** - * Required - API name: {@code total_count} - */ - public final int totalCount() { - return this.totalCount; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("cache_count"); - generator.write(this.cacheCount); - - generator.writeKey("cache_size"); - generator.write(this.cacheSize); - - generator.writeKey("evictions"); - generator.write(this.evictions); - - generator.writeKey("hit_count"); - generator.write(this.hitCount); - - if (this.memorySize != null) { - generator.writeKey("memory_size"); - generator.write(this.memorySize); - - } - generator.writeKey("memory_size_in_bytes"); - generator.write(this.memorySizeInBytes); - - generator.writeKey("miss_count"); - generator.write(this.missCount); - - generator.writeKey("total_count"); - generator.write(this.totalCount); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link QueryCacheStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Integer cacheCount; - - private Integer cacheSize; - - private Integer evictions; - - private Integer hitCount; - - @Nullable - private String memorySize; - - private Integer memorySizeInBytes; - - private Integer missCount; - - private Integer totalCount; - - /** - * Required - API name: {@code cache_count} - */ - public final Builder cacheCount(int value) { - this.cacheCount = value; - return this; - } - - /** - * Required - API name: {@code cache_size} - */ - public final Builder cacheSize(int value) { - this.cacheSize = value; - return this; - } - - /** - * Required - API name: {@code evictions} - */ - public final Builder evictions(int value) { - this.evictions = value; - return this; - } - - /** - * Required - API name: {@code hit_count} - */ - public final Builder hitCount(int value) { - this.hitCount = value; - return this; - } - - /** - * API name: {@code memory_size} - */ - public final Builder memorySize(@Nullable String value) { - this.memorySize = value; - return this; - } - - /** - * Required - API name: {@code memory_size_in_bytes} - */ - public final Builder memorySizeInBytes(int value) { - this.memorySizeInBytes = value; - return this; - } - - /** - * Required - API name: {@code miss_count} - */ - public final Builder missCount(int value) { - this.missCount = value; - return this; - } - - /** - * Required - API name: {@code total_count} - */ - public final Builder totalCount(int value) { - this.totalCount = value; - return this; - } - - /** - * Builds a {@link QueryCacheStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public QueryCacheStats build() { - _checkSingleUse(); - - return new QueryCacheStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link QueryCacheStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - QueryCacheStats::setupQueryCacheStatsDeserializer); - - protected static void setupQueryCacheStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::cacheCount, JsonpDeserializer.integerDeserializer(), "cache_count"); - op.add(Builder::cacheSize, JsonpDeserializer.integerDeserializer(), "cache_size"); - op.add(Builder::evictions, JsonpDeserializer.integerDeserializer(), "evictions"); - op.add(Builder::hitCount, JsonpDeserializer.integerDeserializer(), "hit_count"); - op.add(Builder::memorySize, JsonpDeserializer.stringDeserializer(), "memory_size"); - op.add(Builder::memorySizeInBytes, JsonpDeserializer.integerDeserializer(), "memory_size_in_bytes"); - op.add(Builder::missCount, JsonpDeserializer.integerDeserializer(), "miss_count"); - op.add(Builder::totalCount, JsonpDeserializer.integerDeserializer(), "total_count"); - - } + /** + * Required - API name: {@code miss_count} + */ + public final int missCount() { + return this.missCount; + } + + /** + * Required - API name: {@code total_count} + */ + public final int totalCount() { + return this.totalCount; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("cache_count"); + generator.write(this.cacheCount); + + generator.writeKey("cache_size"); + generator.write(this.cacheSize); + + generator.writeKey("evictions"); + generator.write(this.evictions); + + generator.writeKey("hit_count"); + generator.write(this.hitCount); + + if (this.memorySize != null) { + generator.writeKey("memory_size"); + generator.write(this.memorySize); + + } + generator.writeKey("memory_size_in_bytes"); + generator.write(this.memorySizeInBytes); + + generator.writeKey("miss_count"); + generator.write(this.missCount); + + generator.writeKey("total_count"); + generator.write(this.totalCount); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link QueryCacheStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Integer cacheCount; + + private Integer cacheSize; + + private Integer evictions; + + private Integer hitCount; + + @Nullable + private String memorySize; + + private Integer memorySizeInBytes; + + private Integer missCount; + + private Integer totalCount; + + /** + * Required - API name: {@code cache_count} + */ + public final Builder cacheCount(int value) { + this.cacheCount = value; + return this; + } + + /** + * Required - API name: {@code cache_size} + */ + public final Builder cacheSize(int value) { + this.cacheSize = value; + return this; + } + + /** + * Required - API name: {@code evictions} + */ + public final Builder evictions(int value) { + this.evictions = value; + return this; + } + + /** + * Required - API name: {@code hit_count} + */ + public final Builder hitCount(int value) { + this.hitCount = value; + return this; + } + + /** + * API name: {@code memory_size} + */ + public final Builder memorySize(@Nullable String value) { + this.memorySize = value; + return this; + } + + /** + * Required - API name: {@code memory_size_in_bytes} + */ + public final Builder memorySizeInBytes(int value) { + this.memorySizeInBytes = value; + return this; + } + + /** + * Required - API name: {@code miss_count} + */ + public final Builder missCount(int value) { + this.missCount = value; + return this; + } + + /** + * Required - API name: {@code total_count} + */ + public final Builder totalCount(int value) { + this.totalCount = value; + return this; + } + + /** + * Builds a {@link QueryCacheStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public QueryCacheStats build() { + _checkSingleUse(); + + return new QueryCacheStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link QueryCacheStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + QueryCacheStats::setupQueryCacheStatsDeserializer + ); + + protected static void setupQueryCacheStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::cacheCount, JsonpDeserializer.integerDeserializer(), "cache_count"); + op.add(Builder::cacheSize, JsonpDeserializer.integerDeserializer(), "cache_size"); + op.add(Builder::evictions, JsonpDeserializer.integerDeserializer(), "evictions"); + op.add(Builder::hitCount, JsonpDeserializer.integerDeserializer(), "hit_count"); + op.add(Builder::memorySize, JsonpDeserializer.stringDeserializer(), "memory_size"); + op.add(Builder::memorySizeInBytes, JsonpDeserializer.integerDeserializer(), "memory_size_in_bytes"); + op.add(Builder::missCount, JsonpDeserializer.integerDeserializer(), "miss_count"); + op.add(Builder::totalCount, JsonpDeserializer.integerDeserializer(), "total_count"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/RecoveryStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/RecoveryStats.java index 475d640048..80f4d182ff 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/RecoveryStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/RecoveryStats.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,171 +44,169 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.RecoveryStats @JsonpDeserializable public class RecoveryStats implements JsonpSerializable { - private final long currentAsSource; + private final long currentAsSource; - private final long currentAsTarget; + private final long currentAsTarget; - @Nullable - private final String throttleTime; + @Nullable + private final String throttleTime; - private final long throttleTimeInMillis; + private final long throttleTimeInMillis; - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - private RecoveryStats(Builder builder) { + private RecoveryStats(Builder builder) { - this.currentAsSource = ApiTypeHelper.requireNonNull(builder.currentAsSource, this, "currentAsSource"); - this.currentAsTarget = ApiTypeHelper.requireNonNull(builder.currentAsTarget, this, "currentAsTarget"); - this.throttleTime = builder.throttleTime; - this.throttleTimeInMillis = ApiTypeHelper.requireNonNull(builder.throttleTimeInMillis, this, - "throttleTimeInMillis"); - - } - - public static RecoveryStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Required - API name: {@code current_as_source} - */ - public final long currentAsSource() { - return this.currentAsSource; - } - - /** - * Required - API name: {@code current_as_target} - */ - public final long currentAsTarget() { - return this.currentAsTarget; - } - - /** - * API name: {@code throttle_time} - */ - @Nullable - public final String throttleTime() { - return this.throttleTime; - } - - /** - * Required - API name: {@code throttle_time_in_millis} - */ - public final long throttleTimeInMillis() { - return this.throttleTimeInMillis; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("current_as_source"); - generator.write(this.currentAsSource); - - generator.writeKey("current_as_target"); - generator.write(this.currentAsTarget); - - if (this.throttleTime != null) { - generator.writeKey("throttle_time"); - generator.write(this.throttleTime); - - } - generator.writeKey("throttle_time_in_millis"); - generator.write(this.throttleTimeInMillis); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link RecoveryStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long currentAsSource; - - private Long currentAsTarget; - - @Nullable - private String throttleTime; - - private Long throttleTimeInMillis; - - /** - * Required - API name: {@code current_as_source} - */ - public final Builder currentAsSource(long value) { - this.currentAsSource = value; - return this; - } - - /** - * Required - API name: {@code current_as_target} - */ - public final Builder currentAsTarget(long value) { - this.currentAsTarget = value; - return this; - } - - /** - * API name: {@code throttle_time} - */ - public final Builder throttleTime(@Nullable String value) { - this.throttleTime = value; - return this; - } - - /** - * Required - API name: {@code throttle_time_in_millis} - */ - public final Builder throttleTimeInMillis(long value) { - this.throttleTimeInMillis = value; - return this; - } - - /** - * Builds a {@link RecoveryStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public RecoveryStats build() { - _checkSingleUse(); - - return new RecoveryStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link RecoveryStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - RecoveryStats::setupRecoveryStatsDeserializer); - - protected static void setupRecoveryStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::currentAsSource, JsonpDeserializer.longDeserializer(), "current_as_source"); - op.add(Builder::currentAsTarget, JsonpDeserializer.longDeserializer(), "current_as_target"); - op.add(Builder::throttleTime, JsonpDeserializer.stringDeserializer(), "throttle_time"); - op.add(Builder::throttleTimeInMillis, JsonpDeserializer.longDeserializer(), "throttle_time_in_millis"); - - } + this.currentAsSource = ApiTypeHelper.requireNonNull(builder.currentAsSource, this, "currentAsSource"); + this.currentAsTarget = ApiTypeHelper.requireNonNull(builder.currentAsTarget, this, "currentAsTarget"); + this.throttleTime = builder.throttleTime; + this.throttleTimeInMillis = ApiTypeHelper.requireNonNull(builder.throttleTimeInMillis, this, "throttleTimeInMillis"); + + } + + public static RecoveryStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code current_as_source} + */ + public final long currentAsSource() { + return this.currentAsSource; + } + + /** + * Required - API name: {@code current_as_target} + */ + public final long currentAsTarget() { + return this.currentAsTarget; + } + + /** + * API name: {@code throttle_time} + */ + @Nullable + public final String throttleTime() { + return this.throttleTime; + } + + /** + * Required - API name: {@code throttle_time_in_millis} + */ + public final long throttleTimeInMillis() { + return this.throttleTimeInMillis; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("current_as_source"); + generator.write(this.currentAsSource); + + generator.writeKey("current_as_target"); + generator.write(this.currentAsTarget); + + if (this.throttleTime != null) { + generator.writeKey("throttle_time"); + generator.write(this.throttleTime); + + } + generator.writeKey("throttle_time_in_millis"); + generator.write(this.throttleTimeInMillis); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RecoveryStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long currentAsSource; + + private Long currentAsTarget; + + @Nullable + private String throttleTime; + + private Long throttleTimeInMillis; + + /** + * Required - API name: {@code current_as_source} + */ + public final Builder currentAsSource(long value) { + this.currentAsSource = value; + return this; + } + + /** + * Required - API name: {@code current_as_target} + */ + public final Builder currentAsTarget(long value) { + this.currentAsTarget = value; + return this; + } + + /** + * API name: {@code throttle_time} + */ + public final Builder throttleTime(@Nullable String value) { + this.throttleTime = value; + return this; + } + + /** + * Required - API name: {@code throttle_time_in_millis} + */ + public final Builder throttleTimeInMillis(long value) { + this.throttleTimeInMillis = value; + return this; + } + + /** + * Builds a {@link RecoveryStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public RecoveryStats build() { + _checkSingleUse(); + + return new RecoveryStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RecoveryStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RecoveryStats::setupRecoveryStatsDeserializer + ); + + protected static void setupRecoveryStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::currentAsSource, JsonpDeserializer.longDeserializer(), "current_as_source"); + op.add(Builder::currentAsTarget, JsonpDeserializer.longDeserializer(), "current_as_target"); + op.add(Builder::throttleTime, JsonpDeserializer.stringDeserializer(), "throttle_time"); + op.add(Builder::throttleTimeInMillis, JsonpDeserializer.longDeserializer(), "throttle_time_in_millis"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Refresh.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Refresh.java index 190d4c62c5..b1b78d0305 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Refresh.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Refresh.java @@ -37,23 +37,23 @@ @JsonpDeserializable public enum Refresh implements JsonEnum { - True("true"), + True("true"), - False("false"), + False("false"), - WaitFor("wait_for"), + WaitFor("wait_for"), - ; + ; - private final String jsonValue; + private final String jsonValue; - Refresh(String jsonValue) { - this.jsonValue = jsonValue; - } + Refresh(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Refresh.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Refresh.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/RefreshStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/RefreshStats.java index f811195f56..bfa6015a4b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/RefreshStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/RefreshStats.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,221 +44,217 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.RefreshStats - @JsonpDeserializable public class RefreshStats implements JsonpSerializable { - private final long externalTotal; - - private final long externalTotalTimeInMillis; - - private final long listeners; - - private final long total; - - @Nullable - private final String totalTime; + private final long externalTotal; + + private final long externalTotalTimeInMillis; + + private final long listeners; + + private final long total; + + @Nullable + private final String totalTime; + + private final long totalTimeInMillis; - private final long totalTimeInMillis; + // --------------------------------------------------------------------------------------------- - // --------------------------------------------------------------------------------------------- + private RefreshStats(Builder builder) { - private RefreshStats(Builder builder) { + this.externalTotal = ApiTypeHelper.requireNonNull(builder.externalTotal, this, "externalTotal"); + this.externalTotalTimeInMillis = ApiTypeHelper.requireNonNull(builder.externalTotalTimeInMillis, this, "externalTotalTimeInMillis"); + this.listeners = ApiTypeHelper.requireNonNull(builder.listeners, this, "listeners"); + this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); + this.totalTime = builder.totalTime; + this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); - this.externalTotal = ApiTypeHelper.requireNonNull(builder.externalTotal, this, "externalTotal"); - this.externalTotalTimeInMillis = ApiTypeHelper.requireNonNull(builder.externalTotalTimeInMillis, this, - "externalTotalTimeInMillis"); - this.listeners = ApiTypeHelper.requireNonNull(builder.listeners, this, "listeners"); - this.total = ApiTypeHelper.requireNonNull(builder.total, this, "total"); - this.totalTime = builder.totalTime; - this.totalTimeInMillis = ApiTypeHelper.requireNonNull(builder.totalTimeInMillis, this, "totalTimeInMillis"); + } - } + public static RefreshStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } - public static RefreshStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } + /** + * Required - API name: {@code external_total} + */ + public final long externalTotal() { + return this.externalTotal; + } - /** - * Required - API name: {@code external_total} - */ - public final long externalTotal() { - return this.externalTotal; - } + /** + * Required - API name: {@code external_total_time_in_millis} + */ + public final long externalTotalTimeInMillis() { + return this.externalTotalTimeInMillis; + } - /** - * Required - API name: {@code external_total_time_in_millis} - */ - public final long externalTotalTimeInMillis() { - return this.externalTotalTimeInMillis; - } + /** + * Required - API name: {@code listeners} + */ + public final long listeners() { + return this.listeners; + } - /** - * Required - API name: {@code listeners} - */ - public final long listeners() { - return this.listeners; - } - - /** - * Required - API name: {@code total} - */ - public final long total() { - return this.total; - } - - /** - * API name: {@code total_time} - */ - @Nullable - public final String totalTime() { - return this.totalTime; - } - - /** - * Required - API name: {@code total_time_in_millis} - */ - public final long totalTimeInMillis() { - return this.totalTimeInMillis; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("external_total"); - generator.write(this.externalTotal); - - generator.writeKey("external_total_time_in_millis"); - generator.write(this.externalTotalTimeInMillis); - - generator.writeKey("listeners"); - generator.write(this.listeners); - - generator.writeKey("total"); - generator.write(this.total); - - if (this.totalTime != null) { - generator.writeKey("total_time"); - generator.write(this.totalTime); - - } - generator.writeKey("total_time_in_millis"); - generator.write(this.totalTimeInMillis); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link RefreshStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long externalTotal; - - private Long externalTotalTimeInMillis; - - private Long listeners; - - private Long total; - - @Nullable - private String totalTime; - - private Long totalTimeInMillis; - - /** - * Required - API name: {@code external_total} - */ - public final Builder externalTotal(long value) { - this.externalTotal = value; - return this; - } - - /** - * Required - API name: {@code external_total_time_in_millis} - */ - public final Builder externalTotalTimeInMillis(long value) { - this.externalTotalTimeInMillis = value; - return this; - } - - /** - * Required - API name: {@code listeners} - */ - public final Builder listeners(long value) { - this.listeners = value; - return this; - } - - /** - * Required - API name: {@code total} - */ - public final Builder total(long value) { - this.total = value; - return this; - } - - /** - * API name: {@code total_time} - */ - public final Builder totalTime(@Nullable String value) { - this.totalTime = value; - return this; - } - - /** - * Required - API name: {@code total_time_in_millis} - */ - public final Builder totalTimeInMillis(long value) { - this.totalTimeInMillis = value; - return this; - } - - /** - * Builds a {@link RefreshStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public RefreshStats build() { - _checkSingleUse(); - - return new RefreshStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link RefreshStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - RefreshStats::setupRefreshStatsDeserializer); - - protected static void setupRefreshStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::externalTotal, JsonpDeserializer.longDeserializer(), "external_total"); - op.add(Builder::externalTotalTimeInMillis, JsonpDeserializer.longDeserializer(), - "external_total_time_in_millis"); - op.add(Builder::listeners, JsonpDeserializer.longDeserializer(), "listeners"); - op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); - op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); - op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); - - } + /** + * Required - API name: {@code total} + */ + public final long total() { + return this.total; + } + + /** + * API name: {@code total_time} + */ + @Nullable + public final String totalTime() { + return this.totalTime; + } + + /** + * Required - API name: {@code total_time_in_millis} + */ + public final long totalTimeInMillis() { + return this.totalTimeInMillis; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("external_total"); + generator.write(this.externalTotal); + + generator.writeKey("external_total_time_in_millis"); + generator.write(this.externalTotalTimeInMillis); + + generator.writeKey("listeners"); + generator.write(this.listeners); + + generator.writeKey("total"); + generator.write(this.total); + + if (this.totalTime != null) { + generator.writeKey("total_time"); + generator.write(this.totalTime); + + } + generator.writeKey("total_time_in_millis"); + generator.write(this.totalTimeInMillis); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RefreshStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long externalTotal; + + private Long externalTotalTimeInMillis; + + private Long listeners; + + private Long total; + + @Nullable + private String totalTime; + + private Long totalTimeInMillis; + + /** + * Required - API name: {@code external_total} + */ + public final Builder externalTotal(long value) { + this.externalTotal = value; + return this; + } + + /** + * Required - API name: {@code external_total_time_in_millis} + */ + public final Builder externalTotalTimeInMillis(long value) { + this.externalTotalTimeInMillis = value; + return this; + } + + /** + * Required - API name: {@code listeners} + */ + public final Builder listeners(long value) { + this.listeners = value; + return this; + } + + /** + * Required - API name: {@code total} + */ + public final Builder total(long value) { + this.total = value; + return this; + } + + /** + * API name: {@code total_time} + */ + public final Builder totalTime(@Nullable String value) { + this.totalTime = value; + return this; + } + + /** + * Required - API name: {@code total_time_in_millis} + */ + public final Builder totalTimeInMillis(long value) { + this.totalTimeInMillis = value; + return this; + } + + /** + * Builds a {@link RefreshStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public RefreshStats build() { + _checkSingleUse(); + + return new RefreshStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RefreshStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RefreshStats::setupRefreshStatsDeserializer + ); + + protected static void setupRefreshStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::externalTotal, JsonpDeserializer.longDeserializer(), "external_total"); + op.add(Builder::externalTotalTimeInMillis, JsonpDeserializer.longDeserializer(), "external_total_time_in_millis"); + op.add(Builder::listeners, JsonpDeserializer.longDeserializer(), "listeners"); + op.add(Builder::total, JsonpDeserializer.longDeserializer(), "total"); + op.add(Builder::totalTime, JsonpDeserializer.stringDeserializer(), "total_time"); + op.add(Builder::totalTimeInMillis, JsonpDeserializer.longDeserializer(), "total_time_in_millis"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/RequestBase.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/RequestBase.java index bb57c5de8c..165c5258a0 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/RequestBase.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/RequestBase.java @@ -36,16 +36,12 @@ // typedef: _types.RequestBase - public abstract class RequestBase { - public RequestBase() { - } + public RequestBase() {} - protected abstract static class AbstractBuilder> - extends - ObjectBuilderBase { - protected abstract BuilderT self(); + protected abstract static class AbstractBuilder> extends ObjectBuilderBase { + protected abstract BuilderT self(); - } + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/RequestCacheStats.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/RequestCacheStats.java index ace6ed3e06..1b7a25c28f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/RequestCacheStats.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/RequestCacheStats.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,194 +44,193 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.RequestCacheStats @JsonpDeserializable public class RequestCacheStats implements JsonpSerializable { - private final long evictions; + private final long evictions; - private final long hitCount; + private final long hitCount; - @Nullable - private final String memorySize; + @Nullable + private final String memorySize; - private final long memorySizeInBytes; + private final long memorySizeInBytes; - private final long missCount; + private final long missCount; - // --------------------------------------------------------------------------------------------- + // --------------------------------------------------------------------------------------------- - private RequestCacheStats(Builder builder) { + private RequestCacheStats(Builder builder) { - this.evictions = ApiTypeHelper.requireNonNull(builder.evictions, this, "evictions"); - this.hitCount = ApiTypeHelper.requireNonNull(builder.hitCount, this, "hitCount"); - this.memorySize = builder.memorySize; - this.memorySizeInBytes = ApiTypeHelper.requireNonNull(builder.memorySizeInBytes, this, "memorySizeInBytes"); - this.missCount = ApiTypeHelper.requireNonNull(builder.missCount, this, "missCount"); + this.evictions = ApiTypeHelper.requireNonNull(builder.evictions, this, "evictions"); + this.hitCount = ApiTypeHelper.requireNonNull(builder.hitCount, this, "hitCount"); + this.memorySize = builder.memorySize; + this.memorySizeInBytes = ApiTypeHelper.requireNonNull(builder.memorySizeInBytes, this, "memorySizeInBytes"); + this.missCount = ApiTypeHelper.requireNonNull(builder.missCount, this, "missCount"); - } + } - public static RequestCacheStats of(Function> fn) { - return fn.apply(new Builder()).build(); - } + public static RequestCacheStats of(Function> fn) { + return fn.apply(new Builder()).build(); + } - /** - * Required - API name: {@code evictions} - */ - public final long evictions() { - return this.evictions; - } - - /** - * Required - API name: {@code hit_count} - */ - public final long hitCount() { - return this.hitCount; - } - - /** - * API name: {@code memory_size} - */ - @Nullable - public final String memorySize() { - return this.memorySize; - } - - /** - * Required - API name: {@code memory_size_in_bytes} - */ - public final long memorySizeInBytes() { - return this.memorySizeInBytes; - } - - /** - * Required - API name: {@code miss_count} - */ - public final long missCount() { - return this.missCount; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - generator.writeKey("evictions"); - generator.write(this.evictions); - - generator.writeKey("hit_count"); - generator.write(this.hitCount); - - if (this.memorySize != null) { - generator.writeKey("memory_size"); - generator.write(this.memorySize); - - } - generator.writeKey("memory_size_in_bytes"); - generator.write(this.memorySizeInBytes); - - generator.writeKey("miss_count"); - generator.write(this.missCount); - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link RequestCacheStats}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long evictions; - - private Long hitCount; - - @Nullable - private String memorySize; - - private Long memorySizeInBytes; - - private Long missCount; - - /** - * Required - API name: {@code evictions} - */ - public final Builder evictions(long value) { - this.evictions = value; - return this; - } - - /** - * Required - API name: {@code hit_count} - */ - public final Builder hitCount(long value) { - this.hitCount = value; - return this; - } - - /** - * API name: {@code memory_size} - */ - public final Builder memorySize(@Nullable String value) { - this.memorySize = value; - return this; - } - - /** - * Required - API name: {@code memory_size_in_bytes} - */ - public final Builder memorySizeInBytes(long value) { - this.memorySizeInBytes = value; - return this; - } - - /** - * Required - API name: {@code miss_count} - */ - public final Builder missCount(long value) { - this.missCount = value; - return this; - } - - /** - * Builds a {@link RequestCacheStats}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public RequestCacheStats build() { - _checkSingleUse(); - - return new RequestCacheStats(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link RequestCacheStats} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, RequestCacheStats::setupRequestCacheStatsDeserializer); - - protected static void setupRequestCacheStatsDeserializer(ObjectDeserializer op) { - - op.add(Builder::evictions, JsonpDeserializer.longDeserializer(), "evictions"); - op.add(Builder::hitCount, JsonpDeserializer.longDeserializer(), "hit_count"); - op.add(Builder::memorySize, JsonpDeserializer.stringDeserializer(), "memory_size"); - op.add(Builder::memorySizeInBytes, JsonpDeserializer.longDeserializer(), "memory_size_in_bytes"); - op.add(Builder::missCount, JsonpDeserializer.longDeserializer(), "miss_count"); - - } + /** + * Required - API name: {@code evictions} + */ + public final long evictions() { + return this.evictions; + } + + /** + * Required - API name: {@code hit_count} + */ + public final long hitCount() { + return this.hitCount; + } + + /** + * API name: {@code memory_size} + */ + @Nullable + public final String memorySize() { + return this.memorySize; + } + + /** + * Required - API name: {@code memory_size_in_bytes} + */ + public final long memorySizeInBytes() { + return this.memorySizeInBytes; + } + + /** + * Required - API name: {@code miss_count} + */ + public final long missCount() { + return this.missCount; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("evictions"); + generator.write(this.evictions); + + generator.writeKey("hit_count"); + generator.write(this.hitCount); + + if (this.memorySize != null) { + generator.writeKey("memory_size"); + generator.write(this.memorySize); + + } + generator.writeKey("memory_size_in_bytes"); + generator.write(this.memorySizeInBytes); + + generator.writeKey("miss_count"); + generator.write(this.missCount); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link RequestCacheStats}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long evictions; + + private Long hitCount; + + @Nullable + private String memorySize; + + private Long memorySizeInBytes; + + private Long missCount; + + /** + * Required - API name: {@code evictions} + */ + public final Builder evictions(long value) { + this.evictions = value; + return this; + } + + /** + * Required - API name: {@code hit_count} + */ + public final Builder hitCount(long value) { + this.hitCount = value; + return this; + } + + /** + * API name: {@code memory_size} + */ + public final Builder memorySize(@Nullable String value) { + this.memorySize = value; + return this; + } + + /** + * Required - API name: {@code memory_size_in_bytes} + */ + public final Builder memorySizeInBytes(long value) { + this.memorySizeInBytes = value; + return this; + } + + /** + * Required - API name: {@code miss_count} + */ + public final Builder missCount(long value) { + this.missCount = value; + return this; + } + + /** + * Builds a {@link RequestCacheStats}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public RequestCacheStats build() { + _checkSingleUse(); + + return new RequestCacheStats(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link RequestCacheStats} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + RequestCacheStats::setupRequestCacheStatsDeserializer + ); + + protected static void setupRequestCacheStatsDeserializer(ObjectDeserializer op) { + + op.add(Builder::evictions, JsonpDeserializer.longDeserializer(), "evictions"); + op.add(Builder::hitCount, JsonpDeserializer.longDeserializer(), "hit_count"); + op.add(Builder::memorySize, JsonpDeserializer.stringDeserializer(), "memory_size"); + op.add(Builder::memorySizeInBytes, JsonpDeserializer.longDeserializer(), "memory_size_in_bytes"); + op.add(Builder::missCount, JsonpDeserializer.longDeserializer(), "miss_count"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Result.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Result.java index 6d2a026a12..54b408cf76 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Result.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Result.java @@ -37,27 +37,27 @@ @JsonpDeserializable public enum Result implements JsonEnum { - Created("created"), + Created("created"), - Updated("updated"), + Updated("updated"), - Deleted("deleted"), + Deleted("deleted"), - NotFound("not_found"), + NotFound("not_found"), - NoOp("noop"), + NoOp("noop"), - ; + ; - private final String jsonValue; + private final String jsonValue; - Result(String jsonValue) { - this.jsonValue = jsonValue; - } + Result(String jsonValue) { + this.jsonValue = jsonValue; + } - public String jsonValue() { - return this.jsonValue; - } + public String jsonValue() { + return this.jsonValue; + } - public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Result.values()); + public static final JsonEnum.Deserializer _DESERIALIZER = new JsonEnum.Deserializer<>(Result.values()); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Retries.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Retries.java index 677fbd2707..235a05576c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Retries.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Retries.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -41,116 +43,116 @@ import org.opensearch.client.util.ApiTypeHelper; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; // typedef: _types.Retries @JsonpDeserializable public class Retries implements JsonpSerializable { - private final long bulk; - - private final long search; - - // --------------------------------------------------------------------------------------------- + private final long bulk; - private Retries(Builder builder) { + private final long search; + + // --------------------------------------------------------------------------------------------- - this.bulk = ApiTypeHelper.requireNonNull(builder.bulk, this, "bulk"); - this.search = ApiTypeHelper.requireNonNull(builder.search, this, "search"); + private Retries(Builder builder) { - } + this.bulk = ApiTypeHelper.requireNonNull(builder.bulk, this, "bulk"); + this.search = ApiTypeHelper.requireNonNull(builder.search, this, "search"); - public static Retries of(Function> fn) { - return fn.apply(new Builder()).build(); - } + } - /** - * Required - API name: {@code bulk} - */ - public final long bulk() { - return this.bulk; - } + public static Retries of(Function> fn) { + return fn.apply(new Builder()).build(); + } - /** - * Required - API name: {@code search} - */ - public final long search() { - return this.search; - } + /** + * Required - API name: {@code bulk} + */ + public final long bulk() { + return this.bulk; + } - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } + /** + * Required - API name: {@code search} + */ + public final long search() { + return this.search; + } - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } - generator.writeKey("bulk"); - generator.write(this.bulk); + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - generator.writeKey("search"); - generator.write(this.search); + generator.writeKey("bulk"); + generator.write(this.bulk); - } + generator.writeKey("search"); + generator.write(this.search); - // --------------------------------------------------------------------------------------------- + } - /** - * Builder for {@link Retries}. - */ + // --------------------------------------------------------------------------------------------- - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - private Long bulk; + /** + * Builder for {@link Retries}. + */ - private Long search; + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private Long bulk; - /** - * Required - API name: {@code bulk} - */ - public final Builder bulk(long value) { - this.bulk = value; - return this; - } + private Long search; - /** - * Required - API name: {@code search} - */ - public final Builder search(long value) { - this.search = value; - return this; - } + /** + * Required - API name: {@code bulk} + */ + public final Builder bulk(long value) { + this.bulk = value; + return this; + } - /** - * Builds a {@link Retries}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public Retries build() { - _checkSingleUse(); + /** + * Required - API name: {@code search} + */ + public final Builder search(long value) { + this.search = value; + return this; + } - return new Retries(this); - } - } + /** + * Builds a {@link Retries}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public Retries build() { + _checkSingleUse(); - // --------------------------------------------------------------------------------------------- + return new Retries(this); + } + } - /** - * Json deserializer for {@link Retries} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - Retries::setupRetriesDeserializer); + // --------------------------------------------------------------------------------------------- - protected static void setupRetriesDeserializer(ObjectDeserializer op) { + /** + * Json deserializer for {@link Retries} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + Retries::setupRetriesDeserializer + ); - op.add(Builder::bulk, JsonpDeserializer.longDeserializer(), "bulk"); - op.add(Builder::search, JsonpDeserializer.longDeserializer(), "search"); + protected static void setupRetriesDeserializer(ObjectDeserializer op) { - } + op.add(Builder::bulk, JsonpDeserializer.longDeserializer(), "bulk"); + op.add(Builder::search, JsonpDeserializer.longDeserializer(), "search"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ScoreSort.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ScoreSort.java index 5e1a86fc87..b432f1dfd1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ScoreSort.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ScoreSort.java @@ -32,6 +32,9 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -40,107 +43,105 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; -import jakarta.json.stream.JsonGenerator; - -import java.util.function.Function; -import javax.annotation.Nullable; // typedef: _types.ScoreSort @JsonpDeserializable public class ScoreSort implements SortOptionsVariant, JsonpSerializable { - @Nullable - private final SortOrder order; - - // --------------------------------------------------------------------------------------------- - - private ScoreSort(Builder builder) { - - this.order = builder.order; - - } - - public static ScoreSort of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * SortOptions variant kind. - */ - @Override - public SortOptions.Kind _sortOptionsKind() { - return SortOptions.Kind.Doc; - } - - /** - * API name: {@code order} - */ - @Nullable - public final SortOrder order() { - return this.order; - } - - /** - * Serialize this object to JSON. - */ - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - generator.writeStartObject(); - serializeInternal(generator, mapper); - generator.writeEnd(); - } - - protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.order != null) { - generator.writeKey("order"); - this.order.serialize(generator, mapper); - } - - } - - // --------------------------------------------------------------------------------------------- - - /** - * Builder for {@link ScoreSort}. - */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private SortOrder order; - - /** - * API name: {@code order} - */ - public final Builder order(@Nullable SortOrder value) { - this.order = value; - return this; - } - - /** - * Builds a {@link ScoreSort}. - * - * @throws NullPointerException - * if some of the required fields are null. - */ - public ScoreSort build() { - _checkSingleUse(); - - return new ScoreSort(this); - } - } - - // --------------------------------------------------------------------------------------------- - - /** - * Json deserializer for {@link ScoreSort} - */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ScoreSort::setupScoreSortDeserializer); - - protected static void setupScoreSortDeserializer(ObjectDeserializer op) { - - op.add(Builder::order, SortOrder._DESERIALIZER, "order"); - - } + @Nullable + private final SortOrder order; + + // --------------------------------------------------------------------------------------------- + + private ScoreSort(Builder builder) { + + this.order = builder.order; + + } + + public static ScoreSort of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * SortOptions variant kind. + */ + @Override + public SortOptions.Kind _sortOptionsKind() { + return SortOptions.Kind.Doc; + } + + /** + * API name: {@code order} + */ + @Nullable + public final SortOrder order() { + return this.order; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + if (this.order != null) { + generator.writeKey("order"); + this.order.serialize(generator, mapper); + } + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ScoreSort}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + @Nullable + private SortOrder order; + + /** + * API name: {@code order} + */ + public final Builder order(@Nullable SortOrder value) { + this.order = value; + return this; + } + + /** + * Builds a {@link ScoreSort}. + * + * @throws NullPointerException + * if some of the required fields are null. + */ + public ScoreSort build() { + _checkSingleUse(); + + return new ScoreSort(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ScoreSort} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + ScoreSort::setupScoreSortDeserializer + ); + + protected static void setupScoreSortDeserializer(ObjectDeserializer op) { + + op.add(Builder::order, SortOrder._DESERIALIZER, "order"); + + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Script.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Script.java index 0f6250be36..6f969b8f5a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/Script.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/Script.java @@ -32,6 +32,8 @@ package org.opensearch.client.opensearch._types; +import jakarta.json.stream.JsonGenerator; +import java.util.function.Function; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,127 +44,125 @@ import org.opensearch.client.util.ObjectBuilderBase; import org.opensearch.client.util.TaggedUnion; import org.opensearch.client.util.TaggedUnionUtils; -import jakarta.json.stream.JsonGenerator; -import java.util.function.Function; // typedef: _types.Script @JsonpDeserializable public class Script implements TaggedUnion, JsonpSerializable { - public enum Kind { - Inline, Stored - - } - - private final Kind _kind; - private final Object _value; - - @Override - public final Kind _kind() { - return _kind; - } - - @Override - public final Object _get() { - return _value; - } - - private Script(Kind kind, Object value) { - this._kind = kind; - this._value = value; - } - - private Script(Builder builder) { - - this._kind = ApiTypeHelper.requireNonNull(builder._kind, builder, ""); - this._value = ApiTypeHelper.requireNonNull(builder._value, builder, ""); - - } - - public static Script of(Function> fn) { - return fn.apply(new Builder()).build(); - } - - /** - * Is this variant instance of kind {@code inline}? - */ - public boolean isInline() { - return _kind == Kind.Inline; - } - - /** - * Get the {@code inline} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code inline} kind. - */ - public InlineScript inline() { - return TaggedUnionUtils.get(this, Kind.Inline); - } - - /** - * Is this variant instance of kind {@code stored}? - */ - public boolean isStored() { - return _kind == Kind.Stored; - } - - /** - * Get the {@code stored} variant value. - * - * @throws IllegalStateException - * if the current variant is not of the {@code stored} kind. - */ - public StoredScriptId stored() { - return TaggedUnionUtils.get(this, Kind.Stored); - } - - @Override - public void serialize(JsonGenerator generator, JsonpMapper mapper) { - if (_value instanceof JsonpSerializable) { - ((JsonpSerializable) _value).serialize(generator, mapper); - } - - } - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder