diff --git a/UPGRADING.md b/UPGRADING.md index 7edfe5b589..d756de966b 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -143,4 +143,12 @@ After: ### QueryStringQuery - The `phraseSlop` property has been corrected to be of type `Integer` instead of `Double`. -- The `tieBreaker` property has been corrected to be of type `Float` instead of `Double`. \ No newline at end of file +- The `tieBreaker` property has been corrected to be of type `Float` instead of `Double`. + +### simulate_template.Template +- The `settings` property is now of type `IndexSettings` instead of `Map`. +- The `overlapping` property has been moved to `SimulateTemplateResponse`. + +### PutTemplateRequest +- The `flatSettings` property has been removed as it is not supported by OpenSearch. +- The `timeout` property has been removed as it is not supported by OpenSearch. \ No newline at end of file diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteTemplateRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DeleteTemplateRequest.java similarity index 57% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteTemplateRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/DeleteTemplateRequest.java index f6994928bb..aebbba89f1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteTemplateRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DeleteTemplateRequest.java @@ -30,11 +30,18 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; @@ -42,24 +49,27 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.delete_template.Request /** * Deletes an index template. - * */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteTemplateRequest extends RequestBase implements ToCopyableBuilder { -public class DeleteTemplateRequest extends RequestBase { - @Deprecated @Nullable - private final Time masterTimeout; + private final Time clusterManagerTimeout; + @Deprecated @Nullable - private final Time clusterManagerTimeout; + private final Time masterTimeout; + @Nonnull private final String name; @Nullable @@ -68,52 +78,56 @@ public class DeleteTemplateRequest extends RequestBase { // --------------------------------------------------------------------------------------------- private DeleteTemplateRequest(Builder builder) { - - this.masterTimeout = builder.masterTimeout; this.clusterManagerTimeout = builder.clusterManagerTimeout; + this.masterTimeout = builder.masterTimeout; this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); this.timeout = builder.timeout; - } - public static DeleteTemplateRequest of(Function> fn) { + public static DeleteTemplateRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Specify timeout for connection to master + * Operation timeout for connection to cluster-manager node. *

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

