From ba10e9d3dfb416a3508741778c4978afa792350e Mon Sep 17 00:00:00 2001 From: Thomas Farr Date: Fri, 11 Oct 2024 11:40:11 +1300 Subject: [PATCH] Generate indices.delete Signed-off-by: Thomas Farr --- .../_types/IndicesResponseBase.java | 32 ++- .../indices/DeleteIndexRequest.java | 248 +++++++++++------- .../indices/DeleteIndexResponse.java | 29 +- .../OpenSearchIndicesAsyncClientBase.java | 19 ++ .../indices/OpenSearchIndicesClientBase.java | 19 ++ .../indices/OpenSearchIndicesAsyncClient.java | 32 --- .../indices/OpenSearchIndicesClient.java | 32 --- .../client/codegen/CodeGenerator.java | 2 +- .../client/codegen/model/RequestShape.java | 2 + 9 files changed, 236 insertions(+), 179 deletions(-) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/_types/IndicesResponseBase.java (77%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/DeleteIndexRequest.java (59%) rename java-client/src/{main => generated}/java/org/opensearch/client/opensearch/indices/DeleteIndexResponse.java (78%) diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/IndicesResponseBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/IndicesResponseBase.java similarity index 77% rename from java-client/src/main/java/org/opensearch/client/opensearch/_types/IndicesResponseBase.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/_types/IndicesResponseBase.java index ba251d885a..ac2e1f6955 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/_types/IndicesResponseBase.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/_types/IndicesResponseBase.java @@ -30,10 +30,16 @@ * GitHub history for details. */ +//---------------------------------------------------- +// THIS CODE IS GENERATED. MANUAL EDITS WILL BE LOST. +//---------------------------------------------------- + package org.opensearch.client.opensearch._types; import jakarta.json.stream.JsonGenerator; +import java.util.Objects; import java.util.function.Function; +import javax.annotation.Generated; import javax.annotation.Nullable; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.ObjectDeserializer; @@ -41,7 +47,9 @@ // typedef: _types.IndicesResponseBase +@Generated("org.opensearch.client.codegen.CodeGenerator") public abstract class IndicesResponseBase extends AcknowledgedResponseBase { + @Nullable private final ShardStatistics shards; @@ -49,9 +57,7 @@ public abstract class IndicesResponseBase extends AcknowledgedResponseBase { protected IndicesResponseBase(AbstractBuilder builder) { super(builder); - this.shards = builder.shards; - } /** @@ -63,16 +69,15 @@ public final ShardStatistics shards() { } protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - super.serializeInternal(generator, mapper); if (this.shards != null) { generator.writeKey("_shards"); this.shards.serialize(generator, mapper); - } - } + // --------------------------------------------------------------------------------------------- + protected abstract static class AbstractBuilder> extends AcknowledgedResponseBase.AbstractBuilder { @Nullable @@ -90,18 +95,33 @@ public final BuilderT shards(@Nullable ShardStatistics value) { * API name: {@code _shards} */ public final BuilderT shards(Function> fn) { - return this.shards(fn.apply(new ShardStatistics.Builder()).build()); + return shards(fn.apply(new ShardStatistics.Builder()).build()); } } // --------------------------------------------------------------------------------------------- + protected static > void setupIndicesResponseBaseDeserializer( ObjectDeserializer op ) { setupAcknowledgedResponseBaseDeserializer(op); op.add(AbstractBuilder::shards, ShardStatistics._DESERIALIZER, "_shards"); + } + public int hashCode() { + int result = super.hashCode(); + result = 31 * result + Objects.hashCode(this.shards); + return result; } + 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; + IndicesResponseBase other = (IndicesResponseBase) o; + return Objects.equals(this.shards, other.shards); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteIndexRequest.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DeleteIndexRequest.java similarity index 59% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteIndexRequest.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/DeleteIndexRequest.java index c3f7bf09db..074b697f02 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteIndexRequest.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DeleteIndexRequest.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; @@ -52,53 +59,54 @@ /** * Deletes an index. - * */ - +@Generated("org.opensearch.client.codegen.CodeGenerator") public class DeleteIndexRequest 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; @Deprecated @Nullable private final Time masterTimeout; - @Nullable - private final Time clusterManagerTimeout; - @Nullable private final Time timeout; // --------------------------------------------------------------------------------------------- private DeleteIndexRequest(Builder builder) { - this.allowNoIndices = builder.allowNoIndices; + this.clusterManagerTimeout = builder.clusterManagerTimeout; this.expandWildcards = ApiTypeHelper.unmodifiable(builder.expandWildcards); this.ignoreUnavailable = builder.ignoreUnavailable; this.index = ApiTypeHelper.unmodifiableRequired(builder.index, this, "index"); this.masterTimeout = builder.masterTimeout; - this.clusterManagerTimeout = builder.clusterManagerTimeout; this.timeout = builder.timeout; - } - public static DeleteIndexRequest of(Function> fn) { + public static DeleteIndexRequest of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Ignore if a wildcard expression resolves to no concrete indices (default: - * false) + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets only + * missing or closed indices. This behavior applies even if the request targets other open indices. *

* API name: {@code allow_no_indices} + *

*/ @Nullable public final Boolean allowNoIndices() { @@ -106,19 +114,34 @@ public final Boolean allowNoIndices() { } /** - * Whether wildcard expressions should get expanded to open, closed, or hidden - * indices + * 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; } /** - * Ignore unavailable indexes (default: false) + * 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() { @@ -126,19 +149,24 @@ public final Boolean ignoreUnavailable() { } /** - * Required - A comma-separated list of indices to delete; use _all - * or * string to delete all indices + * Required - Comma-separated list of indices to delete. You cannot specify index aliases. By default, this parameter does not support + * wildcards (*) or _all. To use wildcards or _all, set the + * action.destructive_requires_name cluster setting to false. *

* 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 master node. If no response is received before the timeout expires, the request fails and + * returns an error. *

* API name: {@code master_timeout} + *

*/ @Deprecated @Nullable @@ -147,19 +175,10 @@ 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; - } - - /** - * 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() { @@ -171,34 +190,27 @@ public final Time timeout() { /** * Builder for {@link DeleteIndexRequest}. */ - public static class Builder extends ObjectBuilderBase implements ObjectBuilder { @Nullable private Boolean allowNoIndices; - + @Nullable + private Time clusterManagerTimeout; @Nullable private List expandWildcards; - @Nullable private Boolean ignoreUnavailable; - private List index; - - @Deprecated @Nullable private Time masterTimeout; - - @Nullable - private Time clusterManagerTimeout; - @Nullable private Time timeout; /** - * Ignore if a wildcard expression resolves to no concrete indices (default: - * false) + * If false, the request returns an error if any wildcard expression, index alias, or _all value targets + * only missing or closed indices. This behavior applies even if the request targets other open indices. *

* API name: {@code allow_no_indices} + *

*/ public final Builder allowNoIndices(@Nullable Boolean value) { this.allowNoIndices = value; @@ -206,12 +218,37 @@ public final Builder allowNoIndices(@Nullable Boolean value) { } /** - * Whether wildcard expressions should get expanded to open, closed, or hidden - * indices + * Operation timeout for connection to cluster-manager node. + *

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

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

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

+ */ + public final Builder clusterManagerTimeout(Function> fn) { + return clusterManagerTimeout(fn.apply(new Time.Builder()).build()); + } + + /** + * 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. + *

*/ public final Builder expandWildcards(List list) { this.expandWildcards = _listAddAll(this.expandWildcards, list); @@ -219,12 +256,16 @@ public final Builder expandWildcards(List list) { } /** - * Whether wildcard expressions should get expanded to open, closed, or hidden - * indices + * 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. + *

*/ public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... values) { this.expandWildcards = _listAdd(this.expandWildcards, value, values); @@ -232,9 +273,10 @@ public final Builder expandWildcards(ExpandWildcard value, ExpandWildcard... val } /** - * Ignore unavailable indexes (default: false) + * If false, the request returns an error if it targets a missing or closed index. *

* API name: {@code ignore_unavailable} + *

*/ public final Builder ignoreUnavailable(@Nullable Boolean value) { this.ignoreUnavailable = value; @@ -242,12 +284,16 @@ public final Builder ignoreUnavailable(@Nullable Boolean value) { } /** - * Required - A comma-separated list of indices to delete; use _all - * or * string to delete all indices + * Required - Comma-separated list of indices to delete. You cannot specify index aliases. By default, this parameter does not + * support wildcards (*) or _all. To use wildcards or _all, set the + * action.destructive_requires_name cluster setting to false. *

* API name: {@code index} + *

+ * *

* Adds all elements of list to index. + *

*/ public final Builder index(List list) { this.index = _listAddAll(this.index, list); @@ -255,12 +301,16 @@ public final Builder index(List list) { } /** - * Required - A comma-separated list of indices to delete; use _all - * or * string to delete all indices + * Required - Comma-separated list of indices to delete. You cannot specify index aliases. By default, this parameter does not + * support wildcards (*) or _all. To use wildcards or _all, set the + * action.destructive_requires_name cluster setting to false. *

* API name: {@code index} + *

+ * *

* Adds one or more values to index. + *

*/ public final Builder index(String value, String... values) { this.index = _listAdd(this.index, value, values); @@ -268,9 +318,11 @@ public final Builder index(String value, String... values) { } /** - * Specify timeout for connection to master + * 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. *

* API name: {@code master_timeout} + *

*/ @Deprecated public final Builder masterTimeout(@Nullable Time value) { @@ -279,38 +331,22 @@ public final Builder masterTimeout(@Nullable Time value) { } /** - * Specify timeout for connection to master + * 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. *

* API name: {@code master_timeout} + *

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

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

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

*/ public final Builder timeout(@Nullable Time value) { this.timeout = value; @@ -318,19 +354,19 @@ public final Builder timeout(@Nullable Time value) { } /** - * 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} + *

*/ 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 DeleteIndexRequest}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public DeleteIndexRequest build() { _checkSingleUse(); @@ -345,36 +381,20 @@ public DeleteIndexRequest build() { * Endpoint "{@code indices.delete}". */ public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - // Request method - request -> { - return "DELETE"; - - }, - + request -> "DELETE", // 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); - return buf.toString(); - } - throw SimpleEndpoint.noPathTemplateFound("path"); - + StringBuilder buf = new StringBuilder(); + buf.append("/"); + SimpleEndpoint.pathEncode(String.join(",", request.index), buf); + 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()); @@ -385,17 +405,41 @@ public DeleteIndexRequest 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 (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, DeleteIndexResponse._DESERIALIZER ); + + 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 + this.index.hashCode(); + result = 31 * result + Objects.hashCode(this.masterTimeout); + result = 31 * result + Objects.hashCode(this.timeout); + return result; + } + + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || this.getClass() != o.getClass()) return false; + DeleteIndexRequest other = (DeleteIndexRequest) 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) + && this.index.equals(other.index) + && Objects.equals(this.masterTimeout, other.masterTimeout) + && Objects.equals(this.timeout, other.timeout); + } } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteIndexResponse.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DeleteIndexResponse.java similarity index 78% rename from java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteIndexResponse.java rename to java-client/src/generated/java/org/opensearch/client/opensearch/indices/DeleteIndexResponse.java index 27bb751b42..2996a1eb42 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteIndexResponse.java +++ b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/DeleteIndexResponse.java @@ -30,9 +30,14 @@ * 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 org.opensearch.client.json.JsonpDeserializable; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.ObjectBuilderDeserializer; @@ -43,15 +48,16 @@ // typedef: indices.delete.Response @JsonpDeserializable +@Generated("org.opensearch.client.codegen.CodeGenerator") public class DeleteIndexResponse extends IndicesResponseBase { + // --------------------------------------------------------------------------------------------- private DeleteIndexResponse(Builder builder) { super(builder); - } - public static DeleteIndexResponse of(Function> fn) { + public static DeleteIndexResponse of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -60,8 +66,8 @@ public static DeleteIndexResponse of(Function implements ObjectBuilder { + @Override protected Builder self() { return this; @@ -70,8 +76,7 @@ protected Builder self() { /** * Builds a {@link DeleteIndexResponse}. * - * @throws NullPointerException - * if some of the required fields are null. + * @throws NullPointerException if some of the required fields are null. */ public DeleteIndexResponse build() { _checkSingleUse(); @@ -91,8 +96,20 @@ public DeleteIndexResponse build() { ); protected static void setupDeleteIndexResponseDeserializer(ObjectDeserializer op) { - IndicesResponseBase.setupIndicesResponseBaseDeserializer(op); + setupIndicesResponseBaseDeserializer(op); + } + public int hashCode() { + int result = super.hashCode(); + return result; } + 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/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClientBase.java b/java-client/src/generated/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClientBase.java index 1b441c5070..7aef6e75e3 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 @@ -78,6 +78,25 @@ public final CompletableFuture create(Function delete(DeleteIndexRequest request) throws IOException, OpenSearchException { + return this.transport.performRequestAsync(request, DeleteIndexRequest._ENDPOINT, this.transportOptions); + } + + /** + * Deletes an index. + * + * @param fn a function that initializes a builder to create the {@link DeleteIndexRequest} + */ + public final CompletableFuture delete(Function> fn) + throws IOException, OpenSearchException { + return delete(fn.apply(new DeleteIndexRequest.Builder()).build()); + } + // ----- Endpoint: indices.exists /** 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 2f113ea47d..ffd788a06f 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 @@ -77,6 +77,25 @@ public final CreateIndexResponse create(Function> fn) throws IOException, + OpenSearchException { + return delete(fn.apply(new DeleteIndexRequest.Builder()).build()); + } + // ----- Endpoint: indices.exists /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClient.java index d4811a6974..f90140a6a5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesAsyncClient.java @@ -278,38 +278,6 @@ public CompletableFuture createDataStream( return createDataStream(fn.apply(new CreateDataStreamRequest.Builder()).build()); } - // ----- Endpoint: indices.delete - - /** - * Deletes an index. - * - * - */ - - public CompletableFuture delete(DeleteIndexRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DeleteIndexRequest, - DeleteIndexResponse, - ErrorResponse>) DeleteIndexRequest._ENDPOINT; - - return this.transport.performRequestAsync(request, endpoint, this.transportOptions); - } - - /** - * Deletes an index. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteIndexRequest} - * - */ - - public final CompletableFuture delete(Function> fn) - throws IOException, OpenSearchException { - return delete(fn.apply(new DeleteIndexRequest.Builder()).build()); - } - // ----- Endpoint: indices.delete_data_stream /** diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClient.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClient.java index 8d7881294d..85a108f1fb 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClient.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenSearchIndicesClient.java @@ -264,38 +264,6 @@ public final CreateDataStreamResponse createDataStream( return createDataStream(fn.apply(new CreateDataStreamRequest.Builder()).build()); } - // ----- Endpoint: indices.delete - - /** - * Deletes an index. - * - * - */ - - public DeleteIndexResponse delete(DeleteIndexRequest request) throws IOException, OpenSearchException { - @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint< - DeleteIndexRequest, - DeleteIndexResponse, - ErrorResponse>) DeleteIndexRequest._ENDPOINT; - - return this.transport.performRequest(request, endpoint, this.transportOptions); - } - - /** - * Deletes an index. - * - * @param fn - * a function that initializes a builder to create the - * {@link DeleteIndexRequest} - * - */ - - public final DeleteIndexResponse delete(Function> fn) throws IOException, - OpenSearchException { - return delete(fn.apply(new DeleteIndexRequest.Builder()).build()); - } - // ----- Endpoint: indices.delete_data_stream /** diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java index 07819e4e3e..7a79aecbe6 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/CodeGenerator.java @@ -43,7 +43,7 @@ public class CodeGenerator { private static final OperationGroupMatcher OPERATION_MATCHER = or( and(namespace(""), named("info")), namespace("dangling_indices"), - and(namespace("indices"), named("create", "exists", "get")), + and(namespace("indices"), named("create", "delete", "exists", "get")), and(namespace("ml"), not(named("search_models"))), // TODO: search_models is complex and ideally should re-use the search structures and(namespace("snapshot"), named("cleanup_repository", "clone", "verify_repository")), and(namespace("tasks")) diff --git a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java index b30d2b9e95..fc351a1156 100644 --- a/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java +++ b/java-codegen/src/main/java/org/opensearch/client/codegen/model/RequestShape.java @@ -182,6 +182,8 @@ private static String classBaseName(@Nonnull OperationGroup operationGroup) { switch (operationGroup.toString()) { case "indices.create": return "CreateIndex"; + case "indices.delete": + return "DeleteIndex"; case "indices.get": return "GetIndex"; case "snapshot.clone":