From e79ce60a2dbe2f9a820e41063e7ea07b8cf826aa Mon Sep 17 00:00:00 2001 From: Dominik Szczepanczyk Date: Tue, 7 Mar 2023 22:07:06 +0100 Subject: [PATCH] fix: create ErrorStringResponse object and pass ErrorT type to the SimpleEndpoint request (#301) Signed-off-by: Dominik Szczepanczyk --- .../_types/ErrorStringResponse.java | 171 ++++++++++++++++++ .../_types/OpenSearchExceptionFactory.java | 59 ++++++ .../client/opensearch/cat/AliasesRequest.java | 2 +- .../opensearch/cat/AllocationRequest.java | 2 +- .../opensearch/cat/ClusterManagerRequest.java | 4 +- .../client/opensearch/cat/CountRequest.java | 2 +- .../opensearch/cat/FielddataRequest.java | 2 +- .../client/opensearch/cat/HealthRequest.java | 2 +- .../client/opensearch/cat/HelpRequest.java | 2 +- .../client/opensearch/cat/IndicesRequest.java | 2 +- .../opensearch/cat/NodeattrsRequest.java | 2 +- .../client/opensearch/cat/NodesRequest.java | 2 +- .../opensearch/cat/PendingTasksRequest.java | 2 +- .../client/opensearch/cat/PluginsRequest.java | 2 +- .../opensearch/cat/RecoveryRequest.java | 2 +- .../opensearch/cat/RepositoriesRequest.java | 2 +- .../opensearch/cat/SegmentsRequest.java | 2 +- .../client/opensearch/cat/ShardsRequest.java | 2 +- .../opensearch/cat/SnapshotsRequest.java | 2 +- .../client/opensearch/cat/TasksRequest.java | 2 +- .../opensearch/cat/TemplatesRequest.java | 2 +- .../opensearch/cat/ThreadPoolRequest.java | 2 +- .../cluster/AllocationExplainRequest.java | 2 +- .../cluster/ClusterStatsRequest.java | 2 +- .../DeleteComponentTemplateRequest.java | 2 +- .../cluster/GetClusterSettingsRequest.java | 2 +- .../cluster/GetComponentTemplateRequest.java | 2 +- .../opensearch/cluster/HealthRequest.java | 2 +- .../cluster/PendingTasksRequest.java | 2 +- .../cluster/PutClusterSettingsRequest.java | 2 +- .../cluster/PutComponentTemplateRequest.java | 2 +- .../opensearch/cluster/RemoteInfoRequest.java | 2 +- .../opensearch/cluster/RerouteRequest.java | 2 +- .../opensearch/cluster/StateRequest.java | 2 +- .../client/opensearch/core/BulkRequest.java | 2 +- .../opensearch/core/ClearScrollRequest.java | 2 +- .../client/opensearch/core/CountRequest.java | 2 +- .../client/opensearch/core/CreateRequest.java | 2 +- .../opensearch/core/DeleteByQueryRequest.java | 2 +- .../core/DeleteByQueryRethrottleRequest.java | 2 +- .../client/opensearch/core/DeleteRequest.java | 2 +- .../opensearch/core/DeleteScriptRequest.java | 2 +- .../opensearch/core/ExplainRequest.java | 4 +- .../opensearch/core/FieldCapsRequest.java | 2 +- .../client/opensearch/core/GetRequest.java | 4 +- .../core/GetScriptContextRequest.java | 2 +- .../core/GetScriptLanguagesRequest.java | 2 +- .../opensearch/core/GetScriptRequest.java | 2 +- .../opensearch/core/GetSourceRequest.java | 4 +- .../client/opensearch/core/IndexRequest.java | 2 +- .../client/opensearch/core/InfoRequest.java | 2 +- .../client/opensearch/core/MgetRequest.java | 4 +- .../opensearch/core/MsearchRequest.java | 4 +- .../core/MsearchTemplateRequest.java | 4 +- .../opensearch/core/MtermvectorsRequest.java | 2 +- .../opensearch/core/PutScriptRequest.java | 2 +- .../opensearch/core/RankEvalRequest.java | 2 +- .../opensearch/core/ReindexRequest.java | 2 +- .../core/ReindexRethrottleRequest.java | 2 +- .../core/RenderSearchTemplateRequest.java | 2 +- .../core/ScriptsPainlessExecuteRequest.java | 4 +- .../client/opensearch/core/ScrollRequest.java | 4 +- .../client/opensearch/core/SearchRequest.java | 4 +- .../opensearch/core/SearchShardsRequest.java | 2 +- .../core/SearchTemplateRequest.java | 4 +- .../opensearch/core/TermsEnumRequest.java | 2 +- .../opensearch/core/TermvectorsRequest.java | 2 +- .../opensearch/core/UpdateByQueryRequest.java | 2 +- .../core/UpdateByQueryRethrottleRequest.java | 2 +- .../client/opensearch/core/UpdateRequest.java | 4 +- .../DeleteDanglingIndexRequest.java | 2 +- .../ImportDanglingIndexRequest.java | 2 +- .../ListDanglingIndicesRequest.java | 2 +- .../features/GetFeaturesRequest.java | 2 +- .../features/ResetFeaturesRequest.java | 2 +- .../opensearch/indices/AddBlockRequest.java | 2 +- .../opensearch/indices/AnalyzeRequest.java | 2 +- .../opensearch/indices/ClearCacheRequest.java | 2 +- .../opensearch/indices/CloneIndexRequest.java | 2 +- .../opensearch/indices/CloseIndexRequest.java | 2 +- .../indices/CreateIndexRequest.java | 2 +- .../indices/DeleteAliasRequest.java | 2 +- .../indices/DeleteIndexRequest.java | 2 +- .../indices/DeleteIndexTemplateRequest.java | 2 +- .../indices/DeleteTemplateRequest.java | 2 +- .../opensearch/indices/DiskUsageRequest.java | 2 +- .../opensearch/indices/FlushRequest.java | 2 +- .../opensearch/indices/ForcemergeRequest.java | 2 +- .../opensearch/indices/GetAliasRequest.java | 6 +- .../indices/GetFieldMappingRequest.java | 2 +- .../opensearch/indices/GetIndexRequest.java | 2 +- .../indices/GetIndexTemplateRequest.java | 2 +- .../indices/GetIndicesSettingsRequest.java | 2 +- .../opensearch/indices/GetMappingRequest.java | 2 +- .../indices/GetTemplateRequest.java | 2 +- .../opensearch/indices/GetUpgradeRequest.java | 2 +- .../indices/IndicesStatsRequest.java | 2 +- .../opensearch/indices/OpenRequest.java | 2 +- .../indices/OpenSearchIndicesAsyncClient.java | 5 +- .../indices/OpenSearchIndicesClient.java | 5 +- .../opensearch/indices/PutAliasRequest.java | 2 +- .../indices/PutIndexTemplateRequest.java | 2 +- .../indices/PutIndicesSettingsRequest.java | 2 +- .../opensearch/indices/PutMappingRequest.java | 2 +- .../indices/PutTemplateRequest.java | 2 +- .../opensearch/indices/RecoveryRequest.java | 2 +- .../opensearch/indices/RefreshRequest.java | 2 +- .../indices/ResolveIndexRequest.java | 2 +- .../opensearch/indices/RolloverRequest.java | 2 +- .../opensearch/indices/SegmentsRequest.java | 2 +- .../indices/ShardStoresRequest.java | 2 +- .../opensearch/indices/ShrinkRequest.java | 2 +- .../indices/SimulateIndexTemplateRequest.java | 2 +- .../indices/SimulateTemplateRequest.java | 2 +- .../opensearch/indices/SplitRequest.java | 2 +- .../indices/UpdateAliasesRequest.java | 2 +- .../opensearch/indices/UpgradeRequest.java | 2 +- .../indices/ValidateQueryRequest.java | 2 +- .../ingest/DeletePipelineRequest.java | 2 +- .../opensearch/ingest/GeoIpStatsRequest.java | 2 +- .../opensearch/ingest/GetPipelineRequest.java | 2 +- .../ingest/ProcessorGrokRequest.java | 2 +- .../opensearch/ingest/PutPipelineRequest.java | 2 +- .../opensearch/ingest/SimulateRequest.java | 2 +- .../opensearch/nodes/HotThreadsRequest.java | 2 +- .../opensearch/nodes/NodesInfoRequest.java | 2 +- .../opensearch/nodes/NodesStatsRequest.java | 2 +- .../opensearch/nodes/NodesUsageRequest.java | 2 +- .../nodes/ReloadSecureSettingsRequest.java | 2 +- .../shutdown/DeleteNodeRequest.java | 2 +- .../opensearch/shutdown/GetNodeRequest.java | 2 +- .../opensearch/shutdown/PutNodeRequest.java | 2 +- .../snapshot/CleanupRepositoryRequest.java | 2 +- .../snapshot/CloneSnapshotRequest.java | 2 +- .../snapshot/CreateRepositoryRequest.java | 2 +- .../snapshot/CreateSnapshotRequest.java | 2 +- .../snapshot/DeleteRepositoryRequest.java | 2 +- .../snapshot/DeleteSnapshotRequest.java | 2 +- .../snapshot/GetRepositoryRequest.java | 2 +- .../snapshot/GetSnapshotRequest.java | 2 +- .../opensearch/snapshot/RestoreRequest.java | 2 +- .../snapshot/SnapshotStatusRequest.java | 2 +- .../snapshot/VerifyRepositoryRequest.java | 2 +- .../opensearch/tasks/CancelRequest.java | 2 +- .../opensearch/tasks/GetTasksRequest.java | 2 +- .../client/opensearch/tasks/ListRequest.java | 2 +- .../transport/endpoints/BooleanEndpoint.java | 5 +- .../transport/endpoints/SimpleEndpoint.java | 27 +-- .../ApacheHttpClient5Transport.java | 6 +- .../rest_client/RestClientTransport.java | 6 +- .../experiments/api/FooOptRequest.java | 5 +- .../experiments/api/FooRequest.java | 3 +- .../experiments/generics/GenericClass.java | 3 +- 153 files changed, 421 insertions(+), 186 deletions(-) create mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorStringResponse.java create mode 100644 java-client/src/main/java/org/opensearch/client/opensearch/_types/OpenSearchExceptionFactory.java diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorStringResponse.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorStringResponse.java new file mode 100644 index 0000000000..6404eb7001 --- /dev/null +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/ErrorStringResponse.java @@ -0,0 +1,171 @@ +/* + * 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._types; + +import jakarta.json.stream.JsonGenerator; +import org.opensearch.client.json.JsonpDeserializable; +import org.opensearch.client.json.JsonpDeserializer; +import org.opensearch.client.json.JsonpMapper; +import org.opensearch.client.json.JsonpSerializable; +import org.opensearch.client.json.ObjectBuilderDeserializer; +import org.opensearch.client.json.ObjectDeserializer; +import org.opensearch.client.util.ApiTypeHelper; +import org.opensearch.client.util.ObjectBuilder; +import org.opensearch.client.util.ObjectBuilderBase; + +import java.util.function.Function; + +// typedef: _types.ErrorSimpleResponseBase + +/** + * The response returned by Elasticsearch when request execution did not + * succeed. + */ +@JsonpDeserializable +public class ErrorStringResponse implements JsonpSerializable { + private final String error; + + private final int status; + + // --------------------------------------------------------------------------------------------- + + private ErrorStringResponse(Builder builder) { + + this.error = ApiTypeHelper.requireNonNull(builder.error, this, "error"); + this.status = ApiTypeHelper.requireNonNull(builder.status, this, "status"); + + } + + public static ErrorStringResponse of(Function> fn) { + return fn.apply(new Builder()).build(); + } + + /** + * Required - API name: {@code error} + */ + public final String error() { + return this.error; + } + + /** + * Required - API name: {@code status} + */ + public final int status() { + return this.status; + } + + /** + * Serialize this object to JSON. + */ + public void serialize(JsonGenerator generator, JsonpMapper mapper) { + generator.writeStartObject(); + serializeInternal(generator, mapper); + generator.writeEnd(); + } + + protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { + + generator.writeKey("error"); + generator.write(this.error); + + generator.writeKey("status"); + generator.write(this.status); + + } + + // --------------------------------------------------------------------------------------------- + + /** + * Builder for {@link ErrorStringResponse}. + */ + + public static class Builder extends ObjectBuilderBase implements ObjectBuilder { + private String error; + + private Integer status; + + /** + * Required - API name: {@code error} + */ + public final Builder error(String value) { + this.error = value; + return this; + } + + /** + * Required - API name: {@code error} + */ + public final Builder error(Function> fn) { + return this.error(fn.apply(new ErrorCause.Builder()).build()); + } + + /** + * Required - API name: {@code status} + */ + public final Builder status(int value) { + this.status = value; + return this; + } + + /** + * Builds a {@link ErrorStringResponse}. + * + * @throws NullPointerException if some of the required fields are null. + */ + public ErrorStringResponse build() { + _checkSingleUse(); + + return new ErrorStringResponse(this); + } + } + + // --------------------------------------------------------------------------------------------- + + /** + * Json deserializer for {@link ErrorStringResponse} + */ + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + ErrorStringResponse::setupErrorResponseDeserializer); + + protected static void setupErrorResponseDeserializer(ObjectDeserializer op) { + + op.add(Builder::error, JsonpDeserializer.stringDeserializer(), "error"); + op.add(Builder::status, JsonpDeserializer.integerDeserializer(), "status"); + + } + +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpenSearchExceptionFactory.java b/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpenSearchExceptionFactory.java new file mode 100644 index 0000000000..1b2ba7c0e0 --- /dev/null +++ b/java-client/src/main/java/org/opensearch/client/opensearch/_types/OpenSearchExceptionFactory.java @@ -0,0 +1,59 @@ +/* + * 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. + */ + +package org.opensearch.client.opensearch._types; + +public class OpenSearchExceptionFactory { + + private OpenSearchExceptionFactory() { + //should be empty + } + + public static OpenSearchException createException(ErrorT error) { + if (error instanceof ErrorResponse) { + return new OpenSearchException((ErrorResponse) error); + } else if (error instanceof ErrorStringResponse) { + ErrorStringResponse errorStringResponse = (ErrorStringResponse) error; + return new OpenSearchException(getErrorResponse(errorStringResponse.status(), "string_error", errorStringResponse.error())); + } else { + throw new OpenSearchException(getErrorResponse(500, "error_type", "Unknown error type: " + error.getClass())); + } + } + + private static ErrorResponse getErrorResponse(int status, String type, String reason) { + return ErrorResponse.of( + builder -> builder.status(status).error( + builder1 -> builder1.type(type).reason(reason) + ) + ); + } +} diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cat/AliasesRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cat/AliasesRequest.java index bcd93f57a7..3356566db4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cat/AliasesRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cat/AliasesRequest.java @@ -223,5 +223,5 @@ public AliasesRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, AliasesResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, AliasesResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cat/AllocationRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cat/AllocationRequest.java index 16681a809e..26f1c45fd1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cat/AllocationRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cat/AllocationRequest.java @@ -207,5 +207,5 @@ public AllocationRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, AllocationResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, AllocationResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cat/ClusterManagerRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cat/ClusterManagerRequest.java index 513c6d7cfe..e60c257896 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cat/ClusterManagerRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cat/ClusterManagerRequest.java @@ -84,7 +84,7 @@ public ClusterManagerRequest() { params.put("format", "json"); return params; - }, SimpleEndpoint.emptyMap(), false, ClusterManagerResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, ClusterManagerResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); /** * Endpoint "{@code cat.cluster_manager}". @@ -109,5 +109,5 @@ public ClusterManagerRequest() { params.put("format", "json"); return params; - }, SimpleEndpoint.emptyMap(), false, ClusterManagerResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, ClusterManagerResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cat/CountRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cat/CountRequest.java index 0925464f5b..42b4a352b2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cat/CountRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cat/CountRequest.java @@ -175,5 +175,5 @@ public CountRequest build() { params.put("format", "json"); return params; - }, SimpleEndpoint.emptyMap(), false, CountResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, CountResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cat/FielddataRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cat/FielddataRequest.java index b47e4d2acf..67c8e2b31f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cat/FielddataRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cat/FielddataRequest.java @@ -207,5 +207,5 @@ public FielddataRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, FielddataResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, FielddataResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cat/HealthRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cat/HealthRequest.java index 114cddfcf6..6000be6a94 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cat/HealthRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cat/HealthRequest.java @@ -141,5 +141,5 @@ public HealthRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, HealthResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, HealthResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cat/HelpRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cat/HelpRequest.java index c6db7f28c9..c866358cf9 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cat/HelpRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cat/HelpRequest.java @@ -84,5 +84,5 @@ public HelpRequest() { params.put("format", "json"); return params; - }, SimpleEndpoint.emptyMap(), false, HelpResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, HelpResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cat/IndicesRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cat/IndicesRequest.java index f63fdc2670..ee2f32dcc6 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cat/IndicesRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cat/IndicesRequest.java @@ -349,5 +349,5 @@ public IndicesRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, IndicesResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, IndicesResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cat/NodeattrsRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cat/NodeattrsRequest.java index 9f43e1be1f..cad7328f5c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cat/NodeattrsRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cat/NodeattrsRequest.java @@ -84,5 +84,5 @@ public NodeattrsRequest() { params.put("format", "json"); return params; - }, SimpleEndpoint.emptyMap(), false, NodeattrsResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, NodeattrsResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cat/NodesRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cat/NodesRequest.java index 6d925aa82e..0774fb1829 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cat/NodesRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cat/NodesRequest.java @@ -172,5 +172,5 @@ public NodesRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, NodesResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, NodesResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cat/PendingTasksRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cat/PendingTasksRequest.java index 25e5526607..9de0949014 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cat/PendingTasksRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cat/PendingTasksRequest.java @@ -84,5 +84,5 @@ public PendingTasksRequest() { params.put("format", "json"); return params; - }, SimpleEndpoint.emptyMap(), false, PendingTasksResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, PendingTasksResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cat/PluginsRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cat/PluginsRequest.java index f20d504f78..2bf89ad2ab 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cat/PluginsRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cat/PluginsRequest.java @@ -84,5 +84,5 @@ public PluginsRequest() { params.put("format", "json"); return params; - }, SimpleEndpoint.emptyMap(), false, PluginsResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, PluginsResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cat/RecoveryRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cat/RecoveryRequest.java index 8762d3bcda..a629eedc19 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cat/RecoveryRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cat/RecoveryRequest.java @@ -270,5 +270,5 @@ public RecoveryRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, RecoveryResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, RecoveryResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cat/RepositoriesRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cat/RepositoriesRequest.java index 49bff51dd9..6afe82aa62 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cat/RepositoriesRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cat/RepositoriesRequest.java @@ -84,5 +84,5 @@ public RepositoriesRequest() { params.put("format", "json"); return params; - }, SimpleEndpoint.emptyMap(), false, RepositoriesResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, RepositoriesResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cat/SegmentsRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cat/SegmentsRequest.java index 6c2adce21e..addb9c9c74 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cat/SegmentsRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cat/SegmentsRequest.java @@ -205,5 +205,5 @@ public SegmentsRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, SegmentsResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, SegmentsResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cat/ShardsRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cat/ShardsRequest.java index 229d47ddad..199a13dbb4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cat/ShardsRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cat/ShardsRequest.java @@ -205,5 +205,5 @@ public ShardsRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, ShardsResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, ShardsResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cat/SnapshotsRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cat/SnapshotsRequest.java index ea05c89761..bbee296fe8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cat/SnapshotsRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cat/SnapshotsRequest.java @@ -205,5 +205,5 @@ public SnapshotsRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, SnapshotsResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, SnapshotsResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cat/TasksRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cat/TasksRequest.java index ee1dc86744..f19413040e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cat/TasksRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cat/TasksRequest.java @@ -252,5 +252,5 @@ public TasksRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, TasksResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, TasksResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cat/TemplatesRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cat/TemplatesRequest.java index 8ebdfe1795..3d3a4b710e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cat/TemplatesRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cat/TemplatesRequest.java @@ -159,5 +159,5 @@ public TemplatesRequest build() { params.put("format", "json"); return params; - }, SimpleEndpoint.emptyMap(), false, TemplatesResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, TemplatesResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cat/ThreadPoolRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cat/ThreadPoolRequest.java index 90be667ebb..0d111144e4 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cat/ThreadPoolRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cat/ThreadPoolRequest.java @@ -211,5 +211,5 @@ public ThreadPoolRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, ThreadPoolResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, ThreadPoolResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/AllocationExplainRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/AllocationExplainRequest.java index 5083a6495b..659f62a0de 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/AllocationExplainRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/AllocationExplainRequest.java @@ -339,5 +339,5 @@ protected static void setupAllocationExplainRequestDeserializer( } return params; - }, SimpleEndpoint.emptyMap(), true, AllocationExplainResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, AllocationExplainResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/ClusterStatsRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/ClusterStatsRequest.java index b375d96217..1171972254 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/ClusterStatsRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/ClusterStatsRequest.java @@ -258,5 +258,5 @@ public ClusterStatsRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, ClusterStatsResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, ClusterStatsResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/DeleteComponentTemplateRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/DeleteComponentTemplateRequest.java index 8996916a57..0291dd1ff8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/DeleteComponentTemplateRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/DeleteComponentTemplateRequest.java @@ -274,5 +274,5 @@ public DeleteComponentTemplateRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, DeleteComponentTemplateResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, DeleteComponentTemplateResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/GetClusterSettingsRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/GetClusterSettingsRequest.java index 0b83afbd74..c3eeae9ca1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/GetClusterSettingsRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/GetClusterSettingsRequest.java @@ -294,5 +294,5 @@ public GetClusterSettingsRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, GetClusterSettingsResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, GetClusterSettingsResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/GetComponentTemplateRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/GetComponentTemplateRequest.java index 0e3518c07f..cbe043315c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/GetComponentTemplateRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/GetComponentTemplateRequest.java @@ -300,5 +300,5 @@ public GetComponentTemplateRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, GetComponentTemplateResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, GetComponentTemplateResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/HealthRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/HealthRequest.java index 732438b462..c94da77d73 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/HealthRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/HealthRequest.java @@ -639,5 +639,5 @@ public HealthRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, HealthResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, HealthResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PendingTasksRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PendingTasksRequest.java index cdb4ae7d7c..d9e22a0d03 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PendingTasksRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PendingTasksRequest.java @@ -228,5 +228,5 @@ public PendingTasksRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, PendingTasksResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, PendingTasksResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PutClusterSettingsRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PutClusterSettingsRequest.java index 2dc2543c18..990c68b56b 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PutClusterSettingsRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PutClusterSettingsRequest.java @@ -388,5 +388,5 @@ protected static void setupPutClusterSettingsRequestDeserializer( } return params; - }, SimpleEndpoint.emptyMap(), true, PutClusterSettingsResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, PutClusterSettingsResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PutComponentTemplateRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PutComponentTemplateRequest.java index 5c308101db..cd3de57a37 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PutComponentTemplateRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/PutComponentTemplateRequest.java @@ -537,5 +537,5 @@ protected static void setupPutComponentTemplateRequestDeserializer( } return params; - }, SimpleEndpoint.emptyMap(), true, PutComponentTemplateResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, PutComponentTemplateResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/RemoteInfoRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/RemoteInfoRequest.java index b3501083e0..cc800c183f 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/RemoteInfoRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/RemoteInfoRequest.java @@ -84,5 +84,5 @@ public RemoteInfoRequest() { request -> { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), false, RemoteInfoResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, RemoteInfoResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/RerouteRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/RerouteRequest.java index a18f1a8387..5764460a52 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/cluster/RerouteRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/cluster/RerouteRequest.java @@ -480,5 +480,5 @@ protected static void setupRerouteRequestDeserializer(ObjectDeserializer { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), true, ClearScrollResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, ClearScrollResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/CountRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/CountRequest.java index 8da350aa8b..75cbcbaf7e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/CountRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/CountRequest.java @@ -702,5 +702,5 @@ protected static void setupCountRequestDeserializer(ObjectDeserializer JsonpDeserializer> createCrea } return params; - }, SimpleEndpoint.emptyMap(), true, CreateResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, CreateResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteByQueryRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteByQueryRequest.java index e684435b8f..58c05a5eb5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteByQueryRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/DeleteByQueryRequest.java @@ -1428,5 +1428,5 @@ protected static void setupDeleteByQueryRequestDeserializer(ObjectDeserializer _ENDPOINT = new SimpleEndpoint<>( + public static final SimpleEndpoint _ENDPOINT = new SimpleEndpoint<>( // Request method request -> { @@ -669,7 +669,7 @@ protected static void setupExplainRequestDeserializer(ObjectDeserializer _ENDPOINT = new SimpleEndpoint<>( + public static final SimpleEndpoint _ENDPOINT = new SimpleEndpoint<>( // Request method request -> { @@ -539,7 +539,7 @@ public GetRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, GetResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, GetResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); /** * Create an "{@code get}" endpoint. diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/GetScriptContextRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/GetScriptContextRequest.java index fde68054c9..4bbdaaab13 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/GetScriptContextRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/GetScriptContextRequest.java @@ -82,5 +82,5 @@ public GetScriptContextRequest() { request -> { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), false, GetScriptContextResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, GetScriptContextResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/GetScriptLanguagesRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/GetScriptLanguagesRequest.java index 93b5570906..d0181058e1 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/GetScriptLanguagesRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/GetScriptLanguagesRequest.java @@ -82,5 +82,5 @@ public GetScriptLanguagesRequest() { request -> { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), false, GetScriptLanguagesResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, GetScriptLanguagesResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/GetScriptRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/GetScriptRequest.java index df49a513a9..88c6c981cf 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/GetScriptRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/GetScriptRequest.java @@ -233,5 +233,5 @@ public GetScriptRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, GetScriptResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, GetScriptResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/GetSourceRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/GetSourceRequest.java index 943bf21e96..c31ad5de02 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/GetSourceRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/GetSourceRequest.java @@ -463,7 +463,7 @@ public GetSourceRequest build() { /** * Endpoint "{@code get_source}". */ - public static final SimpleEndpoint _ENDPOINT = new SimpleEndpoint<>( + public static final SimpleEndpoint _ENDPOINT = new SimpleEndpoint<>( // Request method request -> { @@ -532,7 +532,7 @@ public GetSourceRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, GetSourceResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, GetSourceResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); /** * Create an "{@code get_source}" endpoint. diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/IndexRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/IndexRequest.java index e3178df13c..3f1d8a1b14 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/IndexRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/IndexRequest.java @@ -645,5 +645,5 @@ public static JsonpDeserializer> createIndex } return params; - }, SimpleEndpoint.emptyMap(), true, IndexResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, IndexResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/InfoRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/InfoRequest.java index aeec589bd7..ae2f03fe38 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/InfoRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/InfoRequest.java @@ -82,5 +82,5 @@ public InfoRequest() { request -> { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), false, InfoResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, InfoResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/MgetRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/MgetRequest.java index 64d7be1cf6..0e4b0b21d7 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/MgetRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/MgetRequest.java @@ -521,7 +521,7 @@ protected static void setupMgetRequestDeserializer(ObjectDeserializer _ENDPOINT = new SimpleEndpoint<>( + public static final SimpleEndpoint _ENDPOINT = new SimpleEndpoint<>( // Request method request -> { @@ -586,7 +586,7 @@ protected static void setupMgetRequestDeserializer(ObjectDeserializer _ENDPOINT = new SimpleEndpoint<>( + public static final SimpleEndpoint _ENDPOINT = new SimpleEndpoint<>( // Request method request -> { @@ -562,7 +562,7 @@ public MsearchRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), true, MsearchResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, MsearchResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); /** * Create an "{@code msearch}" endpoint. diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/MsearchTemplateRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/MsearchTemplateRequest.java index cdd85aeaec..d03655a81d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/MsearchTemplateRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/MsearchTemplateRequest.java @@ -293,7 +293,7 @@ public MsearchTemplateRequest build() { /** * Endpoint "{@code msearch_template}". */ - public static final SimpleEndpoint _ENDPOINT = new SimpleEndpoint<>( + public static final SimpleEndpoint _ENDPOINT = new SimpleEndpoint<>( // Request method request -> { @@ -343,7 +343,7 @@ public MsearchTemplateRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), true, MsearchTemplateResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, MsearchTemplateResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); /** * Create an "{@code msearch_template}" endpoint. diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/MtermvectorsRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/MtermvectorsRequest.java index c66d86503a..76b6804191 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/MtermvectorsRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/MtermvectorsRequest.java @@ -667,5 +667,5 @@ protected static void setupMtermvectorsRequestDeserializer(ObjectDeserializer { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), true, RenderSearchTemplateResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, RenderSearchTemplateResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/ScriptsPainlessExecuteRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/ScriptsPainlessExecuteRequest.java index 2a609460a4..4a86420e81 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/ScriptsPainlessExecuteRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/ScriptsPainlessExecuteRequest.java @@ -230,7 +230,7 @@ protected static void setupScriptsPainlessExecuteRequestDeserializer( /** * Endpoint "{@code scripts_painless_execute}". */ - public static final SimpleEndpoint _ENDPOINT = new SimpleEndpoint<>( + public static final SimpleEndpoint _ENDPOINT = new SimpleEndpoint<>( // Request method request -> { @@ -248,7 +248,7 @@ protected static void setupScriptsPainlessExecuteRequestDeserializer( request -> { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), true, ScriptsPainlessExecuteResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, ScriptsPainlessExecuteResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); /** * Create an "{@code scripts_painless_execute}" endpoint. diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/ScrollRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/ScrollRequest.java index 886bc856b6..3afb45e127 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/ScrollRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/ScrollRequest.java @@ -196,7 +196,7 @@ protected static void setupScrollRequestDeserializer(ObjectDeserializer _ENDPOINT = new SimpleEndpoint<>( + public static final SimpleEndpoint _ENDPOINT = new SimpleEndpoint<>( // Request method request -> { @@ -214,7 +214,7 @@ protected static void setupScrollRequestDeserializer(ObjectDeserializer { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), true, ScrollResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, ScrollResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); /** * Create an "{@code scroll}" endpoint. diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/SearchRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/SearchRequest.java index f7822edd3a..0d46893a70 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/SearchRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/SearchRequest.java @@ -2141,7 +2141,7 @@ protected static void setupSearchRequestDeserializer(ObjectDeserializer _ENDPOINT = new SimpleEndpoint<>( + public static final SimpleEndpoint _ENDPOINT = new SimpleEndpoint<>( // Request method request -> { @@ -2245,7 +2245,7 @@ protected static void setupSearchRequestDeserializer(ObjectDeserializer _ENDPOINT = new SimpleEndpoint<>( + public static final SimpleEndpoint _ENDPOINT = new SimpleEndpoint<>( // Request method request -> { @@ -702,7 +702,7 @@ protected static void setupSearchTemplateRequestDeserializer(ObjectDeserializer< } return params; - }, SimpleEndpoint.emptyMap(), true, SearchTemplateResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, SearchTemplateResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); /** * Create an "{@code search_template}" endpoint. diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/TermsEnumRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/TermsEnumRequest.java index af1c3b7c35..1e1718eff5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/TermsEnumRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/TermsEnumRequest.java @@ -441,5 +441,5 @@ protected static void setupTermsEnumRequestDeserializer(ObjectDeserializer { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), true, TermsEnumResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, TermsEnumResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/TermvectorsRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/TermvectorsRequest.java index c57e72144c..84321ba929 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/TermvectorsRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/TermvectorsRequest.java @@ -712,5 +712,5 @@ protected static void setupTermvectorsRequestDeserializer( } return params; - }, SimpleEndpoint.emptyMap(), true, TermvectorsResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, TermvectorsResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/core/UpdateByQueryRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/core/UpdateByQueryRequest.java index 847e0e8bd7..0474772644 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/core/UpdateByQueryRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/core/UpdateByQueryRequest.java @@ -1498,5 +1498,5 @@ protected static void setupUpdateByQueryRequestDeserializer(ObjectDeserializer void setupUpdateRequestDeserializ /** * Endpoint "{@code update}". */ - public static final SimpleEndpoint, ?> _ENDPOINT = new SimpleEndpoint<>( + public static final SimpleEndpoint, ?, ErrorResponse> _ENDPOINT = new SimpleEndpoint<>( // Request method request -> { @@ -831,7 +831,7 @@ protected static void setupUpdateRequestDeserializ } return params; - }, SimpleEndpoint.emptyMap(), true, UpdateResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, UpdateResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); /** * Create an "{@code update}" endpoint. diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexRequest.java index 07384df4a2..714452e634 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/DeleteDanglingIndexRequest.java @@ -297,5 +297,5 @@ public DeleteDanglingIndexRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, DeleteDanglingIndexResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, DeleteDanglingIndexResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java index 3f8584ae6f..3716479df5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/ImportDanglingIndexRequest.java @@ -298,5 +298,5 @@ public ImportDanglingIndexRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, ImportDanglingIndexResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, ImportDanglingIndexResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesRequest.java index 80a235b26a..a248dc2a8a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/dangling_indices/ListDanglingIndicesRequest.java @@ -83,5 +83,5 @@ public ListDanglingIndicesRequest() { request -> { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), false, ListDanglingIndicesResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, ListDanglingIndicesResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/features/GetFeaturesRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/features/GetFeaturesRequest.java index 6d1a096cde..2d2e08c642 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/features/GetFeaturesRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/features/GetFeaturesRequest.java @@ -83,5 +83,5 @@ public GetFeaturesRequest() { request -> { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), false, GetFeaturesResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, GetFeaturesResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/features/ResetFeaturesRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/features/ResetFeaturesRequest.java index 359dba461b..51e4ac4712 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/features/ResetFeaturesRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/features/ResetFeaturesRequest.java @@ -82,5 +82,5 @@ public ResetFeaturesRequest() { request -> { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), false, ResetFeaturesResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, ResetFeaturesResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/AddBlockRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/AddBlockRequest.java index 6cc44eaf3d..38499a2d9c 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/AddBlockRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/AddBlockRequest.java @@ -417,5 +417,5 @@ public AddBlockRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, AddBlockResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, AddBlockResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/AnalyzeRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/AnalyzeRequest.java index 2d631cc21f..10e1e3be6a 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/AnalyzeRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/AnalyzeRequest.java @@ -542,5 +542,5 @@ protected static void setupAnalyzeRequestDeserializer(ObjectDeserializer { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), true, AnalyzeResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, AnalyzeResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ClearCacheRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/ClearCacheRequest.java index c96a7330ad..bb4ac43dd2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ClearCacheRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/ClearCacheRequest.java @@ -423,5 +423,5 @@ public ClearCacheRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, ClearCacheResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, ClearCacheResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/CloneIndexRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/CloneIndexRequest.java index 1c8849e54b..2f2acf1d3d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/CloneIndexRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/CloneIndexRequest.java @@ -476,5 +476,5 @@ protected static void setupCloneIndexRequestDeserializer(ObjectDeserializer { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), false, DeleteIndexTemplateResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, DeleteIndexTemplateResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteTemplateRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteTemplateRequest.java index 6c821ebe1e..40830a9778 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteTemplateRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/DeleteTemplateRequest.java @@ -272,5 +272,5 @@ public DeleteTemplateRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, DeleteTemplateResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, DeleteTemplateResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DiskUsageRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/DiskUsageRequest.java index a91434a8fe..6a397f78a6 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/DiskUsageRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/DiskUsageRequest.java @@ -475,5 +475,5 @@ public DiskUsageRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, DiskUsageResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, DiskUsageResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/FlushRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/FlushRequest.java index c36f41400a..6de82193d0 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/FlushRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/FlushRequest.java @@ -361,5 +361,5 @@ public FlushRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, FlushResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, FlushResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ForcemergeRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/ForcemergeRequest.java index d54de87b24..84aaa079b0 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/ForcemergeRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/ForcemergeRequest.java @@ -381,5 +381,5 @@ public ForcemergeRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, ForcemergeResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, ForcemergeResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetAliasRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetAliasRequest.java index d7ac8959e6..c50ca8fb02 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetAliasRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetAliasRequest.java @@ -36,7 +36,7 @@ package org.opensearch.client.opensearch.indices; -import org.opensearch.client.opensearch._types.ErrorResponse; +import org.opensearch.client.opensearch._types.ErrorStringResponse; import org.opensearch.client.opensearch._types.ExpandWildcard; import org.opensearch.client.opensearch._types.RequestBase; import org.opensearch.client.transport.Endpoint; @@ -305,7 +305,7 @@ public GetAliasRequest build() { /** * Endpoint "{@code indices.get_alias}". */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( // Request method request -> { @@ -376,5 +376,5 @@ public GetAliasRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, GetAliasResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, GetAliasResponse._DESERIALIZER, ErrorStringResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetFieldMappingRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetFieldMappingRequest.java index d451dbff52..1ee5742d37 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetFieldMappingRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetFieldMappingRequest.java @@ -396,5 +396,5 @@ public GetFieldMappingRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, GetFieldMappingResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, GetFieldMappingResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetIndexRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetIndexRequest.java index e2e25f6461..056f729068 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetIndexRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetIndexRequest.java @@ -462,5 +462,5 @@ public GetIndexRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, GetIndexResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, GetIndexResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetIndexTemplateRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetIndexTemplateRequest.java index 1f518ebdff..a08a9ca950 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetIndexTemplateRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetIndexTemplateRequest.java @@ -311,5 +311,5 @@ public GetIndexTemplateRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, GetIndexTemplateResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, GetIndexTemplateResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetIndicesSettingsRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetIndicesSettingsRequest.java index 866b6b390d..77cf45f99e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetIndicesSettingsRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetIndicesSettingsRequest.java @@ -523,5 +523,5 @@ public GetIndicesSettingsRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, GetIndicesSettingsResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, GetIndicesSettingsResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetMappingRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetMappingRequest.java index 6094e98a4f..ddabb0d2d5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetMappingRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetMappingRequest.java @@ -402,5 +402,5 @@ public GetMappingRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, GetMappingResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, GetMappingResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetTemplateRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetTemplateRequest.java index 1312f76e1f..ec8ba0fe7e 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetTemplateRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetTemplateRequest.java @@ -318,5 +318,5 @@ public GetTemplateRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, GetTemplateResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, GetTemplateResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetUpgradeRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetUpgradeRequest.java index 5e1ebfd003..72b0317072 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetUpgradeRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/GetUpgradeRequest.java @@ -157,5 +157,5 @@ public GetUpgradeRequest build() { request -> { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), false, GetUpgradeResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, GetUpgradeResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/IndicesStatsRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/IndicesStatsRequest.java index af9561945b..24da40c888 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/IndicesStatsRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/IndicesStatsRequest.java @@ -634,5 +634,5 @@ public IndicesStatsRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, IndicesStatsResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, IndicesStatsResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenRequest.java index bae12c1dc8..c3cd94bbd8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/OpenRequest.java @@ -443,5 +443,5 @@ public OpenRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, OpenResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, OpenResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } 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 87ebde9b49..605195e240 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 @@ -37,6 +37,7 @@ package org.opensearch.client.opensearch.indices; import org.opensearch.client.ApiClient; +import org.opensearch.client.opensearch._types.ErrorStringResponse; import org.opensearch.client.opensearch._types.OpenSearchException; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.transport.OpenSearchTransport; @@ -703,8 +704,8 @@ public final CompletableFuture get( public CompletableFuture getAlias(GetAliasRequest request) throws IOException, OpenSearchException { @SuppressWarnings("unchecked") - JsonEndpoint endpoint = - (JsonEndpoint) GetAliasRequest._ENDPOINT; + JsonEndpoint endpoint = + (JsonEndpoint) GetAliasRequest._ENDPOINT; return this.transport.performRequestAsync(request, endpoint, this.transportOptions); } 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 bd1ee0db85..7d847050e5 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 @@ -37,6 +37,7 @@ package org.opensearch.client.opensearch.indices; import org.opensearch.client.ApiClient; +import org.opensearch.client.opensearch._types.ErrorStringResponse; import org.opensearch.client.opensearch._types.OpenSearchException; import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.transport.OpenSearchTransport; @@ -665,8 +666,8 @@ public final GetIndexResponse get(Function endpoint = - (JsonEndpoint) GetAliasRequest._ENDPOINT; + JsonEndpoint endpoint = + (JsonEndpoint) GetAliasRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutAliasRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutAliasRequest.java index 49808d6ad0..1560803084 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutAliasRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutAliasRequest.java @@ -517,5 +517,5 @@ protected static void setupPutAliasRequestDeserializer(ObjectDeserializer { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), true, PutIndexTemplateResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, PutIndexTemplateResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutIndicesSettingsRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutIndicesSettingsRequest.java index 7bc41cfa03..f5cbdda4c8 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutIndicesSettingsRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutIndicesSettingsRequest.java @@ -528,5 +528,5 @@ protected static JsonpDeserializer createPutIndicesSe } return params; - }, SimpleEndpoint.emptyMap(), true, PutIndicesSettingsResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, PutIndicesSettingsResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutMappingRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutMappingRequest.java index afd9a749c2..1475d62ea2 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutMappingRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/PutMappingRequest.java @@ -1031,5 +1031,5 @@ protected static void setupPutMappingRequestDeserializer(ObjectDeserializer createSimulateTempla } return params; - }, SimpleEndpoint.emptyMap(), true, SimulateTemplateResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, SimulateTemplateResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/indices/SplitRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/indices/SplitRequest.java index 95ad5c16d3..065d834638 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/indices/SplitRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/indices/SplitRequest.java @@ -478,5 +478,5 @@ protected static void setupSplitRequestDeserializer(ObjectDeserializer { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), false, GeoIpStatsResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, GeoIpStatsResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/GetPipelineRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/ingest/GetPipelineRequest.java index 13c6af178c..199cd1758d 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/GetPipelineRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/ingest/GetPipelineRequest.java @@ -273,5 +273,5 @@ public GetPipelineRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, GetPipelineResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, GetPipelineResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/ProcessorGrokRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/ingest/ProcessorGrokRequest.java index d4ef3c12f4..9c6bb121b0 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/ProcessorGrokRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/ingest/ProcessorGrokRequest.java @@ -82,5 +82,5 @@ public ProcessorGrokRequest() { request -> { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), false, ProcessorGrokResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, ProcessorGrokResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/PutPipelineRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/ingest/PutPipelineRequest.java index a741750d99..db7f87f767 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/ingest/PutPipelineRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/ingest/PutPipelineRequest.java @@ -536,5 +536,5 @@ protected static void setupPutPipelineRequestDeserializer(ObjectDeserializer { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), false, DeleteNodeResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, DeleteNodeResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/shutdown/GetNodeRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/shutdown/GetNodeRequest.java index 68b6c20606..177e3bca22 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/shutdown/GetNodeRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/shutdown/GetNodeRequest.java @@ -175,5 +175,5 @@ public GetNodeRequest build() { request -> { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), false, GetNodeResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, GetNodeResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/shutdown/PutNodeRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/shutdown/PutNodeRequest.java index 21c9493c57..159c7648d5 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/shutdown/PutNodeRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/shutdown/PutNodeRequest.java @@ -148,5 +148,5 @@ public PutNodeRequest build() { request -> { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), false, PutNodeResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, PutNodeResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryRequest.java index d245a74fd2..ec037908bc 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CleanupRepositoryRequest.java @@ -273,5 +273,5 @@ public CleanupRepositoryRequest build() { } return params; - }, SimpleEndpoint.emptyMap(), false, CleanupRepositoryResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, CleanupRepositoryResponse._DESERIALIZER, ErrorResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotRequest.java b/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotRequest.java index 0b60409993..a61ffe17fa 100644 --- a/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotRequest.java +++ b/java-client/src/main/java/org/opensearch/client/opensearch/snapshot/CloneSnapshotRequest.java @@ -378,5 +378,5 @@ protected static void setupCloneSnapshotRequestDeserializer(ObjectDeserializer extends SimpleEndpoint { +public class BooleanEndpoint extends SimpleEndpoint { public BooleanEndpoint( String id, @@ -49,7 +50,7 @@ public BooleanEndpoint( boolean hasRequestBody, // always false JsonpDeserializer responseParser // always null ) { - super(method, requestUrl, queryParameters, headers, false, null); + super(method, requestUrl, queryParameters, headers, false, null, ErrorResponse._DESERIALIZER); } @Override diff --git a/java-client/src/main/java/org/opensearch/client/transport/endpoints/SimpleEndpoint.java b/java-client/src/main/java/org/opensearch/client/transport/endpoints/SimpleEndpoint.java index 1f40ff5267..1995deac75 100644 --- a/java-client/src/main/java/org/opensearch/client/transport/endpoints/SimpleEndpoint.java +++ b/java-client/src/main/java/org/opensearch/client/transport/endpoints/SimpleEndpoint.java @@ -32,7 +32,6 @@ package org.opensearch.client.transport.endpoints; -import org.opensearch.client.opensearch._types.ErrorResponse; import org.apache.hc.core5.net.URLEncodedUtils; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.transport.JsonEndpoint; @@ -41,7 +40,7 @@ import java.util.Map; import java.util.function.Function; -public class SimpleEndpoint implements JsonEndpoint { +public class SimpleEndpoint implements JsonEndpoint { private static final Function> EMPTY_MAP = x -> Collections.emptyMap(); @@ -60,14 +59,16 @@ public static Function> emptyMap() { private final Function> headers; private final boolean hasRequestBody; private final JsonpDeserializer responseParser; + private final JsonpDeserializer errorDeserializer; public SimpleEndpoint( - Function method, - Function requestUrl, - Function> queryParameters, - Function> headers, - boolean hasRequestBody, - JsonpDeserializer responseParser + Function method, + Function requestUrl, + Function> queryParameters, + Function> headers, + boolean hasRequestBody, + JsonpDeserializer responseParser, + JsonpDeserializer errorDeserializer ) { this.method = method; this.requestUrl = requestUrl; @@ -75,6 +76,7 @@ public SimpleEndpoint( this.headers = headers; this.hasRequestBody = hasRequestBody; this.responseParser = responseParser; + this.errorDeserializer = errorDeserializer; } @Override @@ -114,11 +116,11 @@ public boolean isError(int statusCode) { } @Override - public JsonpDeserializer errorDeserializer(int statusCode) { - return ErrorResponse._DESERIALIZER; + public JsonpDeserializer errorDeserializer(int statusCode) { + return errorDeserializer; } - public SimpleEndpoint withResponseDeserializer( + public SimpleEndpoint withResponseDeserializer( JsonpDeserializer newResponseParser ) { return new SimpleEndpoint<>( @@ -127,7 +129,8 @@ public SimpleEndpoint withResponseDeseria queryParameters, headers, hasRequestBody, - newResponseParser + newResponseParser, + errorDeserializer ); } diff --git a/java-client/src/main/java/org/opensearch/client/transport/httpclient5/ApacheHttpClient5Transport.java b/java-client/src/main/java/org/opensearch/client/transport/httpclient5/ApacheHttpClient5Transport.java index 033cbcaaa7..07bbce826d 100644 --- a/java-client/src/main/java/org/opensearch/client/transport/httpclient5/ApacheHttpClient5Transport.java +++ b/java-client/src/main/java/org/opensearch/client/transport/httpclient5/ApacheHttpClient5Transport.java @@ -73,8 +73,7 @@ import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.NdJsonpSerializable; -import org.opensearch.client.opensearch._types.ErrorResponse; -import org.opensearch.client.opensearch._types.OpenSearchException; +import org.opensearch.client.opensearch._types.OpenSearchExceptionFactory; import org.opensearch.client.transport.Endpoint; import org.opensearch.client.transport.JsonEndpoint; import org.opensearch.client.transport.OpenSearchTransport; @@ -474,8 +473,7 @@ private ResponseT prepareResponse(Response clientResp, InputStream content = entity.getContent(); try (JsonParser parser = mapper.jsonProvider().createParser(content)) { ErrorT error = errorDeserializer.deserialize(parser, mapper); - // TODO: have the endpoint provide the exception constructor - throw new OpenSearchException((ErrorResponse) error); + throw OpenSearchExceptionFactory.createException(error); } } catch(MissingRequiredPropertyException errorEx) { // Could not decode exception, try the response type diff --git a/java-client/src/main/java/org/opensearch/client/transport/rest_client/RestClientTransport.java b/java-client/src/main/java/org/opensearch/client/transport/rest_client/RestClientTransport.java index 336392be3f..21c16eb550 100644 --- a/java-client/src/main/java/org/opensearch/client/transport/rest_client/RestClientTransport.java +++ b/java-client/src/main/java/org/opensearch/client/transport/rest_client/RestClientTransport.java @@ -32,11 +32,10 @@ package org.opensearch.client.transport.rest_client; -import org.opensearch.client.opensearch._types.OpenSearchException; -import org.opensearch.client.opensearch._types.ErrorResponse; import org.opensearch.client.json.JsonpDeserializer; import org.opensearch.client.json.JsonpMapper; import org.opensearch.client.json.NdJsonpSerializable; +import org.opensearch.client.opensearch._types.OpenSearchExceptionFactory; import org.opensearch.client.transport.JsonEndpoint; import org.opensearch.client.transport.TransportException; import org.opensearch.client.transport.endpoints.BooleanEndpoint; @@ -270,8 +269,7 @@ private ResponseT getHighLevelResponse( InputStream content = entity.getContent(); try (JsonParser parser = mapper.jsonProvider().createParser(content)) { ErrorT error = errorDeserializer.deserialize(parser, mapper); - // TODO: have the endpoint provide the exception constructor - throw new OpenSearchException((ErrorResponse) error); + throw OpenSearchExceptionFactory.createException(error); } } catch(MissingRequiredPropertyException errorEx) { // Could not decode exception, try the response type diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/experiments/api/FooOptRequest.java b/java-client/src/test/java/org/opensearch/client/opensearch/experiments/api/FooOptRequest.java index 191c8940b3..03968a9791 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/experiments/api/FooOptRequest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/experiments/api/FooOptRequest.java @@ -271,13 +271,14 @@ public FooOptRequest build() { // } public static final Endpoint ENDPOINT = - new SimpleEndpoint( + new SimpleEndpoint( r -> "POST", r -> "/foo", SimpleEndpoint.emptyMap(), SimpleEndpoint.emptyMap(), true, - FooResponse.PARSER + FooResponse.PARSER, + ErrorResponse._DESERIALIZER ) { }; diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/experiments/api/FooRequest.java b/java-client/src/test/java/org/opensearch/client/opensearch/experiments/api/FooRequest.java index 6a82a795d3..9e45af192c 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/experiments/api/FooRequest.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/experiments/api/FooRequest.java @@ -317,7 +317,8 @@ public static JsonpDeserializer parser() { SimpleEndpoint.emptyMap(), SimpleEndpoint.emptyMap(), true, - FooResponse.PARSER + FooResponse.PARSER, + ErrorResponse._DESERIALIZER ); public static void requireTrue(boolean v, String message) { diff --git a/java-client/src/test/java/org/opensearch/client/opensearch/experiments/generics/GenericClass.java b/java-client/src/test/java/org/opensearch/client/opensearch/experiments/generics/GenericClass.java index 15b83578fd..b7751e13b3 100644 --- a/java-client/src/test/java/org/opensearch/client/opensearch/experiments/generics/GenericClass.java +++ b/java-client/src/test/java/org/opensearch/client/opensearch/experiments/generics/GenericClass.java @@ -127,7 +127,8 @@ public static Endpoint, ErrorResponse SimpleEndpoint.emptyMap(), SimpleEndpoint.emptyMap(), true, - GenericClass.parser(genParamDeserializer) + GenericClass.parser(genParamDeserializer), + ErrorResponse._DESERIALIZER ); }