*/ - @Deprecated @Nullable - public final Time masterTimeout() { - return this.masterTimeout; + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; } /** - * Specify timeout for connection to cluster-manager + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

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

*/ + @Deprecated @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; + public final Time masterTimeout() { + return this.masterTimeout; } /** - * Required - The name of the template + * Required - The name of the legacy index template to delete. Wildcard (*) expressions are supported. *

* API name: {@code name} + *

*/ + @Nonnull public final String name() { return this.name; } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -122,98 +136,143 @@ public final Time timeout() { // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link DeleteTemplateRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Deprecated - @Nullable - private Time masterTimeout; - + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Time clusterManagerTimeout; - + @Nullable + private Time masterTimeout; private String name; - @Nullable private Time timeout; + public Builder() {} + + private Builder(DeleteTemplateRequest o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.masterTimeout = o.masterTimeout; + this.name = o.name; + this.timeout = o.timeout; + } + + private Builder(Builder o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.masterTimeout = o.masterTimeout; + this.name = o.name; + this.timeout = o.timeout; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Specify timeout for connection to master + * Operation timeout for connection to cluster-manager node. *

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

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

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

*/ - @Deprecated - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); } /** - * Specify timeout for connection to cluster-manager + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

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

*/ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; + @Deprecated + @Nonnull + public final Builder masterTimeout(@Nullable Time value) { + this.masterTimeout = value; return this; } /** - * Specify timeout for connection to cluster-manager + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

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

*/ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + @Deprecated + @Nonnull + public final Builder masterTimeout(Function> fn) { + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** - * Required - The name of the template + * Required - The name of the legacy index template to delete. Wildcard (*) expressions are supported. *

* API name: {@code name} + *

*/ + @Nonnull public final Builder name(String value) { this.name = value; return this; } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(@Nullable Time value) { this.timeout = value; return this; } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** * Builds a {@link DeleteTemplateRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DeleteTemplateRequest build() { _checkSingleUse(); @@ -227,49 +286,52 @@ public DeleteTemplateRequest build() { * Endpoint "{@code indices.delete_template}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "DELETE"; - - }, - + request -> "DELETE", // Request path request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_template"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/_template/"); + SimpleEndpoint.pathEncode(request.name, buf); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } if (request.timeout != null) { params.put("timeout", request.timeout._toJsonString()); } return params; - }, SimpleEndpoint.emptyMap(), false, DeleteTemplateResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + this.name.hashCode(); + result = 31 * result + Objects.hashCode(this.timeout); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DeleteTemplateRequest other = (DeleteTemplateRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && this.name.equals(other.name) + && Objects.equals(this.timeout, other.timeout); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteTemplateResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DeleteTemplateResponse.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteTemplateResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/DeleteTemplateResponse.java index 84f613a4b2..ad24c02322 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteTemplateResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DeleteTemplateResponse.java @@ -30,39 +30,80 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.delete_template.Response @JsonpDeserializable -public class DeleteTemplateResponse extends AcknowledgedResponseBase { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class DeleteTemplateResponse extends AcknowledgedResponseBase + implements + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private DeleteTemplateResponse(Builder builder) { super(builder); - } - public static DeleteTemplateResponse of(Function> fn) { + public static DeleteTemplateResponse of(Function> fn) { return fn.apply(new Builder()).build(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link DeleteTemplateResponse}. */ + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(DeleteTemplateResponse o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -70,9 +111,10 @@ protected Builder self() { /** * Builds a {@link DeleteTemplateResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public DeleteTemplateResponse build() { _checkSingleUse(); @@ -91,8 +133,22 @@ public DeleteTemplateResponse build() { ); protected static void setupDeleteTemplateResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + setupAcknowledgedResponseBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ExistsTemplateRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ExistsTemplateRequest.java similarity index 66% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/ExistsTemplateRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/ExistsTemplateRequest.java index 52a4d5b0b0..bf1df9d4f5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ExistsTemplateRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/ExistsTemplateRequest.java @@ -30,13 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; -import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; @@ -46,17 +52,22 @@ import org.opensearch.client.transport.endpoints.BooleanResponse; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.exists_template.Request /** * Returns information about whether a particular index template exists. - * */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class ExistsTemplateRequest extends RequestBase implements ToCopyableBuilder { + + @Nullable + private final Time clusterManagerTimeout; -public class ExistsTemplateRequest extends RequestBase { @Nullable private final Boolean flatSettings; @@ -67,31 +78,39 @@ public class ExistsTemplateRequest extends RequestBase { @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - + @Nonnull private final List name; // --------------------------------------------------------------------------------------------- private ExistsTemplateRequest(Builder builder) { - + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.flatSettings = builder.flatSettings; this.local = builder.local; this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.name = ApiTypeHelper.unmodifiableRequired(builder.name, this, "name"); - } - public static ExistsTemplateRequest of(Function> fn) { + public static ExistsTemplateRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Return settings in flat format (default: false) + * Operation timeout for connection to cluster-manager node. + *

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

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * Return settings in flat format. *

* API name: {@code flat_settings} + *

*/ @Nullable public final Boolean flatSettings() { @@ -99,10 +118,10 @@ public final Boolean flatSettings() { } /** - * Return local information, do not retrieve the state from cluster-manager node - * (default: false) + * Return local information, do not retrieve the state from cluster-manager node. *

* API name: {@code local} + *

*/ @Nullable public final Boolean local() { @@ -110,9 +129,10 @@ public final Boolean local() { } /** - * Explicit operation timeout for connection to master node + * Explicit operation timeout for connection to cluster-manager node *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -120,115 +140,151 @@ public final Time masterTimeout() { return this.masterTimeout; } - /** - * Explicit operation timeout for connection to cluster-manager node - *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } - /** * Required - The comma separated names of the index templates *

* API name: {@code name} + *

*/ + @Nonnull public final List name() { return this.name; } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link ExistsTemplateRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Time clusterManagerTimeout; @Nullable private Boolean flatSettings; - @Nullable private Boolean local; - - @Deprecated @Nullable private Time masterTimeout; + private List name; - @Nullable - private Time clusterManagerTimeout; + public Builder() {} - private List name; + private Builder(ExistsTemplateRequest o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.flatSettings = o.flatSettings; + this.local = o.local; + this.masterTimeout = o.masterTimeout; + this.name = _listCopy(o.name); + } + + private Builder(Builder o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.flatSettings = o.flatSettings; + this.local = o.local; + this.masterTimeout = o.masterTimeout; + this.name = _listCopy(o.name); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * Return settings in flat format (default: false) + * Operation timeout for connection to cluster-manager node. + *

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

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

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

+ */ + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Return settings in flat format. *

* API name: {@code flat_settings} + *

*/ + @Nonnull public final Builder flatSettings(@Nullable Boolean value) { this.flatSettings = value; return this; } /** - * Return local information, do not retrieve the state from cluster-manager node - * (default: false) + * Return local information, do not retrieve the state from cluster-manager node. *

* API name: {@code local} + *

*/ + @Nonnull public final Builder local(@Nullable Boolean value) { this.local = value; return this; } /** - * Explicit operation timeout for connection to master node + * Explicit operation timeout for connection to cluster-manager node *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(@Nullable Time value) { this.masterTimeout = value; return this; } /** - * Explicit operation timeout for connection to master node + * Explicit operation timeout for connection to cluster-manager node *

* API name: {@code master_timeout} + *

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

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

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** * Required - The comma separated names of the index templates *

* API name: {@code name} + *

+ * *

* Adds all elements of list to name. + *

*/ + @Nonnull public final Builder name(List list) { this.name = _listAddAll(this.name, list); return this; @@ -238,9 +294,13 @@ public final Builder name(List list) { * Required - The comma separated names of the index templates *

* API name: {@code name} + *

+ * *

* Adds one or more values to name. + *

*/ + @Nonnull public final Builder name(String value, String... values) { this.name = _listAdd(this.name, value, values); return this; @@ -249,9 +309,10 @@ public final Builder name(String value, String... values) { /** * Builds a {@link ExistsTemplateRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public ExistsTemplateRequest build() { _checkSingleUse(); @@ -265,39 +326,18 @@ public ExistsTemplateRequest build() { * Endpoint "{@code indices.exists_template}". */ public static final Endpoint _ENDPOINT = new BooleanEndpoint<>( - "opensearch/indices.exists_template", - // Request method - request -> { - return "HEAD"; - - }, - + request -> "HEAD", // Request path request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_template"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/_template/"); + SimpleEndpoint.pathEncode(String.join(",", request.name), buf); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } @@ -307,11 +347,34 @@ public ExistsTemplateRequest build() { if (request.local != null) { params.put("local", String.valueOf(request.local)); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } return params; - }, - SimpleEndpoint.emptyMap(), - false, - null + SimpleEndpoint.emptyMap() ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.flatSettings); + result = 31 * result + Objects.hashCode(this.local); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + this.name.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + ExistsTemplateRequest other = (ExistsTemplateRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.flatSettings, other.flatSettings) + && Objects.equals(this.local, other.local) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && this.name.equals(other.name); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetIndicesSettingsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetIndicesSettingsRequest.java similarity index 56% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/GetIndicesSettingsRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetIndicesSettingsRequest.java index d19083af7d..cead52f23d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetIndicesSettingsRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetIndicesSettingsRequest.java @@ -30,13 +30,20 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.ExpandWildcard; @@ -45,20 +52,28 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.get_settings.Request /** - * Returns settings for one or more indices. - * + * Returns settings for one or more indexes. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetIndicesSettingsRequest extends RequestBase + implements + ToCopyableBuilder { -public class GetIndicesSettingsRequest extends RequestBase { @Nullable private final Boolean allowNoIndices; + @Nullable + private final Time clusterManagerTimeout; + + @Nonnull private final List expandWildcards; @Nullable @@ -70,6 +85,7 @@ public class GetIndicesSettingsRequest extends RequestBase { @Nullable private final Boolean includeDefaults; + @Nonnull private final List index; @Nullable @@ -79,16 +95,14 @@ public class GetIndicesSettingsRequest extends RequestBase { @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - + @Nonnull private final List name; // --------------------------------------------------------------------------------------------- private GetIndicesSettingsRequest(Builder builder) { - this.allowNoIndices = builder.allowNoIndices; + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); this.flatSettings = builder.flatSettings; this.ignoreUnavailable = builder.ignoreUnavailable; @@ -96,21 +110,20 @@ private GetIndicesSettingsRequest(Builder builder) { this.index = ApiTypeHelper.unmodifiable(builder.index); this.local = builder.local; this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.name = ApiTypeHelper.unmodifiable(builder.name); - } - public static GetIndicesSettingsRequest of(Function> fn) { + public static GetIndicesSettingsRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets only + * missing or closed indexes. This behavior applies even if the request targets other open indexes. For example, a request targeting + * foo*,bar* returns an error if an index starts with foo but no index starts with bar. *

* API name: {@code allow_no_indices} + *

*/ @Nullable public final Boolean allowNoIndices() { @@ -118,19 +131,33 @@ public final Boolean allowNoIndices() { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Operation timeout for connection to cluster-manager node. + *

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

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. *

* API name: {@code expand_wildcards} + *

*/ + @Nonnull public final List expandWildcards() { return this.expandWildcards; } /** - * Return settings in flat format (default: false) + * If true, returns settings in flat format. *

* API name: {@code flat_settings} + *

*/ @Nullable public final Boolean flatSettings() { @@ -138,10 +165,10 @@ public final Boolean flatSettings() { } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing or closed index. *

* API name: {@code ignore_unavailable} + *

*/ @Nullable public final Boolean ignoreUnavailable() { @@ -149,9 +176,10 @@ public final Boolean ignoreUnavailable() { } /** - * Whether to return all default setting for each of the indices. + * If true, return all default settings in the response. *

* API name: {@code include_defaults} + *

*/ @Nullable public final Boolean includeDefaults() { @@ -159,20 +187,23 @@ public final Boolean includeDefaults() { } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To target + * all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

*/ + @Nonnull public final List index() { return this.index; } /** - * Return local information, do not retrieve the state from cluster-manager node - * (default: false) + * If true, the request retrieves information from the local node only. If false, information is retrieved + * from the cluster-manager node. *

* API name: {@code local} + *

*/ @Nullable public final Boolean local() { @@ -180,9 +211,11 @@ public final Boolean local() { } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -191,227 +224,296 @@ public final Time masterTimeout() { } /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } - - /** - * The name of the settings that should be included + * Comma-separated list or wildcard expression of settings to retrieve. *

* API name: {@code name} + *

*/ + @Nonnull public final List name() { return this.name; } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link GetIndicesSettingsRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Boolean allowNoIndices; - + @Nullable + private Time clusterManagerTimeout; @Nullable private List expandWildcards; - @Nullable private Boolean flatSettings; - @Nullable private Boolean ignoreUnavailable; - @Nullable private Boolean includeDefaults; - @Nullable private List index; - @Nullable private Boolean local; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - @Nullable private List name; + public Builder() {} + + private Builder(GetIndicesSettingsRequest o) { + this.allowNoIndices = o.allowNoIndices; + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.expandWildcards = _listCopy(o.expandWildcards); + this.flatSettings = o.flatSettings; + this.ignoreUnavailable = o.ignoreUnavailable; + this.includeDefaults = o.includeDefaults; + this.index = _listCopy(o.index); + this.local = o.local; + this.masterTimeout = o.masterTimeout; + this.name = _listCopy(o.name); + } + + private Builder(Builder o) { + this.allowNoIndices = o.allowNoIndices; + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.expandWildcards = _listCopy(o.expandWildcards); + this.flatSettings = o.flatSettings; + this.ignoreUnavailable = o.ignoreUnavailable; + this.includeDefaults = o.includeDefaults; + this.index = _listCopy(o.index); + this.local = o.local; + this.masterTimeout = o.masterTimeout; + this.name = _listCopy(o.name); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets + * only missing or closed indexes. This behavior applies even if the request targets other open indexes. For example, a request + * targeting foo*,bar* returns an error if an index starts with foo but no index starts with bar. *

* API name: {@code allow_no_indices} + *

*/ + @Nonnull public final Builder allowNoIndices(@Nullable Boolean value) { this.allowNoIndices = value; return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Operation timeout for connection to cluster-manager node. + *

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

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

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

+ */ + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds all elements of list to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(List list) { this.expandWildcards = _listAddAll(this.expandWildcards, list); return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds one or more values to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { this.expandWildcards = _listAdd(this.expandWildcards, value, values); return this; } /** - * Return settings in flat format (default: false) + * If true, returns settings in flat format. *

* API name: {@code flat_settings} + *

*/ + @Nonnull public final Builder flatSettings(@Nullable Boolean value) { this.flatSettings = value; return this; } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing or closed index. *

* API name: {@code ignore_unavailable} + *

*/ + @Nonnull public final Builder ignoreUnavailable(@Nullable Boolean value) { this.ignoreUnavailable = value; return this; } /** - * Whether to return all default setting for each of the indices. + * If true, return all default settings in the response. *

* API name: {@code include_defaults} + *

*/ + @Nonnull public final Builder includeDefaults(@Nullable Boolean value) { this.includeDefaults = value; return this; } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To + * target all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

+ * *

* Adds all elements of list to index. + *

*/ + @Nonnull public final Builder index(List list) { this.index = _listAddAll(this.index, list); return this; } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To + * target all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

+ * *

* Adds one or more values to index. + *

*/ + @Nonnull public final Builder index(String value, String... values) { this.index = _listAdd(this.index, value, values); return this; } /** - * Return local information, do not retrieve the state from cluster-manager node - * (default: false) + * If true, the request retrieves information from the local node only. If false, information is retrieved + * from the cluster-manager node. *

* API name: {@code local} + *

*/ + @Nonnull public final Builder local(@Nullable Boolean value) { this.local = value; return this; } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(@Nullable Time value) { this.masterTimeout = value; return this; } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

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

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

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * The name of the settings that should be included + * Comma-separated list or wildcard expression of settings to retrieve. *

* API name: {@code name} + *

+ * *

* Adds all elements of list to name. + *

*/ + @Nonnull public final Builder name(List list) { this.name = _listAddAll(this.name, list); return this; } /** - * The name of the settings that should be included + * Comma-separated list or wildcard expression of settings to retrieve. *

* API name: {@code name} + *

+ * *

* Adds one or more values to name. + *

*/ + @Nonnull public final Builder name(String value, String... values) { this.name = _listAdd(this.name, value, values); return this; @@ -420,9 +522,10 @@ public final Builder name(String value, String... values) { /** * Builds a {@link GetIndicesSettingsRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public GetIndicesSettingsRequest build() { _checkSingleUse(); @@ -436,87 +539,109 @@ public GetIndicesSettingsRequest build() { * Endpoint "{@code indices.get_settings}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "GET"; - - }, - + request -> "GET", // Request path request -> { - final int _name = 1 << 0; - final int _index = 1 << 1; + final int _index = 1 << 0; + final int _name = 1 << 1; int propsSet = 0; - if (ApiTypeHelper.isDefined(request.name())) propsSet |= _name; if (ApiTypeHelper.isDefined(request.index())) propsSet |= _index; + if (ApiTypeHelper.isDefined(request.name())) propsSet |= _name; if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_settings"); - return buf.toString(); + return "/_settings"; } if (propsSet == (_index)) { StringBuilder buf = new StringBuilder(); buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); buf.append("/_settings"); return buf.toString(); } if (propsSet == (_index | _name)) { StringBuilder buf = new StringBuilder(); buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_settings"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); + buf.append("/_settings/"); + SimpleEndpoint.pathEncode(String.join(",", request.name), buf); return buf.toString(); } if (propsSet == (_name)) { StringBuilder buf = new StringBuilder(); - buf.append("/_settings"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); + buf.append("/_settings/"); + SimpleEndpoint.pathEncode(String.join(",", request.name), buf); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); + if (request.allowNoIndices != null) { + params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } - if (request.flatSettings != null) { - params.put("flat_settings", String.valueOf(request.flatSettings)); - } if (ApiTypeHelper.isDefined(request.expandWildcards)) { params.put("expand_wildcards", request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); } + if (request.flatSettings != null) { + params.put("flat_settings", String.valueOf(request.flatSettings)); + } if (request.ignoreUnavailable != null) { params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); - } if (request.includeDefaults != null) { params.put("include_defaults", String.valueOf(request.includeDefaults)); } if (request.local != null) { params.put("local", String.valueOf(request.local)); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } return params; - }, SimpleEndpoint.emptyMap(), false, GetIndicesSettingsResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allowNoIndices); + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.expandWildcards); + result = 31 * result + Objects.hashCode(this.flatSettings); + result = 31 * result + Objects.hashCode(this.ignoreUnavailable); + result = 31 * result + Objects.hashCode(this.includeDefaults); + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + Objects.hashCode(this.local); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.name); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetIndicesSettingsRequest other = (GetIndicesSettingsRequest) o; + return Objects.equals(this.allowNoIndices, other.allowNoIndices) + && Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.expandWildcards, other.expandWildcards) + && Objects.equals(this.flatSettings, other.flatSettings) + && Objects.equals(this.ignoreUnavailable, other.ignoreUnavailable) + && Objects.equals(this.includeDefaults, other.includeDefaults) + && Objects.equals(this.index, other.index) + && Objects.equals(this.local, other.local) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.name, other.name); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetIndicesSettingsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetIndicesSettingsResponse.java similarity index 83% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/GetIndicesSettingsResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetIndicesSettingsResponse.java index 88528509e1..5885d45eb4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetIndicesSettingsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetIndicesSettingsResponse.java @@ -30,9 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; @@ -43,15 +49,17 @@ // typedef: indices.get_settings.Response @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class GetIndicesSettingsResponse extends DictionaryResponse { // --------------------------------------------------------------------------------------------- private GetIndicesSettingsResponse(Builder builder) { super(builder); - } - public static GetIndicesSettingsResponse of(Function> fn) { + public static GetIndicesSettingsResponse of( + Function> fn + ) { return fn.apply(new Builder()).build(); } @@ -60,11 +68,11 @@ public static GetIndicesSettingsResponse of(Function implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -72,8 +80,7 @@ protected Builder self() { /** * Builds a {@link GetIndicesSettingsResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public GetIndicesSettingsResponse build() { _checkSingleUse(); @@ -95,8 +102,6 @@ public GetIndicesSettingsResponse build() { ); protected static void setupGetIndicesSettingsResponseDeserializer(ObjectDeserializer op) { - DictionaryResponse.setupDictionaryResponseDeserializer(op, JsonpDeserializer.stringDeserializer(), IndexState._DESERIALIZER); - + setupDictionaryResponseDeserializer(op, JsonpDeserializer.stringDeserializer(), IndexState._DESERIALIZER); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetMappingRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetMappingRequest.java similarity index 55% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/GetMappingRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetMappingRequest.java index 86dad6e8e4..baab0141c4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetMappingRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetMappingRequest.java @@ -30,13 +30,20 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.ExpandWildcard; @@ -45,25 +52,32 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.get_mapping.Request /** - * Returns mappings for one or more indices. - * + * Returns mappings for one or more indexes. */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetMappingRequest extends RequestBase implements ToCopyableBuilder { -public class GetMappingRequest extends RequestBase { @Nullable private final Boolean allowNoIndices; + @Nullable + private final Time clusterManagerTimeout; + + @Nonnull private final List expandWildcards; @Nullable private final Boolean ignoreUnavailable; + @Nonnull private final List index; @Nullable @@ -73,33 +87,28 @@ public class GetMappingRequest extends RequestBase { @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - // --------------------------------------------------------------------------------------------- private GetMappingRequest(Builder builder) { - this.allowNoIndices = builder.allowNoIndices; + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); this.ignoreUnavailable = builder.ignoreUnavailable; this.index = ApiTypeHelper.unmodifiable(builder.index); this.local = builder.local; this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; - } - public static GetMappingRequest of(Function> fn) { + public static GetMappingRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets only + * missing or closed indexes. This behavior applies even if the request targets other open indexes. *

* API name: {@code allow_no_indices} + *

*/ @Nullable public final Boolean allowNoIndices() { @@ -107,20 +116,34 @@ public final Boolean allowNoIndices() { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Operation timeout for connection to cluster-manager node. + *

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

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

*/ + @Nonnull public final List expandWildcards() { return this.expandWildcards; } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing or closed index. *

* API name: {@code ignore_unavailable} + *

*/ @Nullable public final Boolean ignoreUnavailable() { @@ -128,19 +151,22 @@ public final Boolean ignoreUnavailable() { } /** - * A comma-separated list of index names + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To target + * all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

*/ + @Nonnull public final List index() { return this.index; } /** - * Return local information, do not retrieve the state from cluster-manager node - * (default: false) + * If true, the request retrieves information from the local node only. *

* API name: {@code local} + *

*/ @Nullable public final Boolean local() { @@ -148,9 +174,11 @@ public final Boolean local() { } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

* API name: {@code master_timeout} + *

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

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link GetMappingRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Boolean allowNoIndices; - + @Nullable + private Time clusterManagerTimeout; @Nullable private List expandWildcards; - @Nullable private Boolean ignoreUnavailable; - @Nullable private List index; - @Nullable private Boolean local; - - @Deprecated @Nullable private Time masterTimeout; - @Nullable - private Time clusterManagerTimeout; + public Builder() {} + + private Builder(GetMappingRequest o) { + this.allowNoIndices = o.allowNoIndices; + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.expandWildcards = _listCopy(o.expandWildcards); + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.local = o.local; + this.masterTimeout = o.masterTimeout; + } + + private Builder(Builder o) { + this.allowNoIndices = o.allowNoIndices; + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.expandWildcards = _listCopy(o.expandWildcards); + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.local = o.local; + this.masterTimeout = o.masterTimeout; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets + * only missing or closed indexes. This behavior applies even if the request targets other open indexes. *

* API name: {@code allow_no_indices} + *

*/ + @Nonnull public final Builder allowNoIndices(@Nullable Boolean value) { this.allowNoIndices = value; return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Operation timeout for connection to cluster-manager node. + *

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

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

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

+ */ + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds all elements of list to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(List list) { this.expandWildcards = _listAddAll(this.expandWildcards, list); return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds one or more values to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { this.expandWildcards = _listAdd(this.expandWildcards, value, values); return this; } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * If false, the request returns an error if it targets a missing or closed index. *

* API name: {@code ignore_unavailable} + *

*/ + @Nonnull public final Builder ignoreUnavailable(@Nullable Boolean value) { this.ignoreUnavailable = value; return this; } /** - * A comma-separated list of index names + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To + * target all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

+ * *

* Adds all elements of list to index. + *

*/ + @Nonnull public final Builder index(List list) { this.index = _listAddAll(this.index, list); return this; } /** - * A comma-separated list of index names + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To + * target all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

+ * *

* Adds one or more values to index. + *

*/ + @Nonnull public final Builder index(String value, String... values) { this.index = _listAdd(this.index, value, values); return this; } /** - * Return local information, do not retrieve the state from cluster-manager node - * (default: false) + * If true, the request retrieves information from the local node only. *

* API name: {@code local} + *

*/ + @Nonnull public final Builder local(@Nullable Boolean value) { this.local = value; return this; } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(@Nullable Time value) { this.masterTimeout = value; return this; } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

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

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

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** * Builds a {@link GetMappingRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public GetMappingRequest build() { _checkSingleUse(); @@ -340,13 +423,8 @@ public GetMappingRequest build() { * Endpoint "{@code indices.get_mapping}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "GET"; - - }, - + request -> "GET", // Request path request -> { final int _index = 1 << 0; @@ -356,26 +434,23 @@ public GetMappingRequest build() { if (ApiTypeHelper.isDefined(request.index())) propsSet |= _index; if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_mapping"); - return buf.toString(); + return "/_mapping"; } if (propsSet == (_index)) { StringBuilder buf = new StringBuilder(); buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); buf.append("/_mapping"); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); + if (request.allowNoIndices != null) { + params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); @@ -386,17 +461,46 @@ public GetMappingRequest build() { if (request.ignoreUnavailable != null) { params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); + if (ApiTypeHelper.isDefined(request.index)) { + params.put("index", String.join(",", request.index)); } if (request.local != null) { params.put("local", String.valueOf(request.local)); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } return params; - }, SimpleEndpoint.emptyMap(), false, GetMappingResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allowNoIndices); + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.expandWildcards); + result = 31 * result + Objects.hashCode(this.ignoreUnavailable); + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + Objects.hashCode(this.local); + result = 31 * result + Objects.hashCode(this.masterTimeout); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetMappingRequest other = (GetMappingRequest) o; + return Objects.equals(this.allowNoIndices, other.allowNoIndices) + && Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.expandWildcards, other.expandWildcards) + && Objects.equals(this.ignoreUnavailable, other.ignoreUnavailable) + && Objects.equals(this.index, other.index) + && Objects.equals(this.local, other.local) + && Objects.equals(this.masterTimeout, other.masterTimeout); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetMappingResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetMappingResponse.java similarity index 83% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/GetMappingResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetMappingResponse.java index 0f36d4121e..ee1f709235 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetMappingResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetMappingResponse.java @@ -30,9 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; @@ -44,15 +50,15 @@ // typedef: indices.get_mapping.Response @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class GetMappingResponse extends DictionaryResponse { // --------------------------------------------------------------------------------------------- private GetMappingResponse(Builder builder) { super(builder); - } - public static GetMappingResponse of(Function> fn) { + public static GetMappingResponse of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -61,11 +67,11 @@ public static GetMappingResponse of(Function implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -73,8 +79,7 @@ protected Builder self() { /** * Builds a {@link GetMappingResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public GetMappingResponse build() { _checkSingleUse(); @@ -96,12 +101,6 @@ public GetMappingResponse build() { ); protected static void setupGetMappingResponseDeserializer(ObjectDeserializer op) { - DictionaryResponse.setupDictionaryResponseDeserializer( - op, - JsonpDeserializer.stringDeserializer(), - IndexMappingRecord._DESERIALIZER - ); - + setupDictionaryResponseDeserializer(op, JsonpDeserializer.stringDeserializer(), IndexMappingRecord._DESERIALIZER); } - } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetTemplateRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetTemplateRequest.java similarity index 59% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/GetTemplateRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetTemplateRequest.java index fffb7b92ce..fada14bad7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetTemplateRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetTemplateRequest.java @@ -30,13 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; -import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.opensearch._types.RequestBase; @@ -44,17 +50,22 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.get_template.Request /** * Returns an index template. - * */ +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class GetTemplateRequest extends RequestBase implements ToCopyableBuilder { + + @Nullable + private final Time clusterManagerTimeout; -public class GetTemplateRequest extends RequestBase { @Nullable private final Boolean flatSettings; @@ -65,31 +76,39 @@ public class GetTemplateRequest extends RequestBase { @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - + @Nonnull private final List name; // --------------------------------------------------------------------------------------------- private GetTemplateRequest(Builder builder) { - + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.flatSettings = builder.flatSettings; this.local = builder.local; this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.name = ApiTypeHelper.unmodifiable(builder.name); - } - public static GetTemplateRequest of(Function> fn) { + public static GetTemplateRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Return settings in flat format (default: false) + * Operation timeout for connection to cluster-manager node. + *

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

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * If true, returns settings in flat format. *

* API name: {@code flat_settings} + *

*/ @Nullable public final Boolean flatSettings() { @@ -97,10 +116,10 @@ public final Boolean flatSettings() { } /** - * Return local information, do not retrieve the state from cluster-manager node - * (default: false) + * If true, the request retrieves information from the local node only. *

* API name: {@code local} + *

*/ @Nullable public final Boolean local() { @@ -108,9 +127,11 @@ public final Boolean local() { } /** - * Explicit operation timeout for connection to master node + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -119,127 +140,172 @@ public final Time masterTimeout() { } /** - * Explicit operation timeout for connection to cluster-manager node - *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } - - /** - * The comma separated names of the index templates + * Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. To + * return all index templates, omit this parameter or use a value of _all or *. *

* API name: {@code name} + *

*/ + @Nonnull public final List name() { return this.name; } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link GetTemplateRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private Time clusterManagerTimeout; @Nullable private Boolean flatSettings; - @Nullable private Boolean local; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - @Nullable private List name; + public Builder() {} + + private Builder(GetTemplateRequest o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.flatSettings = o.flatSettings; + this.local = o.local; + this.masterTimeout = o.masterTimeout; + this.name = _listCopy(o.name); + } + + private Builder(Builder o) { + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.flatSettings = o.flatSettings; + this.local = o.local; + this.masterTimeout = o.masterTimeout; + this.name = _listCopy(o.name); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * Operation timeout for connection to cluster-manager node. + *

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

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

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

+ */ + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + /** - * Return settings in flat format (default: false) + * If true, returns settings in flat format. *

* API name: {@code flat_settings} + *

*/ + @Nonnull public final Builder flatSettings(@Nullable Boolean value) { this.flatSettings = value; return this; } /** - * Return local information, do not retrieve the state from cluster-manager node - * (default: false) + * If true, the request retrieves information from the local node only. *

* API name: {@code local} + *

*/ + @Nonnull public final Builder local(@Nullable Boolean value) { this.local = value; return this; } /** - * Explicit operation timeout for connection to master node + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(@Nullable Time value) { this.masterTimeout = value; return this; } /** - * Explicit operation timeout for connection to master node + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

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

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

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * The comma separated names of the index templates + * Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. To + * return all index templates, omit this parameter or use a value of _all or *. *

* API name: {@code name} + *

+ * *

* Adds all elements of list to name. + *

*/ + @Nonnull public final Builder name(List list) { this.name = _listAddAll(this.name, list); return this; } /** - * The comma separated names of the index templates + * Comma-separated list of index template names used to limit the request. Wildcard (*) expressions are supported. To + * return all index templates, omit this parameter or use a value of _all or *. *

* API name: {@code name} + *

+ * *

* Adds one or more values to name. + *

*/ + @Nonnull public final Builder name(String value, String... values) { this.name = _listAdd(this.name, value, values); return this; @@ -248,9 +314,10 @@ public final Builder name(String value, String... values) { /** * Builds a {@link GetTemplateRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public GetTemplateRequest build() { _checkSingleUse(); @@ -264,13 +331,8 @@ public GetTemplateRequest build() { * Endpoint "{@code indices.get_template}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "GET"; - - }, - + request -> "GET", // Request path request -> { final int _name = 1 << 0; @@ -280,27 +342,20 @@ public GetTemplateRequest build() { if (ApiTypeHelper.isDefined(request.name())) propsSet |= _name; if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_template"); - return buf.toString(); + return "/_template"; } if (propsSet == (_name)) { StringBuilder buf = new StringBuilder(); - buf.append("/_template"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name.stream().map(v -> v).collect(Collectors.joining(",")), buf); + buf.append("/_template/"); + SimpleEndpoint.pathEncode(String.join(",", request.name), buf); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } @@ -310,11 +365,36 @@ public GetTemplateRequest build() { if (request.local != null) { params.put("local", String.valueOf(request.local)); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } return params; - }, SimpleEndpoint.emptyMap(), false, GetTemplateResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.flatSettings); + result = 31 * result + Objects.hashCode(this.local); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.name); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + GetTemplateRequest other = (GetTemplateRequest) o; + return Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.flatSettings, other.flatSettings) + && Objects.equals(this.local, other.local) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.name, other.name); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetTemplateResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetTemplateResponse.java similarity index 83% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/GetTemplateResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetTemplateResponse.java index 590cb1a696..5265654646 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetTemplateResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/GetTemplateResponse.java @@ -30,9 +30,15 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; @@ -43,15 +49,15 @@ // typedef: indices.get_template.Response @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class GetTemplateResponse extends DictionaryResponse { // --------------------------------------------------------------------------------------------- private GetTemplateResponse(Builder builder) { super(builder); - } - public static GetTemplateResponse of(Function> fn) { + public static GetTemplateResponse of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -60,11 +66,11 @@ public static GetTemplateResponse of(Function implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -72,8 +78,7 @@ protected Builder self() { /** * Builds a {@link GetTemplateResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public GetTemplateResponse build() { _checkSingleUse(); @@ -95,8 +100,6 @@ public GetTemplateResponse build() { ); protected static void setupGetTemplateResponseDeserializer(ObjectDeserializer op) { - DictionaryResponse.setupDictionaryResponseDeserializer(op, JsonpDeserializer.stringDeserializer(), TemplateMapping._DESERIALIZER); - + setupDictionaryResponseDeserializer(op, JsonpDeserializer.stringDeserializer(), TemplateMapping._DESERIALIZER); } - } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClientBase.java index c031703329..2959a09154 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClientBase.java @@ -118,6 +118,26 @@ public final CompletableFuture deleteIndexTemplate( return deleteIndexTemplate(fn.apply(new DeleteIndexTemplateRequest.Builder()).build()); } + // ----- Endpoint: indices.delete_template + + /** + * Deletes an index template. + */ + public CompletableFuture deleteTemplate(DeleteTemplateRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, DeleteTemplateRequest._ENDPOINT, this.transportOptions); + } + + /** + * Deletes an index template. + * + * @param fn a function that initializes a builder to create the {@link DeleteTemplateRequest} + */ + public final CompletableFuture deleteTemplate( + Function> fn + ) throws IOException, OpenSearchException { + return deleteTemplate(fn.apply(new DeleteTemplateRequest.Builder()).build()); + } + // ----- Endpoint: indices.exists /** @@ -158,6 +178,26 @@ public final CompletableFuture existsIndexTemplate( return existsIndexTemplate(fn.apply(new ExistsIndexTemplateRequest.Builder()).build()); } + // ----- Endpoint: indices.exists_template + + /** + * Returns information about whether a particular index template exists. + */ + public CompletableFuture existsTemplate(ExistsTemplateRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, ExistsTemplateRequest._ENDPOINT, this.transportOptions); + } + + /** + * Returns information about whether a particular index template exists. + * + * @param fn a function that initializes a builder to create the {@link ExistsTemplateRequest} + */ + public final CompletableFuture existsTemplate( + Function> fn + ) throws IOException, OpenSearchException { + return existsTemplate(fn.apply(new ExistsTemplateRequest.Builder()).build()); + } + // ----- Endpoint: indices.get /** @@ -205,6 +245,87 @@ public final CompletableFuture getIndexTemplate() thro return getIndexTemplate(new GetIndexTemplateRequest.Builder().build()); } + // ----- Endpoint: indices.get_mapping + + /** + * Returns mappings for one or more indexes. + */ + public CompletableFuture getMapping(GetMappingRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, GetMappingRequest._ENDPOINT, this.transportOptions); + } + + /** + * Returns mappings for one or more indexes. + * + * @param fn a function that initializes a builder to create the {@link GetMappingRequest} + */ + public final CompletableFuture getMapping(Function> fn) + throws IOException, OpenSearchException { + return getMapping(fn.apply(new GetMappingRequest.Builder()).build()); + } + + /** + * Returns mappings for one or more indexes. + */ + public final CompletableFuture getMapping() throws IOException, OpenSearchException { + return getMapping(new GetMappingRequest.Builder().build()); + } + + // ----- Endpoint: indices.get_settings + + /** + * Returns settings for one or more indexes. + */ + public CompletableFuture getSettings(GetIndicesSettingsRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, GetIndicesSettingsRequest._ENDPOINT, this.transportOptions); + } + + /** + * Returns settings for one or more indexes. + * + * @param fn a function that initializes a builder to create the {@link GetIndicesSettingsRequest} + */ + public final CompletableFuture getSettings( + Function> fn + ) throws IOException, OpenSearchException { + return getSettings(fn.apply(new GetIndicesSettingsRequest.Builder()).build()); + } + + /** + * Returns settings for one or more indexes. + */ + public final CompletableFuture getSettings() throws IOException, OpenSearchException { + return getSettings(new GetIndicesSettingsRequest.Builder().build()); + } + + // ----- Endpoint: indices.get_template + + /** + * Returns an index template. + */ + public CompletableFuture getTemplate(GetTemplateRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, GetTemplateRequest._ENDPOINT, this.transportOptions); + } + + /** + * Returns an index template. + * + * @param fn a function that initializes a builder to create the {@link GetTemplateRequest} + */ + public final CompletableFuture getTemplate( + Function> fn + ) throws IOException, OpenSearchException { + return getTemplate(fn.apply(new GetTemplateRequest.Builder()).build()); + } + + /** + * Returns an index template. + */ + public final CompletableFuture getTemplate() throws IOException, OpenSearchException { + return getTemplate(new GetTemplateRequest.Builder().build()); + } + // ----- Endpoint: indices.put_index_template /** @@ -226,6 +347,66 @@ public final CompletableFuture putIndexTemplate( return putIndexTemplate(fn.apply(new PutIndexTemplateRequest.Builder()).build()); } + // ----- Endpoint: indices.put_mapping + + /** + * Updates the index mappings. + */ + public CompletableFuture putMapping(PutMappingRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, PutMappingRequest._ENDPOINT, this.transportOptions); + } + + /** + * Updates the index mappings. + * + * @param fn a function that initializes a builder to create the {@link PutMappingRequest} + */ + public final CompletableFuture putMapping(Function> fn) + throws IOException, OpenSearchException { + return putMapping(fn.apply(new PutMappingRequest.Builder()).build()); + } + + // ----- Endpoint: indices.put_settings + + /** + * Updates the index settings. + */ + public CompletableFuture putSettings(PutIndicesSettingsRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, PutIndicesSettingsRequest._ENDPOINT, this.transportOptions); + } + + /** + * Updates the index settings. + * + * @param fn a function that initializes a builder to create the {@link PutIndicesSettingsRequest} + */ + public final CompletableFuture putSettings( + Function> fn + ) throws IOException, OpenSearchException { + return putSettings(fn.apply(new PutIndicesSettingsRequest.Builder()).build()); + } + + // ----- Endpoint: indices.put_template + + /** + * Creates or updates an index template. + */ + public CompletableFuture putTemplate(PutTemplateRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, PutTemplateRequest._ENDPOINT, this.transportOptions); + } + + /** + * Creates or updates an index template. + * + * @param fn a function that initializes a builder to create the {@link PutTemplateRequest} + */ + public final CompletableFuture putTemplate( + Function> fn + ) throws IOException, OpenSearchException { + return putTemplate(fn.apply(new PutTemplateRequest.Builder()).build()); + } + // ----- Endpoint: indices.simulate_index_template /** @@ -246,4 +427,25 @@ public final CompletableFuture simulateIndexTempl ) throws IOException, OpenSearchException { return simulateIndexTemplate(fn.apply(new SimulateIndexTemplateRequest.Builder()).build()); } + + // ----- Endpoint: indices.simulate_template + + /** + * Simulate resolving the given template name or body. + */ + public CompletableFuture simulateTemplate(SimulateTemplateRequest request) throws IOException, + OpenSearchException { + return this.transport.performRequestAsync(request, SimulateTemplateRequest._ENDPOINT, this.transportOptions); + } + + /** + * Simulate resolving the given template name or body. + * + * @param fn a function that initializes a builder to create the {@link SimulateTemplateRequest} + */ + public final CompletableFuture simulateTemplate( + Function> fn + ) throws IOException, OpenSearchException { + return simulateTemplate(fn.apply(new SimulateTemplateRequest.Builder()).build()); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClientBase.java index 01da5df600..c9c20e12d3 100644 --- a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClientBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClientBase.java @@ -116,6 +116,25 @@ public final DeleteIndexTemplateResponse deleteIndexTemplate( return deleteIndexTemplate(fn.apply(new DeleteIndexTemplateRequest.Builder()).build()); } + // ----- Endpoint: indices.delete_template + + /** + * Deletes an index template. + */ + public DeleteTemplateResponse deleteTemplate(DeleteTemplateRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, DeleteTemplateRequest._ENDPOINT, this.transportOptions); + } + + /** + * Deletes an index template. + * + * @param fn a function that initializes a builder to create the {@link DeleteTemplateRequest} + */ + public final DeleteTemplateResponse deleteTemplate(Function> fn) + throws IOException, OpenSearchException { + return deleteTemplate(fn.apply(new DeleteTemplateRequest.Builder()).build()); + } + // ----- Endpoint: indices.exists /** @@ -155,6 +174,25 @@ public final BooleanResponse existsIndexTemplate( return existsIndexTemplate(fn.apply(new ExistsIndexTemplateRequest.Builder()).build()); } + // ----- Endpoint: indices.exists_template + + /** + * Returns information about whether a particular index template exists. + */ + public BooleanResponse existsTemplate(ExistsTemplateRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, ExistsTemplateRequest._ENDPOINT, this.transportOptions); + } + + /** + * Returns information about whether a particular index template exists. + * + * @param fn a function that initializes a builder to create the {@link ExistsTemplateRequest} + */ + public final BooleanResponse existsTemplate(Function> fn) + throws IOException, OpenSearchException { + return existsTemplate(fn.apply(new ExistsTemplateRequest.Builder()).build()); + } + // ----- Endpoint: indices.get /** @@ -201,6 +239,85 @@ public final GetIndexTemplateResponse getIndexTemplate() throws IOException, Ope return getIndexTemplate(new GetIndexTemplateRequest.Builder().build()); } + // ----- Endpoint: indices.get_mapping + + /** + * Returns mappings for one or more indexes. + */ + public GetMappingResponse getMapping(GetMappingRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, GetMappingRequest._ENDPOINT, this.transportOptions); + } + + /** + * Returns mappings for one or more indexes. + * + * @param fn a function that initializes a builder to create the {@link GetMappingRequest} + */ + public final GetMappingResponse getMapping(Function> fn) throws IOException, + OpenSearchException { + return getMapping(fn.apply(new GetMappingRequest.Builder()).build()); + } + + /** + * Returns mappings for one or more indexes. + */ + public final GetMappingResponse getMapping() throws IOException, OpenSearchException { + return getMapping(new GetMappingRequest.Builder().build()); + } + + // ----- Endpoint: indices.get_settings + + /** + * Returns settings for one or more indexes. + */ + public GetIndicesSettingsResponse getSettings(GetIndicesSettingsRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, GetIndicesSettingsRequest._ENDPOINT, this.transportOptions); + } + + /** + * Returns settings for one or more indexes. + * + * @param fn a function that initializes a builder to create the {@link GetIndicesSettingsRequest} + */ + public final GetIndicesSettingsResponse getSettings( + Function> fn + ) throws IOException, OpenSearchException { + return getSettings(fn.apply(new GetIndicesSettingsRequest.Builder()).build()); + } + + /** + * Returns settings for one or more indexes. + */ + public final GetIndicesSettingsResponse getSettings() throws IOException, OpenSearchException { + return getSettings(new GetIndicesSettingsRequest.Builder().build()); + } + + // ----- Endpoint: indices.get_template + + /** + * Returns an index template. + */ + public GetTemplateResponse getTemplate(GetTemplateRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, GetTemplateRequest._ENDPOINT, this.transportOptions); + } + + /** + * Returns an index template. + * + * @param fn a function that initializes a builder to create the {@link GetTemplateRequest} + */ + public final GetTemplateResponse getTemplate(Function> fn) + throws IOException, OpenSearchException { + return getTemplate(fn.apply(new GetTemplateRequest.Builder()).build()); + } + + /** + * Returns an index template. + */ + public final GetTemplateResponse getTemplate() throws IOException, OpenSearchException { + return getTemplate(new GetTemplateRequest.Builder().build()); + } + // ----- Endpoint: indices.put_index_template /** @@ -221,6 +338,64 @@ public final PutIndexTemplateResponse putIndexTemplate( return putIndexTemplate(fn.apply(new PutIndexTemplateRequest.Builder()).build()); } + // ----- Endpoint: indices.put_mapping + + /** + * Updates the index mappings. + */ + public PutMappingResponse putMapping(PutMappingRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, PutMappingRequest._ENDPOINT, this.transportOptions); + } + + /** + * Updates the index mappings. + * + * @param fn a function that initializes a builder to create the {@link PutMappingRequest} + */ + public final PutMappingResponse putMapping(Function> fn) throws IOException, + OpenSearchException { + return putMapping(fn.apply(new PutMappingRequest.Builder()).build()); + } + + // ----- Endpoint: indices.put_settings + + /** + * Updates the index settings. + */ + public PutIndicesSettingsResponse putSettings(PutIndicesSettingsRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, PutIndicesSettingsRequest._ENDPOINT, this.transportOptions); + } + + /** + * Updates the index settings. + * + * @param fn a function that initializes a builder to create the {@link PutIndicesSettingsRequest} + */ + public final PutIndicesSettingsResponse putSettings( + Function> fn + ) throws IOException, OpenSearchException { + return putSettings(fn.apply(new PutIndicesSettingsRequest.Builder()).build()); + } + + // ----- Endpoint: indices.put_template + + /** + * Creates or updates an index template. + */ + public PutTemplateResponse putTemplate(PutTemplateRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, PutTemplateRequest._ENDPOINT, this.transportOptions); + } + + /** + * Creates or updates an index template. + * + * @param fn a function that initializes a builder to create the {@link PutTemplateRequest} + */ + public final PutTemplateResponse putTemplate(Function> fn) + throws IOException, OpenSearchException { + return putTemplate(fn.apply(new PutTemplateRequest.Builder()).build()); + } + // ----- Endpoint: indices.simulate_index_template /** @@ -241,4 +416,24 @@ public final SimulateIndexTemplateResponse simulateIndexTemplate( ) throws IOException, OpenSearchException { return simulateIndexTemplate(fn.apply(new SimulateIndexTemplateRequest.Builder()).build()); } + + // ----- Endpoint: indices.simulate_template + + /** + * Simulate resolving the given template name or body. + */ + public SimulateTemplateResponse simulateTemplate(SimulateTemplateRequest request) throws IOException, OpenSearchException { + return this.transport.performRequest(request, SimulateTemplateRequest._ENDPOINT, this.transportOptions); + } + + /** + * Simulate resolving the given template name or body. + * + * @param fn a function that initializes a builder to create the {@link SimulateTemplateRequest} + */ + public final SimulateTemplateResponse simulateTemplate( + Function> fn + ) throws IOException, OpenSearchException { + return simulateTemplate(fn.apply(new SimulateTemplateRequest.Builder()).build()); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutIndicesSettingsRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutIndicesSettingsRequest.java similarity index 58% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/PutIndicesSettingsRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutIndicesSettingsRequest.java index aa71f98e2c..e338763804 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutIndicesSettingsRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutIndicesSettingsRequest.java @@ -30,14 +30,21 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -50,20 +57,30 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.put_settings.Request /** * Updates the index settings. - * */ @JsonpDeserializable -public class PutIndicesSettingsRequest extends RequestBase implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PutIndicesSettingsRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + @Nullable private final Boolean allowNoIndices; + @Nullable + private final Time clusterManagerTimeout; + + @Nonnull private final List expandWildcards; @Nullable @@ -72,50 +89,48 @@ public class PutIndicesSettingsRequest extends RequestBase implements PlainJsonS @Nullable private final Boolean ignoreUnavailable; + @Nonnull private final List index; @Deprecated @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - @Nullable private final Boolean preserveExisting; + @Nonnull + private final IndexSettings settings; + @Nullable private final Time timeout; - private final IndexSettings settings; - // --------------------------------------------------------------------------------------------- private PutIndicesSettingsRequest(Builder builder) { - this.allowNoIndices = builder.allowNoIndices; + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); this.flatSettings = builder.flatSettings; this.ignoreUnavailable = builder.ignoreUnavailable; this.index = ApiTypeHelper.unmodifiable(builder.index); this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.preserveExisting = builder.preserveExisting; - this.timeout = builder.timeout; this.settings = ApiTypeHelper.requireNonNull(builder.settings, this, "settings"); - + this.timeout = builder.timeout; } - public static PutIndicesSettingsRequest of(Function> fn) { + public static PutIndicesSettingsRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets only + * missing or closed indexes. This behavior applies even if the request targets other open indexes. For example, a request targeting + * foo*,bar* returns an error if an index starts with foo but no index starts with bar. *

* API name: {@code allow_no_indices} + *

*/ @Nullable public final Boolean allowNoIndices() { @@ -123,19 +138,33 @@ public final Boolean allowNoIndices() { } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Operation timeout for connection to cluster-manager node. + *

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

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. *

* API name: {@code expand_wildcards} + *

*/ + @Nonnull public final List expandWildcards() { return this.expandWildcards; } /** - * Return settings in flat format (default: false) + * If true, returns settings in flat format. *

* API name: {@code flat_settings} + *

*/ @Nullable public final Boolean flatSettings() { @@ -143,10 +172,10 @@ public final Boolean flatSettings() { } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * Whether specified concrete indexes should be ignored when unavailable (missing or closed). *

* API name: {@code ignore_unavailable} + *

*/ @Nullable public final Boolean ignoreUnavailable() { @@ -154,19 +183,23 @@ public final Boolean ignoreUnavailable() { } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To target + * all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

*/ + @Nonnull public final List index() { return this.index; } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -175,270 +208,330 @@ public final Time masterTimeout() { } /** - * Specify timeout for connection to cluster-manager + * If true, existing index settings remain unchanged. *

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

*/ @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; + public final Boolean preserveExisting() { + return this.preserveExisting; } /** - * Whether to update existing settings. If set to true existing - * settings on an index remain unchanged, the default is false - *

- * API name: {@code preserve_existing} + * Required - Request body. */ - @Nullable - public final Boolean preserveExisting() { - return this.preserveExisting; + @Nonnull + public final IndexSettings settings() { + return this.settings; } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { return this.timeout; } - /** - * Required - Request body. - *

- * API name: {@code _value_body} - */ - public final IndexSettings settings() { - return this.settings; - } - /** * Serialize this value to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { this.settings.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link PutIndicesSettingsRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Boolean allowNoIndices; - + @Nullable + private Time clusterManagerTimeout; @Nullable private List expandWildcards; - @Nullable private Boolean flatSettings; - @Nullable private Boolean ignoreUnavailable; - @Nullable private List index; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - @Nullable private Boolean preserveExisting; - + private IndexSettings settings; @Nullable private Time timeout; - private IndexSettings settings; + public Builder() {} + + private Builder(PutIndicesSettingsRequest o) { + this.allowNoIndices = o.allowNoIndices; + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.expandWildcards = _listCopy(o.expandWildcards); + this.flatSettings = o.flatSettings; + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.masterTimeout = o.masterTimeout; + this.preserveExisting = o.preserveExisting; + this.settings = o.settings; + this.timeout = o.timeout; + } + + private Builder(Builder o) { + this.allowNoIndices = o.allowNoIndices; + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.expandWildcards = _listCopy(o.expandWildcards); + this.flatSettings = o.flatSettings; + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.masterTimeout = o.masterTimeout; + this.preserveExisting = o.preserveExisting; + this.settings = o.settings; + this.timeout = o.timeout; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets + * only missing or closed indexes. This behavior applies even if the request targets other open indexes. For example, a request + * targeting foo*,bar* returns an error if an index starts with foo but no index starts with + * bar. *

* API name: {@code allow_no_indices} + *

*/ + @Nonnull public final Builder allowNoIndices(@Nullable Boolean value) { this.allowNoIndices = value; return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Operation timeout for connection to cluster-manager node. + *

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

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

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

+ */ + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds all elements of list to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(List list) { this.expandWildcards = _listAddAll(this.expandWildcards, list); return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds one or more values to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { this.expandWildcards = _listAdd(this.expandWildcards, value, values); return this; } /** - * Return settings in flat format (default: false) + * If true, returns settings in flat format. *

* API name: {@code flat_settings} + *

*/ + @Nonnull public final Builder flatSettings(@Nullable Boolean value) { this.flatSettings = value; return this; } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * Whether specified concrete indexes should be ignored when unavailable (missing or closed). *

* API name: {@code ignore_unavailable} + *

*/ + @Nonnull public final Builder ignoreUnavailable(@Nullable Boolean value) { this.ignoreUnavailable = value; return this; } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To + * target all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

+ * *

* Adds all elements of list to index. + *

*/ + @Nonnull public final Builder index(List list) { this.index = _listAddAll(this.index, list); return this; } /** - * A comma-separated list of index names; use _all or empty string - * to perform the operation on all indices + * Comma-separated list of data streams, indexes, and aliases used to limit the request. Supports wildcards (*). To + * target all data streams and indexes, omit this parameter or use * or _all. *

* API name: {@code index} + *

+ * *

* Adds one or more values to index. + *

*/ + @Nonnull public final Builder index(String value, String... values) { this.index = _listAdd(this.index, value, values); return this; } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(@Nullable Time value) { this.masterTimeout = value; return this; } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** - * Specify timeout for connection to cluster-manager + * If true, existing index settings remain unchanged. *

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

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

- * API name: {@code cluster_manager_timeout} + * Required - Request body. */ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + @Nonnull + public final Builder settings(IndexSettings value) { + this.settings = value; + return this; } /** - * Whether to update existing settings. If set to true existing - * settings on an index remain unchanged, the default is false - *

- * API name: {@code preserve_existing} + * Required - Request body. */ - public final Builder preserveExisting(@Nullable Boolean value) { - this.preserveExisting = value; - return this; + @Nonnull + public final Builder settings(Function> fn) { + return settings(fn.apply(new IndexSettings.Builder()).build()); } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(@Nullable Time value) { this.timeout = value; return this; } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Required - Request body. - *

- * API name: {@code _value_body} - */ - public final Builder settings(IndexSettings value) { - this.settings = value; - return this; - } - - /** - * Required - Request body. - *

- * API name: {@code _value_body} - */ - public final Builder settings(Function> fn) { - return this.settings(fn.apply(new IndexSettings.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** * Builds a {@link PutIndicesSettingsRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public PutIndicesSettingsRequest build() { _checkSingleUse(); @@ -446,12 +539,12 @@ public PutIndicesSettingsRequest build() { } } + // --------------------------------------------------------------------------------------------- + public static final JsonpDeserializer _DESERIALIZER = createPutIndicesSettingsRequestDeserializer(); protected static JsonpDeserializer createPutIndicesSettingsRequestDeserializer() { - JsonpDeserializer valueDeserializer = IndexSettings._DESERIALIZER; - return JsonpDeserializer.of( valueDeserializer.acceptedEvents(), (parser, mapper) -> new Builder().settings(valueDeserializer.deserialize(parser, mapper)).build() @@ -464,13 +557,8 @@ protected static JsonpDeserializer createPutIndicesSe * Endpoint "{@code indices.put_settings}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "PUT"; - - }, - + request -> "PUT", // Request path request -> { final int _index = 1 << 0; @@ -480,41 +568,38 @@ protected static JsonpDeserializer createPutIndicesSe if (ApiTypeHelper.isDefined(request.index())) propsSet |= _index; if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_settings"); - return buf.toString(); + return "/_settings"; } if (propsSet == (_index)) { StringBuilder buf = new StringBuilder(); buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); buf.append("/_settings"); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); + if (request.allowNoIndices != null) { + params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } - if (request.flatSettings != null) { - params.put("flat_settings", String.valueOf(request.flatSettings)); - } if (ApiTypeHelper.isDefined(request.expandWildcards)) { params.put("expand_wildcards", request.expandWildcards.stream().map(v -> v.jsonValue()).collect(Collectors.joining(","))); } + if (request.flatSettings != null) { + params.put("flat_settings", String.valueOf(request.flatSettings)); + } if (request.ignoreUnavailable != null) { params.put("ignore_unavailable", String.valueOf(request.ignoreUnavailable)); } - if (request.allowNoIndices != null) { - params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); } if (request.preserveExisting != null) { params.put("preserve_existing", String.valueOf(request.preserveExisting)); @@ -523,10 +608,42 @@ protected static JsonpDeserializer createPutIndicesSe params.put("timeout", request.timeout._toJsonString()); } return params; - }, SimpleEndpoint.emptyMap(), true, PutIndicesSettingsResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.allowNoIndices); + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.expandWildcards); + result = 31 * result + Objects.hashCode(this.flatSettings); + result = 31 * result + Objects.hashCode(this.ignoreUnavailable); + result = 31 * result + Objects.hashCode(this.index); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.preserveExisting); + result = 31 * result + this.settings.hashCode(); + result = 31 * result + Objects.hashCode(this.timeout); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PutIndicesSettingsRequest other = (PutIndicesSettingsRequest) o; + return Objects.equals(this.allowNoIndices, other.allowNoIndices) + && Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.expandWildcards, other.expandWildcards) + && Objects.equals(this.flatSettings, other.flatSettings) + && Objects.equals(this.ignoreUnavailable, other.ignoreUnavailable) + && Objects.equals(this.index, other.index) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.preserveExisting, other.preserveExisting) + && this.settings.equals(other.settings) + && Objects.equals(this.timeout, other.timeout); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutIndicesSettingsResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutIndicesSettingsResponse.java similarity index 63% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/PutIndicesSettingsResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutIndicesSettingsResponse.java index 39a4a769cf..098dd80a0b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutIndicesSettingsResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutIndicesSettingsResponse.java @@ -30,41 +30,82 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.put_settings.Response @JsonpDeserializable -public class PutIndicesSettingsResponse extends AcknowledgedResponseBase { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PutIndicesSettingsResponse extends AcknowledgedResponseBase + implements + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private PutIndicesSettingsResponse(Builder builder) { super(builder); - } - public static PutIndicesSettingsResponse of(Function> fn) { + public static PutIndicesSettingsResponse of( + Function> fn + ) { return fn.apply(new Builder()).build(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link PutIndicesSettingsResponse}. */ - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder implements - ObjectBuilder { + CopyableBuilder { + + public Builder() {} + + private Builder(PutIndicesSettingsResponse o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + @Override + @Nonnull protected Builder self() { return this; } @@ -72,9 +113,10 @@ protected Builder self() { /** * Builds a {@link PutIndicesSettingsResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public PutIndicesSettingsResponse build() { _checkSingleUse(); @@ -93,8 +135,22 @@ public PutIndicesSettingsResponse build() { ); protected static void setupPutIndicesSettingsResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + setupAcknowledgedResponseBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutMappingRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutMappingRequest.java similarity index 67% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/PutMappingRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutMappingRequest.java index 98229cf9a8..f5d9b4ada3 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutMappingRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutMappingRequest.java @@ -30,14 +30,21 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; import java.util.stream.Collectors; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -59,30 +66,28 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.put_mapping.Request /** * Updates the index mappings. - * */ @JsonpDeserializable -public class PutMappingRequest extends RequestBase implements PlainJsonSerializable { - @Nullable - private final FieldNamesField fieldNames; - - private final Map meta; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PutMappingRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { @Nullable - private final RoutingField routing; - - @Nullable - private final SourceField source; + private final Boolean allowNoIndices; @Nullable - private final Boolean allowNoIndices; + private final Time clusterManagerTimeout; @Nullable private final Boolean dateDetection; @@ -90,29 +95,43 @@ public class PutMappingRequest extends RequestBase implements PlainJsonSerializa @Nullable private final DynamicMapping dynamic; + @Nonnull private final List dynamicDateFormats; + @Nonnull private final List> dynamicTemplates; + @Nonnull private final List expandWildcards; + @Nullable + private final FieldNamesField fieldNames; + @Nullable private final Boolean ignoreUnavailable; + @Nonnull private final List index; @Deprecated @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; + @Nonnull + private final Map meta; @Nullable private final Boolean numericDetection; + @Nonnull private final Map properties; + @Nullable + private final RoutingField routing; + + @Nullable + private final SourceField source; + @Nullable private final Time timeout; @@ -122,89 +141,58 @@ public class PutMappingRequest extends RequestBase implements PlainJsonSerializa // --------------------------------------------------------------------------------------------- private PutMappingRequest(Builder builder) { - - this.fieldNames = builder.fieldNames; - this.meta = ApiTypeHelper.unmodifiable(builder.meta); - this.routing = builder.routing; - this.source = builder.source; this.allowNoIndices = builder.allowNoIndices; + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.dateDetection = builder.dateDetection; this.dynamic = builder.dynamic; this.dynamicDateFormats = ApiTypeHelper.unmodifiable(builder.dynamicDateFormats); this.dynamicTemplates = ApiTypeHelper.unmodifiable(builder.dynamicTemplates); this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); + this.fieldNames = builder.fieldNames; this.ignoreUnavailable = builder.ignoreUnavailable; this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; + this.meta = ApiTypeHelper.unmodifiable(builder.meta); this.numericDetection = builder.numericDetection; this.properties = ApiTypeHelper.unmodifiable(builder.properties); + this.routing = builder.routing; + this.source = builder.source; this.timeout = builder.timeout; this.writeIndexOnly = builder.writeIndexOnly; - } - public static PutMappingRequest of(Function> fn) { + public static PutMappingRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Control whether field names are enabled for the index. + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets only + * missing or closed indexes. This behavior applies even if the request targets other open indexes. *

- * API name: {@code _field_names} - */ - @Nullable - public final FieldNamesField fieldNames() { - return this.fieldNames; - } - - /** - * A mapping type can have custom meta data associated with it. These are not - * used at all by OpenSearch, but can be used to store application-specific - * metadata. - *

- * API name: {@code _meta} - */ - public final Map meta() { - return this.meta; - } - - /** - * Enable making a routing value required on indexed documents. - *

- * API name: {@code _routing} - */ - @Nullable - public final RoutingField routing() { - return this.routing; - } - - /** - * Control whether the _source field is enabled on the index. - *

- * API name: {@code _source} + * API name: {@code allow_no_indices} + *

*/ @Nullable - public final SourceField source() { - return this.source; + public final Boolean allowNoIndices() { + return this.allowNoIndices; } /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * Operation timeout for connection to cluster-manager node. *

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

*/ @Nullable - public final Boolean allowNoIndices() { - return this.allowNoIndices; + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; } /** * Controls whether dynamic date detection is enabled. *

* API name: {@code date_detection} + *

*/ @Nullable public final Boolean dateDetection() { @@ -212,8 +200,6 @@ public final Boolean dateDetection() { } /** - * Controls whether new fields are added dynamically. - *

* API name: {@code dynamic} */ @Nullable @@ -222,12 +208,13 @@ public final DynamicMapping dynamic() { } /** - * If date detection is enabled then new string fields are checked against - * 'dynamic_date_formats' and if the value matches then a new date field is - * added instead of string. + * If date detection is enabled then new string fields are checked against dynamic_date_formats and if the value matches + * then a new date field is added instead of string. *

* API name: {@code dynamic_date_formats} + *

*/ + @Nonnull public final List dynamicDateFormats() { return this.dynamicDateFormats; } @@ -236,26 +223,39 @@ public final List dynamicDateFormats() { * Specify dynamic templates for the mapping. *

* API name: {@code dynamic_templates} + *

*/ + @Nonnull public final List> dynamicTemplates() { return this.dynamicTemplates; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

*/ + @Nonnull public final List expandWildcards() { return this.expandWildcards; } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * API name: {@code _field_names} + */ + @Nullable + public final FieldNamesField fieldNames() { + return this.fieldNames; + } + + /** + * If false, the request returns an error if it targets a missing or closed index. *

* API name: {@code ignore_unavailable} + *

*/ @Nullable public final Boolean ignoreUnavailable() { @@ -263,20 +263,23 @@ public final Boolean ignoreUnavailable() { } /** - * Required - A comma-separated list of index names the mapping should be added - * to (supports wildcards); use _all or omit to add the mapping on - * all indices. + * Required - A comma-separated list of index names the mapping should be added to (supports wildcards); use _all or omit + * to add the mapping on all indexes. *

* API name: {@code index} + *

*/ + @Nonnull public final List index() { return this.index; } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -285,19 +288,18 @@ public final Time masterTimeout() { } /** - * Specify timeout for connection to cluster-manager - *

- * API name: {@code cluster_manager_timeout} + * API name: {@code _meta} */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; + @Nonnull + public final Map meta() { + return this.meta; } /** * Automatically map strings into numeric data types for all fields. *

* API name: {@code numeric_detection} + *

*/ @Nullable public final Boolean numericDetection() { @@ -305,7 +307,9 @@ public final Boolean numericDetection() { } /** + *

* Mapping for a field. For new fields, this mapping can include: + *

*
    *
  • Field name
  • *
  • Field data type
  • @@ -313,15 +317,34 @@ public final Boolean numericDetection() { *
*

* API name: {@code properties} + *

*/ + @Nonnull public final Map properties() { return this.properties; } /** - * Explicit operation timeout + * API name: {@code _routing} + */ + @Nullable + public final RoutingField routing() { + return this.routing; + } + + /** + * API name: {@code _source} + */ + @Nullable + public final SourceField source() { + return this.source; + } + + /** + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ @Nullable public final Time timeout() { @@ -329,10 +352,10 @@ public final Time timeout() { } /** - * When true, applies mappings only to the write index of an alias or data - * stream + * If true, the mappings are applied only to the current write index for the target. *

* API name: {@code write_index_only} + *

*/ @Nullable public final Boolean writeIndexOnly() { @@ -342,6 +365,7 @@ public final Boolean writeIndexOnly() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -349,52 +373,25 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (this.fieldNames != null) { - generator.writeKey("_field_names"); - this.fieldNames.serialize(generator, mapper); - - } - if (ApiTypeHelper.isDefined(this.meta)) { - generator.writeKey("_meta"); - generator.writeStartObject(); - for (Map.Entry item0 : this.meta.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - - } - if (this.routing != null) { - generator.writeKey("_routing"); - this.routing.serialize(generator, mapper); - - } - if (this.source != null) { - generator.writeKey("_source"); - this.source.serialize(generator, mapper); - - } if (this.dateDetection != null) { generator.writeKey("date_detection"); generator.write(this.dateDetection); - } + if (this.dynamic != null) { generator.writeKey("dynamic"); this.dynamic.serialize(generator, mapper); } + if (ApiTypeHelper.isDefined(this.dynamicDateFormats)) { generator.writeKey("dynamic_date_formats"); generator.writeStartArray(); for (String item0 : this.dynamicDateFormats) { generator.write(item0); - } generator.writeEnd(); - } + if (ApiTypeHelper.isDefined(this.dynamicTemplates)) { generator.writeKey("dynamic_templates"); generator.writeStartArray(); @@ -404,234 +401,242 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { for (Map.Entry item1 : item0.entrySet()) { generator.writeKey(item1.getKey()); item1.getValue().serialize(generator, mapper); - } } generator.writeEnd(); - } generator.writeEnd(); + } + if (this.fieldNames != null) { + generator.writeKey("_field_names"); + this.fieldNames.serialize(generator, mapper); + } + + if (ApiTypeHelper.isDefined(this.meta)) { + generator.writeKey("_meta"); + generator.writeStartObject(); + for (Map.Entry item0 : this.meta.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); + } + generator.writeEnd(); } + if (this.numericDetection != null) { generator.writeKey("numeric_detection"); generator.write(this.numericDetection); - } + if (ApiTypeHelper.isDefined(this.properties)) { generator.writeKey("properties"); generator.writeStartObject(); for (Map.Entry item0 : this.properties.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); + } + if (this.routing != null) { + generator.writeKey("_routing"); + this.routing.serialize(generator, mapper); } - } + if (this.source != null) { + generator.writeKey("_source"); + this.source.serialize(generator, mapper); + } + } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link PutMappingRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { - @Nullable - private FieldNamesField fieldNames; - - @Nullable - private Map meta; - - @Nullable - private RoutingField routing; - - @Nullable - private SourceField source; - + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Boolean allowNoIndices; - + @Nullable + private Time clusterManagerTimeout; @Nullable private Boolean dateDetection; - @Nullable private DynamicMapping dynamic; - @Nullable private List dynamicDateFormats; - @Nullable private List> dynamicTemplates; - @Nullable private List expandWildcards; - + @Nullable + private FieldNamesField fieldNames; @Nullable private Boolean ignoreUnavailable; - private List index; - - @Deprecated @Nullable private Time masterTimeout; - @Nullable - private Time clusterManagerTimeout; - + private Map meta; @Nullable private Boolean numericDetection; - @Nullable private Map properties; - + @Nullable + private RoutingField routing; + @Nullable + private SourceField source; @Nullable private Time timeout; - @Nullable private Boolean writeIndexOnly; - /** - * Control whether field names are enabled for the index. - *

- * API name: {@code _field_names} - */ - public final Builder fieldNames(@Nullable FieldNamesField value) { - this.fieldNames = value; - return this; + public Builder() {} + + private Builder(PutMappingRequest o) { + this.allowNoIndices = o.allowNoIndices; + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.dateDetection = o.dateDetection; + this.dynamic = o.dynamic; + this.dynamicDateFormats = _listCopy(o.dynamicDateFormats); + this.dynamicTemplates = _listCopy(o.dynamicTemplates); + this.expandWildcards = _listCopy(o.expandWildcards); + this.fieldNames = o.fieldNames; + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.masterTimeout = o.masterTimeout; + this.meta = _mapCopy(o.meta); + this.numericDetection = o.numericDetection; + this.properties = _mapCopy(o.properties); + this.routing = o.routing; + this.source = o.source; + this.timeout = o.timeout; + this.writeIndexOnly = o.writeIndexOnly; } - /** - * Control whether field names are enabled for the index. - *

- * API name: {@code _field_names} - */ - public final Builder fieldNames(Function> fn) { - return this.fieldNames(fn.apply(new FieldNamesField.Builder()).build()); + private Builder(Builder o) { + this.allowNoIndices = o.allowNoIndices; + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.dateDetection = o.dateDetection; + this.dynamic = o.dynamic; + this.dynamicDateFormats = _listCopy(o.dynamicDateFormats); + this.dynamicTemplates = _listCopy(o.dynamicTemplates); + this.expandWildcards = _listCopy(o.expandWildcards); + this.fieldNames = o.fieldNames; + this.ignoreUnavailable = o.ignoreUnavailable; + this.index = _listCopy(o.index); + this.masterTimeout = o.masterTimeout; + this.meta = _mapCopy(o.meta); + this.numericDetection = o.numericDetection; + this.properties = _mapCopy(o.properties); + this.routing = o.routing; + this.source = o.source; + this.timeout = o.timeout; + this.writeIndexOnly = o.writeIndexOnly; } - /** - * A mapping type can have custom meta data associated with it. These are not - * used at all by OpenSearch, but can be used to store application-specific - * metadata. - *

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

- * Adds all entries of map to meta. - */ - public final Builder meta(Map map) { - this.meta = _mapPutAll(this.meta, map); - return this; + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** - * A mapping type can have custom meta data associated with it. These are not - * used at all by OpenSearch, but can be used to store application-specific - * metadata. - *

- * API name: {@code _meta} + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets + * only missing or closed indexes. This behavior applies even if the request targets other open indexes. *

- * Adds an entry to meta. - */ - public final Builder meta(String key, JsonData value) { - this.meta = _mapPut(this.meta, key, value); - return this; - } - - /** - * Enable making a routing value required on indexed documents. - *

- * API name: {@code _routing} + * API name: {@code allow_no_indices} + *

*/ - public final Builder routing(@Nullable RoutingField value) { - this.routing = value; + @Nonnull + public final Builder allowNoIndices(@Nullable Boolean value) { + this.allowNoIndices = value; return this; } /** - * Enable making a routing value required on indexed documents. - *

- * API name: {@code _routing} - */ - public final Builder routing(Function> fn) { - return this.routing(fn.apply(new RoutingField.Builder()).build()); - } - - /** - * Control whether the _source field is enabled on the index. + * Operation timeout for connection to cluster-manager node. *

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

*/ - public final Builder source(@Nullable SourceField value) { - this.source = value; + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; return this; } /** - * Control whether the _source field is enabled on the index. - *

- * API name: {@code _source} - */ - public final Builder source(Function> fn) { - return this.source(fn.apply(new SourceField.Builder()).build()); - } - - /** - * Whether to ignore if a wildcard indices expression resolves into no concrete - * indices. (This includes _all string or when no indices have been - * specified) + * Operation timeout for connection to cluster-manager node. *

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

*/ - public final Builder allowNoIndices(@Nullable Boolean value) { - this.allowNoIndices = value; - return this; + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); } /** * Controls whether dynamic date detection is enabled. *

* API name: {@code date_detection} + *

*/ + @Nonnull public final Builder dateDetection(@Nullable Boolean value) { this.dateDetection = value; return this; } /** - * Controls whether new fields are added dynamically. - *

* API name: {@code dynamic} */ + @Nonnull public final Builder dynamic(@Nullable DynamicMapping value) { this.dynamic = value; return this; } /** - * If date detection is enabled then new string fields are checked against - * 'dynamic_date_formats' and if the value matches then a new date field is - * added instead of string. + * If date detection is enabled then new string fields are checked against dynamic_date_formats and if the value + * matches then a new date field is added instead of string. *

* API name: {@code dynamic_date_formats} + *

+ * *

* Adds all elements of list to dynamicDateFormats. + *

*/ + @Nonnull public final Builder dynamicDateFormats(List list) { this.dynamicDateFormats = _listAddAll(this.dynamicDateFormats, list); return this; } /** - * If date detection is enabled then new string fields are checked against - * 'dynamic_date_formats' and if the value matches then a new date field is - * added instead of string. + * If date detection is enabled then new string fields are checked against dynamic_date_formats and if the value + * matches then a new date field is added instead of string. *

* API name: {@code dynamic_date_formats} + *

+ * *

* Adds one or more values to dynamicDateFormats. + *

*/ + @Nonnull public final Builder dynamicDateFormats(String value, String... values) { this.dynamicDateFormats = _listAdd(this.dynamicDateFormats, value, values); return this; @@ -641,9 +646,13 @@ public final Builder dynamicDateFormats(String value, String... values) { * Specify dynamic templates for the mapping. *

* API name: {@code dynamic_templates} + *

+ * *

* Adds all elements of list to dynamicTemplates. + *

*/ + @Nonnull public final Builder dynamicTemplates(List> list) { this.dynamicTemplates = _listAddAll(this.dynamicTemplates, list); return this; @@ -653,131 +662,186 @@ public final Builder dynamicTemplates(List> list) { * Specify dynamic templates for the mapping. *

* API name: {@code dynamic_templates} + *

+ * *

* Adds one or more values to dynamicTemplates. + *

*/ + @Nonnull public final Builder dynamicTemplates(Map value, Map... values) { this.dynamicTemplates = _listAdd(this.dynamicTemplates, value, values); return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds all elements of list to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(List list) { this.expandWildcards = _listAddAll(this.expandWildcards, list); return this; } /** - * Whether to expand wildcard expression to concrete indices that are open, - * closed or both. + * Type of index that wildcard patterns can match. If the request can target data streams, this argument determines whether wildcard + * expressions match hidden data streams. Supports comma-separated values, such as open,hidden. Valid values are: + * all, open, closed, hidden, none. *

* API name: {@code expand_wildcards} + *

+ * *

* Adds one or more values to expandWildcards. + *

*/ + @Nonnull public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { this.expandWildcards = _listAdd(this.expandWildcards, value, values); return this; } /** - * Whether specified concrete indices should be ignored when unavailable - * (missing or closed) + * API name: {@code _field_names} + */ + @Nonnull + public final Builder fieldNames(@Nullable FieldNamesField value) { + this.fieldNames = value; + return this; + } + + /** + * API name: {@code _field_names} + */ + @Nonnull + public final Builder fieldNames(Function> fn) { + return fieldNames(fn.apply(new FieldNamesField.Builder()).build()); + } + + /** + * If false, the request returns an error if it targets a missing or closed index. *

* API name: {@code ignore_unavailable} + *

*/ + @Nonnull public final Builder ignoreUnavailable(@Nullable Boolean value) { this.ignoreUnavailable = value; return this; } /** - * Required - A comma-separated list of index names the mapping should be added - * to (supports wildcards); use _all or omit to add the mapping on - * all indices. + * Required - A comma-separated list of index names the mapping should be added to (supports wildcards); use _all or + * omit to add the mapping on all indexes. *

* API name: {@code index} + *

+ * *

* Adds all elements of list to index. + *

*/ + @Nonnull public final Builder index(List list) { this.index = _listAddAll(this.index, list); return this; } /** - * Required - A comma-separated list of index names the mapping should be added - * to (supports wildcards); use _all or omit to add the mapping on - * all indices. + * Required - A comma-separated list of index names the mapping should be added to (supports wildcards); use _all or + * omit to add the mapping on all indexes. *

* API name: {@code index} + *

+ * *

* Adds one or more values to index. + *

*/ + @Nonnull public final Builder index(String value, String... values) { this.index = _listAdd(this.index, value, values); return this; } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(@Nullable Time value) { this.masterTimeout = value; return this; } /** - * Specify timeout for connection to master + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

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

- * API name: {@code cluster_manager_timeout} + * Adds all elements of map to meta. + *

*/ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; + @Nonnull + public final Builder meta(Map map) { + this.meta = _mapPutAll(this.meta, map); return this; } /** - * Specify timeout for connection to cluster-manager + * API name: {@code _meta} + * *

- * API name: {@code cluster_manager_timeout} + * Adds an entry to meta. + *

*/ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + @Nonnull + public final Builder meta(String key, JsonData value) { + this.meta = _mapPut(this.meta, key, value); + return this; } /** * Automatically map strings into numeric data types for all fields. *

* API name: {@code numeric_detection} + *

*/ + @Nonnull public final Builder numericDetection(@Nullable Boolean value) { this.numericDetection = value; return this; } /** + *

* Mapping for a field. For new fields, this mapping can include: + *

*
    *
  • Field name
  • *
  • Field data type
  • @@ -785,16 +849,22 @@ public final Builder numericDetection(@Nullable Boolean value) { *
*

* API name: {@code properties} + *

+ * *

- * Adds all entries of map to properties. + * Adds all elements of map to properties. + *

*/ + @Nonnull public final Builder properties(Map map) { this.properties = _mapPutAll(this.properties, map); return this; } /** + *

* Mapping for a field. For new fields, this mapping can include: + *

*
    *
  • Field name
  • *
  • Field data type
  • @@ -802,16 +872,22 @@ public final Builder properties(Map map) { *
*

* API name: {@code properties} + *

+ * *

* Adds an entry to properties. + *

*/ + @Nonnull public final Builder properties(String key, Property value) { this.properties = _mapPut(this.properties, key, value); return this; } /** + *

* Mapping for a field. For new fields, this mapping can include: + *

*
    *
  • Field name
  • *
  • Field data type
  • @@ -819,38 +895,81 @@ public final Builder properties(String key, Property value) { *
*

* API name: {@code properties} + *

+ * *

- * Adds an entry to properties using a builder lambda. + * Adds a value to properties using a builder lambda. + *

*/ + @Nonnull public final Builder properties(String key, Function> fn) { return properties(key, fn.apply(new Property.Builder()).build()); } /** - * Explicit operation timeout + * API name: {@code _routing} + */ + @Nonnull + public final Builder routing(@Nullable RoutingField value) { + this.routing = value; + return this; + } + + /** + * API name: {@code _routing} + */ + @Nonnull + public final Builder routing(Function> fn) { + return routing(fn.apply(new RoutingField.Builder()).build()); + } + + /** + * API name: {@code _source} + */ + @Nonnull + public final Builder source(@Nullable SourceField value) { + this.source = value; + return this; + } + + /** + * API name: {@code _source} + */ + @Nonnull + public final Builder source(Function> fn) { + return source(fn.apply(new SourceField.Builder()).build()); + } + + /** + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(@Nullable Time value) { this.timeout = value; return this; } /** - * Explicit operation timeout + * Period to wait for a response. If no response is received before the timeout expires, the request fails and returns an error. *

* API name: {@code timeout} + *

*/ + @Nonnull public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); + return timeout(fn.apply(new Time.Builder()).build()); } /** - * When true, applies mappings only to the write index of an alias or data - * stream + * If true, the mappings are applied only to the current write index for the target. *

* API name: {@code write_index_only} + *

*/ + @Nonnull public final Builder writeIndexOnly(@Nullable Boolean value) { this.writeIndexOnly = value; return this; @@ -859,9 +978,10 @@ public final Builder writeIndexOnly(@Nullable Boolean value) { /** * Builds a {@link PutMappingRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public PutMappingRequest build() { _checkSingleUse(); @@ -880,11 +1000,6 @@ public PutMappingRequest build() { ); protected static void setupPutMappingRequestDeserializer(ObjectDeserializer op) { - - op.add(Builder::fieldNames, FieldNamesField._DESERIALIZER, "_field_names"); - op.add(Builder::meta, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "_meta"); - op.add(Builder::routing, RoutingField._DESERIALIZER, "_routing"); - op.add(Builder::source, SourceField._DESERIALIZER, "_source"); op.add(Builder::dateDetection, JsonpDeserializer.booleanDeserializer(), "date_detection"); op.add(Builder::dynamic, DynamicMapping._DESERIALIZER, "dynamic"); op.add( @@ -897,8 +1012,13 @@ protected static void setupPutMappingRequestDeserializer(ObjectDeserializer _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "PUT"; - - }, - + request -> "PUT", // Request path request -> { - final int _index = 1 << 0; - - int propsSet = 0; - - propsSet |= _index; - - if (propsSet == (_index)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_mapping"); - return buf.toString(); - } - if (propsSet == (_index)) { - StringBuilder buf = new StringBuilder(); - buf.append("/"); - SimpleEndpoint.pathEncode(request.index.stream().map(v -> v).collect(Collectors.joining(",")), buf); - buf.append("/_mappings"); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/"); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); + buf.append("/_mapping"); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); + if (request.allowNoIndices != null) { + params.put("allow_no_indices", String.valueOf(request.allowNoIndices)); } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); @@ -955,20 +1052,68 @@ protected static void setupPutMappingRequestDeserializer(ObjectDeserializer { + // --------------------------------------------------------------------------------------------- private PutMappingResponse(Builder builder) { super(builder); - } - public static PutMappingResponse of(Function> fn) { + public static PutMappingResponse of(Function> fn) { return fn.apply(new Builder()).build(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link PutMappingResponse}. */ + public static class Builder extends IndicesResponseBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(PutMappingResponse o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } - public static class Builder extends IndicesResponseBase.AbstractBuilder implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -70,9 +109,10 @@ protected Builder self() { /** * Builds a {@link PutMappingResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public PutMappingResponse build() { _checkSingleUse(); @@ -91,8 +131,22 @@ public PutMappingResponse build() { ); protected static void setupPutMappingResponseDeserializer(ObjectDeserializer op) { - IndicesResponseBase.setupIndicesResponseBaseDeserializer(op); + setupIndicesResponseBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutTemplateRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutTemplateRequest.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/PutTemplateRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutTemplateRequest.java index 408cdd58bc..020823bc03 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutTemplateRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutTemplateRequest.java @@ -30,13 +30,20 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -52,25 +59,33 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.put_template.Request /** * Creates or updates an index template. - * */ @JsonpDeserializable -public class PutTemplateRequest extends RequestBase implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PutTemplateRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull private final Map aliases; @Nullable - private final Boolean create; + private final Time clusterManagerTimeout; @Nullable - private final Boolean flatSettings; + private final Boolean create; + @Nonnull private final List indexPatterns; @Nullable @@ -80,42 +95,34 @@ public class PutTemplateRequest extends RequestBase implements PlainJsonSerializ @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - + @Nonnull private final String name; @Nullable private final Integer order; + @Nonnull private final Map settings; - @Nullable - private final Time timeout; - @Nullable private final Long version; // --------------------------------------------------------------------------------------------- private PutTemplateRequest(Builder builder) { - this.aliases = ApiTypeHelper.unmodifiable(builder.aliases); + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.create = builder.create; - this.flatSettings = builder.flatSettings; this.indexPatterns = ApiTypeHelper.unmodifiable(builder.indexPatterns); this.mappings = builder.mappings; this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); this.order = builder.order; this.settings = ApiTypeHelper.unmodifiable(builder.settings); - this.timeout = builder.timeout; this.version = builder.version; - } - public static PutTemplateRequest of(Function> fn) { + public static PutTemplateRequest of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -123,42 +130,47 @@ public static PutTemplateRequest of(Function * API name: {@code aliases} + *

*/ + @Nonnull public final Map aliases() { return this.aliases; } /** - * If true, this request cannot replace or update existing index templates. + * Operation timeout for connection to cluster-manager node. *

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

*/ @Nullable - public final Boolean create() { - return this.create; + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; } /** - * API name: {@code flat_settings} + * If true, this request cannot replace or update existing index templates. + *

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

*/ @Nullable - public final Boolean flatSettings() { - return this.flatSettings; + public final Boolean create() { + return this.create; } /** - * Array of wildcard expressions used to match the names of indices during - * creation. + * Array of wildcard expressions used to match the names of indexes during creation. *

* API name: {@code index_patterns} + *

*/ + @Nonnull public final List indexPatterns() { return this.indexPatterns; } /** - * Mapping for fields in the index. - *

* API name: {@code mappings} */ @Nullable @@ -167,10 +179,11 @@ public final TypeMapping mappings() { } /** - * Period to wait for a connection to the master node. If no response is - * received before the timeout expires, the request fails and returns an error. + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -178,34 +191,28 @@ public final Time masterTimeout() { return this.masterTimeout; } - /** - * Period to wait for a connection to the cluster-manager node. If no response is - * received before the timeout expires, the request fails and returns an error. - *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } - /** * Required - The name of the template *

* API name: {@code name} + *

*/ + @Nonnull public final String name() { return this.name; } /** - * Order in which OpenSearch applies this template if index matches multiple - * templates. *

- * Templates with lower 'order' values are merged first. Templates with higher - * 'order' values are merged later, overriding templates with lower values. + * Order in which OpenSearch applies this template if index matches multiple templates. + *

+ *

+ * Templates with lower 'order' values are merged first. Templates with higher 'order' values are merged later, overriding templates + * with lower values. + *

*

* API name: {@code order} + *

*/ @Nullable public final Integer order() { @@ -216,23 +223,14 @@ public final Integer order() { * Configuration options for the index. *

* API name: {@code settings} + *

*/ + @Nonnull public final Map settings() { return this.settings; } /** - * API name: {@code timeout} - */ - @Nullable - public final Time timeout() { - return this.timeout; - } - - /** - * Version number used to manage index templates externally. This number is not - * automatically generated by OpenSearch. - *

* API name: {@code version} */ @Nullable @@ -243,6 +241,7 @@ public final Long version() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -250,107 +249,132 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.aliases)) { generator.writeKey("aliases"); generator.writeStartObject(); for (Map.Entry item0 : this.aliases.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + if (ApiTypeHelper.isDefined(this.indexPatterns)) { generator.writeKey("index_patterns"); generator.writeStartArray(); for (String item0 : this.indexPatterns) { generator.write(item0); - } generator.writeEnd(); - } + if (this.mappings != null) { generator.writeKey("mappings"); this.mappings.serialize(generator, mapper); - } + if (this.order != null) { generator.writeKey("order"); generator.write(this.order); - } + if (ApiTypeHelper.isDefined(this.settings)) { generator.writeKey("settings"); generator.writeStartObject(); for (Map.Entry item0 : this.settings.entrySet()) { generator.writeKey(item0.getKey()); item0.getValue().serialize(generator, mapper); - } generator.writeEnd(); - } + if (this.version != null) { generator.writeKey("version"); generator.write(this.version); - } + } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link PutTemplateRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private Map aliases; - @Nullable - private Boolean create; - + private Time clusterManagerTimeout; @Nullable - private Boolean flatSettings; - + private Boolean create; @Nullable private List indexPatterns; - @Nullable private TypeMapping mappings; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - private String name; - @Nullable private Integer order; - @Nullable private Map settings; - - @Nullable - private Time timeout; - @Nullable private Long version; + public Builder() {} + + private Builder(PutTemplateRequest o) { + this.aliases = _mapCopy(o.aliases); + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.create = o.create; + this.indexPatterns = _listCopy(o.indexPatterns); + this.mappings = o.mappings; + this.masterTimeout = o.masterTimeout; + this.name = o.name; + this.order = o.order; + this.settings = _mapCopy(o.settings); + this.version = o.version; + } + + private Builder(Builder o) { + this.aliases = _mapCopy(o.aliases); + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.create = o.create; + this.indexPatterns = _listCopy(o.indexPatterns); + this.mappings = o.mappings; + this.masterTimeout = o.masterTimeout; + this.name = o.name; + this.order = o.order; + this.settings = _mapCopy(o.settings); + this.version = o.version; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Aliases for the index. *

* API name: {@code aliases} + *

+ * *

- * Adds all entries of map to aliases. + * Adds all elements of map to aliases. + *

*/ + @Nonnull public final Builder aliases(Map map) { this.aliases = _mapPutAll(this.aliases, map); return this; @@ -360,9 +384,13 @@ public final Builder aliases(Map map) { * Aliases for the index. *

* API name: {@code aliases} + *

+ * *

* Adds an entry to aliases. + *

*/ + @Nonnull public final Builder aliases(String key, Alias value) { this.aliases = _mapPut(this.aliases, key, value); return this; @@ -372,139 +400,153 @@ public final Builder aliases(String key, Alias value) { * Aliases for the index. *

* API name: {@code aliases} + *

+ * *

- * Adds an entry to aliases using a builder lambda. + * Adds a value to aliases using a builder lambda. + *

*/ + @Nonnull public final Builder aliases(String key, Function> fn) { return aliases(key, fn.apply(new Alias.Builder()).build()); } /** - * If true, this request cannot replace or update existing index templates. + * Operation timeout for connection to cluster-manager node. *

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

*/ - public final Builder create(@Nullable Boolean value) { - this.create = value; + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; return this; } /** - * API name: {@code flat_settings} + * Operation timeout for connection to cluster-manager node. + *

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

*/ - public final Builder flatSettings(@Nullable Boolean value) { - this.flatSettings = value; + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * If true, this request cannot replace or update existing index templates. + *

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

+ */ + @Nonnull + public final Builder create(@Nullable Boolean value) { + this.create = value; return this; } /** - * Array of wildcard expressions used to match the names of indices during - * creation. + * Array of wildcard expressions used to match the names of indexes during creation. *

* API name: {@code index_patterns} + *

+ * *

* Adds all elements of list to indexPatterns. + *

*/ + @Nonnull public final Builder indexPatterns(List list) { this.indexPatterns = _listAddAll(this.indexPatterns, list); return this; } /** - * Array of wildcard expressions used to match the names of indices during - * creation. + * Array of wildcard expressions used to match the names of indexes during creation. *

* API name: {@code index_patterns} + *

+ * *

* Adds one or more values to indexPatterns. + *

*/ + @Nonnull public final Builder indexPatterns(String value, String... values) { this.indexPatterns = _listAdd(this.indexPatterns, value, values); return this; } /** - * Mapping for fields in the index. - *

* API name: {@code mappings} */ + @Nonnull public final Builder mappings(@Nullable TypeMapping value) { this.mappings = value; return this; } /** - * Mapping for fields in the index. - *

* API name: {@code mappings} */ + @Nonnull public final Builder mappings(Function> fn) { - return this.mappings(fn.apply(new TypeMapping.Builder()).build()); + return mappings(fn.apply(new TypeMapping.Builder()).build()); } /** - * Period to wait for a connection to the master node. If no response is - * received before the timeout expires, the request fails and returns an error. + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(@Nullable Time value) { this.masterTimeout = value; return this; } /** - * Period to wait for a connection to the master node. If no response is - * received before the timeout expires, the request fails and returns an error. + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated + @Nonnull public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Period to wait for a connection to the cluster-manager node. If no response is - * received before the timeout expires, the request fails and returns an error. - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; - return this; - } - - /** - * Period to wait for a connection to the cluster-manager node. If no response is - * received before the timeout expires, the request fails and returns an error. - *

- * API name: {@code cluster_manager_timeout} - */ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** * Required - The name of the template *

* API name: {@code name} + *

*/ + @Nonnull public final Builder name(String value) { this.name = value; return this; } /** - * Order in which OpenSearch applies this template if index matches multiple - * templates. *

- * Templates with lower 'order' values are merged first. Templates with higher - * 'order' values are merged later, overriding templates with lower values. + * Order in which OpenSearch applies this template if index matches multiple templates. + *

+ *

+ * Templates with lower 'order' values are merged first. Templates with higher 'order' values are merged later, overriding templates + * with lower values. + *

*

* API name: {@code order} + *

*/ + @Nonnull public final Builder order(@Nullable Integer value) { this.order = value; return this; @@ -514,9 +556,13 @@ public final Builder order(@Nullable Integer value) { * Configuration options for the index. *

* API name: {@code settings} + *

+ * *

- * Adds all entries of map to settings. + * Adds all elements of map to settings. + *

*/ + @Nonnull public final Builder settings(Map map) { this.settings = _mapPutAll(this.settings, map); return this; @@ -526,35 +572,22 @@ public final Builder settings(Map map) { * Configuration options for the index. *

* API name: {@code settings} + *

+ * *

* Adds an entry to settings. + *

*/ + @Nonnull public final Builder settings(String key, JsonData value) { this.settings = _mapPut(this.settings, key, value); return this; } /** - * API name: {@code timeout} - */ - public final Builder timeout(@Nullable Time value) { - this.timeout = value; - return this; - } - - /** - * API name: {@code timeout} - */ - public final Builder timeout(Function> fn) { - return this.timeout(fn.apply(new Time.Builder()).build()); - } - - /** - * Version number used to manage index templates externally. This number is not - * automatically generated by OpenSearch. - *

* API name: {@code version} */ + @Nonnull public final Builder version(@Nullable Long value) { this.version = value; return this; @@ -563,9 +596,10 @@ public final Builder version(@Nullable Long value) { /** * Builds a {@link PutTemplateRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public PutTemplateRequest build() { _checkSingleUse(); @@ -584,16 +618,13 @@ public PutTemplateRequest build() { ); protected static void setupPutTemplateRequestDeserializer(ObjectDeserializer op) { - op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(Alias._DESERIALIZER), "aliases"); - op.add(Builder::create, JsonpDeserializer.booleanDeserializer(), "create"); op.add(Builder::indexPatterns, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "index_patterns"); op.add(Builder::mappings, TypeMapping._DESERIALIZER, "mappings"); op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); op.add(Builder::order, JsonpDeserializer.integerDeserializer(), "order"); op.add(Builder::settings, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "settings"); op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); - } // --------------------------------------------------------------------------------------------- @@ -602,55 +633,64 @@ protected static void setupPutTemplateRequestDeserializer(ObjectDeserializer _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "PUT"; - - }, - + request -> "PUT", // Request path request -> { - final int _name = 1 << 0; - - int propsSet = 0; - - propsSet |= _name; - - if (propsSet == (_name)) { - StringBuilder buf = new StringBuilder(); - buf.append("/_template"); - buf.append("/"); - SimpleEndpoint.pathEncode(request.name, buf); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/_template/"); + SimpleEndpoint.pathEncode(request.name, buf); + return buf.toString(); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); - } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); } - if (request.flatSettings != null) { - params.put("flat_settings", String.valueOf(request.flatSettings)); - } if (request.create != null) { params.put("create", String.valueOf(request.create)); } - if (request.timeout != null) { - params.put("timeout", request.timeout._toJsonString()); + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); } return params; - }, SimpleEndpoint.emptyMap(), true, PutTemplateResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.aliases); + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.create); + result = 31 * result + Objects.hashCode(this.indexPatterns); + result = 31 * result + Objects.hashCode(this.mappings); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + this.name.hashCode(); + result = 31 * result + Objects.hashCode(this.order); + result = 31 * result + Objects.hashCode(this.settings); + result = 31 * result + Objects.hashCode(this.version); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + PutTemplateRequest other = (PutTemplateRequest) o; + return Objects.equals(this.aliases, other.aliases) + && Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.create, other.create) + && Objects.equals(this.indexPatterns, other.indexPatterns) + && Objects.equals(this.mappings, other.mappings) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && this.name.equals(other.name) + && Objects.equals(this.order, other.order) + && Objects.equals(this.settings, other.settings) + && Objects.equals(this.version, other.version); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutTemplateResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutTemplateResponse.java similarity index 62% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/PutTemplateResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutTemplateResponse.java index 0a278cc917..374a94d152 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutTemplateResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/PutTemplateResponse.java @@ -30,39 +30,80 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.opensearch._types.AcknowledgedResponseBase; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.put_template.Response @JsonpDeserializable -public class PutTemplateResponse extends AcknowledgedResponseBase { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class PutTemplateResponse extends AcknowledgedResponseBase + implements + ToCopyableBuilder { + // --------------------------------------------------------------------------------------------- private PutTemplateResponse(Builder builder) { super(builder); - } - public static PutTemplateResponse of(Function> fn) { + public static PutTemplateResponse of(Function> fn) { return fn.apply(new Builder()).build(); } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link PutTemplateResponse}. */ + public static class Builder extends AcknowledgedResponseBase.AbstractBuilder + implements + CopyableBuilder { + + public Builder() {} + + private Builder(PutTemplateResponse o) { + super(o); + } + + private Builder(Builder o) { + super(o); + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } - public static class Builder extends AcknowledgedResponseBase.AbstractBuilder implements ObjectBuilder { @Override + @Nonnull protected Builder self() { return this; } @@ -70,9 +111,10 @@ protected Builder self() { /** * Builds a {@link PutTemplateResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public PutTemplateResponse build() { _checkSingleUse(); @@ -91,8 +133,22 @@ public PutTemplateResponse build() { ); protected static void setupPutTemplateResponseDeserializer(ObjectDeserializer op) { - AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); + setupAcknowledgedResponseBaseDeserializer(op); + } + @Override + public int hashCode() { + int result = super.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + return true; + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/SimulateTemplateRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/SimulateTemplateRequest.java similarity index 58% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/SimulateTemplateRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/SimulateTemplateRequest.java index 68e3b23fce..b54b27bcd8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/SimulateTemplateRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/SimulateTemplateRequest.java @@ -30,12 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.HashMap; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -47,17 +54,29 @@ import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.endpoints.SimpleEndpoint; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.simulate_template.Request /** - * Simulate resolving the given template name or body - * + * Simulate resolving the given template name or body. */ @JsonpDeserializable -public class SimulateTemplateRequest extends RequestBase implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SimulateTemplateRequest extends RequestBase + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nullable + private final String cause; + + @Nullable + private final Time clusterManagerTimeout; + @Nullable private final Boolean create; @@ -65,37 +84,56 @@ public class SimulateTemplateRequest extends RequestBase implements PlainJsonSer @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - @Nullable private final String name; + @Nonnull private final IndexTemplate template; // --------------------------------------------------------------------------------------------- private SimulateTemplateRequest(Builder builder) { - + this.cause = builder.cause; + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.create = builder.create; this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.name = builder.name; this.template = ApiTypeHelper.requireNonNull(builder.template, this, "template"); - } - public static SimulateTemplateRequest of(Function> fn) { + public static SimulateTemplateRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * If true, the template passed in the body is only used if no existing - * templates match the same index patterns. If false, the simulation uses the - * template with the highest priority. Note that the template is not permanently - * added or updated in either case; it is only used for the simulation. + * User defined reason for dry-run creating the new template for simulation purposes. + *

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

+ */ + @Nullable + public final String cause() { + return this.cause; + } + + /** + * Operation timeout for connection to cluster-manager node. + *

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

+ */ + @Nullable + public final Time clusterManagerTimeout() { + return this.clusterManagerTimeout; + } + + /** + * If true, the template passed in the body is only used if no existing templates match the same index patterns. If + * false, the simulation uses the template with the highest priority. Note that the template is not permanently added or + * updated in either case; it is only used for the simulation. *

* API name: {@code create} + *

*/ @Nullable public final Boolean create() { @@ -103,10 +141,11 @@ public final Boolean create() { } /** - * Period to wait for a connection to the master node. If no response is - * received before the timeout expires, the request fails and returns an error. + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request fails + * and returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -115,22 +154,11 @@ public final Time masterTimeout() { } /** - * Period to wait for a connection to the cluster-manager node. If no response is - * received before the timeout expires, the request fails and returns an error. - *

- * API name: {@code cluster_manager_timeout} - */ - @Nullable - public final Time clusterManagerTimeout() { - return this.clusterManagerTimeout; - } - - /** - * Name of the index template to simulate. To test a template configuration - * before you add it to the cluster, omit this parameter and specify the - * template configuration in the request body. + * Name of the index template to simulate. To test a template configuration before you add it to the cluster, omit this parameter and + * specify the template configuration in the request body. *

* API name: {@code name} + *

*/ @Nullable public final String name() { @@ -139,9 +167,8 @@ public final String name() { /** * Required - Request body. - *

- * API name: {@code _value_body} */ + @Nonnull public final IndexTemplate template() { return this.template; } @@ -149,97 +176,150 @@ public final IndexTemplate template() { /** * Serialize this value to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { this.template.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link SimulateTemplateRequest}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private String cause; + @Nullable + private Time clusterManagerTimeout; @Nullable private Boolean create; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - @Nullable private String name; - private IndexTemplate template; + public Builder() {} + + private Builder(SimulateTemplateRequest o) { + this.cause = o.cause; + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.create = o.create; + this.masterTimeout = o.masterTimeout; + this.name = o.name; + this.template = o.template; + } + + private Builder(Builder o) { + this.cause = o.cause; + this.clusterManagerTimeout = o.clusterManagerTimeout; + this.create = o.create; + this.masterTimeout = o.masterTimeout; + this.name = o.name; + this.template = o.template; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** - * If true, the template passed in the body is only used if no existing - * templates match the same index patterns. If false, the simulation uses the - * template with the highest priority. Note that the template is not permanently - * added or updated in either case; it is only used for the simulation. + * User defined reason for dry-run creating the new template for simulation purposes. *

- * API name: {@code create} + * API name: {@code cause} + *

*/ - public final Builder create(@Nullable Boolean value) { - this.create = value; + @Nonnull + public final Builder cause(@Nullable String value) { + this.cause = value; return this; } /** - * Period to wait for a connection to the master node. If no response is - * received before the timeout expires, the request fails and returns an error. + * Operation timeout for connection to cluster-manager node. *

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

*/ - @Deprecated - public final Builder masterTimeout(@Nullable Time value) { - this.masterTimeout = value; + @Nonnull + public final Builder clusterManagerTimeout(@Nullable Time value) { + this.clusterManagerTimeout = value; return this; } /** - * Period to wait for a connection to the master node. If no response is - * received before the timeout expires, the request fails and returns an error. + * Operation timeout for connection to cluster-manager node. *

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

*/ - @Deprecated - public final Builder masterTimeout(Function> fn) { - return this.masterTimeout(fn.apply(new Time.Builder()).build()); + @Nonnull + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); } /** - * Period to wait for a connection to the cluster-manager node. If no response is - * received before the timeout expires, the request fails and returns an error. + * If true, the template passed in the body is only used if no existing templates match the same index patterns. If + * false, the simulation uses the template with the highest priority. Note that the template is not permanently added + * or updated in either case; it is only used for the simulation. *

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

*/ - public final Builder clusterManagerTimeout(@Nullable Time value) { - this.clusterManagerTimeout = value; + @Nonnull + public final Builder create(@Nullable Boolean value) { + this.create = value; return this; } /** - * Period to wait for a connection to the cluster-manager node. If no response is - * received before the timeout expires, the request fails and returns an error. + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. *

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

*/ - public final Builder clusterManagerTimeout(Function> fn) { - return this.clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + @Deprecated + @Nonnull + public final Builder masterTimeout(@Nullable Time value) { + this.masterTimeout = value; + return this; + } + + /** + * Period to wait for a connection to the cluster-manager node. If no response is received before the timeout expires, the request + * fails and returns an error. + *

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

+ */ + @Deprecated + @Nonnull + public final Builder masterTimeout(Function> fn) { + return masterTimeout(fn.apply(new Time.Builder()).build()); } /** - * Name of the index template to simulate. To test a template configuration - * before you add it to the cluster, omit this parameter and specify the - * template configuration in the request body. + * Name of the index template to simulate. To test a template configuration before you add it to the cluster, omit this parameter + * and specify the template configuration in the request body. *

* API name: {@code name} + *

*/ + @Nonnull public final Builder name(@Nullable String value) { this.name = value; return this; @@ -247,9 +327,8 @@ public final Builder name(@Nullable String value) { /** * Required - Request body. - *

- * API name: {@code _value_body} */ + @Nonnull public final Builder template(IndexTemplate value) { this.template = value; return this; @@ -257,19 +336,19 @@ public final Builder template(IndexTemplate value) { /** * Required - Request body. - *

- * API name: {@code _value_body} */ + @Nonnull public final Builder template(Function> fn) { - return this.template(fn.apply(new IndexTemplate.Builder()).build()); + return template(fn.apply(new IndexTemplate.Builder()).build()); } /** * Builds a {@link SimulateTemplateRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public SimulateTemplateRequest build() { _checkSingleUse(); @@ -277,12 +356,12 @@ public SimulateTemplateRequest build() { } } + // --------------------------------------------------------------------------------------------- + public static final JsonpDeserializer _DESERIALIZER = createSimulateTemplateRequestDeserializer(); protected static JsonpDeserializer createSimulateTemplateRequestDeserializer() { - JsonpDeserializer valueDeserializer = IndexTemplate._DESERIALIZER; - return JsonpDeserializer.of( valueDeserializer.acceptedEvents(), (parser, mapper) -> new Builder().template(valueDeserializer.deserialize(parser, mapper)).build() @@ -295,13 +374,8 @@ protected static JsonpDeserializer createSimulateTempla * Endpoint "{@code indices.simulate_template}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "POST"; - - }, - + request -> "POST", // Request path request -> { final int _name = 1 << 0; @@ -311,28 +385,22 @@ protected static JsonpDeserializer createSimulateTempla if (request.name() != null) propsSet |= _name; if (propsSet == 0) { - StringBuilder buf = new StringBuilder(); - buf.append("/_index_template"); - buf.append("/_simulate"); - return buf.toString(); + return "/_index_template/_simulate"; } if (propsSet == (_name)) { StringBuilder buf = new StringBuilder(); - buf.append("/_index_template"); - buf.append("/_simulate"); - buf.append("/"); + buf.append("/_index_template/_simulate/"); SimpleEndpoint.pathEncode(request.name, buf); return buf.toString(); } - throw SimpleEndpoint.noPathTemplateFound("path"); + throw SimpleEndpoint.noPathTemplateFound("path"); }, - // Request parameters request -> { Map params = new HashMap<>(); - if (request.masterTimeout != null) { - params.put("master_timeout", request.masterTimeout._toJsonString()); + if (request.cause != null) { + params.put("cause", request.cause); } if (request.clusterManagerTimeout != null) { params.put("cluster_manager_timeout", request.clusterManagerTimeout._toJsonString()); @@ -340,11 +408,38 @@ protected static JsonpDeserializer createSimulateTempla if (request.create != null) { params.put("create", String.valueOf(request.create)); } + if (request.masterTimeout != null) { + params.put("master_timeout", request.masterTimeout._toJsonString()); + } return params; - }, SimpleEndpoint.emptyMap(), true, SimulateTemplateResponse._DESERIALIZER ); + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.cause); + result = 31 * result + Objects.hashCode(this.clusterManagerTimeout); + result = 31 * result + Objects.hashCode(this.create); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.name); + result = 31 * result + this.template.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SimulateTemplateRequest other = (SimulateTemplateRequest) o; + return Objects.equals(this.cause, other.cause) + && Objects.equals(this.clusterManagerTimeout, other.clusterManagerTimeout) + && Objects.equals(this.create, other.create) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.name, other.name) + && this.template.equals(other.template); + } } diff --git a/java-client/src/generated/java/org/opensearch/client/opensearch/indices/SimulateTemplateResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/SimulateTemplateResponse.java new file mode 100644 index 0000000000..2960276088 --- /dev/null +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/SimulateTemplateResponse.java @@ -0,0 +1,264 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * The OpenSearch Contributors require contributions made to + * this file be licensed under the Apache-2.0 license or a + * compatible open source license. + */ + +/* + * Licensed to Elasticsearch B.V. under one or more contributor + * license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright + * ownership. Elasticsearch B.V. licenses this file to you under + * the Apache License, Version 2.0 (the "License"); you may + * not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Modifications Copyright OpenSearch Contributors. See + * GitHub history for details. + */ + +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + +package org.opensearch.client.opensearch.indices; + +import jakarta.json.stream.JsonGenerator; +import java.util.List; +import java.util.Objects; +import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.json.PlainJsonSerializable; +import org.opensearch.client.opensearch.indices.simulate_template.Overlapping; +import org.opensearch.client.opensearch.indices.simulate_template.Template; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; + +// typedef: indices.simulate_template.Response + +@JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class SimulateTemplateResponse + implements + PlainJsonSerializable, + ToCopyableBuilder { + + @Nonnull + private final List overlapping; + + @Nonnull + private final Template template; + + // --------------------------------------------------------------------------------------------- + + private SimulateTemplateResponse(Builder builder) { + this.overlapping = ApiTypeHelper.unmodifiable(builder.overlapping); + this.template = ApiTypeHelper.requireNonNull(builder.template, this, "template"); + } + + public static SimulateTemplateResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * API name: {@code overlapping} + */ + @Nonnull + public final List overlapping() { + return this.overlapping; + } + + /** + * Required - API name: {@code template} + */ + @Nonnull + public final Template template() { + return this.template; + } + + /** + * Serialize this object to JSON. + */ + @Override + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + if (ApiTypeHelper.isDefined(this.overlapping)) { + generator.writeKey("overlapping"); + generator.writeStartArray(); + for (Overlapping item0 : this.overlapping) { + item0.serialize(generator, mapper); + } + generator.writeEnd(); + } + + generator.writeKey("template"); + this.template.serialize(generator, mapper); + } + + // --------------------------------------------------------------------------------------------- + + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + + /** + * Builder for {@link SimulateTemplateResponse}. + */ + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + @Nullable + private List overlapping; + private Template template; + + public Builder() {} + + private Builder(SimulateTemplateResponse o) { + this.overlapping = _listCopy(o.overlapping); + this.template = o.template; + } + + private Builder(Builder o) { + this.overlapping = _listCopy(o.overlapping); + this.template = o.template; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + + /** + * API name: {@code overlapping} + * + *

+ * Adds all elements of list to overlapping. + *

+ */ + @Nonnull + public final Builder overlapping(List list) { + this.overlapping = _listAddAll(this.overlapping, list); + return this; + } + + /** + * API name: {@code overlapping} + * + *

+ * Adds one or more values to overlapping. + *

+ */ + @Nonnull + public final Builder overlapping(Overlapping value, Overlapping... values) { + this.overlapping = _listAdd(this.overlapping, value, values); + return this; + } + + /** + * API name: {@code overlapping} + * + *

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

+ */ + @Nonnull + public final Builder overlapping(Function> fn) { + return overlapping(fn.apply(new Overlapping.Builder()).build()); + } + + /** + * Required - API name: {@code template} + */ + @Nonnull + public final Builder template(Template value) { + this.template = value; + return this; + } + + /** + * Required - API name: {@code template} + */ + @Nonnull + public final Builder template(Function> fn) { + return template(fn.apply(new Template.Builder()).build()); + } + + /** + * Builds a {@link SimulateTemplateResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + @Override + @Nonnull + public SimulateTemplateResponse build() { + _checkSingleUse(); + + return new SimulateTemplateResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link SimulateTemplateResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy( + Builder::new, + SimulateTemplateResponse::setupSimulateTemplateResponseDeserializer + ); + + protected static void setupSimulateTemplateResponseDeserializer(ObjectDeserializer op) { + op.add(Builder::overlapping, JsonpDeserializer.arrayDeserializer(Overlapping._DESERIALIZER), "overlapping"); + op.add(Builder::template, Template._DESERIALIZER, "template"); + } + + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.overlapping); + result = 31 * result + this.template.hashCode(); + return result; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + SimulateTemplateResponse other = (SimulateTemplateResponse) o; + return Objects.equals(this.overlapping, other.overlapping) && this.template.equals(other.template); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/TemplateMapping.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/TemplateMapping.java similarity index 67% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/TemplateMapping.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/TemplateMapping.java index ceb905e844..c0d6c616c4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/TemplateMapping.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/TemplateMapping.java @@ -30,12 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonData; import org.opensearch.client.json.JsonpDeserializable; @@ -46,21 +53,29 @@ import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.mapping.TypeMapping; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; -// typedef: indices._types.TemplateMapping +// typedef: indices.TemplateMapping @JsonpDeserializable -public class TemplateMapping implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class TemplateMapping implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final Map aliases; + @Nonnull private final List indexPatterns; + @Nonnull private final TypeMapping mappings; private final int order; + @Nonnull private final Map settings; @Nullable @@ -69,23 +84,22 @@ public class TemplateMapping implements PlainJsonSerializable { // --------------------------------------------------------------------------------------------- private TemplateMapping(Builder builder) { - this.aliases = ApiTypeHelper.unmodifiableRequired(builder.aliases, this, "aliases"); this.indexPatterns = ApiTypeHelper.unmodifiableRequired(builder.indexPatterns, this, "indexPatterns"); this.mappings = ApiTypeHelper.requireNonNull(builder.mappings, this, "mappings"); this.order = ApiTypeHelper.requireNonNull(builder.order, this, "order"); this.settings = ApiTypeHelper.unmodifiableRequired(builder.settings, this, "settings"); this.version = builder.version; - } - public static TemplateMapping of(Function> fn) { + public static TemplateMapping of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code aliases} */ + @Nonnull public final Map aliases() { return this.aliases; } @@ -93,6 +107,7 @@ public final Map aliases() { /** * Required - API name: {@code index_patterns} */ + @Nonnull public final List indexPatterns() { return this.indexPatterns; } @@ -100,6 +115,7 @@ public final List indexPatterns() { /** * Required - API name: {@code mappings} */ + @Nonnull public final TypeMapping mappings() { return this.mappings; } @@ -114,6 +130,7 @@ public final int order() { /** * Required - API name: {@code settings} */ + @Nonnull public final Map settings() { return this.settings; } @@ -129,6 +146,7 @@ public final Long version() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -136,78 +154,100 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.aliases)) { - generator.writeKey("aliases"); - generator.writeStartObject(); - for (Map.Entry item0 : this.aliases.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("aliases"); + generator.writeStartObject(); + for (Map.Entry item0 : this.aliases.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); } - if (ApiTypeHelper.isDefined(this.indexPatterns)) { - generator.writeKey("index_patterns"); - generator.writeStartArray(); - for (String item0 : this.indexPatterns) { - generator.write(item0); - - } - generator.writeEnd(); + generator.writeEnd(); + generator.writeKey("index_patterns"); + generator.writeStartArray(); + for (String item0 : this.indexPatterns) { + generator.write(item0); } + generator.writeEnd(); + generator.writeKey("mappings"); this.mappings.serialize(generator, mapper); generator.writeKey("order"); generator.write(this.order); - if (ApiTypeHelper.isDefined(this.settings)) { - generator.writeKey("settings"); - generator.writeStartObject(); - for (Map.Entry item0 : this.settings.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("settings"); + generator.writeStartObject(); + for (Map.Entry item0 : this.settings.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); } + generator.writeEnd(); + if (this.version != null) { generator.writeKey("version"); generator.write(this.version); - } - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link TemplateMapping}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { private Map aliases; - private List indexPatterns; - private TypeMapping mappings; - private Integer order; - private Map settings; - @Nullable private Long version; + public Builder() {} + + private Builder(TemplateMapping o) { + this.aliases = _mapCopy(o.aliases); + this.indexPatterns = _listCopy(o.indexPatterns); + this.mappings = o.mappings; + this.order = o.order; + this.settings = _mapCopy(o.settings); + this.version = o.version; + } + + private Builder(Builder o) { + this.aliases = _mapCopy(o.aliases); + this.indexPatterns = _listCopy(o.indexPatterns); + this.mappings = o.mappings; + this.order = o.order; + this.settings = _mapCopy(o.settings); + this.version = o.version; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * Required - API name: {@code aliases} + * *

- * Adds all entries of map to aliases. + * Adds all elements of map to aliases. + *

*/ + @Nonnull public final Builder aliases(Map map) { this.aliases = _mapPutAll(this.aliases, map); return this; @@ -215,9 +255,12 @@ public final Builder aliases(Map map) { /** * Required - API name: {@code aliases} + * *

* Adds an entry to aliases. + *

*/ + @Nonnull public final Builder aliases(String key, Alias value) { this.aliases = _mapPut(this.aliases, key, value); return this; @@ -225,18 +268,24 @@ public final Builder aliases(String key, Alias value) { /** * Required - API name: {@code aliases} + * *

- * Adds an entry to aliases using a builder lambda. + * Adds a value to aliases using a builder lambda. + *

*/ + @Nonnull public final Builder aliases(String key, Function> fn) { return aliases(key, fn.apply(new Alias.Builder()).build()); } /** * Required - API name: {@code index_patterns} + * *

* Adds all elements of list to indexPatterns. + *

*/ + @Nonnull public final Builder indexPatterns(List list) { this.indexPatterns = _listAddAll(this.indexPatterns, list); return this; @@ -244,9 +293,12 @@ public final Builder indexPatterns(List list) { /** * Required - API name: {@code index_patterns} + * *

* Adds one or more values to indexPatterns. + *

*/ + @Nonnull public final Builder indexPatterns(String value, String... values) { this.indexPatterns = _listAdd(this.indexPatterns, value, values); return this; @@ -255,6 +307,7 @@ public final Builder indexPatterns(String value, String... values) { /** * Required - API name: {@code mappings} */ + @Nonnull public final Builder mappings(TypeMapping value) { this.mappings = value; return this; @@ -263,13 +316,15 @@ public final Builder mappings(TypeMapping value) { /** * Required - API name: {@code mappings} */ + @Nonnull public final Builder mappings(Function> fn) { - return this.mappings(fn.apply(new TypeMapping.Builder()).build()); + return mappings(fn.apply(new TypeMapping.Builder()).build()); } /** * Required - API name: {@code order} */ + @Nonnull public final Builder order(int value) { this.order = value; return this; @@ -277,9 +332,12 @@ public final Builder order(int value) { /** * Required - API name: {@code settings} + * *

- * Adds all entries of map to settings. + * Adds all elements of map to settings. + *

*/ + @Nonnull public final Builder settings(Map map) { this.settings = _mapPutAll(this.settings, map); return this; @@ -287,9 +345,12 @@ public final Builder settings(Map map) { /** * Required - API name: {@code settings} + * *

* Adds an entry to settings. + *

*/ + @Nonnull public final Builder settings(String key, JsonData value) { this.settings = _mapPut(this.settings, key, value); return this; @@ -298,6 +359,7 @@ public final Builder settings(String key, JsonData value) { /** * API name: {@code version} */ + @Nonnull public final Builder version(@Nullable Long value) { this.version = value; return this; @@ -306,9 +368,10 @@ public final Builder version(@Nullable Long value) { /** * Builds a {@link TemplateMapping}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public TemplateMapping build() { _checkSingleUse(); @@ -327,14 +390,36 @@ public TemplateMapping build() { ); protected static void setupTemplateMappingDeserializer(ObjectDeserializer op) { - op.add(Builder::aliases, JsonpDeserializer.stringMapDeserializer(Alias._DESERIALIZER), "aliases"); op.add(Builder::indexPatterns, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "index_patterns"); op.add(Builder::mappings, TypeMapping._DESERIALIZER, "mappings"); op.add(Builder::order, JsonpDeserializer.integerDeserializer(), "order"); op.add(Builder::settings, JsonpDeserializer.stringMapDeserializer(JsonData._DESERIALIZER), "settings"); op.add(Builder::version, JsonpDeserializer.longDeserializer(), "version"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.aliases.hashCode(); + result = 31 * result + this.indexPatterns.hashCode(); + result = 31 * result + this.mappings.hashCode(); + result = 31 * result + Integer.hashCode(this.order); + result = 31 * result + this.settings.hashCode(); + result = 31 * result + Objects.hashCode(this.version); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + TemplateMapping other = (TemplateMapping) o; + return this.aliases.equals(other.aliases) + && this.indexPatterns.equals(other.indexPatterns) + && this.mappings.equals(other.mappings) + && this.order == other.order + && this.settings.equals(other.settings) + && Objects.equals(this.version, other.version); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/get_mapping/IndexMappingRecord.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/get_mapping/IndexMappingRecord.java similarity index 70% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/get_mapping/IndexMappingRecord.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/get_mapping/IndexMappingRecord.java index b7ccf034a9..2fb7e52511 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/get_mapping/IndexMappingRecord.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/get_mapping/IndexMappingRecord.java @@ -30,10 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.get_mapping; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; @@ -43,28 +50,31 @@ import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.mapping.TypeMapping; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.get_mapping.IndexMappingRecord @JsonpDeserializable -public class IndexMappingRecord implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class IndexMappingRecord implements PlainJsonSerializable, ToCopyableBuilder { + @Nullable private final TypeMapping item; + @Nonnull private final TypeMapping mappings; // --------------------------------------------------------------------------------------------- private IndexMappingRecord(Builder builder) { - this.item = builder.item; this.mappings = ApiTypeHelper.requireNonNull(builder.mappings, this, "mappings"); - } - public static IndexMappingRecord of(Function> fn) { + public static IndexMappingRecord of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -79,6 +89,7 @@ public final TypeMapping item() { /** * Required - API name: {@code mappings} */ + @Nonnull public final TypeMapping mappings() { return this.mappings; } @@ -86,6 +97,7 @@ public final TypeMapping mappings() { /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -93,32 +105,58 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (this.item != null) { generator.writeKey("item"); this.item.serialize(generator, mapper); - } + generator.writeKey("mappings"); this.mappings.serialize(generator, mapper); - } // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); + } + + @Nonnull + public static Builder builder() { + return new Builder(); + } + /** * Builder for {@link IndexMappingRecord}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { @Nullable private TypeMapping item; - private TypeMapping mappings; + public Builder() {} + + private Builder(IndexMappingRecord o) { + this.item = o.item; + this.mappings = o.mappings; + } + + private Builder(Builder o) { + this.item = o.item; + this.mappings = o.mappings; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); + } + /** * API name: {@code item} */ + @Nonnull public final Builder item(@Nullable TypeMapping value) { this.item = value; return this; @@ -127,13 +165,15 @@ public final Builder item(@Nullable TypeMapping value) { /** * API name: {@code item} */ + @Nonnull public final Builder item(Function> fn) { - return this.item(fn.apply(new TypeMapping.Builder()).build()); + return item(fn.apply(new TypeMapping.Builder()).build()); } /** * Required - API name: {@code mappings} */ + @Nonnull public final Builder mappings(TypeMapping value) { this.mappings = value; return this; @@ -142,16 +182,18 @@ public final Builder mappings(TypeMapping value) { /** * Required - API name: {@code mappings} */ + @Nonnull public final Builder mappings(Function> fn) { - return this.mappings(fn.apply(new TypeMapping.Builder()).build()); + return mappings(fn.apply(new TypeMapping.Builder()).build()); } /** * Builds a {@link IndexMappingRecord}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public IndexMappingRecord build() { _checkSingleUse(); @@ -170,10 +212,23 @@ public IndexMappingRecord build() { ); protected static void setupIndexMappingRecordDeserializer(ObjectDeserializer op) { - op.add(Builder::item, TypeMapping._DESERIALIZER, "item"); op.add(Builder::mappings, TypeMapping._DESERIALIZER, "mappings"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + Objects.hashCode(this.item); + result = 31 * result + this.mappings.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + IndexMappingRecord other = (IndexMappingRecord) o; + return Objects.equals(this.item, other.item) && this.mappings.equals(other.mappings); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/simulate_template/Overlapping.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/simulate_template/Overlapping.java similarity index 69% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/simulate_template/Overlapping.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/simulate_template/Overlapping.java index e3261c3927..f17b3e5707 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/simulate_template/Overlapping.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/simulate_template/Overlapping.java @@ -30,11 +30,17 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.simulate_template; import jakarta.json.stream.JsonGenerator; import java.util.List; import java.util.function.Function; +import javax.annotation.Generated; +import javax.annotation.Nonnull; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -42,47 +48,54 @@ import org.opensearch.client.json.ObjectDeserializer; import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.simulate_template.Overlapping @JsonpDeserializable -public class Overlapping implements PlainJsonSerializable { - private final String name; +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Overlapping implements PlainJsonSerializable, ToCopyableBuilder { + @Nonnull private final List indexPatterns; + @Nonnull + private final String name; + // --------------------------------------------------------------------------------------------- private Overlapping(Builder builder) { - - this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); this.indexPatterns = ApiTypeHelper.unmodifiableRequired(builder.indexPatterns, this, "indexPatterns"); - + this.name = ApiTypeHelper.requireNonNull(builder.name, this, "name"); } - public static Overlapping of(Function> fn) { + public static Overlapping of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code name} + * Required - API name: {@code index_patterns} */ - public final String name() { - return this.name; + @Nonnull + public final List indexPatterns() { + return this.indexPatterns; } /** - * Required - API name: {@code index_patterns} + * Required - API name: {@code name} */ - public final List indexPatterns() { - return this.indexPatterns; + @Nonnull + public final String name() { + return this.name; } /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -90,47 +103,63 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + generator.writeKey("index_patterns"); + generator.writeStartArray(); + for (String item0 : this.indexPatterns) { + generator.write(item0); + } + generator.writeEnd(); generator.writeKey("name"); generator.write(this.name); + } - if (ApiTypeHelper.isDefined(this.indexPatterns)) { - generator.writeKey("index_patterns"); - generator.writeStartArray(); - for (String item0 : this.indexPatterns) { - generator.write(item0); - - } - generator.writeEnd(); - - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link Overlapping}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + public static class Builder extends ObjectBuilderBase implements CopyableBuilder { + private List indexPatterns; private String name; - private List indexPatterns; + public Builder() {} - /** - * Required - API name: {@code name} - */ - public final Builder name(String value) { - this.name = value; - return this; + private Builder(Overlapping o) { + this.indexPatterns = _listCopy(o.indexPatterns); + this.name = o.name; + } + + private Builder(Builder o) { + this.indexPatterns = _listCopy(o.indexPatterns); + this.name = o.name; + } + + @Override + @Nonnull + public Builder copy() { + return new Builder(this); } /** * Required - API name: {@code index_patterns} + * *

* Adds all elements of list to indexPatterns. + *

*/ + @Nonnull public final Builder indexPatterns(List list) { this.indexPatterns = _listAddAll(this.indexPatterns, list); return this; @@ -138,20 +167,33 @@ public final Builder indexPatterns(List list) { /** * Required - API name: {@code index_patterns} + * *

* Adds one or more values to indexPatterns. + *

*/ + @Nonnull public final Builder indexPatterns(String value, String... values) { this.indexPatterns = _listAdd(this.indexPatterns, value, values); return this; } + /** + * Required - API name: {@code name} + */ + @Nonnull + public final Builder name(String value) { + this.name = value; + return this; + } + /** * Builds a {@link Overlapping}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ + @Override + @Nonnull public Overlapping build() { _checkSingleUse(); @@ -170,10 +212,23 @@ public Overlapping build() { ); protected static void setupOverlappingDeserializer(ObjectDeserializer op) { - - op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); op.add(Builder::indexPatterns, JsonpDeserializer.arrayDeserializer(JsonpDeserializer.stringDeserializer()), "index_patterns"); + op.add(Builder::name, JsonpDeserializer.stringDeserializer(), "name"); + } + @Override + public int hashCode() { + int result = 17; + result = 31 * result + this.indexPatterns.hashCode(); + result = 31 * result + this.name.hashCode(); + return result; } + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + Overlapping other = (Overlapping) o; + return this.indexPatterns.equals(other.indexPatterns) && this.name.equals(other.name); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/simulate_template/Template.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/simulate_template/Template.java similarity index 55% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/simulate_template/Template.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/simulate_template/Template.java index 73b0a66b65..a34435f317 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/simulate_template/Template.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/simulate_template/Template.java @@ -30,13 +30,19 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch.indices.simulate_template; import jakarta.json.stream.JsonGenerator; -import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.function.Function; -import org.opensearch.client.json.JsonData; +import javax.annotation.Generated; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; import org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; @@ -45,47 +51,52 @@ import org.opensearch.client.json.PlainJsonSerializable; import org.opensearch.client.opensearch._types.mapping.TypeMapping; import org.opensearch.client.opensearch.indices.Alias; +import org.opensearch.client.opensearch.indices.IndexSettings; import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.CopyableBuilder; import org.opensearch.client.util.ObjectBuilder; import org.opensearch.client.util.ObjectBuilderBase; +import org.opensearch.client.util.ToCopyableBuilder; // typedef: indices.simulate_template.Template @JsonpDeserializable -public class Template implements PlainJsonSerializable { +@Generated("org.opensearch.client.codegen.CodeGenerator") +public class Template implements PlainJsonSerializable, ToCopyableBuilder { + + @Nonnull private final Map aliases; + @Nullable private final TypeMapping mappings; - private final Map settings; - - private final List overlapping; + @Nonnull + private final IndexSettings settings; // --------------------------------------------------------------------------------------------- private Template(Builder builder) { - this.aliases = ApiTypeHelper.unmodifiableRequired(builder.aliases, this, "aliases"); - this.mappings = ApiTypeHelper.requireNonNull(builder.mappings, this, "mappings"); - this.settings = ApiTypeHelper.unmodifiableRequired(builder.settings, this, "settings"); - this.overlapping = ApiTypeHelper.unmodifiableRequired(builder.overlapping, this, "overlapping"); - + this.mappings = builder.mappings; + this.settings = ApiTypeHelper.requireNonNull(builder.settings, this, "settings"); } - public static Template of(Function> fn) { + public static Template of(Function> fn) { return fn.apply(new Builder()).build(); } /** * Required - API name: {@code aliases} */ + @Nonnull public final Map aliases() { return this.aliases; } /** - * Required - API name: {@code mappings} + * API name: {@code mappings} */ + @Nullable public final TypeMapping mappings() { return this.mappings; } @@ -93,20 +104,15 @@ public final TypeMapping mappings() { /** * Required - API name: {@code settings} */ - public final Map settings() { + @Nonnull + public final IndexSettings settings() { return this.settings; } - /** - * Required - API name: {@code overlapping} - */ - public final List overlapping() { - return this.overlapping; - } - /** * Serialize this object to JSON. */ + @Override public void serialize(JsonGenerator generator, JsonpMapper mapper) { generator.writeStartObject(); serializeInternal(generator, mapper); @@ -114,65 +120,73 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - - if (ApiTypeHelper.isDefined(this.aliases)) { - generator.writeKey("aliases"); - generator.writeStartObject(); - for (Map.Entry item0 : this.aliases.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); - + generator.writeKey("aliases"); + generator.writeStartObject(); + for (Map.Entry item0 : this.aliases.entrySet()) { + generator.writeKey(item0.getKey()); + item0.getValue().serialize(generator, mapper); } - generator.writeKey("mappings"); - this.mappings.serialize(generator, mapper); - - if (ApiTypeHelper.isDefined(this.settings)) { - generator.writeKey("settings"); - generator.writeStartObject(); - for (Map.Entry item0 : this.settings.entrySet()) { - generator.writeKey(item0.getKey()); - item0.getValue().serialize(generator, mapper); - - } - generator.writeEnd(); + generator.writeEnd(); + if (this.mappings != null) { + generator.writeKey("mappings"); + this.mappings.serialize(generator, mapper); } - if (ApiTypeHelper.isDefined(this.overlapping)) { - generator.writeKey("overlapping"); - generator.writeStartArray(); - for (Overlapping item0 : this.overlapping) { - item0.serialize(generator, mapper); - } - generator.writeEnd(); + generator.writeKey("settings"); + this.settings.serialize(generator, mapper); + } - } + // --------------------------------------------------------------------------------------------- + @Override + @Nonnull + public Builder toBuilder() { + return new Builder(this); } - // --------------------------------------------------------------------------------------------- + @Nonnull + public static Builder builder() { + return new Builder(); + } /** * Builder for {@link Template}. */ - - public static class Builder extends ObjectBuilderBase implements ObjectBuilder