From 681c29b4ccd1a4b0beb8c2d7151a3aca2a45604d Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Fri, 15 Apr 2022 15:47:22 -0700 Subject: [PATCH] [2.x] Remove deprecation warning of using REST API request parameter 'master_timeout' (#2920) The plan of deprecation parameter "master_timeout" changed to not show deprecation warning of 'master_timeout' parameter in 2.x version, but start to emit warning from version 3.0 . For the detailed plan, see issue https://github.com/opensearch-project/OpenSearch/issues/2928. Signed-off-by: Tianli Feng (cherry picked from commit 8bc5765866939db680280058e664bbcd5efe4e30) --- .../org/opensearch/rest/BaseRestHandler.java | 21 ++-- .../cluster/RestCleanupRepositoryAction.java | 2 +- .../cluster/RestCloneSnapshotAction.java | 2 +- .../cluster/RestClusterGetSettingsAction.java | 2 +- .../cluster/RestClusterHealthAction.java | 2 +- .../cluster/RestClusterRerouteAction.java | 2 +- .../admin/cluster/RestClusterStateAction.java | 2 +- .../RestClusterUpdateSettingsAction.java | 2 +- .../cluster/RestCreateSnapshotAction.java | 2 +- .../cluster/RestDeleteRepositoryAction.java | 2 +- .../cluster/RestDeleteSnapshotAction.java | 2 +- .../cluster/RestDeleteStoredScriptAction.java | 2 +- .../cluster/RestGetRepositoriesAction.java | 2 +- .../admin/cluster/RestGetSnapshotsAction.java | 2 +- .../cluster/RestGetStoredScriptAction.java | 2 +- .../RestPendingClusterTasksAction.java | 2 +- .../cluster/RestPutRepositoryAction.java | 2 +- .../cluster/RestPutStoredScriptAction.java | 2 +- .../cluster/RestRestoreSnapshotAction.java | 2 +- .../cluster/RestSnapshotsStatusAction.java | 2 +- .../cluster/RestVerifyRepositoryAction.java | 2 +- .../RestDeleteDanglingIndexAction.java | 2 +- .../RestImportDanglingIndexAction.java | 2 +- .../indices/RestAddIndexBlockAction.java | 2 +- .../admin/indices/RestCloseIndexAction.java | 2 +- .../admin/indices/RestCreateIndexAction.java | 2 +- .../RestDeleteComponentTemplateAction.java | 2 +- ...stDeleteComposableIndexTemplateAction.java | 2 +- .../admin/indices/RestDeleteIndexAction.java | 2 +- .../RestDeleteIndexTemplateAction.java | 2 +- .../RestGetComponentTemplateAction.java | 2 +- .../RestGetComposableIndexTemplateAction.java | 2 +- .../indices/RestGetIndexTemplateAction.java | 2 +- .../admin/indices/RestGetIndicesAction.java | 2 +- .../admin/indices/RestGetMappingAction.java | 10 +- .../admin/indices/RestGetSettingsAction.java | 2 +- .../indices/RestIndexDeleteAliasesAction.java | 2 +- .../indices/RestIndexPutAliasAction.java | 2 +- .../indices/RestIndicesAliasesAction.java | 2 +- .../admin/indices/RestOpenIndexAction.java | 2 +- .../RestPutComponentTemplateAction.java | 2 +- .../RestPutComposableIndexTemplateAction.java | 2 +- .../indices/RestPutIndexTemplateAction.java | 2 +- .../admin/indices/RestPutMappingAction.java | 2 +- .../admin/indices/RestResizeHandler.java | 2 +- .../indices/RestRolloverIndexAction.java | 2 +- .../RestSimulateIndexTemplateAction.java | 2 +- .../indices/RestSimulateTemplateAction.java | 2 +- .../indices/RestUpdateSettingsAction.java | 2 +- .../rest/action/cat/RestAllocationAction.java | 2 +- .../rest/action/cat/RestIndicesAction.java | 9 +- .../rest/action/cat/RestMasterAction.java | 2 +- .../rest/action/cat/RestNodeAttrsAction.java | 2 +- .../rest/action/cat/RestNodesAction.java | 2 +- .../cat/RestPendingClusterTasksAction.java | 2 +- .../rest/action/cat/RestPluginsAction.java | 2 +- .../action/cat/RestRepositoriesAction.java | 2 +- .../rest/action/cat/RestSegmentsAction.java | 2 +- .../rest/action/cat/RestShardsAction.java | 2 +- .../rest/action/cat/RestSnapshotAction.java | 2 +- .../rest/action/cat/RestTemplatesAction.java | 2 +- .../rest/action/cat/RestThreadPoolAction.java | 2 +- .../ingest/RestDeletePipelineAction.java | 2 +- .../action/ingest/RestGetPipelineAction.java | 2 +- .../action/ingest/RestPutPipelineAction.java | 2 +- .../RenamedTimeoutRequestParameterTests.java | 96 +------------------ 66 files changed, 73 insertions(+), 187 deletions(-) diff --git a/server/src/main/java/org/opensearch/rest/BaseRestHandler.java b/server/src/main/java/org/opensearch/rest/BaseRestHandler.java index e16e385910d98..bf2fe0f16cb0d 100644 --- a/server/src/main/java/org/opensearch/rest/BaseRestHandler.java +++ b/server/src/main/java/org/opensearch/rest/BaseRestHandler.java @@ -41,7 +41,6 @@ import org.opensearch.client.node.NodeClient; import org.opensearch.common.CheckedConsumer; import org.opensearch.common.collect.Tuple; -import org.opensearch.common.logging.DeprecationLogger; import org.opensearch.common.settings.Setting; import org.opensearch.common.settings.Setting.Property; import org.opensearch.plugins.ActionPlugin; @@ -203,27 +202,19 @@ protected Set responseParams() { return Collections.emptySet(); } + protected static final String DUPLICATE_PARAMETER_ERROR_MESSAGE = + "Please only use one of the request parameters [master_timeout, cluster_manager_timeout]."; + /** * Parse the deprecated request parameter 'master_timeout', and add deprecated log if the parameter is used. * It also validates whether the two parameters 'master_timeout' and 'cluster_manager_timeout' are not assigned together. - * The method is temporarily added in 2.0 duing applying inclusive language. Remove the method along with MASTER_ROLE. + * Deprecation log is not emitted intentionally, because 'master_timeout' is remained in High-Level-REST-Client to keep compatibility with server 1.x. + * The method is temporarily added in 2.0 during applying inclusive language. Remove the method along with the parameter 'master_timeout'. * @param mnr the action request * @param request the REST request to handle - * @param logger the logger that logs deprecation notices - * @param logMsgKeyPrefix the key prefix of a deprecation message to avoid duplicate messages. */ - public static void parseDeprecatedMasterTimeoutParameter( - MasterNodeRequest mnr, - RestRequest request, - DeprecationLogger logger, - String logMsgKeyPrefix - ) { - final String MASTER_TIMEOUT_DEPRECATED_MESSAGE = - "Parameter [master_timeout] is deprecated and will be removed in 3.0. To support inclusive language, please use [cluster_manager_timeout] instead."; - final String DUPLICATE_PARAMETER_ERROR_MESSAGE = - "Please only use one of the request parameters [master_timeout, cluster_manager_timeout]."; + public static void parseDeprecatedMasterTimeoutParameter(MasterNodeRequest mnr, RestRequest request) { if (request.hasParam("master_timeout")) { - logger.deprecate(logMsgKeyPrefix + "_master_timeout_parameter", MASTER_TIMEOUT_DEPRECATED_MESSAGE); if (request.hasParam("cluster_manager_timeout")) { throw new OpenSearchParseException(DUPLICATE_PARAMETER_ERROR_MESSAGE); } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestCleanupRepositoryAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestCleanupRepositoryAction.java index c568eae91a528..befd643167238 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestCleanupRepositoryAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestCleanupRepositoryAction.java @@ -70,7 +70,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC cleanupRepositoryRequest.masterNodeTimeout( request.paramAsTime("cluster_manager_timeout", cleanupRepositoryRequest.masterNodeTimeout()) ); - parseDeprecatedMasterTimeoutParameter(cleanupRepositoryRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(cleanupRepositoryRequest, request); return channel -> client.admin().cluster().cleanupRepository(cleanupRepositoryRequest, new RestToXContentListener<>(channel)); } } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestCloneSnapshotAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestCloneSnapshotAction.java index abf1efa19f79b..4aa8bd44c3620 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestCloneSnapshotAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestCloneSnapshotAction.java @@ -75,7 +75,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC XContentMapValues.nodeStringArrayValue(source.getOrDefault("indices", Collections.emptyList())) ); cloneSnapshotRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", cloneSnapshotRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(cloneSnapshotRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(cloneSnapshotRequest, request); cloneSnapshotRequest.indicesOptions(IndicesOptions.fromMap(source, cloneSnapshotRequest.indicesOptions())); return channel -> client.admin().cluster().cloneSnapshot(cloneSnapshotRequest, new RestToXContentListener<>(channel)); } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java index 1238cd2a818d5..3917505c42496 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterGetSettingsAction.java @@ -88,7 +88,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC final boolean renderDefaults = request.paramAsBoolean("include_defaults", false); clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local())); clusterStateRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterStateRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request); return channel -> client.admin().cluster().state(clusterStateRequest, new RestBuilderListener(channel) { @Override public RestResponse buildResponse(ClusterStateResponse response, XContentBuilder builder) throws Exception { diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterHealthAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterHealthAction.java index 877e387a15ec3..b00db3a7f6daf 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterHealthAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterHealthAction.java @@ -85,7 +85,7 @@ public static ClusterHealthRequest fromRequest(final RestRequest request) { clusterHealthRequest.indicesOptions(IndicesOptions.fromRequest(request, clusterHealthRequest.indicesOptions())); clusterHealthRequest.local(request.paramAsBoolean("local", clusterHealthRequest.local())); clusterHealthRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterHealthRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(clusterHealthRequest, request, deprecationLogger, "cluster_health"); + parseDeprecatedMasterTimeoutParameter(clusterHealthRequest, request); clusterHealthRequest.timeout(request.paramAsTime("timeout", clusterHealthRequest.timeout())); String waitForStatus = request.param("wait_for_status"); if (waitForStatus != null) { diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterRerouteAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterRerouteAction.java index dc5e0ba57e4db..f375b572ef110 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterRerouteAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterRerouteAction.java @@ -144,7 +144,7 @@ public static ClusterRerouteRequest createRequest(RestRequest request) throws IO clusterRerouteRequest.timeout(request.paramAsTime("timeout", clusterRerouteRequest.timeout())); clusterRerouteRequest.setRetryFailed(request.paramAsBoolean("retry_failed", clusterRerouteRequest.isRetryFailed())); clusterRerouteRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterRerouteRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(clusterRerouteRequest, request, deprecationLogger, "cluster_reroute"); + parseDeprecatedMasterTimeoutParameter(clusterRerouteRequest, request); request.applyContentParser(parser -> PARSER.parse(parser, clusterRerouteRequest, null)); return clusterRerouteRequest; } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterStateAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterStateAction.java index 02b1eaa741c9e..d97d1a0a30e28 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterStateAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterStateAction.java @@ -105,7 +105,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC clusterStateRequest.indicesOptions(IndicesOptions.fromRequest(request, clusterStateRequest.indicesOptions())); clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local())); clusterStateRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterStateRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request); if (request.hasParam("wait_for_metadata_version")) { clusterStateRequest.waitForMetadataVersion(request.paramAsLong("wait_for_metadata_version", 0)); } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java index c05cdc752b5f7..f42abcfbc6e29 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestClusterUpdateSettingsAction.java @@ -74,7 +74,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC clusterUpdateSettingsRequest.masterNodeTimeout( request.paramAsTime("cluster_manager_timeout", clusterUpdateSettingsRequest.masterNodeTimeout()) ); - parseDeprecatedMasterTimeoutParameter(clusterUpdateSettingsRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(clusterUpdateSettingsRequest, request); Map source; try (XContentParser parser = request.contentParser()) { source = parser.map(); diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestCreateSnapshotAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestCreateSnapshotAction.java index b3503f0dfbb56..78c19732b5475 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestCreateSnapshotAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestCreateSnapshotAction.java @@ -72,7 +72,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC CreateSnapshotRequest createSnapshotRequest = createSnapshotRequest(request.param("repository"), request.param("snapshot")); request.applyContentParser(p -> createSnapshotRequest.source(p.mapOrdered())); createSnapshotRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", createSnapshotRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(createSnapshotRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(createSnapshotRequest, request); createSnapshotRequest.waitForCompletion(request.paramAsBoolean("wait_for_completion", false)); return channel -> client.admin().cluster().createSnapshot(createSnapshotRequest, new RestToXContentListener<>(channel)); } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java index 5e53595e3a49b..7c8a797b9c924 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestDeleteRepositoryAction.java @@ -70,7 +70,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC deleteRepositoryRequest.masterNodeTimeout( request.paramAsTime("cluster_manager_timeout", deleteRepositoryRequest.masterNodeTimeout()) ); - parseDeprecatedMasterTimeoutParameter(deleteRepositoryRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(deleteRepositoryRequest, request); return channel -> client.admin().cluster().deleteRepository(deleteRepositoryRequest, new RestToXContentListener<>(channel)); } } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java index 891b84f8d0869..380a04dbcd387 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestDeleteSnapshotAction.java @@ -71,7 +71,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC Strings.splitStringByCommaToArray(request.param("snapshot")) ); deleteSnapshotRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", deleteSnapshotRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(deleteSnapshotRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(deleteSnapshotRequest, request); return channel -> client.admin().cluster().deleteSnapshot(deleteSnapshotRequest, new RestToXContentListener<>(channel)); } } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java index b303f769d216b..e1e705383e66b 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestDeleteStoredScriptAction.java @@ -66,7 +66,7 @@ public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client deleteStoredScriptRequest.masterNodeTimeout( request.paramAsTime("cluster_manager_timeout", deleteStoredScriptRequest.masterNodeTimeout()) ); - parseDeprecatedMasterTimeoutParameter(deleteStoredScriptRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(deleteStoredScriptRequest, request); return channel -> client.admin().cluster().deleteStoredScript(deleteStoredScriptRequest, new RestToXContentListener<>(channel)); } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestGetRepositoriesAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestGetRepositoriesAction.java index 780d9266549ae..ddbad64cfd3dc 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestGetRepositoriesAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestGetRepositoriesAction.java @@ -81,7 +81,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC getRepositoriesRequest.masterNodeTimeout( request.paramAsTime("cluster_manager_timeout", getRepositoriesRequest.masterNodeTimeout()) ); - parseDeprecatedMasterTimeoutParameter(getRepositoriesRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(getRepositoriesRequest, request); getRepositoriesRequest.local(request.paramAsBoolean("local", getRepositoriesRequest.local())); settingsFilter.addFilterSettingParams(request); return channel -> client.admin().cluster().getRepositories(getRepositoriesRequest, new RestToXContentListener<>(channel)); diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestGetSnapshotsAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestGetSnapshotsAction.java index 189795516adbd..355071720c4ac 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestGetSnapshotsAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestGetSnapshotsAction.java @@ -73,7 +73,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC getSnapshotsRequest.ignoreUnavailable(request.paramAsBoolean("ignore_unavailable", getSnapshotsRequest.ignoreUnavailable())); getSnapshotsRequest.verbose(request.paramAsBoolean("verbose", getSnapshotsRequest.verbose())); getSnapshotsRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", getSnapshotsRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(getSnapshotsRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(getSnapshotsRequest, request); return channel -> client.admin().cluster().getSnapshots(getSnapshotsRequest, new RestToXContentListener<>(channel)); } } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestGetStoredScriptAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestGetStoredScriptAction.java index 5a904b99be469..43d386a4f3852 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestGetStoredScriptAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestGetStoredScriptAction.java @@ -63,7 +63,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, NodeClient String id = request.param("id"); GetStoredScriptRequest getRequest = new GetStoredScriptRequest(id); getRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", getRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(getRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(getRequest, request); return channel -> client.admin().cluster().getStoredScript(getRequest, new RestStatusToXContentListener<>(channel)); } } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java index 155adc8cc7e19..c6091adf9a57c 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestPendingClusterTasksAction.java @@ -65,7 +65,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC pendingClusterTasksRequest.masterNodeTimeout( request.paramAsTime("cluster_manager_timeout", pendingClusterTasksRequest.masterNodeTimeout()) ); - parseDeprecatedMasterTimeoutParameter(pendingClusterTasksRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(pendingClusterTasksRequest, request); pendingClusterTasksRequest.local(request.paramAsBoolean("local", pendingClusterTasksRequest.local())); return channel -> client.admin().cluster().pendingClusterTasks(pendingClusterTasksRequest, new RestToXContentListener<>(channel)); } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestPutRepositoryAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestPutRepositoryAction.java index a1f34294d630d..87aea07767b40 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestPutRepositoryAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestPutRepositoryAction.java @@ -74,7 +74,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC } putRepositoryRequest.verify(request.paramAsBoolean("verify", true)); putRepositoryRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", putRepositoryRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(putRepositoryRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(putRepositoryRequest, request); putRepositoryRequest.timeout(request.paramAsTime("timeout", putRepositoryRequest.timeout())); return channel -> client.admin().cluster().putRepository(putRepositoryRequest, new RestToXContentListener<>(channel)); } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestPutStoredScriptAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestPutStoredScriptAction.java index 1568a80278bb9..4b5979d566b8c 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestPutStoredScriptAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestPutStoredScriptAction.java @@ -80,7 +80,7 @@ public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client PutStoredScriptRequest putRequest = new PutStoredScriptRequest(id, context, content, request.getXContentType(), source); putRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", putRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(putRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(putRequest, request); putRequest.timeout(request.paramAsTime("timeout", putRequest.timeout())); return channel -> client.admin().cluster().putStoredScript(putRequest, new RestToXContentListener<>(channel)); } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java index 6c607b48a89fb..091e1abdbe2ab 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestRestoreSnapshotAction.java @@ -69,7 +69,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC restoreSnapshotRequest.masterNodeTimeout( request.paramAsTime("cluster_manager_timeout", restoreSnapshotRequest.masterNodeTimeout()) ); - parseDeprecatedMasterTimeoutParameter(restoreSnapshotRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(restoreSnapshotRequest, request); restoreSnapshotRequest.waitForCompletion(request.paramAsBoolean("wait_for_completion", false)); request.applyContentParser(p -> restoreSnapshotRequest.source(p.mapOrdered())); return channel -> client.admin().cluster().restoreSnapshot(restoreSnapshotRequest, new RestToXContentListener<>(channel)); diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java index 469c1eac348d1..78caad8f18522 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestSnapshotsStatusAction.java @@ -84,7 +84,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC snapshotsStatusRequest.masterNodeTimeout( request.paramAsTime("cluster_manager_timeout", snapshotsStatusRequest.masterNodeTimeout()) ); - parseDeprecatedMasterTimeoutParameter(snapshotsStatusRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(snapshotsStatusRequest, request); return channel -> client.admin().cluster().snapshotsStatus(snapshotsStatusRequest, new RestToXContentListener<>(channel)); } } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java index 4792d0e6db148..ee6d24119ca41 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/RestVerifyRepositoryAction.java @@ -66,7 +66,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC verifyRepositoryRequest.masterNodeTimeout( request.paramAsTime("cluster_manager_timeout", verifyRepositoryRequest.masterNodeTimeout()) ); - parseDeprecatedMasterTimeoutParameter(verifyRepositoryRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(verifyRepositoryRequest, request); verifyRepositoryRequest.timeout(request.paramAsTime("timeout", verifyRepositoryRequest.timeout())); return channel -> client.admin().cluster().verifyRepository(verifyRepositoryRequest, new RestToXContentListener<>(channel)); } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/dangling/RestDeleteDanglingIndexAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/dangling/RestDeleteDanglingIndexAction.java index 3e8883058d18e..40fbd028bde7a 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/dangling/RestDeleteDanglingIndexAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/dangling/RestDeleteDanglingIndexAction.java @@ -71,7 +71,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, NodeClient deleteRequest.timeout(request.paramAsTime("timeout", deleteRequest.timeout())); deleteRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", deleteRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(deleteRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(deleteRequest, request); return channel -> client.admin() .cluster() diff --git a/server/src/main/java/org/opensearch/rest/action/admin/cluster/dangling/RestImportDanglingIndexAction.java b/server/src/main/java/org/opensearch/rest/action/admin/cluster/dangling/RestImportDanglingIndexAction.java index 5a48159bd9651..74c7340c2a7c5 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/cluster/dangling/RestImportDanglingIndexAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/cluster/dangling/RestImportDanglingIndexAction.java @@ -70,7 +70,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, NodeClient importRequest.timeout(request.paramAsTime("timeout", importRequest.timeout())); importRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", importRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(importRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(importRequest, request); return channel -> client.admin() .cluster() diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestAddIndexBlockAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestAddIndexBlockAction.java index 6854662e3bb18..0df8721543a2c 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestAddIndexBlockAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestAddIndexBlockAction.java @@ -69,7 +69,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC Strings.splitStringByCommaToArray(request.param("index")) ); addIndexBlockRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", addIndexBlockRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(addIndexBlockRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(addIndexBlockRequest, request); addIndexBlockRequest.timeout(request.paramAsTime("timeout", addIndexBlockRequest.timeout())); addIndexBlockRequest.indicesOptions(IndicesOptions.fromRequest(request, addIndexBlockRequest.indicesOptions())); return channel -> client.admin().indices().addBlock(addIndexBlockRequest, new RestToXContentListener<>(channel)); diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestCloseIndexAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestCloseIndexAction.java index 168d553112fe1..98d75782bc741 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestCloseIndexAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestCloseIndexAction.java @@ -67,7 +67,7 @@ public String getName() { public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { CloseIndexRequest closeIndexRequest = new CloseIndexRequest(Strings.splitStringByCommaToArray(request.param("index"))); closeIndexRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", closeIndexRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(closeIndexRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(closeIndexRequest, request); closeIndexRequest.timeout(request.paramAsTime("timeout", closeIndexRequest.timeout())); closeIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, closeIndexRequest.indicesOptions())); String waitForActiveShards = request.param("wait_for_active_shards"); diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestCreateIndexAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestCreateIndexAction.java index 54199b8e68516..3c634106e68f1 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestCreateIndexAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestCreateIndexAction.java @@ -78,7 +78,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC createIndexRequest.timeout(request.paramAsTime("timeout", createIndexRequest.timeout())); createIndexRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", createIndexRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(createIndexRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(createIndexRequest, request); createIndexRequest.waitForActiveShards(ActiveShardCount.parseString(request.param("wait_for_active_shards"))); return channel -> client.admin().indices().create(createIndexRequest, new RestToXContentListener<>(channel)); } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestDeleteComponentTemplateAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestDeleteComponentTemplateAction.java index 05656cb250596..4486b090ec333 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestDeleteComponentTemplateAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestDeleteComponentTemplateAction.java @@ -64,7 +64,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC DeleteComponentTemplateAction.Request deleteReq = new DeleteComponentTemplateAction.Request(request.param("name")); deleteReq.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", deleteReq.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(deleteReq, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(deleteReq, request); return channel -> client.execute(DeleteComponentTemplateAction.INSTANCE, deleteReq, new RestToXContentListener<>(channel)); } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestDeleteComposableIndexTemplateAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestDeleteComposableIndexTemplateAction.java index b08288593515b..69db0b273ca73 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestDeleteComposableIndexTemplateAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestDeleteComposableIndexTemplateAction.java @@ -64,7 +64,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC DeleteComposableIndexTemplateAction.Request deleteReq = new DeleteComposableIndexTemplateAction.Request(request.param("name")); deleteReq.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", deleteReq.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(deleteReq, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(deleteReq, request); return channel -> client.execute(DeleteComposableIndexTemplateAction.INSTANCE, deleteReq, new RestToXContentListener<>(channel)); } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestDeleteIndexAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestDeleteIndexAction.java index 63fa8a4b29d85..50673e12fa623 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestDeleteIndexAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestDeleteIndexAction.java @@ -67,7 +67,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC DeleteIndexRequest deleteIndexRequest = new DeleteIndexRequest(Strings.splitStringByCommaToArray(request.param("index"))); deleteIndexRequest.timeout(request.paramAsTime("timeout", deleteIndexRequest.timeout())); deleteIndexRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", deleteIndexRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(deleteIndexRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(deleteIndexRequest, request); deleteIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, deleteIndexRequest.indicesOptions())); return channel -> client.admin().indices().delete(deleteIndexRequest, new RestToXContentListener<>(channel)); } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java index ce49332a4abbd..d17214d41b75c 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestDeleteIndexTemplateAction.java @@ -64,7 +64,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC deleteIndexTemplateRequest.masterNodeTimeout( request.paramAsTime("cluster_manager_timeout", deleteIndexTemplateRequest.masterNodeTimeout()) ); - parseDeprecatedMasterTimeoutParameter(deleteIndexTemplateRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(deleteIndexTemplateRequest, request); return channel -> client.admin().indices().deleteTemplate(deleteIndexTemplateRequest, new RestToXContentListener<>(channel)); } } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetComponentTemplateAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetComponentTemplateAction.java index e245c5a20848f..69e983d547a1f 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetComponentTemplateAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetComponentTemplateAction.java @@ -76,7 +76,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC getRequest.local(request.paramAsBoolean("local", getRequest.local())); getRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", getRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(getRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(getRequest, request); final boolean implicitAll = getRequest.name() == null; diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetComposableIndexTemplateAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetComposableIndexTemplateAction.java index d860e8856571e..8f3e58fd2298a 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetComposableIndexTemplateAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetComposableIndexTemplateAction.java @@ -75,7 +75,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC getRequest.local(request.paramAsBoolean("local", getRequest.local())); getRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", getRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(getRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(getRequest, request); final boolean implicitAll = getRequest.name() == null; diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetIndexTemplateAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetIndexTemplateAction.java index cda29d2b0ad47..617695f572817 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetIndexTemplateAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetIndexTemplateAction.java @@ -82,7 +82,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC getIndexTemplatesRequest.masterNodeTimeout( request.paramAsTime("cluster_manager_timeout", getIndexTemplatesRequest.masterNodeTimeout()) ); - parseDeprecatedMasterTimeoutParameter(getIndexTemplatesRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(getIndexTemplatesRequest, request); final boolean implicitAll = getIndexTemplatesRequest.names().length == 0; diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetIndicesAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetIndicesAction.java index c94d691d4e99b..d2ae85c32a3ef 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetIndicesAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetIndicesAction.java @@ -76,7 +76,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC getIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, getIndexRequest.indicesOptions())); getIndexRequest.local(request.paramAsBoolean("local", getIndexRequest.local())); getIndexRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", getIndexRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(getIndexRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(getIndexRequest, request); getIndexRequest.humanReadable(request.paramAsBoolean("human", false)); getIndexRequest.includeDefaults(request.paramAsBoolean("include_defaults", false)); return channel -> client.admin().indices().getIndex(getIndexRequest, new RestToXContentListener<>(channel)); diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetMappingAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetMappingAction.java index 86bf6b626c24a..8d00528c9c60e 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetMappingAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetMappingAction.java @@ -40,7 +40,6 @@ import org.opensearch.action.support.IndicesOptions; import org.opensearch.client.node.NodeClient; import org.opensearch.common.Strings; -import org.opensearch.common.logging.DeprecationLogger; import org.opensearch.common.unit.TimeValue; import org.opensearch.common.xcontent.XContentBuilder; import org.opensearch.rest.BaseRestHandler; @@ -61,12 +60,6 @@ public class RestGetMappingAction extends BaseRestHandler { - private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestGetMappingAction.class); - private static final String MASTER_TIMEOUT_DEPRECATED_MESSAGE = - "Parameter [master_timeout] is deprecated and will be removed in 3.0. To support inclusive language, please use [cluster_manager_timeout] instead."; - private static final String DUPLICATE_PARAMETER_ERROR_MESSAGE = - "Please only use one of the request parameters [master_timeout, cluster_manager_timeout]."; - private final ThreadPool threadPool; public RestGetMappingAction(ThreadPool threadPool) { @@ -98,9 +91,8 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC getMappingsRequest.indices(indices); getMappingsRequest.indicesOptions(IndicesOptions.fromRequest(request, getMappingsRequest.indicesOptions())); TimeValue clusterManagerTimeout = request.paramAsTime("cluster_manager_timeout", getMappingsRequest.masterNodeTimeout()); - // TODO: Remove the if condition and statements inside after removing MASTER_ROLE. + // TODO: Remove the if condition and statements inside after removing parameter 'master_timeout'. if (request.hasParam("master_timeout")) { - deprecationLogger.deprecate("get_mapping_master_timeout_parameter", MASTER_TIMEOUT_DEPRECATED_MESSAGE); if (request.hasParam("cluster_manager_timeout")) { throw new OpenSearchParseException(DUPLICATE_PARAMETER_ERROR_MESSAGE); } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetSettingsAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetSettingsAction.java index 293078b3568e3..81d98b9bc9cc1 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetSettingsAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestGetSettingsAction.java @@ -83,7 +83,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC .names(names); getSettingsRequest.local(request.paramAsBoolean("local", getSettingsRequest.local())); getSettingsRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", getSettingsRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(getSettingsRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(getSettingsRequest, request); return channel -> client.admin().indices().getSettings(getSettingsRequest, new RestToXContentListener<>(channel)); } } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java index 9f0b543a456f2..44422c910d367 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestIndexDeleteAliasesAction.java @@ -69,7 +69,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC indicesAliasesRequest.timeout(request.paramAsTime("timeout", indicesAliasesRequest.timeout())); indicesAliasesRequest.addAliasAction(AliasActions.remove().indices(indices).aliases(aliases)); indicesAliasesRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", indicesAliasesRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(indicesAliasesRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(indicesAliasesRequest, request); return channel -> client.admin().indices().aliases(indicesAliasesRequest, new RestToXContentListener<>(channel)); } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestIndexPutAliasAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestIndexPutAliasAction.java index 8f8eeaf1c8e1c..f53a1c6d5b71a 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestIndexPutAliasAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestIndexPutAliasAction.java @@ -128,7 +128,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest(); indicesAliasesRequest.timeout(request.paramAsTime("timeout", indicesAliasesRequest.timeout())); indicesAliasesRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", indicesAliasesRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(indicesAliasesRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(indicesAliasesRequest, request); IndicesAliasesRequest.AliasActions aliasAction = AliasActions.add().indices(indices).alias(alias); if (routing != null) { diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestIndicesAliasesAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestIndicesAliasesAction.java index 20b67fa73a3f5..9524428f172ea 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestIndicesAliasesAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestIndicesAliasesAction.java @@ -64,7 +64,7 @@ public List routes() { public RestChannelConsumer prepareRequest(final RestRequest request, final NodeClient client) throws IOException { IndicesAliasesRequest indicesAliasesRequest = new IndicesAliasesRequest(); indicesAliasesRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", indicesAliasesRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(indicesAliasesRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(indicesAliasesRequest, request); indicesAliasesRequest.timeout(request.paramAsTime("timeout", indicesAliasesRequest.timeout())); try (XContentParser parser = request.contentParser()) { IndicesAliasesRequest.PARSER.parse(parser, indicesAliasesRequest, null); diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestOpenIndexAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestOpenIndexAction.java index a6d434b1e865e..4193a12807b32 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestOpenIndexAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestOpenIndexAction.java @@ -68,7 +68,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC OpenIndexRequest openIndexRequest = new OpenIndexRequest(Strings.splitStringByCommaToArray(request.param("index"))); openIndexRequest.timeout(request.paramAsTime("timeout", openIndexRequest.timeout())); openIndexRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", openIndexRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(openIndexRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(openIndexRequest, request); openIndexRequest.indicesOptions(IndicesOptions.fromRequest(request, openIndexRequest.indicesOptions())); String waitForActiveShards = request.param("wait_for_active_shards"); if (waitForActiveShards != null) { diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestPutComponentTemplateAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestPutComponentTemplateAction.java index 0d956b4dd147f..f7b4200dc5307 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestPutComponentTemplateAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestPutComponentTemplateAction.java @@ -66,7 +66,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC PutComponentTemplateAction.Request putRequest = new PutComponentTemplateAction.Request(request.param("name")); putRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", putRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(putRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(putRequest, request); putRequest.create(request.paramAsBoolean("create", false)); putRequest.cause(request.param("cause", "api")); putRequest.componentTemplate(ComponentTemplate.parse(request.contentParser())); diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestPutComposableIndexTemplateAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestPutComposableIndexTemplateAction.java index 63352a73b281d..23a527a368d7d 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestPutComposableIndexTemplateAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestPutComposableIndexTemplateAction.java @@ -66,7 +66,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC PutComposableIndexTemplateAction.Request putRequest = new PutComposableIndexTemplateAction.Request(request.param("name")); putRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", putRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(putRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(putRequest, request); putRequest.create(request.paramAsBoolean("create", false)); putRequest.cause(request.param("cause", "api")); putRequest.indexTemplate(ComposableIndexTemplate.parse(request.contentParser())); diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestPutIndexTemplateAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestPutIndexTemplateAction.java index 42cd8e8103a18..ffd18356d0f5e 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestPutIndexTemplateAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestPutIndexTemplateAction.java @@ -79,7 +79,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC } putRequest.order(request.paramAsInt("order", putRequest.order())); putRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", putRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(putRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(putRequest, request); putRequest.create(request.paramAsBoolean("create", false)); putRequest.cause(request.param("cause", "")); diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestPutMappingAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestPutMappingAction.java index 5c305b7c75038..9290e313fd939 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestPutMappingAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestPutMappingAction.java @@ -87,7 +87,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC putMappingRequest.source(sourceAsMap); putMappingRequest.timeout(request.paramAsTime("timeout", putMappingRequest.timeout())); putMappingRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", putMappingRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(putMappingRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(putMappingRequest, request); putMappingRequest.indicesOptions(IndicesOptions.fromRequest(request, putMappingRequest.indicesOptions())); putMappingRequest.writeIndexOnly(request.paramAsBoolean("write_index_only", false)); return channel -> client.admin().indices().putMapping(putMappingRequest, new RestToXContentListener<>(channel)); diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestResizeHandler.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestResizeHandler.java index 4168c7ad48e7c..3cdb63aa389be 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestResizeHandler.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestResizeHandler.java @@ -92,7 +92,7 @@ public final RestChannelConsumer prepareRequest(final RestRequest request, final request.applyContentParser(resizeRequest::fromXContent); resizeRequest.timeout(request.paramAsTime("timeout", resizeRequest.timeout())); resizeRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", resizeRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(resizeRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(resizeRequest, request); resizeRequest.setWaitForActiveShards(ActiveShardCount.parseString(request.param("wait_for_active_shards"))); return channel -> client.admin().indices().resizeIndex(resizeRequest, new RestToXContentListener<>(channel)); } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestRolloverIndexAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestRolloverIndexAction.java index b9f8b936ff23e..f57ec5d0e6606 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestRolloverIndexAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestRolloverIndexAction.java @@ -73,7 +73,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC rolloverIndexRequest.dryRun(request.paramAsBoolean("dry_run", false)); rolloverIndexRequest.timeout(request.paramAsTime("timeout", rolloverIndexRequest.timeout())); rolloverIndexRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", rolloverIndexRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(rolloverIndexRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(rolloverIndexRequest, request); rolloverIndexRequest.getCreateIndexRequest() .waitForActiveShards(ActiveShardCount.parseString(request.param("wait_for_active_shards"))); return channel -> client.admin().indices().rolloverIndex(rolloverIndexRequest, new RestToXContentListener<>(channel)); diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestSimulateIndexTemplateAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestSimulateIndexTemplateAction.java index fb78b7b0a826d..064fb686a1f67 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestSimulateIndexTemplateAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestSimulateIndexTemplateAction.java @@ -67,7 +67,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC simulateIndexTemplateRequest.masterNodeTimeout( request.paramAsTime("cluster_manager_timeout", simulateIndexTemplateRequest.masterNodeTimeout()) ); - parseDeprecatedMasterTimeoutParameter(simulateIndexTemplateRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(simulateIndexTemplateRequest, request); if (request.hasContent()) { PutComposableIndexTemplateAction.Request indexTemplateRequest = new PutComposableIndexTemplateAction.Request( "simulating_template" diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestSimulateTemplateAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestSimulateTemplateAction.java index 58cc0c1e369d8..09ea8795b750f 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestSimulateTemplateAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestSimulateTemplateAction.java @@ -75,7 +75,7 @@ public RestChannelConsumer prepareRequest(RestRequest request, NodeClient client simulateRequest.indexTemplateRequest(indexTemplateRequest); } simulateRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", simulateRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(simulateRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(simulateRequest, request); return channel -> client.execute(SimulateTemplateAction.INSTANCE, simulateRequest, new RestToXContentListener<>(channel)); } diff --git a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestUpdateSettingsAction.java b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestUpdateSettingsAction.java index bfb634d421f2d..a616a86cee2bc 100644 --- a/server/src/main/java/org/opensearch/rest/action/admin/indices/RestUpdateSettingsAction.java +++ b/server/src/main/java/org/opensearch/rest/action/admin/indices/RestUpdateSettingsAction.java @@ -71,7 +71,7 @@ public RestChannelConsumer prepareRequest(final RestRequest request, final NodeC updateSettingsRequest.timeout(request.paramAsTime("timeout", updateSettingsRequest.timeout())); updateSettingsRequest.setPreserveExisting(request.paramAsBoolean("preserve_existing", updateSettingsRequest.isPreserveExisting())); updateSettingsRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", updateSettingsRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(updateSettingsRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(updateSettingsRequest, request); updateSettingsRequest.indicesOptions(IndicesOptions.fromRequest(request, updateSettingsRequest.indicesOptions())); updateSettingsRequest.fromXContent(request.contentParser()); diff --git a/server/src/main/java/org/opensearch/rest/action/cat/RestAllocationAction.java b/server/src/main/java/org/opensearch/rest/action/cat/RestAllocationAction.java index eb03b9e25a294..400fcb7cf0039 100644 --- a/server/src/main/java/org/opensearch/rest/action/cat/RestAllocationAction.java +++ b/server/src/main/java/org/opensearch/rest/action/cat/RestAllocationAction.java @@ -83,7 +83,7 @@ public RestChannelConsumer doCatRequest(final RestRequest request, final NodeCli clusterStateRequest.clear().routingTable(true); clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local())); clusterStateRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterStateRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request); return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener(channel) { @Override diff --git a/server/src/main/java/org/opensearch/rest/action/cat/RestIndicesAction.java b/server/src/main/java/org/opensearch/rest/action/cat/RestIndicesAction.java index 1b70603edf6e1..8d3a6e8b93916 100644 --- a/server/src/main/java/org/opensearch/rest/action/cat/RestIndicesAction.java +++ b/server/src/main/java/org/opensearch/rest/action/cat/RestIndicesAction.java @@ -53,7 +53,6 @@ import org.opensearch.cluster.metadata.IndexMetadata; import org.opensearch.common.Strings; import org.opensearch.common.Table; -import org.opensearch.common.logging.DeprecationLogger; import org.opensearch.common.settings.Settings; import org.opensearch.common.time.DateFormatter; import org.opensearch.common.unit.TimeValue; @@ -84,11 +83,6 @@ public class RestIndicesAction extends AbstractCatAction { private static final DateFormatter STRICT_DATE_TIME_FORMATTER = DateFormatter.forPattern("strict_date_time"); - private static final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RestIndicesAction.class); - private static final String MASTER_TIMEOUT_DEPRECATED_MESSAGE = - "Parameter [master_timeout] is deprecated and will be removed in 3.0. To support inclusive language, please use [cluster_manager_timeout] instead."; - private static final String DUPLICATE_PARAMETER_ERROR_MESSAGE = - "Please only use one of the request parameters [master_timeout, cluster_manager_timeout]."; @Override public List routes() { @@ -117,9 +111,8 @@ public RestChannelConsumer doCatRequest(final RestRequest request, final NodeCli final IndicesOptions indicesOptions = IndicesOptions.fromRequest(request, IndicesOptions.strictExpand()); final boolean local = request.paramAsBoolean("local", false); TimeValue clusterManagerTimeout = request.paramAsTime("cluster_manager_timeout", DEFAULT_MASTER_NODE_TIMEOUT); - // Remove the if condition and statements inside after removing MASTER_ROLE. + // TODO: Remove the if condition and statements inside after removing parameter 'master_timeout'. if (request.hasParam("master_timeout")) { - deprecationLogger.deprecate("cat_indices_master_timeout_parameter", MASTER_TIMEOUT_DEPRECATED_MESSAGE); if (request.hasParam("cluster_manager_timeout")) { throw new OpenSearchParseException(DUPLICATE_PARAMETER_ERROR_MESSAGE); } diff --git a/server/src/main/java/org/opensearch/rest/action/cat/RestMasterAction.java b/server/src/main/java/org/opensearch/rest/action/cat/RestMasterAction.java index 4bcb16c741ecf..6abadc00181b7 100644 --- a/server/src/main/java/org/opensearch/rest/action/cat/RestMasterAction.java +++ b/server/src/main/java/org/opensearch/rest/action/cat/RestMasterAction.java @@ -74,7 +74,7 @@ public RestChannelConsumer doCatRequest(final RestRequest request, final NodeCli clusterStateRequest.clear().nodes(true); clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local())); clusterStateRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterStateRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request); return channel -> client.admin().cluster().state(clusterStateRequest, new RestResponseListener(channel) { @Override diff --git a/server/src/main/java/org/opensearch/rest/action/cat/RestNodeAttrsAction.java b/server/src/main/java/org/opensearch/rest/action/cat/RestNodeAttrsAction.java index 6ea36267d39ed..b8291c43183f0 100644 --- a/server/src/main/java/org/opensearch/rest/action/cat/RestNodeAttrsAction.java +++ b/server/src/main/java/org/opensearch/rest/action/cat/RestNodeAttrsAction.java @@ -80,7 +80,7 @@ public RestChannelConsumer doCatRequest(final RestRequest request, final NodeCli clusterStateRequest.clear().nodes(true); clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local())); clusterStateRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterStateRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request); return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener(channel) { @Override diff --git a/server/src/main/java/org/opensearch/rest/action/cat/RestNodesAction.java b/server/src/main/java/org/opensearch/rest/action/cat/RestNodesAction.java index 3052a9736f9a3..751ce9f8bb57a 100644 --- a/server/src/main/java/org/opensearch/rest/action/cat/RestNodesAction.java +++ b/server/src/main/java/org/opensearch/rest/action/cat/RestNodesAction.java @@ -111,7 +111,7 @@ public RestChannelConsumer doCatRequest(final RestRequest request, final NodeCli } clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local())); clusterStateRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterStateRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request); final boolean fullId = request.paramAsBoolean("full_id", false); return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener(channel) { @Override diff --git a/server/src/main/java/org/opensearch/rest/action/cat/RestPendingClusterTasksAction.java b/server/src/main/java/org/opensearch/rest/action/cat/RestPendingClusterTasksAction.java index 7e261510ee742..27aa4c81d1dcc 100644 --- a/server/src/main/java/org/opensearch/rest/action/cat/RestPendingClusterTasksAction.java +++ b/server/src/main/java/org/opensearch/rest/action/cat/RestPendingClusterTasksAction.java @@ -72,7 +72,7 @@ public RestChannelConsumer doCatRequest(final RestRequest request, final NodeCli pendingClusterTasksRequest.masterNodeTimeout( request.paramAsTime("cluster_manager_timeout", pendingClusterTasksRequest.masterNodeTimeout()) ); - parseDeprecatedMasterTimeoutParameter(pendingClusterTasksRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(pendingClusterTasksRequest, request); pendingClusterTasksRequest.local(request.paramAsBoolean("local", pendingClusterTasksRequest.local())); return channel -> client.admin() .cluster() diff --git a/server/src/main/java/org/opensearch/rest/action/cat/RestPluginsAction.java b/server/src/main/java/org/opensearch/rest/action/cat/RestPluginsAction.java index 8975c8ab4b3de..f6a63baddbbe0 100644 --- a/server/src/main/java/org/opensearch/rest/action/cat/RestPluginsAction.java +++ b/server/src/main/java/org/opensearch/rest/action/cat/RestPluginsAction.java @@ -79,7 +79,7 @@ public RestChannelConsumer doCatRequest(final RestRequest request, final NodeCli clusterStateRequest.clear().nodes(true); clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local())); clusterStateRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterStateRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request); return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener(channel) { @Override diff --git a/server/src/main/java/org/opensearch/rest/action/cat/RestRepositoriesAction.java b/server/src/main/java/org/opensearch/rest/action/cat/RestRepositoriesAction.java index 76c71bee791ef..65c01ab16a99e 100644 --- a/server/src/main/java/org/opensearch/rest/action/cat/RestRepositoriesAction.java +++ b/server/src/main/java/org/opensearch/rest/action/cat/RestRepositoriesAction.java @@ -66,7 +66,7 @@ public RestChannelConsumer doCatRequest(RestRequest request, NodeClient client) getRepositoriesRequest.masterNodeTimeout( request.paramAsTime("cluster_manager_timeout", getRepositoriesRequest.masterNodeTimeout()) ); - parseDeprecatedMasterTimeoutParameter(getRepositoriesRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(getRepositoriesRequest, request); return channel -> client.admin() .cluster() diff --git a/server/src/main/java/org/opensearch/rest/action/cat/RestSegmentsAction.java b/server/src/main/java/org/opensearch/rest/action/cat/RestSegmentsAction.java index 3a31fdab125b1..3adcce989ebe0 100644 --- a/server/src/main/java/org/opensearch/rest/action/cat/RestSegmentsAction.java +++ b/server/src/main/java/org/opensearch/rest/action/cat/RestSegmentsAction.java @@ -83,7 +83,7 @@ public RestChannelConsumer doCatRequest(final RestRequest request, final NodeCli final ClusterStateRequest clusterStateRequest = new ClusterStateRequest(); clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local())); clusterStateRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterStateRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request); clusterStateRequest.clear().nodes(true).routingTable(true).indices(indices); return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener(channel) { diff --git a/server/src/main/java/org/opensearch/rest/action/cat/RestShardsAction.java b/server/src/main/java/org/opensearch/rest/action/cat/RestShardsAction.java index 32e2ca8481f83..7ca8d053e19cf 100644 --- a/server/src/main/java/org/opensearch/rest/action/cat/RestShardsAction.java +++ b/server/src/main/java/org/opensearch/rest/action/cat/RestShardsAction.java @@ -105,7 +105,7 @@ public RestChannelConsumer doCatRequest(final RestRequest request, final NodeCli final ClusterStateRequest clusterStateRequest = new ClusterStateRequest(); clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local())); clusterStateRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterStateRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request); clusterStateRequest.clear().nodes(true).routingTable(true).indices(indices); return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener(channel) { @Override diff --git a/server/src/main/java/org/opensearch/rest/action/cat/RestSnapshotAction.java b/server/src/main/java/org/opensearch/rest/action/cat/RestSnapshotAction.java index 5adb9228d9869..c1a0b2773a7f5 100644 --- a/server/src/main/java/org/opensearch/rest/action/cat/RestSnapshotAction.java +++ b/server/src/main/java/org/opensearch/rest/action/cat/RestSnapshotAction.java @@ -79,7 +79,7 @@ public RestChannelConsumer doCatRequest(final RestRequest request, NodeClient cl getSnapshotsRequest.ignoreUnavailable(request.paramAsBoolean("ignore_unavailable", getSnapshotsRequest.ignoreUnavailable())); getSnapshotsRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", getSnapshotsRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(getSnapshotsRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(getSnapshotsRequest, request); return channel -> client.admin() .cluster() diff --git a/server/src/main/java/org/opensearch/rest/action/cat/RestTemplatesAction.java b/server/src/main/java/org/opensearch/rest/action/cat/RestTemplatesAction.java index bedc57453cb9b..b18f81a939682 100644 --- a/server/src/main/java/org/opensearch/rest/action/cat/RestTemplatesAction.java +++ b/server/src/main/java/org/opensearch/rest/action/cat/RestTemplatesAction.java @@ -79,7 +79,7 @@ public RestChannelConsumer doCatRequest(final RestRequest request, NodeClient cl clusterStateRequest.clear().metadata(true); clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local())); clusterStateRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterStateRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request); return channel -> client.admin().cluster().state(clusterStateRequest, new RestResponseListener(channel) { @Override diff --git a/server/src/main/java/org/opensearch/rest/action/cat/RestThreadPoolAction.java b/server/src/main/java/org/opensearch/rest/action/cat/RestThreadPoolAction.java index 2f43a3a66d01b..dbfe12288940d 100644 --- a/server/src/main/java/org/opensearch/rest/action/cat/RestThreadPoolAction.java +++ b/server/src/main/java/org/opensearch/rest/action/cat/RestThreadPoolAction.java @@ -93,7 +93,7 @@ public RestChannelConsumer doCatRequest(final RestRequest request, final NodeCli clusterStateRequest.clear().nodes(true); clusterStateRequest.local(request.paramAsBoolean("local", clusterStateRequest.local())); clusterStateRequest.masterNodeTimeout(request.paramAsTime("cluster_manager_timeout", clusterStateRequest.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(clusterStateRequest, request); return channel -> client.admin().cluster().state(clusterStateRequest, new RestActionListener(channel) { @Override diff --git a/server/src/main/java/org/opensearch/rest/action/ingest/RestDeletePipelineAction.java b/server/src/main/java/org/opensearch/rest/action/ingest/RestDeletePipelineAction.java index 69f9316bc3d9c..2e7c99fc89f5f 100644 --- a/server/src/main/java/org/opensearch/rest/action/ingest/RestDeletePipelineAction.java +++ b/server/src/main/java/org/opensearch/rest/action/ingest/RestDeletePipelineAction.java @@ -62,7 +62,7 @@ public String getName() { public RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException { DeletePipelineRequest request = new DeletePipelineRequest(restRequest.param("id")); request.masterNodeTimeout(restRequest.paramAsTime("cluster_manager_timeout", request.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(request, restRequest, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(request, restRequest); request.timeout(restRequest.paramAsTime("timeout", request.timeout())); return channel -> client.admin().cluster().deletePipeline(request, new RestToXContentListener<>(channel)); } diff --git a/server/src/main/java/org/opensearch/rest/action/ingest/RestGetPipelineAction.java b/server/src/main/java/org/opensearch/rest/action/ingest/RestGetPipelineAction.java index 5555bf53a5ee9..e652f45b95180 100644 --- a/server/src/main/java/org/opensearch/rest/action/ingest/RestGetPipelineAction.java +++ b/server/src/main/java/org/opensearch/rest/action/ingest/RestGetPipelineAction.java @@ -65,7 +65,7 @@ public String getName() { public RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient client) throws IOException { GetPipelineRequest request = new GetPipelineRequest(Strings.splitStringByCommaToArray(restRequest.param("id"))); request.masterNodeTimeout(restRequest.paramAsTime("cluster_manager_timeout", request.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(request, restRequest, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(request, restRequest); return channel -> client.admin().cluster().getPipeline(request, new RestStatusToXContentListener<>(channel)); } } diff --git a/server/src/main/java/org/opensearch/rest/action/ingest/RestPutPipelineAction.java b/server/src/main/java/org/opensearch/rest/action/ingest/RestPutPipelineAction.java index 8a9abc860fbc9..d044f3cfd6e58 100644 --- a/server/src/main/java/org/opensearch/rest/action/ingest/RestPutPipelineAction.java +++ b/server/src/main/java/org/opensearch/rest/action/ingest/RestPutPipelineAction.java @@ -67,7 +67,7 @@ public RestChannelConsumer prepareRequest(RestRequest restRequest, NodeClient cl Tuple sourceTuple = restRequest.contentOrSourceParam(); PutPipelineRequest request = new PutPipelineRequest(restRequest.param("id"), sourceTuple.v2(), sourceTuple.v1()); request.masterNodeTimeout(restRequest.paramAsTime("cluster_manager_timeout", request.masterNodeTimeout())); - parseDeprecatedMasterTimeoutParameter(request, restRequest, deprecationLogger, getName()); + parseDeprecatedMasterTimeoutParameter(request, restRequest); request.timeout(restRequest.paramAsTime("timeout", request.timeout())); return channel -> client.admin().cluster().putPipeline(request, new RestToXContentListener<>(channel)); } diff --git a/server/src/test/java/org/opensearch/action/RenamedTimeoutRequestParameterTests.java b/server/src/test/java/org/opensearch/action/RenamedTimeoutRequestParameterTests.java index 648766681a377..7b6f6bf8ba3c9 100644 --- a/server/src/test/java/org/opensearch/action/RenamedTimeoutRequestParameterTests.java +++ b/server/src/test/java/org/opensearch/action/RenamedTimeoutRequestParameterTests.java @@ -13,7 +13,6 @@ import org.opensearch.action.support.master.MasterNodeRequest; import org.opensearch.client.node.NodeClient; import org.opensearch.common.bytes.BytesArray; -import org.opensearch.common.logging.DeprecationLogger; import org.opensearch.common.settings.Settings; import org.opensearch.common.settings.SettingsFilter; import org.opensearch.common.xcontent.NamedXContentRegistry; @@ -101,12 +100,9 @@ public class RenamedTimeoutRequestParameterTests extends OpenSearchTestCase { private final TestThreadPool threadPool = new TestThreadPool(RenamedTimeoutRequestParameterTests.class.getName()); private final NodeClient client = new NodeClient(Settings.EMPTY, threadPool); - private final DeprecationLogger deprecationLogger = DeprecationLogger.getLogger(RenamedTimeoutRequestParameterTests.class); private static final String DUPLICATE_PARAMETER_ERROR_MESSAGE = "Please only use one of the request parameters [master_timeout, cluster_manager_timeout]."; - private static final String MASTER_TIMEOUT_DEPRECATED_MESSAGE = - "Parameter [master_timeout] is deprecated and will be removed in 3.0. To support inclusive language, please use [cluster_manager_timeout] instead."; @After public void terminateThreadPool() { @@ -114,127 +110,93 @@ public void terminateThreadPool() { } public void testNoWarningsForNewParam() { - BaseRestHandler.parseDeprecatedMasterTimeoutParameter( - getMasterNodeRequest(), - getRestRequestWithNewParam(), - deprecationLogger, - "test" - ); - } - - public void testDeprecationWarningForOldParam() { - BaseRestHandler.parseDeprecatedMasterTimeoutParameter( - getMasterNodeRequest(), - getRestRequestWithDeprecatedParam(), - deprecationLogger, - "test" - ); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); + BaseRestHandler.parseDeprecatedMasterTimeoutParameter(getMasterNodeRequest(), getRestRequestWithNewParam()); } public void testBothParamsNotValid() { Exception e = assertThrows( OpenSearchParseException.class, - () -> BaseRestHandler.parseDeprecatedMasterTimeoutParameter( - getMasterNodeRequest(), - getRestRequestWithBothParams(), - deprecationLogger, - "test" - ) + () -> BaseRestHandler.parseDeprecatedMasterTimeoutParameter(getMasterNodeRequest(), getRestRequestWithBothParams()) ); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testCatAllocation() { RestAllocationAction action = new RestAllocationAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testCatIndices() { RestIndicesAction action = new RestIndicesAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testCatClusterManager() { RestMasterAction action = new RestMasterAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testCatNodeattrs() { RestNodeAttrsAction action = new RestNodeAttrsAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testCatNodes() { RestNodesAction action = new RestNodesAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testCatPendingTasks() { RestPendingClusterTasksAction action = new RestPendingClusterTasksAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testCatPlugins() { RestPluginsAction action = new RestPluginsAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testCatRepositories() { RestRepositoriesAction action = new RestRepositoriesAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testCatShards() { RestShardsAction action = new RestShardsAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testCatSnapshots() { RestSnapshotAction action = new RestSnapshotAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testCatTemplates() { RestTemplatesAction action = new RestTemplatesAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testCatThreadPool() { RestThreadPoolAction action = new RestThreadPoolAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testCatSegments() { RestSegmentsAction action = new RestSegmentsAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.doCatRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testClusterHealth() { @@ -243,7 +205,6 @@ public void testClusterHealth() { () -> RestClusterHealthAction.fromRequest(getRestRequestWithBodyWithBothParams()) ); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testClusterReroute() throws IOException { @@ -254,7 +215,6 @@ public void testClusterReroute() throws IOException { () -> action.prepareRequest(getRestRequestWithBodyWithBothParams(), client) ); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testClusterState() throws IOException { @@ -265,7 +225,6 @@ public void testClusterState() throws IOException { () -> action.prepareRequest(getRestRequestWithBodyWithBothParams(), client) ); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testClusterGetSettings() throws IOException { @@ -276,7 +235,6 @@ public void testClusterGetSettings() throws IOException { () -> action.prepareRequest(getRestRequestWithBodyWithBothParams(), client) ); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testClusterUpdateSettings() throws IOException { @@ -286,7 +244,6 @@ public void testClusterUpdateSettings() throws IOException { () -> action.prepareRequest(getRestRequestWithBodyWithBothParams(), client) ); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testClusterPendingTasks() { @@ -296,7 +253,6 @@ public void testClusterPendingTasks() { () -> action.prepareRequest(getRestRequestWithBodyWithBothParams(), client) ); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testAddIndexBlock() { @@ -308,49 +264,42 @@ public void testAddIndexBlock() { RestAddIndexBlockAction action = new RestAddIndexBlockAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(request, client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testCloseIndex() { RestCloseIndexAction action = new RestCloseIndexAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testCreateIndex() { RestCreateIndexAction action = new RestCreateIndexAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testDeleteIndex() { RestDeleteIndexAction action = new RestDeleteIndexAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testGetIndices() { RestGetIndicesAction action = new RestGetIndicesAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testGetMapping() { RestGetMappingAction action = new RestGetMappingAction(threadPool); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testGetSettings() { RestGetSettingsAction action = new RestGetSettingsAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testIndexDeleteAliases() { @@ -362,28 +311,24 @@ public void testIndexDeleteAliases() { RestIndexDeleteAliasesAction action = new RestIndexDeleteAliasesAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(request, client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testIndexPutAlias() { RestIndexPutAliasAction action = new RestIndexPutAliasAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testIndicesAliases() { RestIndicesAliasesAction action = new RestIndicesAliasesAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testOpenIndex() { RestOpenIndexAction action = new RestOpenIndexAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testPutMapping() { @@ -393,42 +338,36 @@ public void testPutMapping() { () -> action.prepareRequest(getRestRequestWithBodyWithBothParams(), client) ); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testShrinkIndex() { RestResizeHandler.RestShrinkIndexAction action = new RestResizeHandler.RestShrinkIndexAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testSplitIndex() { RestResizeHandler.RestSplitIndexAction action = new RestResizeHandler.RestSplitIndexAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testCloneIndex() { RestResizeHandler.RestCloneIndexAction action = new RestResizeHandler.RestCloneIndexAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testRolloverIndex() { RestRolloverIndexAction action = new RestRolloverIndexAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testUpdateSettings() { RestUpdateSettingsAction action = new RestUpdateSettingsAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testDeleteDanglingIndex() { @@ -439,7 +378,6 @@ public void testDeleteDanglingIndex() { RestDeleteDanglingIndexAction action = new RestDeleteDanglingIndexAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(request, client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testImportDanglingIndex() { @@ -450,70 +388,60 @@ public void testImportDanglingIndex() { RestImportDanglingIndexAction action = new RestImportDanglingIndexAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(request, client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testDeleteComponentTemplate() { RestDeleteComponentTemplateAction action = new RestDeleteComponentTemplateAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testDeleteComposableIndexTemplate() { RestDeleteComposableIndexTemplateAction action = new RestDeleteComposableIndexTemplateAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testDeleteIndexTemplate() { RestDeleteIndexTemplateAction action = new RestDeleteIndexTemplateAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testGetComponentTemplate() { RestGetComponentTemplateAction action = new RestGetComponentTemplateAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testGetComposableIndexTemplate() { RestGetComposableIndexTemplateAction action = new RestGetComposableIndexTemplateAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testGetIndexTemplate() { RestGetIndexTemplateAction action = new RestGetIndexTemplateAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testPutComponentTemplate() { RestPutComponentTemplateAction action = new RestPutComponentTemplateAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testPutComposableIndexTemplate() { RestPutComposableIndexTemplateAction action = new RestPutComposableIndexTemplateAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testPutIndexTemplate() { RestPutIndexTemplateAction action = new RestPutIndexTemplateAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testSimulateIndexTemplate() { @@ -524,21 +452,18 @@ public void testSimulateIndexTemplate() { RestSimulateIndexTemplateAction action = new RestSimulateIndexTemplateAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(request, client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testSimulateTemplate() { RestSimulateTemplateAction action = new RestSimulateTemplateAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testCleanupRepository() { RestCleanupRepositoryAction action = new RestCleanupRepositoryAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testCloneSnapshot() { @@ -548,28 +473,24 @@ public void testCloneSnapshot() { () -> action.prepareRequest(getRestRequestWithBodyWithBothParams(), client) ); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testCreateSnapshot() { RestCreateSnapshotAction action = new RestCreateSnapshotAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testDeleteRepository() { RestDeleteRepositoryAction action = new RestDeleteRepositoryAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testDeleteSnapshot() { RestDeleteSnapshotAction action = new RestDeleteSnapshotAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testGetRepositories() { @@ -577,14 +498,12 @@ public void testGetRepositories() { RestGetRepositoriesAction action = new RestGetRepositoriesAction(filter); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testGetSnapshots() { RestGetSnapshotsAction action = new RestGetSnapshotsAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testPutRepository() { @@ -594,28 +513,24 @@ public void testPutRepository() { () -> action.prepareRequest(getRestRequestWithBodyWithBothParams(), client) ); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testRestoreSnapshot() { RestRestoreSnapshotAction action = new RestRestoreSnapshotAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testSnapshotsStatus() { RestSnapshotsStatusAction action = new RestSnapshotsStatusAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testVerifyRepository() { RestVerifyRepositoryAction action = new RestVerifyRepositoryAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testDeletePipeline() { @@ -626,14 +541,12 @@ public void testDeletePipeline() { RestDeletePipelineAction action = new RestDeletePipelineAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(request, client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testGetPipeline() { RestGetPipelineAction action = new RestGetPipelineAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testPutPipeline() { @@ -644,21 +557,18 @@ public void testPutPipeline() { RestPutPipelineAction action = new RestPutPipelineAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(request, client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testDeleteStoredScript() { RestDeleteStoredScriptAction action = new RestDeleteStoredScriptAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testGetStoredScript() { RestGetStoredScriptAction action = new RestGetStoredScriptAction(); Exception e = assertThrows(OpenSearchParseException.class, () -> action.prepareRequest(getRestRequestWithBothParams(), client)); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE); } public void testPutStoredScript() { @@ -668,7 +578,7 @@ public void testPutStoredScript() { () -> action.prepareRequest(getRestRequestWithBodyWithBothParams(), client) ); assertThat(e.getMessage(), containsString(DUPLICATE_PARAMETER_ERROR_MESSAGE)); - assertWarnings(MASTER_TIMEOUT_DEPRECATED_MESSAGE, "empty templates should no longer be used"); + assertWarnings("empty templates should no longer be used"); } private MasterNodeRequest getMasterNodeRequest() {